Safe Haskell | None |
---|---|

Language | Haskell98 |

A module providing elementary operations involving scalars, vectors, and matrices over a ring or field. Vectors are represented as [a], matrices as [[a]]. (No distinction is made between row and column vectors.) It is the caller's responsibility to ensure that the lists have the correct number of elements.

The mnemonic for many of the arithmetic operations is that the number of angle brackets on each side indicates the dimension of the argument on that side. For example, v <*>> m is multiplication of a vector on the left by a matrix on the right.

- (<+>) :: Num a => [a] -> [a] -> [a]
- (<->) :: Num a => [a] -> [a] -> [a]
- (*>) :: Num a => a -> [a] -> [a]
- (<.>) :: Num a => [a] -> [a] -> a
- (<*>) :: Num a => [a] -> [a] -> [[a]]
- (<<+>>) :: Num a => [[a]] -> [[a]] -> [[a]]
- (<<->>) :: Num a => [[a]] -> [[a]] -> [[a]]
- (<<*>>) :: Num a => [[a]] -> [[a]] -> [[a]]
- (*>>) :: Num a => a -> [[a]] -> [[a]]
- (<<*>) :: Num a => [[a]] -> [a] -> [a]
- (<*>>) :: Num a => [a] -> [[a]] -> [a]
- fMatrix :: (Num t1, Enum t1) => t1 -> (t1 -> t1 -> t) -> [[t]]
- fMatrix' :: (Num t1, Enum t1) => t1 -> (t1 -> t1 -> t) -> [[t]]
- idMx :: Num a => Int -> [[a]]
- iMx :: Num t => Int -> [[t]]
- jMx :: Num t => Int -> [[t]]
- zMx :: Num t => Int -> [[t]]
- inverse :: (Eq a, Fractional a) => [[a]] -> Maybe [[a]]
- inverse1 :: (Fractional a, Eq a) => [[a]] -> [[a]]
- inverse2 :: (Num t, Eq t) => [[t]] -> [[t]]
- (!) :: [a] -> Int -> a
- rowEchelonForm :: (Fractional a, Eq a) => [[a]] -> [[a]]
- reducedRowEchelonForm :: (Eq a, Fractional a) => [[a]] -> [[a]]
- solveLinearSystem :: (Fractional a, Eq a) => [[a]] -> [a] -> Maybe [a]
- isZero :: (Num a, Eq a) => [a] -> Bool
- inSpanRE :: (Num a, Eq a) => [[a]] -> [a] -> Bool
- rank :: (Fractional a, Eq a) => [[a]] -> Int
- kernel :: (Ord a, Fractional a) => [[a]] -> [[a]]
- kernelRRE :: (Ord a, Num a) => [[a]] -> [[a]]
- det :: (Eq a, Fractional a) => [[a]] -> a

# Documentation

(*>) :: Num a => a -> [a] -> [a] infixr 8 Source

k *> v returns the product k*v of the scalar k and the vector v

(<.>) :: Num a => [a] -> [a] -> a infixl 7 Source

u <.> v returns the dot product of vectors (also called inner or scalar product)

(<*>) :: Num a => [a] -> [a] -> [[a]] infixl 7 Source

u <*> v returns the tensor product of vectors (also called outer or matrix product)

(<<+>>) :: Num a => [[a]] -> [[a]] -> [[a]] infixl 6 Source

a <<+>> b returns the sum a+b of matrices

(<<->>) :: Num a => [[a]] -> [[a]] -> [[a]] infixl 6 Source

a <<->> b returns the difference a-b of matrices

(<<*>>) :: Num a => [[a]] -> [[a]] -> [[a]] infixl 7 Source

a <<*>> b returns the product a*b of matrices

(*>>) :: Num a => a -> [[a]] -> [[a]] infixr 8 Source

k *>> m returns the product k*m of the scalar k and the matrix m

(<<*>) :: Num a => [[a]] -> [a] -> [a] infixr 7 Source

m <<*> v is multiplication of a vector by a matrix on the left

(<*>>) :: Num a => [a] -> [[a]] -> [a] infixl 7 Source

v <*>> m is multiplication of a vector by a matrix on the right

inverse :: (Eq a, Fractional a) => [[a]] -> Maybe [[a]] Source

The inverse of a matrix (over a field), if it exists

inverse1 :: (Fractional a, Eq a) => [[a]] -> [[a]] Source

rowEchelonForm :: (Fractional a, Eq a) => [[a]] -> [[a]] Source

reducedRowEchelonForm :: (Eq a, Fractional a) => [[a]] -> [[a]] Source

solveLinearSystem :: (Fractional a, Eq a) => [[a]] -> [a] -> Maybe [a] Source

rank :: (Fractional a, Eq a) => [[a]] -> Int Source

kernel :: (Ord a, Fractional a) => [[a]] -> [[a]] Source

det :: (Eq a, Fractional a) => [[a]] -> a Source

The determinant of a matrix (over a field)