blas-0.7.5: Bindings to the BLAS library

Stabilityexperimental
MaintainerPatrick Perry <patperry@stanford.edu>

Unsafe.BLAS

Contents

Description

Unsafe BLAS functions. Most of these functions to not check the shapes of their arguments, and should be used with caution.

Synopsis

Utility functions

Vector functions

data IOVector n e Source

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.

Constructors

IOVector !ConjEnum !Int !(ForeignPtr e) !(Ptr e) !Int 

unsafeVector :: BLAS1 e => Int -> [(Int, e)] -> Vector n eSource

unsafeSubvector :: BLAS1 e => Vector n e -> Int -> Int -> Vector n' eSource

unsafeDot :: BLAS1 e => Vector n e -> Vector n e -> 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

data IOMatrix np e Source

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 prefer IOMatrix (n,p) e to IOMatrix np e.
  • e: the element type of the matrix. Only certain element types are supported.

Constructors

IOMatrix !TransEnum !Int !Int !(ForeignPtr e) !(Ptr e) !Int 

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

unsafeMatrix :: BLAS3 e => (Int, Int) -> [((Int, Int), e)] -> Matrix (n, p) eSource

unsafeSubmatrix :: Elem e => Matrix (n, p) e -> (Int, Int) -> (Int, Int) -> Matrix (n', p') eSource

unsafeDiag :: Elem e => Matrix (n, p) e -> Int -> Vector k 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

data IOBanded np e Source

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 prefer IOBanded (n,p) e to IOBanded np e.
  • e: the element type of the matrix. Only certain element types are supported.

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

unsafeBanded :: BLAS3 e => (Int, Int) -> (Int, Int) -> [((Int, Int), e)] -> Banded (n, p) eSource

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

unsafeDiagBanded :: BLAS1 e => Banded (n, p) e -> Int -> Vector k eSource

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.

Instances

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.

Instances

BLAS3 e => ISolve (Tri Matrix) e 
BLAS3 e => ISolve (Tri Banded) e 

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.

Methods

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.

Instances

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) 

getRowsIO :: (MMatrix a e IO, WriteVector x e IO) => a (k, l) e -> IO [x l e]Source

getRowsST :: (MMatrix a e (ST s), WriteVector x e (ST s)) => a (k, l) e -> ST s [x l e]Source

getColsIO :: (MMatrix a e IO, WriteVector x e IO) => a (k, l) e -> IO [x k e]Source

getColsST :: (MMatrix a e (ST s), WriteVector x e (ST s)) => a (k, l) e -> ST s [x k e]Source

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.

Methods

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

Instances

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)