Stability | experimental |
---|---|
Maintainer | Patrick Perry <patperry@stanford.edu> |
Unsafe BLAS functions. Most of these functions to not check the shapes of their arguments, and should be used with caution.
- clearArray :: Storable e => Ptr e -> Int -> IO ()
- inlinePerformIO :: IO a -> a
- data IOVector n e = IOVector !(ForeignPtr e) !(Ptr e) !Int !Int !Bool
- unsafeIOVectorToVector :: BaseVector x e => IOVector n e -> x n e
- unsafeVector :: BLAS1 e => Int -> [(Int, e)] -> Vector n e
- unsafeSubvector :: BLAS1 e => Vector n e -> Int -> Int -> Vector n' e
- unsafeSubvectorWithStride :: Elem e => Int -> Vector n e -> Int -> Int -> Vector n' e
- unsafeDot :: BLAS1 e => Vector n e -> Vector n e -> e
- unsafeNewVector :: WriteVector x e m => Int -> [(Int, e)] -> m (x n e)
- unsafeCopyVector :: (ReadVector y e m, ReadVector x e m) => y n e -> x n e -> m ()
- unsafeSwapVector :: (WriteVector x e m, WriteVector y e m) => x n e -> y n e -> m ()
- unsafeSubvectorView :: BaseVector x e => x n e -> Int -> Int -> x n' e
- unsafeSubvectorViewWithStride :: BaseVector x e => Int -> x n e -> Int -> Int -> x n' e
- unsafeGetAddVector :: (ReadVector x e m, ReadVector y e m, WriteVector z e m) => x n e -> y n e -> m (z n e)
- unsafeGetSubVector :: (ReadVector x e m, ReadVector y e m, WriteVector z e m) => x n e -> y n e -> m (z n e)
- unsafeGetMulVector :: (ReadVector x e m, ReadVector y e m, WriteVector z e m) => x n e -> y n e -> m (z n e)
- unsafeGetDivVector :: (ReadVector x e m, ReadVector y e m, WriteVector z e m) => x n e -> y n e -> m (z n e)
- unsafeAxpyVector :: (ReadVector x e m, ReadVector y e m) => e -> x n e -> y n e -> m ()
- unsafeAddVector :: (WriteVector y e m, ReadVector x e m) => y n e -> x n e -> m ()
- unsafeSubVector :: (WriteVector y e m, ReadVector x e m) => y n e -> x n e -> m ()
- unsafeMulVector :: (WriteVector y e m, ReadVector x e m) => y n e -> x n e -> m ()
- unsafeDivVector :: (WriteVector y e m, ReadVector x e m) => y n e -> x n e -> m ()
- unsafeGetDot :: (ReadVector x e m, ReadVector y e m) => x n e -> y n e -> m e
- data IOMatrix np e = IOMatrix !(ForeignPtr e) !(Ptr e) !Int !Int !Int !Bool
- unsafeIOMatrixToMatrix :: BaseMatrix a e => IOMatrix (n, p) e -> a (n, p) e
- unsafeSubmatrixView :: BaseMatrix a e => a (n, p) e -> (Int, Int) -> (Int, Int) -> a (n', p') e
- unsafeDiagView :: BaseMatrix a e => a (n, p) e -> Int -> VectorView a k e
- unsafeRowView :: BaseMatrix a e => a (n, p) e -> Int -> VectorView a p e
- unsafeColView :: BaseMatrix a e => a (n, p) e -> Int -> VectorView a n e
- unsafeMatrix :: BLAS3 e => (Int, Int) -> [((Int, Int), e)] -> Matrix (n, p) e
- unsafeSubmatrix :: Elem e => Matrix (n, p) e -> (Int, Int) -> (Int, Int) -> Matrix (n', p') e
- unsafeDiag :: Elem e => Matrix (n, p) e -> Int -> Vector k e
- unsafeNewMatrix :: WriteMatrix a e m => (Int, Int) -> [((Int, Int), e)] -> m (a (n, p) e)
- unsafeCopyMatrix :: (WriteMatrix b e m, ReadMatrix a e m) => b (n, p) e -> a (n, p) e -> m ()
- unsafeSwapMatrix :: (WriteMatrix a e m, WriteMatrix b e m) => a (n, p) e -> b (n, p) e -> m ()
- unsafeSwapRows :: WriteMatrix a e m => a (n, p) e -> Int -> Int -> m ()
- unsafeSwapCols :: WriteMatrix a e m => a (n, p) e -> Int -> Int -> m ()
- unsafeGetDiag :: (ReadMatrix a e m, WriteVector y e m) => a (n, p) e -> Int -> m (y k e)
- unsafeGetAddMatrix :: (ReadMatrix a e m, ReadMatrix b e m, WriteMatrix c e m) => a (n, p) e -> b (n, p) e -> m (c (n, p) e)
- unsafeGetSubMatrix :: (ReadMatrix a e m, ReadMatrix b e m, WriteMatrix c e m) => a (n, p) e -> b (n, p) e -> m (c (n, p) e)
- unsafeGetMulMatrix :: (ReadMatrix a e m, ReadMatrix b e m, WriteMatrix c e m) => a (n, p) e -> b (n, p) e -> m (c (n, p) e)
- unsafeGetDivMatrix :: (ReadMatrix a e m, ReadMatrix b e m, WriteMatrix c e m) => a (n, p) e -> b (n, p) e -> m (c (n, p) e)
- unsafeAxpyMatrix :: (ReadMatrix a e m, WriteMatrix b e m) => e -> a (n, p) e -> b (n, p) e -> m ()
- unsafeAddMatrix :: (WriteMatrix b e m, ReadMatrix a e m) => b (n, p) e -> a (n, p) e -> m ()
- unsafeSubMatrix :: (WriteMatrix b e m, ReadMatrix a e m) => b (n, p) e -> a (n, p) e -> m ()
- unsafeMulMatrix :: (WriteMatrix b e m, ReadMatrix a e m) => b (n, p) e -> a (n, p) e -> m ()
- unsafeDivMatrix :: (WriteMatrix b e m, ReadMatrix a e m) => b (n, p) e -> a (n, p) e -> m ()
- data IOBanded np e = IOBanded {
- fptrIOBanded :: !(ForeignPtr e)
- ptrIOBanded :: !(Ptr e)
- numRowsIOBanded :: !Int
- numColsIOBanded :: !Int
- numLowerIOBanded :: !Int
- numUpperIOBanded :: !Int
- ldaIOBanded :: !Int
- isHermIOBanded :: !Bool
- unsafeIOBandedToBanded :: BaseBanded a e => IOBanded (n, p) e -> a (n, p) e
- unsafeDiagViewBanded :: BaseBanded a e => a (n, p) e -> Int -> VectorView a k e
- unsafeRowViewBanded :: BaseBanded a e => a (n, p) e -> Int -> (Int, VectorView a k e, Int)
- unsafeColViewBanded :: BaseBanded a e => a (n, p) e -> Int -> (Int, VectorView a k e, Int)
- unsafeBanded :: BLAS3 e => (Int, Int) -> (Int, Int) -> [((Int, Int), e)] -> Banded (n, p) e
- unsafeNewBanded :: WriteBanded a e m => (Int, Int) -> (Int, Int) -> [((Int, Int), e)] -> m (a (n, p) e)
- unsafeGetDiagBanded :: (ReadBanded a e m, WriteVector y e m) => a (n, p) e -> Int -> m (y k e)
- unsafeGetRowBanded :: (ReadBanded a e m, WriteVector y e m) => a (n, p) e -> Int -> m (y p e)
- unsafeGetColBanded :: (ReadBanded a e m, WriteVector y e m) => a (n, p) e -> Int -> m (y n e)
- unsafeDiagBanded :: BLAS1 e => Banded (n, p) e -> Int -> Vector k e
- class (MatrixShaped a, BLAS3 e) => IMatrix a e
- class (MatrixShaped a, BLAS3 e) => ISolve a e
- class (MatrixShaped a, BLAS3 e, Monad m) => MMatrix a e m where
- unsafeGetSApply :: (ReadVector x e m, WriteVector y e m) => e -> a (k, l) e -> x l e -> m (y k e)
- unsafeGetSApplyMat :: (ReadMatrix b e m, WriteMatrix c e m) => e -> a (r, s) e -> b (s, t) e -> m (c (r, t) e)
- unsafeDoSApplyAdd :: (ReadVector x e m, WriteVector y e m) => e -> a (k, l) e -> x l e -> e -> y k e -> m ()
- unsafeDoSApplyAddMat :: (ReadMatrix b e m, WriteMatrix c e m) => e -> a (r, s) e -> b (s, t) e -> e -> c (r, t) e -> m ()
- unsafeDoSApply_ :: WriteVector y e m => e -> a (n, n) e -> y n e -> m ()
- unsafeDoSApplyMat_ :: WriteMatrix b e m => e -> a (k, k) e -> b (k, l) e -> m ()
- unsafeGetRow :: WriteVector x e m => a (k, l) e -> Int -> m (x l e)
- unsafeGetCol :: WriteVector x e m => a (k, l) e -> Int -> m (x k e)
- 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]
- getRowsIO :: (MMatrix a e IO, WriteVector x e IO) => a (k, l) e -> IO [x l e]
- getRowsST :: (MMatrix a e (ST s), WriteVector x e (ST s)) => a (k, l) e -> ST s [x l e]
- getColsIO :: (MMatrix a e IO, WriteVector x e IO) => a (k, l) e -> IO [x k e]
- getColsST :: (MMatrix a e (ST s), WriteVector x e (ST s)) => a (k, l) e -> ST s [x k e]
- class (MatrixShaped a, BLAS3 e, Monad m) => MSolve a e m where
- unsafeDoSolve :: (ReadVector y e m, WriteVector x e m) => a (k, l) e -> y k e -> x l e -> m ()
- unsafeDoSolveMat :: (ReadMatrix c e m, WriteMatrix b e m) => a (r, s) e -> c (r, t) e -> b (s, t) e -> m ()
- unsafeDoSSolve :: (ReadVector y e m, WriteVector x e m) => e -> a (k, l) e -> y k e -> x l e -> m ()
- unsafeDoSSolveMat :: (ReadMatrix c e m, WriteMatrix b e m) => e -> a (r, s) e -> c (r, t) e -> b (s, t) e -> m ()
- unsafeDoSolve_ :: WriteVector x e m => a (k, k) e -> x k e -> m ()
- unsafeDoSSolve_ :: WriteVector x e m => e -> a (k, k) e -> x k e -> m ()
- unsafeDoSolveMat_ :: WriteMatrix b e m => a (k, k) e -> b (k, l) e -> m ()
- unsafeDoSSolveMat_ :: WriteMatrix b e m => e -> a (k, k) e -> b (k, l) e -> m ()
Utility functions
inlinePerformIO :: IO a -> aSource
Vector functions
Dense vectors in the IO
monad. The type arguments are as follows:
-
n
: a phantom type for the dimension of the vector -
e
: the element type of the vector. Only certain element types are supported.
Shaped IOVector Int | |
Elem e => BaseVector IOVector e | |
BLAS1 e => WriteVector IOVector e IO | |
BLAS1 e => ReadVector IOVector e IO | |
BLAS1 e => WriteTensor IOVector Int e IO | |
Elem e => ReadTensor IOVector Int e IO |
unsafeIOVectorToVector :: BaseVector x e => IOVector n e -> x n eSource
unsafeNewVector :: WriteVector x e m => Int -> [(Int, e)] -> m (x n e)Source
unsafeCopyVector :: (ReadVector y e m, ReadVector x e m) => y n e -> x n e -> m ()Source
unsafeSwapVector :: (WriteVector x e m, WriteVector y e m) => x n e -> y n e -> m ()Source
unsafeSubvectorView :: BaseVector x e => x n e -> Int -> Int -> x n' eSource
unsafeSubvectorViewWithStride :: BaseVector x e => Int -> x n e -> Int -> Int -> x n' eSource
unsafeGetAddVector :: (ReadVector x e m, ReadVector y e m, WriteVector z e m) => x n e -> y n e -> m (z n e)Source
unsafeGetSubVector :: (ReadVector x e m, ReadVector y e m, WriteVector z e m) => x n e -> y n e -> m (z n e)Source
unsafeGetMulVector :: (ReadVector x e m, ReadVector y e m, WriteVector z e m) => x n e -> y n e -> m (z n e)Source
unsafeGetDivVector :: (ReadVector x e m, ReadVector y e m, WriteVector z e m) => x n e -> y n e -> m (z n e)Source
unsafeAxpyVector :: (ReadVector x e m, ReadVector y e m) => e -> x n e -> y n e -> m ()Source
unsafeAddVector :: (WriteVector y e m, ReadVector x e m) => y n e -> x n e -> m ()Source
unsafeSubVector :: (WriteVector y e m, ReadVector x e m) => y n e -> x n e -> m ()Source
unsafeMulVector :: (WriteVector y e m, ReadVector x e m) => y n e -> x n e -> m ()Source
unsafeDivVector :: (WriteVector y e m, ReadVector x e m) => y n e -> x n e -> m ()Source
unsafeGetDot :: (ReadVector x e m, ReadVector y e m) => x n e -> y n e -> m eSource
Matrix functions
Dense matrix in the IO
monad. The type arguments are as follows:
-
np
: a phantom type for the shape of the matrix. Most functions will demand that this be specified as a pair. When writing a function signature, you should always preferIOMatrix (n,p) e
toIOMatrix np e
. -
e
: the element type of the matrix. Only certain element types are supported.
MatrixShaped IOMatrix | |
HasVectorView IOMatrix | |
Elem e => BaseMatrix IOMatrix e | |
BLAS3 e => MMatrix IOMatrix e IO | |
BLAS3 e => WriteMatrix IOMatrix e IO | |
BLAS3 e => ReadMatrix IOMatrix e IO | |
Shaped IOMatrix (Int, Int) | |
BLAS1 e => WriteTensor IOMatrix (Int, Int) e IO | |
Elem e => ReadTensor IOMatrix (Int, Int) e IO | |
BLAS3 e => MSolve (Tri IOMatrix) e IO | |
BLAS3 e => MMatrix (Herm IOMatrix) e IO | |
BLAS3 e => MMatrix (Tri IOMatrix) e IO |
unsafeIOMatrixToMatrix :: BaseMatrix a e => IOMatrix (n, p) e -> a (n, p) eSource
unsafeSubmatrixView :: BaseMatrix a e => a (n, p) e -> (Int, Int) -> (Int, Int) -> a (n', p') eSource
unsafeDiagView :: BaseMatrix a e => a (n, p) e -> Int -> VectorView a k eSource
unsafeRowView :: BaseMatrix a e => a (n, p) e -> Int -> VectorView a p eSource
unsafeColView :: BaseMatrix a e => a (n, p) e -> Int -> VectorView a n eSource
unsafeNewMatrix :: WriteMatrix a e m => (Int, Int) -> [((Int, Int), e)] -> m (a (n, p) e)Source
unsafeCopyMatrix :: (WriteMatrix b e m, ReadMatrix a e m) => b (n, p) e -> a (n, p) e -> m ()Source
unsafeSwapMatrix :: (WriteMatrix a e m, WriteMatrix b e m) => a (n, p) e -> b (n, p) e -> m ()Source
unsafeSwapRows :: WriteMatrix a e m => a (n, p) e -> Int -> Int -> m ()Source
unsafeSwapCols :: WriteMatrix a e m => a (n, p) e -> Int -> Int -> m ()Source
unsafeGetDiag :: (ReadMatrix a e m, WriteVector y e m) => a (n, p) e -> Int -> m (y k e)Source
unsafeGetAddMatrix :: (ReadMatrix a e m, ReadMatrix b e m, WriteMatrix c e m) => a (n, p) e -> b (n, p) e -> m (c (n, p) e)Source
unsafeGetSubMatrix :: (ReadMatrix a e m, ReadMatrix b e m, WriteMatrix c e m) => a (n, p) e -> b (n, p) e -> m (c (n, p) e)Source
unsafeGetMulMatrix :: (ReadMatrix a e m, ReadMatrix b e m, WriteMatrix c e m) => a (n, p) e -> b (n, p) e -> m (c (n, p) e)Source
unsafeGetDivMatrix :: (ReadMatrix a e m, ReadMatrix b e m, WriteMatrix c e m) => a (n, p) e -> b (n, p) e -> m (c (n, p) e)Source
unsafeAxpyMatrix :: (ReadMatrix a e m, WriteMatrix b e m) => e -> a (n, p) e -> b (n, p) e -> m ()Source
unsafeAddMatrix :: (WriteMatrix b e m, ReadMatrix a e m) => b (n, p) e -> a (n, p) e -> m ()Source
unsafeSubMatrix :: (WriteMatrix b e m, ReadMatrix a e m) => b (n, p) e -> a (n, p) e -> m ()Source
unsafeMulMatrix :: (WriteMatrix b e m, ReadMatrix a e m) => b (n, p) e -> a (n, p) e -> m ()Source
unsafeDivMatrix :: (WriteMatrix b e m, ReadMatrix a e m) => b (n, p) e -> a (n, p) e -> m ()Source
Banded functions
Banded matrix in the IO
monad. The type arguments are as follows:
-
np
: a phantom type for the shape of the matrix. Most functions will demand that this be specified as a pair. When writing a function signature, you should always preferIOBanded (n,p) e
toIOBanded np e
. -
e
: the element type of the matrix. Only certain element types are supported.
IOBanded | |
|
MatrixShaped IOBanded | |
HasMatrixStorage IOBanded | |
HasVectorView IOBanded | |
Elem e => BaseBanded IOBanded e | |
BLAS3 e => MMatrix IOBanded e IO | |
BLAS3 e => WriteBanded IOBanded e IO | |
BLAS3 e => ReadBanded IOBanded e IO | |
Shaped IOBanded (Int, Int) | |
BLAS3 e => WriteTensor IOBanded (Int, Int) e IO | |
BLAS3 e => ReadTensor IOBanded (Int, Int) e IO | |
BLAS3 e => MSolve (Tri IOBanded) e IO | |
BLAS3 e => MMatrix (Herm IOBanded) e IO | |
BLAS3 e => MMatrix (Tri IOBanded) e IO |
unsafeIOBandedToBanded :: BaseBanded a e => IOBanded (n, p) e -> a (n, p) eSource
unsafeDiagViewBanded :: BaseBanded a e => a (n, p) e -> Int -> VectorView a k eSource
unsafeRowViewBanded :: BaseBanded a e => a (n, p) e -> Int -> (Int, VectorView a k e, Int)Source
unsafeColViewBanded :: BaseBanded a e => a (n, p) e -> Int -> (Int, VectorView a k e, Int)Source
unsafeNewBanded :: WriteBanded a e m => (Int, Int) -> (Int, Int) -> [((Int, Int), e)] -> m (a (n, p) e)Source
unsafeGetDiagBanded :: (ReadBanded a e m, WriteVector y e m) => a (n, p) e -> Int -> m (y k e)Source
unsafeGetRowBanded :: (ReadBanded a e m, WriteVector y e m) => a (n, p) e -> Int -> m (y p e)Source
unsafeGetColBanded :: (ReadBanded a e m, WriteVector y e m) => a (n, p) e -> Int -> m (y n e)Source
Matrix type classes
class (MatrixShaped a, BLAS3 e) => IMatrix a e Source
A type class for immutable matrices. 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.
class (MatrixShaped a, BLAS3 e) => ISolve a e Source
A type class for immutable matrices with inverses. 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.
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.
unsafeGetSApply :: (ReadVector x e m, WriteVector y e m) => e -> a (k, l) e -> x l e -> m (y k e)Source
unsafeGetSApplyMat :: (ReadMatrix b e m, WriteMatrix c e m) => e -> a (r, s) e -> b (s, t) e -> m (c (r, t) e)Source
unsafeDoSApplyAdd :: (ReadVector x e m, WriteVector y e m) => e -> a (k, l) e -> x l e -> e -> y k e -> m ()Source
unsafeDoSApplyAddMat :: (ReadMatrix b e m, WriteMatrix c e m) => e -> a (r, s) e -> b (s, t) e -> e -> c (r, t) e -> m ()Source
unsafeDoSApply_ :: WriteVector y e m => e -> a (n, n) e -> y n e -> m ()Source
unsafeDoSApplyMat_ :: WriteMatrix b e m => e -> a (k, k) e -> b (k, l) e -> m ()Source
unsafeGetRow :: WriteVector x e m => a (k, l) e -> Int -> m (x l e)Source
unsafeGetCol :: WriteVector x e m => a (k, l) e -> Int -> m (x k e)Source
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) |
class (MatrixShaped a, BLAS3 e, Monad m) => MSolve a e m whereSource
A type class for mutable matrices with inverses. 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.
unsafeDoSolve :: (ReadVector y e m, WriteVector x e m) => a (k, l) e -> y k e -> x l e -> m ()Source
unsafeDoSolveMat :: (ReadMatrix c e m, WriteMatrix b e m) => a (r, s) e -> c (r, t) e -> b (s, t) e -> m ()Source
unsafeDoSSolve :: (ReadVector y e m, WriteVector x e m) => e -> a (k, l) e -> y k e -> x l e -> m ()Source
unsafeDoSSolveMat :: (ReadMatrix c e m, WriteMatrix b e m) => e -> a (r, s) e -> c (r, t) e -> b (s, t) e -> m ()Source
unsafeDoSolve_ :: WriteVector x e m => a (k, k) e -> x k e -> m ()Source
unsafeDoSSolve_ :: WriteVector x e m => e -> a (k, k) e -> x k e -> m ()Source
unsafeDoSolveMat_ :: WriteMatrix b e m => a (k, k) e -> b (k, l) e -> m ()Source
unsafeDoSSolveMat_ :: WriteMatrix b e m => e -> a (k, k) e -> b (k, l) e -> m ()Source
BLAS3 e => MSolve (Tri IOMatrix) e IO | |
BLAS3 e => MSolve (Tri Matrix) e IO | |
BLAS3 e => MSolve (Tri IOBanded) e IO | |
BLAS3 e => MSolve (Tri Banded) e IO | |
BLAS3 e => MSolve (Tri Matrix) e (ST s) | |
BLAS3 e => MSolve (Tri (STMatrix s)) e (ST s) | |
BLAS3 e => MSolve (Tri Banded) e (ST s) | |
BLAS3 e => MSolve (Tri (STBanded s)) e (ST s) |