hblas-0.3.2.1: Human friendly BLAS and Lapack bindings for Haskell.

Safe HaskellNone
LanguageHaskell2010

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.

  • NoTranspose leaves the matrix mat as is.
  • Transpose treats the mat as being implicitly transposed, with dimension m x n. Entry mat(i,j) being treated as actually being the entry mat(j,i). For Real matrices this is also the matrix adjoint operation. ie Tranpose(mat)(i,j)=mat(j,i)
  • ConjNoTranspose will implicitly conjugate mat, which is a no op for Real (Float or Double) matrices, but for 'Complex Float' and 'Complex Double' matrices, a given matrix entry mat(i,j)==x:+y will be treated as actually being conjugate(mat)(i,j)=y:+x.
  • ConjTranpose will 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', where trLeft and trRight are values of type Transpose that respectively act on the matrices left and right.
  • 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 strsv matuplo tranposeMatA matdiag matrixA xVector. A key detail to note is that the input vector is ALSO the result vector, ie strsv 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

dgemm :: PrimMonad m => GemmFun Double orient (PrimState m) m Source

sgemm :: PrimMonad m => GemmFun Float orient (PrimState m) m Source

cgemm :: PrimMonad m => GemmFun (Complex Float) orient (PrimState m) m Source

zgemm :: PrimMonad m => GemmFun (Complex Double) orient (PrimState m) m Source

sgemv :: PrimMonad m => GemvFun Float orient (PrimState m) m Source

dgemv :: PrimMonad m => GemvFun Double orient (PrimState m) m Source

cgemv :: PrimMonad m => GemvFun (Complex Float) orient (PrimState m) m Source

zgemv :: PrimMonad m => GemvFun (Complex Double) orient (PrimState m) m Source

strsv :: PrimMonad m => TrsvFun Float orient (PrimState m) m Source

dtrsv :: PrimMonad m => TrsvFun Double orient (PrimState m) m Source

ctrsv :: PrimMonad m => TrsvFun (Complex Float) orient (PrimState m) m Source

ztrsv :: PrimMonad m => TrsvFun (Complex Double) orient (PrimState m) m Source