Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- class Eq a => Zero a where
- zero :: a
- data CSR v a = CSR !Int !Int !(v a) !(Vector Int) !(Vector Int)
- type AssocList a = [((Int, Int), a)]
- dim :: Matrix m v a => m v a -> (Int, Int)
- rows :: Matrix m v a => m v a -> Int
- cols :: Matrix m v a => m v a -> Int
- unsafeIndex :: Matrix m v a => m v a -> (Int, Int) -> a
- (!) :: Matrix m v a => m v a -> (Int, Int) -> a
- takeRow :: Matrix m v a => m v a -> Int -> v a
- takeColumn :: Matrix m v a => m v a -> Int -> v a
- takeDiag :: Matrix m v a => m v a -> v a
- fromAscAL :: Vector v a => (Int, Int) -> Int -> AssocList a -> CSR v a
- unsafeFromVector :: Matrix m v a => (Int, Int) -> v a -> m v a
- fromVector :: Matrix m v a => (Int, Int) -> v a -> m v a
- matrix :: Matrix m v a => Int -> [a] -> m v a
- fromLists :: Matrix m v a => [[a]] -> m v a
- fromRows :: Matrix m v a => [v a] -> m v a
- empty :: Matrix m v a => m v a
- flatten :: Matrix m v a => m v a -> v a
- toRows :: Matrix m v a => m v a -> [v a]
- toColumns :: Matrix m v a => m v a -> [v a]
- toList :: Matrix m v a => m v a -> [a]
- toLists :: Matrix m v a => m v a -> [[a]]
Documentation
Compressed Sparse Row (CSR) matrix
Instances
Accessors
length information
Indexing
takeColumn :: Matrix m v a => m v a -> Int -> v a Source #
Extract a row.
takeDiag :: Matrix m v a => m v a -> v a Source #
Extract the diagonal. Default algorithm is O(min(m,n) * O(unsafeIndex)).
Construction
fromAscAL :: Vector v a => (Int, Int) -> Int -> AssocList a -> CSR v a Source #
Construct CSR from ascending association list. Items must be sorted first by row index, and then by column index.
O(m*n) Matrix construction
fromLists :: Matrix m v a => [[a]] -> m v a Source #
O(m*n) Create matrix from list of lists, it doesn't check if the list of list is a valid matrix