matrices-0.5.0: native matrix based on vector

Safe HaskellNone
LanguageHaskell2010

Data.Matrix.Class

Contents

Synopsis

Documentation

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

Instances
type Mutable Matrix Source # 
Instance details

Defined in Data.Matrix.Generic

type Mutable CSR Source #

mutable sparse matrix not implemented

Instance details

Defined in Data.Matrix.Sparse.Generic

type Mutable SymMatrix Source # 
Instance details

Defined in Data.Matrix.Symmetric.Generic

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

Methods

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
Vector v a => Matrix Matrix v a Source # 
Instance details

Defined in Data.Matrix.Generic

Methods

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

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

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

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

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

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

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

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

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

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

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

(Zero a, Vector v a) => Matrix CSR v a Source # 
Instance details

Defined in Data.Matrix.Sparse.Generic

Methods

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

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

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

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

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

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

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

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

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

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

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

Vector v a => Matrix SymMatrix v a Source # 
Instance details

Defined in Data.Matrix.Symmetric.Generic

Derived mothods

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

Derived methods

Return the number of rows

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

Return the number of columns

(!) :: Matrix m v a => m v a -> (Int, Int) -> a Source #

Indexing

fromVector :: Matrix m v a => (Int, Int) -> v a -> m v a Source #

fromList :: Matrix m v a => (Int, Int) -> [a] -> m v a Source #

empty :: Matrix m v a => m v a Source #

toList :: Matrix m v a => m v a -> [a] Source #

O(m*n) Create a list by concatenating rows

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

matrix Source #

Arguments

:: Matrix m v a 
=> Int

number of columns

-> [a]

row list

-> m v a 

O(m*n) Matrix construction

fromRows :: Matrix m v a => [v a] -> m v a Source #

O(m*n) Create matrix from rows

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

Extract a row.

toRows :: Matrix m v a => m v a -> [v a] Source #

O(m) Return the rows

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

Extract a row.

toColumns :: Matrix m v a => m v a -> [v a] Source #

O(m*n) Return the columns

toLists :: Matrix m v a => m v a -> [[a]] Source #

O(m*n) List of lists

create :: Matrix m v a => (forall s. ST s (Mutable m (Mutable v) s a)) -> m v a Source #