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

Language | Haskell2010 |

## Synopsis

- type family Mutable (m :: (* -> *) -> * -> *) :: (* -> * -> *) -> * -> * -> *
- class (MMatrix (Mutable m) (Mutable v) a, Vector v a) => Matrix m v a where
- dim :: m v a -> (Int, Int)
- unsafeIndex :: m v a -> (Int, Int) -> a
- unsafeFromVector :: (Int, Int) -> v a -> m v a
- flatten :: m v a -> v a
- unsafeTakeRow :: m v a -> Int -> v a
- unsafeTakeColumn :: m v a -> Int -> v a
- takeDiag :: m v a -> v a
- thaw :: PrimMonad s => m v a -> s (Mutable m (Mutable v) (PrimState s) a)
- unsafeThaw :: PrimMonad s => m v a -> s (Mutable m (Mutable v) (PrimState s) a)
- freeze :: PrimMonad s => Mutable m (Mutable v) (PrimState s) a -> s (m v a)
- unsafeFreeze :: PrimMonad s => Mutable m (Mutable v) (PrimState s) a -> s (m v a)

- rows :: Matrix m v a => m v a -> Int
- cols :: Matrix m v a => m v a -> Int
- (!) :: Matrix m v a => m v a -> (Int, Int) -> a
- fromVector :: Matrix m v a => (Int, Int) -> v a -> m v a
- fromList :: Matrix m v a => (Int, Int) -> [a] -> m v a
- empty :: Matrix m v a => m v a
- toList :: Matrix m v a => m v a -> [a]
- fromLists :: Matrix m v a => [[a]] -> m v a
- matrix :: Matrix m v a => Int -> [a] -> m v a
- fromRows :: Matrix m v a => [v a] -> m v a
- takeRow :: Matrix m v a => m v a -> Int -> v a
- toRows :: Matrix m v a => m v a -> [v a]
- takeColumn :: Matrix m v a => m v a -> Int -> v a
- toColumns :: Matrix m v a => m v a -> [v a]
- toLists :: Matrix m v a => m v a -> [[a]]
- create :: Matrix m v a => (forall s. ST s (Mutable m (Mutable v) s a)) -> m v a

# Documentation

type family Mutable (m :: (* -> *) -> * -> *) :: (* -> * -> *) -> * -> * -> * Source #

## Instances

type Mutable Matrix Source # | |

Defined in Data.Matrix.Generic | |

type Mutable CSR Source # | mutable sparse matrix not implemented |

Defined in Data.Matrix.Sparse.Generic | |

type Mutable SymMatrix Source # | |

Defined in Data.Matrix.Symmetric.Generic |

class (MMatrix (Mutable m) (Mutable v) a, Vector v a) => Matrix m v a where Source #

dim :: m v a -> (Int, Int) Source #

unsafeIndex :: m v a -> (Int, Int) -> a Source #

unsafeFromVector :: (Int, Int) -> v a -> m v a Source #

flatten :: m v a -> v a Source #

Default algorithm is O((m*n) * O(unsafeIndex)).

unsafeTakeRow :: m v a -> Int -> v a Source #

Extract a row. Default algorithm is O(n * O(unsafeIndex)).

unsafeTakeColumn :: m v a -> Int -> v a Source #

Extract a column. Default algorithm is O(m * O(unsafeIndex)).

takeDiag :: m v a -> v a Source #

Extract the diagonal. Default algorithm is O(min(m,n) * O(unsafeIndex)).

thaw :: PrimMonad s => m v a -> s (Mutable m (Mutable v) (PrimState s) a) Source #

unsafeThaw :: PrimMonad s => m v a -> s (Mutable m (Mutable v) (PrimState s) a) Source #

freeze :: PrimMonad s => Mutable m (Mutable v) (PrimState s) a -> s (m v a) Source #

unsafeFreeze :: PrimMonad s => Mutable m (Mutable v) (PrimState s) a -> s (m v a) Source #

## Instances

# Derived mothods

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

O(m*n) Matrix construction

takeColumn :: Matrix m v a => m v a -> Int -> v a Source #

Extract a row.