Jikka-5.0.11.1: A transpiler from Python to C++ for competitive programming
Safe HaskellNone
LanguageHaskell2010

Jikka.Common.Matrix

Synopsis

Documentation

data Matrix a Source #

Matrix is data for matrices. It is guaranteed that internal arrays are not jagged arrays.

Instances

Instances details
Functor Matrix Source # 
Instance details

Defined in Jikka.Common.Matrix

Methods

fmap :: (a -> b) -> Matrix a -> Matrix b #

(<$) :: a -> Matrix b -> Matrix a #

Eq a => Eq (Matrix a) Source # 
Instance details

Defined in Jikka.Common.Matrix

Methods

(==) :: Matrix a -> Matrix a -> Bool #

(/=) :: Matrix a -> Matrix a -> Bool #

Ord a => Ord (Matrix a) Source # 
Instance details

Defined in Jikka.Common.Matrix

Methods

compare :: Matrix a -> Matrix a -> Ordering #

(<) :: Matrix a -> Matrix a -> Bool #

(<=) :: Matrix a -> Matrix a -> Bool #

(>) :: Matrix a -> Matrix a -> Bool #

(>=) :: Matrix a -> Matrix a -> Bool #

max :: Matrix a -> Matrix a -> Matrix a #

min :: Matrix a -> Matrix a -> Matrix a #

Show a => Show (Matrix a) Source # 
Instance details

Defined in Jikka.Common.Matrix

Methods

showsPrec :: Int -> Matrix a -> ShowS #

show :: Matrix a -> String #

showList :: [Matrix a] -> ShowS #

matsize :: Matrix a -> (Int, Int) Source #

matsize computes the size of a matrix.

matsize' :: Vector (Vector a) -> (Int, Int) Source #

matsize` computes the size of a matrix. This assumes inputs are matrices (matcheck).

matcheck :: Vector (Vector a) -> Bool Source #

matcheck checks a given vector of vectors is a matrix. That is, this returns False for jagged arrays.

matzero :: Num a => Int -> Matrix a Source #

matone :: Num a => Int -> Matrix a Source #

matadd :: Num a => Matrix a -> Matrix a -> Matrix a Source #

matadd calculates the addition \(A + B\) of two matrices \(A, B\). This assumes sizes of inputs match.

matmul :: Num a => Matrix a -> Matrix a -> Matrix a Source #

matmul calculates the multiplication \(A B\)of two matrices \(A, B\). This assumes sizes of inputs match.

matap :: Num a => Matrix a -> Vector a -> Vector a Source #

matap calculates the multiplication \(A x\) of a matrix \(A\) and a vector \(x\). This assumes sizes of inputs match.

matscalar :: Num a => a -> Matrix a -> Matrix a Source #

matpow :: (Show a, Num a) => Matrix a -> Integer -> Matrix a Source #

matpow calculates the power \(A^k\) of a matrix \(A\) and a natural number \(k\). This assumes inputs are square matrices. This fails for \(k \lt 0\).