Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- type Matrix = Matrix Vector
- dim :: Context a => Matrix a -> (Int, Int)
- rows :: Context a => Matrix a -> Int
- cols :: Context a => Matrix a -> Int
- unsafeIndex :: Context a => Matrix a -> (Int, Int) -> a
- (!) :: Context a => Matrix a -> (Int, Int) -> a
- takeRow :: Context a => Matrix a -> Int -> Vector a
- takeColumn :: Context a => Matrix a -> Int -> Vector a
- takeDiag :: Context a => Matrix a -> Vector a
- unsafeFromVector :: Context a => (Int, Int) -> Vector a -> Matrix a
- fromVector :: Context a => (Int, Int) -> Vector a -> Matrix a
- matrix :: Context a => Int -> [a] -> Matrix a
- fromList :: Context a => (Int, Int) -> [a] -> Matrix a
- fromLists :: Context a => [[a]] -> Matrix a
- fromRows :: Context a => [Vector a] -> Matrix a
- fromColumns :: Context a => [Vector a] -> Matrix a
- empty :: Context a => Matrix a
- flatten :: Context a => Matrix a -> Vector a
- toRows :: Context a => Matrix a -> [Vector a]
- toColumns :: Context a => Matrix a -> [Vector a]
- toList :: Context a => Matrix a -> [a]
- toLists :: Context a => Matrix a -> [[a]]
- tr :: Context a => Matrix a -> Matrix a
- subMatrix :: Context a => (Int, Int) -> (Int, Int) -> Matrix a -> Matrix a
- ident :: (Context a, Num a) => Int -> Matrix a
- diag :: (Context a, Num a, Foldable t) => t a -> Matrix a
- diagRect :: (Context a, Foldable t) => a -> (Int, Int) -> t a -> Matrix a
- fromBlocks :: Context a => a -> [[Matrix a]] -> Matrix a
- isSymmetric :: (Context a, Eq a) => Matrix a -> Bool
- force :: Context a => Matrix a -> Matrix a
- foldl :: Context b => (a -> b -> a) -> a -> Matrix b -> a
- map :: (Context a, Context b) => (a -> b) -> Matrix a -> Matrix b
- imap :: (Context a, Context b) => ((Int, Int) -> a -> b) -> Matrix a -> Matrix b
- mapM :: (Context a, Context b, Monad m) => (a -> m b) -> Matrix a -> m (Matrix b)
- imapM :: (Context a, Context b, Monad m) => ((Int, Int) -> a -> m b) -> Matrix a -> m (Matrix b)
- mapM_ :: (Context a, Monad m) => (a -> m b) -> Matrix a -> m ()
- imapM_ :: (Context a, Monad m) => ((Int, Int) -> a -> m b) -> Matrix a -> m ()
- forM :: (Context a, Context b, Monad m) => Matrix a -> (a -> m b) -> m (Matrix b)
- forM_ :: (Context a, Monad m) => Matrix a -> (a -> m b) -> m ()
- zipWith :: (Context a, Context b, Context c) => (a -> b -> c) -> Matrix a -> Matrix b -> Matrix c
- zipWith3 :: (Context a, Context b, Context c, Context d) => (a -> b -> c -> d) -> Matrix a -> Matrix b -> Matrix c -> Matrix d
- zipWith4 :: (Context a, Context b, Context c, Context d, Context e) => (a -> b -> c -> d -> e) -> Matrix a -> Matrix b -> Matrix c -> Matrix d -> Matrix e
- zipWith5 :: (Context a, Context b, Context c, Context d, Context e, Context f) => (a -> b -> c -> d -> e -> f) -> Matrix a -> Matrix b -> Matrix c -> Matrix d -> Matrix e -> Matrix f
- zipWith6 :: (Context a, Context b, Context c, Context d, Context e, Context f, Context g) => (a -> b -> c -> d -> e -> f -> g) -> Matrix a -> Matrix b -> Matrix c -> Matrix d -> Matrix e -> Matrix f -> Matrix g
- izipWith :: (Context a, Context b, Context c) => ((Int, Int) -> a -> b -> c) -> Matrix a -> Matrix b -> Matrix c
- izipWith3 :: (Context a, Context b, Context c, Context d) => ((Int, Int) -> a -> b -> c -> d) -> Matrix a -> Matrix b -> Matrix c -> Matrix d
- izipWith4 :: (Context a, Context b, Context c, Context d, Context e) => ((Int, Int) -> a -> b -> c -> d -> e) -> Matrix a -> Matrix b -> Matrix c -> Matrix d -> Matrix e
- izipWith5 :: (Context a, Context b, Context c, Context d, Context e, Context f) => ((Int, Int) -> a -> b -> c -> d -> e -> f) -> Matrix a -> Matrix b -> Matrix c -> Matrix d -> Matrix e -> Matrix f
- izipWith6 :: (Context a, Context b, Context c, Context d, Context e, Context f, Context g) => ((Int, Int) -> a -> b -> c -> d -> e -> f -> g) -> Matrix a -> Matrix b -> Matrix c -> Matrix d -> Matrix e -> Matrix f -> Matrix g
- zip :: (Context a, Context b, Context (a, b)) => Matrix a -> Matrix b -> Matrix (a, b)
- zip3 :: (Context a, Context b, Context c, Context (a, b, c)) => Matrix a -> Matrix b -> Matrix c -> Matrix (a, b, c)
- zip4 :: (Context a, Context b, Context c, Context d, Context (a, b, c, d)) => Matrix a -> Matrix b -> Matrix c -> Matrix d -> Matrix (a, b, c, d)
- zip5 :: (Context a, Context b, Context c, Context d, Context e, Context (a, b, c, d, e)) => Matrix a -> Matrix b -> Matrix c -> Matrix d -> Matrix e -> Matrix (a, b, c, d, e)
- zip6 :: (Context a, Context b, Context c, Context d, Context e, Context f, Context (a, b, c, d, e, f)) => Matrix a -> Matrix b -> Matrix c -> Matrix d -> Matrix e -> Matrix f -> Matrix (a, b, c, d, e, f)
- zipWithM :: (Context a, Context b, Context c, Monad m) => (a -> b -> m c) -> Matrix a -> Matrix b -> m (Matrix c)
- zipWithM_ :: (Context a, Context b, Monad m) => (a -> b -> m c) -> Matrix a -> Matrix b -> m ()
- unzip :: (Context a, Context b, Context (a, b)) => Matrix (a, b) -> (Matrix a, Matrix b)
- unzip3 :: (Context a, Context b, Context c, Context (a, b, c)) => Matrix (a, b, c) -> (Matrix a, Matrix b, Matrix c)
- unzip4 :: (Context a, Context b, Context c, Context d, Context (a, b, c, d)) => Matrix (a, b, c, d) -> (Matrix a, Matrix b, Matrix c, Matrix d)
- unzip5 :: (Context a, Context b, Context c, Context d, Context e, Context (a, b, c, d, e)) => Matrix (a, b, c, d, e) -> (Matrix a, Matrix b, Matrix c, Matrix d, Matrix e)
- unzip6 :: (Context a, Context b, Context c, Context d, Context e, Context f, Context (a, b, c, d, e, f)) => Matrix (a, b, c, d, e, f) -> (Matrix a, Matrix b, Matrix c, Matrix d, Matrix e, Matrix f)
- generate :: Context a => (Int, Int) -> ((Int, Int) -> a) -> Matrix a
- thaw :: (Context a, PrimMonad s) => Matrix a -> s (MMatrix (PrimState s) a)
- unsafeThaw :: (Context a, PrimMonad s) => Matrix a -> s (MMatrix (PrimState s) a)
- freeze :: (Context a, PrimMonad s) => MMatrix (PrimState s) a -> s (Matrix a)
- unsafeFreeze :: (Context a, PrimMonad s) => MMatrix (PrimState s) a -> s (Matrix a)
- create :: Context a => (forall s. ST s (MMatrix s a)) -> Matrix a
Documentation
Accessors
length information
Indexing
Construction
fromLists :: Context a => [[a]] -> Matrix a Source #
O(m*n) Create matrix from list of lists, it doesn't check if the list of list is a valid matrix
fromColumns :: Context a => [Vector a] -> Matrix a Source #
O(m*n) Create matrix from columns
Conversions
:: Context a | |
=> (Int, Int) | upper left corner of the submatrix |
-> (Int, Int) | bottom right corner of the submatrix |
-> Matrix a | |
-> Matrix a |
O(1) Extract sub matrix
O(m*n) Create a square matrix with given diagonal, other entries default to 0
O(m*n) Create a rectangular matrix with default values and given diagonal
Mapping
Monadic mapping
imapM :: (Context a, Context b, Monad m) => ((Int, Int) -> a -> m b) -> Matrix a -> m (Matrix b) Source #
O(m*n) Apply the monadic action to every element and its index, yielding a matrix of results.
imapM_ :: (Context a, Monad m) => ((Int, Int) -> a -> m b) -> Matrix a -> m () Source #
O(m*n) Apply the monadic action to every element and its index, ignoring the results.
Zipping
zipWith :: (Context a, Context b, Context c) => (a -> b -> c) -> Matrix a -> Matrix b -> Matrix c Source #
zipWith3 :: (Context a, Context b, Context c, Context d) => (a -> b -> c -> d) -> Matrix a -> Matrix b -> Matrix c -> Matrix d Source #
zipWith4 :: (Context a, Context b, Context c, Context d, Context e) => (a -> b -> c -> d -> e) -> Matrix a -> Matrix b -> Matrix c -> Matrix d -> Matrix e Source #
zipWith5 :: (Context a, Context b, Context c, Context d, Context e, Context f) => (a -> b -> c -> d -> e -> f) -> Matrix a -> Matrix b -> Matrix c -> Matrix d -> Matrix e -> Matrix f Source #
zipWith6 :: (Context a, Context b, Context c, Context d, Context e, Context f, Context g) => (a -> b -> c -> d -> e -> f -> g) -> Matrix a -> Matrix b -> Matrix c -> Matrix d -> Matrix e -> Matrix f -> Matrix g Source #
izipWith :: (Context a, Context b, Context c) => ((Int, Int) -> a -> b -> c) -> Matrix a -> Matrix b -> Matrix c Source #
izipWith3 :: (Context a, Context b, Context c, Context d) => ((Int, Int) -> a -> b -> c -> d) -> Matrix a -> Matrix b -> Matrix c -> Matrix d Source #
izipWith4 :: (Context a, Context b, Context c, Context d, Context e) => ((Int, Int) -> a -> b -> c -> d -> e) -> Matrix a -> Matrix b -> Matrix c -> Matrix d -> Matrix e Source #
izipWith5 :: (Context a, Context b, Context c, Context d, Context e, Context f) => ((Int, Int) -> a -> b -> c -> d -> e -> f) -> Matrix a -> Matrix b -> Matrix c -> Matrix d -> Matrix e -> Matrix f Source #
izipWith6 :: (Context a, Context b, Context c, Context d, Context e, Context f, Context g) => ((Int, Int) -> a -> b -> c -> d -> e -> f -> g) -> Matrix a -> Matrix b -> Matrix c -> Matrix d -> Matrix e -> Matrix f -> Matrix g Source #
zip3 :: (Context a, Context b, Context c, Context (a, b, c)) => Matrix a -> Matrix b -> Matrix c -> Matrix (a, b, c) Source #
zip4 :: (Context a, Context b, Context c, Context d, Context (a, b, c, d)) => Matrix a -> Matrix b -> Matrix c -> Matrix d -> Matrix (a, b, c, d) Source #
zip5 :: (Context a, Context b, Context c, Context d, Context e, Context (a, b, c, d, e)) => Matrix a -> Matrix b -> Matrix c -> Matrix d -> Matrix e -> Matrix (a, b, c, d, e) Source #
zip6 :: (Context a, Context b, Context c, Context d, Context e, Context f, Context (a, b, c, d, e, f)) => Matrix a -> Matrix b -> Matrix c -> Matrix d -> Matrix e -> Matrix f -> Matrix (a, b, c, d, e, f) Source #
Monadic Zipping
zipWithM :: (Context a, Context b, Context c, Monad m) => (a -> b -> m c) -> Matrix a -> Matrix b -> m (Matrix c) Source #
zipWithM_ :: (Context a, Context b, Monad m) => (a -> b -> m c) -> Matrix a -> Matrix b -> m () Source #
Unzipping
unzip3 :: (Context a, Context b, Context c, Context (a, b, c)) => Matrix (a, b, c) -> (Matrix a, Matrix b, Matrix c) Source #
unzip4 :: (Context a, Context b, Context c, Context d, Context (a, b, c, d)) => Matrix (a, b, c, d) -> (Matrix a, Matrix b, Matrix c, Matrix d) Source #
unzip5 :: (Context a, Context b, Context c, Context d, Context e, Context (a, b, c, d, e)) => Matrix (a, b, c, d, e) -> (Matrix a, Matrix b, Matrix c, Matrix d, Matrix e) Source #
unzip6 :: (Context a, Context b, Context c, Context d, Context e, Context f, Context (a, b, c, d, e, f)) => Matrix (a, b, c, d, e, f) -> (Matrix a, Matrix b, Matrix c, Matrix d, Matrix e, Matrix f) Source #