Stability | experimental |
---|---|
Maintainer | Patrick Perry <patperry@stanford.edu> |
An overloaded interface for mutable matrices. The type class associates a matrix with a monad type in which operations can be perfomred. The matrices provide access to rows and columns, and can operate via multiplication on dense vectors and matrices.
- class (MatrixShaped a, BLAS3 e, Monad m) => MMatrix a e m where
- getRows :: WriteVector x e m => a (k, l) e -> m [x l e]
- getCols :: WriteVector x e m => a (k, l) e -> m [x k e]
- getRow :: (MMatrix a e m, WriteVector x e m) => a (k, l) e -> Int -> m (x l e)
- getCol :: (MMatrix a e m, WriteVector x e m) => a (k, l) e -> Int -> m (x k e)
- getRows' :: (MMatrix a e m, WriteVector x e m) => a (k, l) e -> m [x l e]
- getCols' :: (MMatrix a e m, WriteVector x e m) => a (k, l) e -> m [x k e]
- getApply :: (MMatrix a e m, ReadVector x e m, WriteVector y e m) => a (k, l) e -> x l e -> m (y k e)
- getSApply :: (MMatrix a e m, ReadVector x e m, WriteVector y e m) => e -> a (k, l) e -> x l e -> m (y k e)
- getApplyMat :: (MMatrix a e m, ReadMatrix b e m, WriteMatrix c e m) => a (r, s) e -> b (s, t) e -> m (c (r, t) e)
- getSApplyMat :: (MMatrix a e m, ReadMatrix b e m, WriteMatrix c e m) => e -> a (r, s) e -> b (s, t) e -> m (c (r, t) e)
- doApply :: (MMatrix a e m, ReadVector x e m, WriteVector y e m) => a (k, l) e -> x l e -> y k e -> m ()
- doSApplyAdd :: (MMatrix a e m, ReadVector x e m, WriteVector y e m) => e -> a (k, l) e -> x l e -> e -> y k e -> m ()
- doApply_ :: (MMatrix a e m, WriteVector y e m) => a (n, n) e -> y n e -> m ()
- doSApply_ :: (MMatrix a e m, WriteVector y e m) => e -> a (n, n) e -> y n e -> m ()
- doApplyMat :: (MMatrix a e m, ReadMatrix b e m, WriteMatrix c e m) => a (r, s) e -> b (s, t) e -> c (r, t) e -> m ()
- doSApplyAddMat :: (MMatrix a e m, ReadMatrix b e m, WriteMatrix c e m) => e -> a (r, s) e -> b (s, t) e -> e -> c (r, t) e -> m ()
- doApplyMat_ :: (MMatrix a e m, WriteMatrix b e m) => a (s, s) e -> b (s, t) e -> m ()
- doSApplyMat_ :: (MMatrix a e m, WriteMatrix b e m) => e -> a (s, s) e -> b (s, t) e -> m ()
The MMatrix type class
class (MatrixShaped a, BLAS3 e, Monad m) => MMatrix a e m whereSource
A type class for mutable matrices associated with a monad. The member functions of the type class do not perform any checks on the validity of shapes or indices, so in general their safe counterparts should be preferred.
getRows :: WriteVector x e m => a (k, l) e -> m [x l e]Source
Get a lazy list the row vectors in the matrix.
getCols :: WriteVector x e m => a (k, l) e -> m [x k e]Source
Get a lazy list of the column vectors in the matrix.
BLAS3 e => MMatrix IOMatrix e IO | |
BLAS3 e => MMatrix Matrix e IO | |
BLAS3 e => MMatrix IOBanded e IO | |
BLAS3 e => MMatrix Banded e IO | |
BLAS3 e => MMatrix Matrix e (ST s) | |
BLAS3 e => MMatrix Banded e (ST s) | |
BLAS3 e => MMatrix (Herm IOMatrix) e IO | |
BLAS3 e => MMatrix (Herm Matrix) e IO | |
BLAS3 e => MMatrix (Herm IOBanded) e IO | |
BLAS3 e => MMatrix (Herm Banded) e IO | |
BLAS3 e => MMatrix (Tri IOMatrix) e IO | |
BLAS3 e => MMatrix (Tri Matrix) e IO | |
BLAS3 e => MMatrix (Tri IOBanded) e IO | |
BLAS3 e => MMatrix (Tri Banded) e IO | |
BLAS3 e => MMatrix (Herm Matrix) e (ST s) | |
BLAS3 e => MMatrix (Herm (STMatrix s)) e (ST s) | |
BLAS3 e => MMatrix (Herm Banded) e (ST s) | |
BLAS3 e => MMatrix (Herm (STBanded s)) e (ST s) | |
BLAS3 e => MMatrix (Tri Matrix) e (ST s) | |
BLAS3 e => MMatrix (Tri (STMatrix s)) e (ST s) | |
BLAS3 e => MMatrix (Tri Banded) e (ST s) | |
BLAS3 e => MMatrix (Tri (STBanded s)) e (ST s) | |
BLAS3 e => MMatrix (STMatrix s) e (ST s) | |
BLAS3 e => MMatrix (STBanded s) e (ST s) |
Getting rows and columns
getRow :: (MMatrix a e m, WriteVector x e m) => a (k, l) e -> Int -> m (x l e)Source
Get the given row in a matrix.
getCol :: (MMatrix a e m, WriteVector x e m) => a (k, l) e -> Int -> m (x k e)Source
Get the given column in a matrix.
getRows' :: (MMatrix a e m, WriteVector x e m) => a (k, l) e -> m [x l e]Source
Get a strict list the row vectors in the matrix.
getCols' :: (MMatrix a e m, WriteVector x e m) => a (k, l) e -> m [x k e]Source
Get a strict list of the column vectors in the matrix.
Matrix and vector multiplication
getApply :: (MMatrix a e m, ReadVector x e m, WriteVector y e m) => a (k, l) e -> x l e -> m (y k e)Source
Apply to a vector
getSApply :: (MMatrix a e m, ReadVector x e m, WriteVector y e m) => e -> a (k, l) e -> x l e -> m (y k e)Source
Scale and apply to a vector
getApplyMat :: (MMatrix a e m, ReadMatrix b e m, WriteMatrix c e m) => a (r, s) e -> b (s, t) e -> m (c (r, t) e)Source
Apply to a matrix
getSApplyMat :: (MMatrix a e m, ReadMatrix b e m, WriteMatrix c e m) => e -> a (r, s) e -> b (s, t) e -> m (c (r, t) e)Source
Scale and apply to a matrix
In-place multiplication
doApply :: (MMatrix a e m, ReadVector x e m, WriteVector y e m) => a (k, l) e -> x l e -> y k e -> m ()Source
Apply to a vector and store the result in another vector
doSApplyAdd :: (MMatrix a e m, ReadVector x e m, WriteVector y e m) => e -> a (k, l) e -> x l e -> e -> y k e -> m ()Source
y := alpha a x + beta y
doApply_ :: (MMatrix a e m, WriteVector y e m) => a (n, n) e -> y n e -> m ()Source
x := a x
doSApply_ :: (MMatrix a e m, WriteVector y e m) => e -> a (n, n) e -> y n e -> m ()Source
x := alpha a x
doApplyMat :: (MMatrix a e m, ReadMatrix b e m, WriteMatrix c e m) => a (r, s) e -> b (s, t) e -> c (r, t) e -> m ()Source
Apply to a matrix and store the result in another matrix
doSApplyAddMat :: (MMatrix a e m, ReadMatrix b e m, WriteMatrix c e m) => e -> a (r, s) e -> b (s, t) e -> e -> c (r, t) e -> m ()Source
c := alpha a b + beta c
doApplyMat_ :: (MMatrix a e m, WriteMatrix b e m) => a (s, s) e -> b (s, t) e -> m ()Source
b := a b
doSApplyMat_ :: (MMatrix a e m, WriteMatrix b e m) => e -> a (s, s) e -> b (s, t) e -> m ()Source
b := alpha a b