xerus
a general purpose tensor library
xerus::blasWrapper Namespace Reference

In this namespace the minimal wrappers for the BLAS and LAPACK functions are collected. More...

Functions

std::tuple< std::unique_ptr< double[]>, std::unique_ptr< double[]>, size_t > cq (const double *const _A, const size_t _m, const size_t _n)
 : splits A = C*Q, with _C an rxm matrix (where r is the rank of _A) and _Q orthogonal. More...
 
std::tuple< std::unique_ptr< double[]>, std::unique_ptr< double[]>, size_t > cq_destructive (double *const _A, const size_t _m, const size_t _n)
 : splits A = C*Q, with _C an rxm matrix (where r is the rank of _A) and _Q orthogonal. Destroys A. More...
 
double dot_product (const double *const _x, const size_t _n, const double *const _y)
 : Computes the dot product = x^T*y More...
 
void dyadic_vector_product (double *_A, const size_t _m, const size_t _n, const double _alpha, const double *const _x, const double *const _y)
 : Performs A = alpha*x*y^T More...
 
void inplace_qr (double *const _AtoQ, double *const _R, const size_t _m, const size_t _n)
 : Performs (AtoQ,R) = QR(AtoQ) More...
 
void inplace_rq (double *const _R, double *const _AtoQ, const size_t _m, const size_t _n)
 : Performs (R,AtoQ) = RQ(AtoQ) More...
 
void inverse (double *const _B, const double *const _A, const size_t _m, const size_t _n)
 : Performs B = A^-1 More...
 
static bool is_symmetric (const double *const _A, const size_t _n)
 
void matrix_matrix_product (double *const _C, const size_t _leftDim, const size_t _rightDim, const double _alpha, const double *const _A, const size_t _lda, const bool _transposeA, const size_t _middleDim, const double *const _B, const size_t _ldb, const bool _transposeB)
 : Performs the Matrix-Matrix product C = alpha*OP(A) * OP(B) More...
 
static XERUS_force_inline void matrix_matrix_product (double *const _C, const size_t _leftDim, const size_t _rightDim, const double _alpha, const double *const _A, const bool _transposeA, const size_t _middleDim, const double *const _B, const bool _transposeB)
 : Performs the Matrix-Matrix product C = alpha*OP(A) * OP(B) More...
 
void matrix_vector_product (double *const _x, const size_t _m, const double _alpha, const double *const _A, const size_t _n, const bool _transposed, const double *const _y)
 : Perfroms x = alpha*OP(A)*y More...
 
double one_norm (const double *const _x, const size_t _n)
 : Computes the one norm =||x||_1 More...
 
static bool pos_neg_definite_diagonal (const double *const _A, const size_t _n)
 checks whether the diagonal of _A is all positive or all negative. returns false otherwise More...
 
std::tuple< std::unique_ptr< double[]>, std::unique_ptr< double[]>, size_t > qc (const double *const _A, const size_t _m, const size_t _n)
 : splits A = Q*C, with _C an rxn matrix (where r is the rank of _A) and _Q orthogonal. More...
 
std::tuple< std::unique_ptr< double[]>, std::unique_ptr< double[]>, size_t > qc_destructive (double *const _A, const size_t _m, const size_t _n)
 : splits A = Q*C, with _C an rxn matrix (where r is the rank of _A) and _Q orthogonal. Destroys A. More...
 
void qr (double *const _Q, double *const _R, const double *const _A, const size_t _m, const size_t _n)
 : Performs (Q,R) = QR(A) More...
 
void qr_destructive (double *const _Q, double *const _R, double *const _A, const size_t _m, const size_t _n)
 : Performs (Q,R) = QR(A), destroys A in the process More...
 
void rq (double *const _R, double *const _Q, const double *const _A, const size_t _m, const size_t _n)
 : Performs (R,Q) = RQ(A) More...
 
void rq_destructive (double *const _R, double *const _Q, double *const _A, const size_t _m, const size_t _n)
 : Performs (R,Q) = RQ(A), destroys A in the process More...
 
void solve (double *_x, const double *_A, size_t _m, size_t _n, const double *_b, size_t _p)
 : Solves Ax = b for x More...
 
void solve_least_squares (double *const _x, const double *const _A, const size_t _m, const size_t _n, const double *const _b, const size_t _p)
 : Solves min ||Ax - b||_2 for x More...
 
void solve_least_squares_destructive (double *const _x, double *const _A, const size_t _m, const size_t _n, double *const _b, const size_t _p)
 : Solves min ||Ax - b||_2 for x More...
 
void svd (double *const _U, double *const _S, double *const _Vt, const double *const _A, const size_t _m, const size_t _n)
 : Performs (U,S,V) = SVD(A) More...
 
void svd_destructive (double *const _U, double *const _S, double *const _Vt, double *const _A, const size_t _m, const size_t _n)
 : Performs (U,S,V) = SVD(A). Destroys A. More...
 
double two_norm (const double *const _x, const size_t _n)
 : Computes the two norm =||x||_2 More...
 

Detailed Description

In this namespace the minimal wrappers for the BLAS and LAPACK functions are collected.

As an end user of xerus it should never be nessecary to call any of these functions, unless a seriously low level implementation of a critical part of an algorithm is required.

Function Documentation

◆ cq()

std::tuple< std::unique_ptr< double[]>, std::unique_ptr< double[]>, size_t > xerus::blasWrapper::cq ( const double *const  _A,
const size_t  _m,
const size_t  _n 
)

: splits A = C*Q, with _C an rxm matrix (where r is the rank of _A) and _Q orthogonal.

Definition at line 308 of file blasLapackWrapper.cpp.

◆ cq_destructive()

std::tuple< std::unique_ptr< double[]>, std::unique_ptr< double[]>, size_t > xerus::blasWrapper::cq_destructive ( double *const  _A,
const size_t  _m,
const size_t  _n 
)

: splits A = C*Q, with _C an rxm matrix (where r is the rank of _A) and _Q orthogonal. Destroys A.

Definition at line 317 of file blasLapackWrapper.cpp.

◆ dot_product()

double xerus::blasWrapper::dot_product ( const double *const  _x,
const size_t  _n,
const double *const  _y 
)

: Computes the dot product = x^T*y

Definition at line 100 of file blasLapackWrapper.cpp.

◆ dyadic_vector_product()

void xerus::blasWrapper::dyadic_vector_product ( double *  _A,
const size_t  _m,
const size_t  _n,
const double  _alpha,
const double *const  _x,
const double *const  _y 
)

: Performs A = alpha*x*y^T

Definition at line 132 of file blasLapackWrapper.cpp.

◆ inplace_qr()

void xerus::blasWrapper::inplace_qr ( double *const  _AtoQ,
double *const  _R,
const size_t  _m,
const size_t  _n 
)

: Performs (AtoQ,R) = QR(AtoQ)

Definition at line 383 of file blasLapackWrapper.cpp.

◆ inplace_rq()

void xerus::blasWrapper::inplace_rq ( double *const  _R,
double *const  _AtoQ,
const size_t  _m,
const size_t  _n 
)

: Performs (R,AtoQ) = RQ(AtoQ)

Definition at line 450 of file blasLapackWrapper.cpp.

◆ inverse()

void xerus::blasWrapper::inverse ( double *const  _B,
const double *const  _A,
const size_t  _m,
const size_t  _n 
)

: Performs B = A^-1

◆ is_symmetric()

static bool xerus::blasWrapper::is_symmetric ( const double *const  _A,
const size_t  _n 
)
static

Definition at line 501 of file blasLapackWrapper.cpp.

◆ matrix_matrix_product() [1/2]

void xerus::blasWrapper::matrix_matrix_product ( double *const  _C,
const size_t  _leftDim,
const size_t  _rightDim,
const double  _alpha,
const double *const  _A,
const size_t  _lda,
const bool  _transposeA,
const size_t  _middleDim,
const double *const  _B,
const size_t  _ldb,
const bool  _transposeB 
)

: Performs the Matrix-Matrix product C = alpha*OP(A) * OP(B)

Performs the Matrix-Matrix product c = a * b.

Definition at line 149 of file blasLapackWrapper.cpp.

◆ matrix_matrix_product() [2/2]

static XERUS_force_inline void xerus::blasWrapper::matrix_matrix_product ( double *const  _C,
const size_t  _leftDim,
const size_t  _rightDim,
const double  _alpha,
const double *const  _A,
const bool  _transposeA,
const size_t  _middleDim,
const double *const  _B,
const bool  _transposeB 
)
static

: Performs the Matrix-Matrix product C = alpha*OP(A) * OP(B)

Definition at line 74 of file blasLapackWrapper.h.

◆ matrix_vector_product()

void xerus::blasWrapper::matrix_vector_product ( double *const  _x,
const size_t  _m,
const double  _alpha,
const double *const  _A,
const size_t  _n,
const bool  _transposed,
const double *const  _y 
)

: Perfroms x = alpha*OP(A)*y

Definition at line 115 of file blasLapackWrapper.cpp.

◆ one_norm()

double xerus::blasWrapper::one_norm ( const double *const  _x,
const size_t  _n 
)

: Computes the one norm =||x||_1

Definition at line 76 of file blasLapackWrapper.cpp.

◆ pos_neg_definite_diagonal()

static bool xerus::blasWrapper::pos_neg_definite_diagonal ( const double *const  _A,
const size_t  _n 
)
static

checks whether the diagonal of _A is all positive or all negative. returns false otherwise

Definition at line 519 of file blasLapackWrapper.cpp.

◆ qc()

std::tuple< std::unique_ptr< double[]>, std::unique_ptr< double[]>, size_t > xerus::blasWrapper::qc ( const double *const  _A,
const size_t  _m,
const size_t  _n 
)

: splits A = Q*C, with _C an rxn matrix (where r is the rank of _A) and _Q orthogonal.

Definition at line 235 of file blasLapackWrapper.cpp.

◆ qc_destructive()

std::tuple< std::unique_ptr< double[]>, std::unique_ptr< double[]>, size_t > xerus::blasWrapper::qc_destructive ( double *const  _A,
const size_t  _m,
const size_t  _n 
)

: splits A = Q*C, with _C an rxn matrix (where r is the rank of _A) and _Q orthogonal. Destroys A.

Definition at line 243 of file blasLapackWrapper.cpp.

◆ qr()

void xerus::blasWrapper::qr ( double *const  _Q,
double *const  _R,
const double *const  _A,
const size_t  _m,
const size_t  _n 
)

: Performs (Q,R) = QR(A)

Definition at line 374 of file blasLapackWrapper.cpp.

◆ qr_destructive()

void xerus::blasWrapper::qr_destructive ( double *const  _Q,
double *const  _R,
double *const  _A,
const size_t  _m,
const size_t  _n 
)

: Performs (Q,R) = QR(A), destroys A in the process

Definition at line 388 of file blasLapackWrapper.cpp.

◆ rq()

void xerus::blasWrapper::rq ( double *const  _R,
double *const  _Q,
const double *const  _A,
const size_t  _m,
const size_t  _n 
)

: Performs (R,Q) = RQ(A)

Definition at line 441 of file blasLapackWrapper.cpp.

◆ rq_destructive()

void xerus::blasWrapper::rq_destructive ( double *const  _R,
double *const  _Q,
double *const  _A,
const size_t  _m,
const size_t  _n 
)

: Performs (R,Q) = RQ(A), destroys A in the process

Definition at line 455 of file blasLapackWrapper.cpp.

◆ solve()

void xerus::blasWrapper::solve ( double *const  _x,
const double *const  _A,
const size_t  _m,
const size_t  _n,
const double *const  _b,
const size_t  _nrhs 
)

: Solves Ax = b for x

Solves Ax = b for x order of checks and solvers inspired by matlabs mldivide https://de.mathworks.com/help/matlab/ref/mldivide.html

Definition at line 542 of file blasLapackWrapper.cpp.

◆ solve_least_squares()

void xerus::blasWrapper::solve_least_squares ( double *const  _x,
const double *const  _A,
const size_t  _m,
const size_t  _n,
const double *const  _b,
const size_t  _p 
)

: Solves min ||Ax - b||_2 for x

Definition at line 654 of file blasLapackWrapper.cpp.

◆ solve_least_squares_destructive()

void xerus::blasWrapper::solve_least_squares_destructive ( double *const  _x,
double *const  _A,
const size_t  _m,
const size_t  _n,
double *const  _b,
const size_t  _p 
)

: Solves min ||Ax - b||_2 for x

Definition at line 665 of file blasLapackWrapper.cpp.

◆ svd()

void xerus::blasWrapper::svd ( double *const  _U,
double *const  _S,
double *const  _Vt,
const double *const  _A,
const size_t  _m,
const size_t  _n 
)

: Performs (U,S,V) = SVD(A)

Definition at line 201 of file blasLapackWrapper.cpp.

◆ svd_destructive()

void xerus::blasWrapper::svd_destructive ( double *const  _U,
double *const  _S,
double *const  _Vt,
double *const  _A,
const size_t  _m,
const size_t  _n 
)

: Performs (U,S,V) = SVD(A). Destroys A.

Definition at line 210 of file blasLapackWrapper.cpp.

◆ two_norm()

double xerus::blasWrapper::two_norm ( const double *const  _x,
const size_t  _n 
)

: Computes the two norm =||x||_2

Definition at line 88 of file blasLapackWrapper.cpp.