For vector/vector, matrix/vector and matrix/matrix multiplications with large dense matrices Blaze relies on the efficiency of BLAS libraries. For this purpose, Blaze implements several convenient C++ wrapper functions for several BLAS functions. The following sections give a complete overview of all available BLAS level 1, 2 and 3 functions.
BLAS Level 1
Dot Product (dotu)
The following wrapper functions provide a generic interface for the BLAS functions for the dot product of two dense vectors (cblas_sdot()
, cblas_ddot()
, cblas_cdotu_sub()
, and cblas_zdotu_sub()
):
namespace blaze {
template< typename VT1, bool TF1, typename VT2, bool TF2 >
ElementType_<VT1>
dotu(
const DenseVector<VT1,TF1>& x,
const DenseVector<VT2,TF2>& y );
}
Complex data type of the Blaze library.
ElementType_t< VT1 > dotu(const DenseVector< VT1, TF1 > &x, const DenseVector< VT2, TF2 > &y)
BLAS kernel for a dense vector dot product ( ).
Definition: dotu.h:88
int32_t blas_int_t
Signed integer type used in the BLAS/LAPACK wrapper functions.
Definition: Types.h:64
Complex Conjugate Dot Product (dotc)
The following wrapper functions provide a generic interface for the BLAS functions for the complex conjugate dot product of two dense vectors (cblas_sdot()
, cblas_ddot()
, cblas_cdotc_sub()
, and cblas_zdotc_sub()
):
namespace blaze {
template< typename VT1, bool TF1, typename VT2, bool TF2 >
ElementType_<VT1>
dotc(
const DenseVector<VT1,TF1>& x,
const DenseVector<VT2,TF2>& y );
}
ElementType_t< VT1 > dotc(const DenseVector< VT1, TF1 > &x, const DenseVector< VT2, TF2 > &y)
BLAS kernel for a dense vector complex conjugate dot product ( ).
Definition: dotc.h:93
Axpy Product (axpy)
The following wrapper functions provide a generic interface for the BLAS functions for the axpy product of two dense vectors (cblas_saxpy()
, cblas_daxpy()
, cblas_caxpy()
, and cblas_zaxpy()
):
namespace blaze {
template< typename VT1, bool TF1, typename VT2, bool TF2, typename ST >
void axpy(
const DenseVector<VT1,TF1>& x,
const DenseVector<VT2,TF2>& y, ST alpha );
}
void axpy(DenseVector< VT1, TF1 > &x, const DenseVector< VT2, TF2 > &y, ST alpha)
BLAS kernel for a dense vector axpy product ( ).
Definition: axpy.h:90
BLAS Level 2
General Matrix/Vector Multiplication (gemv)
The following wrapper functions provide a generic interface for the BLAS functions for the general matrix/vector multiplication (cblas_sgemv()
, cblas_dgemv()
, cblas_cgemv()
, and cblas_zgemv()
):
Triangular Matrix/Vector Multiplication (trmv)
The following wrapper functions provide a generic interface for the BLAS functions for the matrix/vector multiplication with a triangular matrix (cblas_strmv()
, cblas_dtrmv()
, cblas_ctrmv()
, and cblas_ztrmv()
):
namespace blaze {
void trmv( CBLAS_ORDER order, CBLAS_UPLO uplo, CBLAS_TRANSPOSE transA, CBLAS_DIAG diag,
void trmv( CBLAS_ORDER order, CBLAS_UPLO uplo, CBLAS_TRANSPOSE transA, CBLAS_DIAG diag,
void trmv( CBLAS_ORDER order, CBLAS_UPLO uplo, CBLAS_TRANSPOSE transA, CBLAS_DIAG diag,
void trmv( CBLAS_ORDER order, CBLAS_UPLO uplo, CBLAS_TRANSPOSE transA, CBLAS_DIAG diag,
template< typename VT, typename MT, bool SO >
void trmv( DenseVector<VT,false>& x, const DenseMatrix<MT,SO>& A, CBLAS_UPLO uplo );
template< typename VT, typename MT, bool SO >
void trmv( DenseVector<VT,true>& x, const DenseMatrix<MT,SO>& A, CBLAS_UPLO uplo );
}
BLAS Level 3
General Matrix/Matrix Multiplication (gemm)
The following wrapper functions provide a generic interface for the BLAS functions for the general matrix/matrix multiplication (cblas_sgemm()
, cblas_dgemm()
, cblas_cgemm()
, and cblas_zgemm()
):
namespace blaze {
void gemm( CBLAS_ORDER order, CBLAS_TRANSPOSE transA, CBLAS_TRANSPOSE transB,
void gemm( CBLAS_ORDER order, CBLAS_TRANSPOSE transA, CBLAS_TRANSPOSE transB,
void gemm( CBLAS_ORDER order, CBLAS_TRANSPOSE transA, CBLAS_TRANSPOSE transB,
void gemm( CBLAS_ORDER order, CBLAS_TRANSPOSE transA, CBLAS_TRANSPOSE transB,
}
Triangular Matrix/Matrix Multiplication (trmm)
The following wrapper functions provide a generic interface for the BLAS functions for the matrix/matrix multiplication with a triangular matrix (cblas_strmm()
, cblas_dtrmm()
, cblas_ctrmm()
, and cblas_ztrmm()
):
namespace blaze {
void trmm( CBLAS_ORDER order, CBLAS_SIDE side, CBLAS_UPLO uplo, CBLAS_TRANSPOSE transA,
void trmm( CBLAS_ORDER order, CBLAS_SIDE side, CBLAS_UPLO uplo, CBLAS_TRANSPOSE transA,
void trmm( CBLAS_ORDER order, CBLAS_SIDE side, CBLAS_UPLO uplo, CBLAS_TRANSPOSE transA,
void trmm( CBLAS_ORDER order, CBLAS_SIDE side, CBLAS_UPLO uplo, CBLAS_TRANSPOSE transA,
template< typename MT1, bool SO1, typename MT2, bool SO2, typename ST >
void trmm( DenseMatrix<MT1,SO1>& B, const DenseMatrix<MT2,SO2>& A,
CBLAS_SIDE side, CBLAS_UPLO uplo, ST alpha );
}
Triangular System Solver (trsm)
The following wrapper functions provide a generic interface for the BLAS functions for solving a triangular system of equations (cblas_strsm()
, cblas_dtrsm()
, cblas_ctrsm()
, and cblas_ztrsm()
):
namespace blaze {
void trsm( CBLAS_ORDER order, CBLAS_SIDE side, CBLAS_UPLO uplo, CBLAS_TRANSPOSE transA,
void trsm( CBLAS_ORDER order, CBLAS_SIDE side, CBLAS_UPLO uplo, CBLAS_TRANSPOSE transA,
void trsm( CBLAS_ORDER order, CBLAS_SIDE side, CBLAS_UPLO uplo, CBLAS_TRANSPOSE transA,
void trsm( CBLAS_ORDER order, CBLAS_SIDE side, CBLAS_UPLO uplo, CBLAS_TRANSPOSE transA,
template< typename MT, bool SO, typename VT, bool TF, typename ST >
void trsm( const DenseMatrix<MT,SO>& A, DenseVector<VT,TF>& b,
CBLAS_SIDE side, CBLAS_UPLO uplo, ST alpha );
template< typename MT1, bool SO1, typename MT2, bool SO2, typename ST >
void trsm( const DenseMatrix<MT1,SO1>& A, DenseMatrix<MT2,SO2>& B,
CBLAS_SIDE side, CBLAS_UPLO uplo, ST alpha );
}
Previous: Customization of the Error Reporting Mechanism Next: LAPACK Functions