| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Numerical.HBLAS.BLAS
Description
The BLAS module provides a fully general
yet type safe BLAS API.
When in doubt about the semantics of an operation, consult your system's BLAS api documentation, or just read the documentation for the Intel MKL BLAS distribution
A few basic notes about how to invoke BLAS routines.
Many BLAS operations take one or more arguments of type Transpose.
Tranpose has the following different constructors, which tell BLAS
routines what transformation to implicitly apply to an input matrix mat with dimension n x m.
NoTransposeleaves the matrixmatas is.Transposetreats thematas being implicitly transposed, with dimensionm x n. Entrymat(i,j)being treated as actually being the entrymat(j,i). For Real matrices this is also the matrix adjoint operation. ieTranpose(mat)(i,j)=mat(j,i)ConjNoTransposewill implicitly conjugatemat, which is a no op for Real (FloatorDouble) matrices, but for 'Complex Float' and 'Complex Double' matrices, a given matrix entrymat(i,j)==xwill be treated as actually being:+yconjugate(mat)(i,j)=y.:+xConjTranposewill implicitly transpose and conjugate the input matrix. ConjugateTranpose acts as matrix adjoint for both real and complex matrices.
The *gemm operations work as follows (using sgemm as an example):
'sgemm trLeft trRight alpha beta left right result', wheretrLeftandtrRightare values of typeTransposethat respectively act on the matricesleftandright.- the generalized matrix computation thusly formed can be viewed as being
result = alpha * trLeft(left) * trRight(right) + beta * result
the *gemv operations are akin to the *gemm operations, but with right and result
being vectors rather than matrices.
the *trsv operations solve for x in the equation A x = y given A and y.
The MatUpLo argument determines if the matrix should be treated as upper or
lower triangular and MatDiag determines if the triangular solver should treat
the diagonal of the matrix as being all 1's or not. A general pattern of invocation
would be .
A key detail to note is that the input vector is ALSO the result vector,
ie strsv matuplo tranposeMatA matdiag matrixA xVectorstrsv and friends updates the vector place.
Documentation
type GemvFun el orient s m = Transpose -> el -> el -> MDenseMatrix s orient el -> MDenseVector s Direct el -> MDenseVector s Direct el -> m () Source
type GemmFun el orient s m = Transpose -> Transpose -> el -> el -> MDenseMatrix s orient el -> MDenseMatrix s orient el -> MDenseMatrix s orient el -> m () Source
type TrsvFun el orient s m = MatUpLo -> Transpose -> MatDiag -> MDenseMatrix s orient el -> MDenseVector s Direct el -> m () Source