Data.Matrix.Dense
 Stability experimental Maintainer Patrick Perry
 Contents Dense matrix type Matrix shape Creating matrices Reading matrix elements Special matrices Matrix views Vector views Low-level properties Matrix and vector multiplication Converting between mutable and immutable matrices
Description
Synopsis
newtype Matrix mn e = M (IOMatrix mn e)
module BLAS.Tensor.Base
module BLAS.Matrix.Base
coerceMatrix :: BaseMatrix a x => a mn e -> a mn' e
matrix :: BLAS1 e => (Int, Int) -> [((Int, Int), e)] -> Matrix (m, n) e
listMatrix :: BLAS1 e => (Int, Int) -> [e] -> Matrix (m, n) e
rowsMatrix :: BLAS1 e => (Int, Int) -> [Vector n e] -> Matrix (m, n) e
colsMatrix :: BLAS1 e => (Int, Int) -> [Vector m e] -> Matrix (m, n) e
rowMatrix :: BLAS1 e => Vector n e -> Matrix (one, n) e
colMatrix :: BLAS1 e => Vector m e -> Matrix (m, one) e
unsafeMatrix :: BLAS1 e => (Int, Int) -> [((Int, Int), e)] -> Matrix (m, n) e
module BLAS.Tensor.Immutable
zeroMatrix :: BLAS1 e => (Int, Int) -> Matrix (m, n) e
constantMatrix :: BLAS1 e => (Int, Int) -> e -> Matrix (m, n) e
identityMatrix :: BLAS1 e => (Int, Int) -> Matrix (m, n) e
submatrix :: Elem e => Matrix mn e -> (Int, Int) -> (Int, Int) -> Matrix mn' e
splitRowsAt :: (BaseMatrix a x, Storable e) => Int -> a (m, n) e -> (a (m1, n) e, a (m2, n) e)
splitColsAt :: (BaseMatrix a x, Storable e) => Int -> a (m, n) e -> (a (m, n1) e, a (m, n2) e)
unsafeSubmatrix :: Elem e => Matrix mn e -> (Int, Int) -> (Int, Int) -> Matrix mn' e
unsafeSplitRowsAt :: (BaseMatrix a x, Storable e) => Int -> a (m, n) e -> (a (m1, n) e, a (m2, n) e)
unsafeSplitColsAt :: (BaseMatrix a x, Storable e) => Int -> a (m, n) e -> (a (m, n1) e, a (m, n2) e)
diag :: Elem e => Matrix mn e -> Int -> Vector k e
unsafeDiag :: Elem e => Matrix mn e -> Int -> Vector k e
ldaOfMatrix :: BaseMatrix a x => a mn e -> Int
isHermMatrix :: BaseMatrix a x => a mn e -> Bool
module BLAS.Matrix.Immutable
class UnsafeFreezeMatrix a where
 unsafeFreezeMatrix :: a mn e -> Matrix mn e
class UnsafeThawMatrix a where
 unsafeThawMatrix :: Matrix mn e -> a mn e
freezeMatrix :: (ReadMatrix a x m, WriteMatrix b y m, UnsafeFreezeMatrix b, BLAS1 e) => a mn e -> m (Matrix mn e)
thawMatrix :: (WriteMatrix a y m, BLAS1 e) => Matrix mn e -> m (a mn e)
Dense matrix type
 newtype Matrix mn e Source
Constructors
 M (IOMatrix mn e)
Instances
 BaseMatrix Matrix BaseMatrix Matrix Vector BLAS3 e => IMatrix Matrix e UnsafeIOToM m => ReadMatrix Matrix Vector m (BLAS3 e, UnsafeIOToM m) => MMatrix Matrix e m BaseTensor Matrix ((,) Int Int) ITensor Matrix ((,) Int Int) Monad m => ReadTensor Matrix ((,) Int Int) m (BLAS1 e, Eq e) => Eq (Matrix mn e) (BLAS1 e, Floating e) => Floating (Matrix ((,) m n) e) BLAS1 e => Fractional (Matrix mn e) BLAS1 e => Num (Matrix mn e) (BLAS1 e, Show e) => Show (Matrix mn e) (BLAS1 e, AEq e) => AEq (Matrix mn e)
Matrix shape
module BLAS.Tensor.Base
module BLAS.Matrix.Base
 coerceMatrix :: BaseMatrix a x => a mn e -> a mn' e Source
Cast the shape type of the matrix.
Creating matrices
 matrix :: BLAS1 e => (Int, Int) -> [((Int, Int), e)] -> Matrix (m, n) e Source
Create a new matrix of the given size and initialize the given elements to the given values. All other elements get set to zero.
 listMatrix :: BLAS1 e => (Int, Int) -> [e] -> Matrix (m, n) e Source
Create a new matrix with the given elements in row-major order.
 rowsMatrix :: BLAS1 e => (Int, Int) -> [Vector n e] -> Matrix (m, n) e Source
Create a matrix of the given shape from a list of rows
 colsMatrix :: BLAS1 e => (Int, Int) -> [Vector m e] -> Matrix (m, n) e Source
Create a matrix of the given shape from a list of columns
 rowMatrix :: BLAS1 e => Vector n e -> Matrix (one, n) e Source
Get a matrix from a row vector.
 colMatrix :: BLAS1 e => Vector m e -> Matrix (m, one) e Source
Get a matrix from a column vector.
 unsafeMatrix :: BLAS1 e => (Int, Int) -> [((Int, Int), e)] -> Matrix (m, n) e Source
Same as matrix but does not do any bounds checking.
module BLAS.Tensor.Immutable
Special matrices
 zeroMatrix :: BLAS1 e => (Int, Int) -> Matrix (m, n) e Source
Get a new zero of the given shape.
 constantMatrix :: BLAS1 e => (Int, Int) -> e -> Matrix (m, n) e Source
Get a new constant of the given shape.
 identityMatrix :: BLAS1 e => (Int, Int) -> Matrix (m, n) e Source
Get a new matrix of the given shape with ones along the diagonal and zeroes everywhere else.
Matrix views
 submatrix :: Elem e => Matrix mn e -> (Int, Int) -> (Int, Int) -> Matrix mn' e Source
submatrix a ij mn returns the submatrix of a with element (0,0) being element ij in a, and having shape mn.
 splitRowsAt :: (BaseMatrix a x, Storable e) => Int -> a (m, n) e -> (a (m1, n) e, a (m2, n) e) Source
 splitColsAt :: (BaseMatrix a x, Storable e) => Int -> a (m, n) e -> (a (m, n1) e, a (m, n2) e) Source
 unsafeSubmatrix :: Elem e => Matrix mn e -> (Int, Int) -> (Int, Int) -> Matrix mn' e Source
Same as submatrix but indices are not range-checked.
 unsafeSplitRowsAt :: (BaseMatrix a x, Storable e) => Int -> a (m, n) e -> (a (m1, n) e, a (m2, n) e) Source
 unsafeSplitColsAt :: (BaseMatrix a x, Storable e) => Int -> a (m, n) e -> (a (m, n1) e, a (m, n2) e) Source
Vector views
 diag :: Elem e => Matrix mn e -> Int -> Vector k e Source
Get a the given diagonal in a matrix. Negative indices correspond to sub-diagonals.
 unsafeDiag :: Elem e => Matrix mn e -> Int -> Vector k e Source
Same as diag but index is not range-checked.
Low-level properties
 ldaOfMatrix :: BaseMatrix a x => a mn e -> Int Source
 isHermMatrix :: BaseMatrix a x => a mn e -> Bool Source
Matrix and vector multiplication
module BLAS.Matrix.Immutable
Converting between mutable and immutable matrices
 class UnsafeFreezeMatrix a where Source
Methods
 unsafeFreezeMatrix :: a mn e -> Matrix mn e Source
Instances
 UnsafeFreezeMatrix IOMatrix UnsafeFreezeMatrix (STMatrix s)
 class UnsafeThawMatrix a where Source
Methods
 unsafeThawMatrix :: Matrix mn e -> a mn e Source
Instances
 UnsafeThawMatrix IOMatrix UnsafeThawMatrix (STMatrix s)
 freezeMatrix :: (ReadMatrix a x m, WriteMatrix b y m, UnsafeFreezeMatrix b, BLAS1 e) => a mn e -> m (Matrix mn e) Source
 thawMatrix :: (WriteMatrix a y m, BLAS1 e) => Matrix mn e -> m (a mn e) Source
Produced by Haddock version 2.3.0