Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- length :: (Real a, Floating b) => Vector n a -> b
- mulMatricesWith :: (a -> b -> c) -> ([c] -> d) -> Matrix m n a -> Matrix n k b -> Matrix m k d
- neg :: Num a => Matrix m n a -> Matrix m n a
- transpose :: Matrix m n a -> Matrix n m a
- zipMatricesWith :: (a -> b -> c) -> Matrix m n a -> Matrix m n b -> Matrix m n c
- det :: Num a => Matrix n n a -> a
- algebraicComplement :: forall n a i j. (KnownNat i, KnownNat j, KnownNat n, Num a, i <= n, j <= n) => Matrix n n a -> Index i j -> a
- algebraicComplement' :: Num a => Matrix n n a -> (Int, Int) -> Maybe a
- adjugate :: Num a => Matrix n n a -> Matrix n n a
- inverted :: forall a b n. (Fractional b, Eq a, Real a) => Matrix n n a -> Maybe (Matrix n n b)
- (*~) :: Num a => a -> Matrix m n a -> Matrix m n a
- (~*~) :: Num a => Matrix m n a -> Matrix n k a -> Matrix m k a
- (~+) :: Num a => Matrix m n a -> a -> Matrix m n a
- (+~) :: Num a => a -> Matrix m n a -> Matrix m n a
- (~+~) :: Num a => Matrix m n a -> Matrix m n a -> Matrix m n a
- (~-~) :: Num a => Matrix m n a -> Matrix m n a -> Matrix m n a
Documentation
length :: (Real a, Floating b) => Vector n a -> b Source #
Length of vector
>>>
length [vector| 3 4 |]
5.0>>>
length [vector| 1 1 |]
1.4142135623730951
:: (a -> b -> c) | operation "*" |
-> ([c] -> d) | operation `"+"`. "Summarizes" elements of list |
-> Matrix m n a | |
-> Matrix n k b | |
-> Matrix m k d |
Generalized matrices multiplication
neg :: Num a => Matrix m n a -> Matrix m n a Source #
Nagates all elements of matrix
>>>
neg [matrix| 1 2 3 |]
[-1,-2,-3]
transpose :: Matrix m n a -> Matrix n m a Source #
Transposes matrix
>>>
transpose [matrix| 1 2 3; 4 5 6 |]
[1,4] [2,5] [3,6]
Generalized matrices addition
det :: Num a => Matrix n n a -> a Source #
Determinant of matrix
>>>
det [matrix| 1 0; 0 1|]
1>>>
det [matrix| 1 3; 4 2|]
-10
algebraicComplement :: forall n a i j. (KnownNat i, KnownNat j, KnownNat n, Num a, i <= n, j <= n) => Matrix n n a -> Index i j -> a Source #
Typesafe algebraic complement
To use it you have to know i and j at compile time
>>>
algebraicComplement [matrix| 1 2; 3 4 |] (Index @1 @1)
4>>>
algebraicComplement [matrix| 1 2 3; 4 5 6; 7 8 9 |] (Index @1 @1)
-3
algebraicComplement' :: Num a => Matrix n n a -> (Int, Int) -> Maybe a Source #
Algebraic complement.
Use it if you don't know indices at compile time
>>>
algebraicComplement' [matrix| 1 2; 3 4 |] (1, 1)
Just 4
>>>
algebraicComplement' [matrix| 1 2; 3 4 |] (34, 43)
Nothing
>>>
algebraicComplement' [matrix| 1 2 3; 4 5 6; 7 8 9 |] (1, 1)
Just (-3)
adjugate :: Num a => Matrix n n a -> Matrix n n a Source #
Adjugate matrix
>>>
adjugate [matrix| 1 2; 3 4|]
[4,-2] [-3,1]
inverted :: forall a b n. (Fractional b, Eq a, Real a) => Matrix n n a -> Maybe (Matrix n n b) Source #
Inverted matrix
>>>
inverted [matrix| 1 2; 3 4|]
Just [-2.0,1.0] [1.5,-0.5]>>>
inverted [matrix| 1 4; 1 4|]
Nothing
Multuplies all elements of matrix m by k
>>>
5 *~ [matrix| 1 2 3; 4 5 6 |]
[5,10,15] [20,25,30]
(~*~) :: Num a => Matrix m n a -> Matrix n k a -> Matrix m k a Source #
Multiplies two matrix
>>>
[matrix| 1 2; 3 4 |] ~*~ [matrix| 1; 2 |]
[5] [11]
(~+) :: Num a => Matrix m n a -> a -> Matrix m n a Source #
Adds a to all elements of matrix m
>>>
[matrix| 1 2 3 |] ~+ 8
[9,10,11]