blas-0.6: Bindings to the BLAS librarySource codeContentsIndex
Data.Matrix.Dense
Stabilityexperimental
MaintainerPatrick Perry <patperry@stanford.edu>
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)
show/hide Instances
Matrix shape
module BLAS.Tensor.Base
module BLAS.Matrix.Base
coerceMatrix :: BaseMatrix a x => a mn e -> a mn' eSource
Cast the shape type of the matrix.
Creating matrices
matrix :: BLAS1 e => (Int, Int) -> [((Int, Int), e)] -> Matrix (m, n) eSource
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) eSource
Create a new matrix with the given elements in row-major order.
rowsMatrix :: BLAS1 e => (Int, Int) -> [Vector n e] -> Matrix (m, n) eSource
Create a matrix of the given shape from a list of rows
colsMatrix :: BLAS1 e => (Int, Int) -> [Vector m e] -> Matrix (m, n) eSource
Create a matrix of the given shape from a list of columns
rowMatrix :: BLAS1 e => Vector n e -> Matrix (one, n) eSource
Get a matrix from a row vector.
colMatrix :: BLAS1 e => Vector m e -> Matrix (m, one) eSource
Get a matrix from a column vector.
unsafeMatrix :: BLAS1 e => (Int, Int) -> [((Int, Int), e)] -> Matrix (m, n) eSource
Same as matrix but does not do any bounds checking.
Reading matrix elements
module BLAS.Tensor.Immutable
Special matrices
zeroMatrix :: BLAS1 e => (Int, Int) -> Matrix (m, n) eSource
Get a new zero of the given shape.
constantMatrix :: BLAS1 e => (Int, Int) -> e -> Matrix (m, n) eSource
Get a new constant of the given shape.
identityMatrix :: BLAS1 e => (Int, Int) -> Matrix (m, n) eSource
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' eSource
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' eSource
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 eSource
Get a the given diagonal in a matrix. Negative indices correspond to sub-diagonals.
unsafeDiag :: Elem e => Matrix mn e -> Int -> Vector k eSource
Same as diag but index is not range-checked.
Low-level properties
ldaOfMatrix :: BaseMatrix a x => a mn e -> IntSource
isHermMatrix :: BaseMatrix a x => a mn e -> BoolSource
Matrix and vector multiplication
module BLAS.Matrix.Immutable
Converting between mutable and immutable matrices
class UnsafeFreezeMatrix a whereSource
Methods
unsafeFreezeMatrix :: a mn e -> Matrix mn eSource
show/hide Instances
class UnsafeThawMatrix a whereSource
Methods
unsafeThawMatrix :: Matrix mn e -> a mn eSource
show/hide Instances
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