Enumerations
o2scl_cblas Namespace Reference

Namespace for O2scl CBLAS function templates. More...

Enumerations

enum  o2cblas_order { o2cblas_RowMajor =101, o2cblas_ColMajor =102 }
 Matrix order, either column-major or row-major.
 
enum  o2cblas_transpose { o2cblas_NoTrans =111, o2cblas_Trans =112, o2cblas_ConjTrans =113 }
 Transpose operations.
 
enum  o2cblas_uplo { o2cblas_Upper =121, o2cblas_Lower =122 }
 Upper- or lower-triangular.
 
enum  o2cblas_diag { o2cblas_NonUnit =131, o2cblas_Unit =132 }
 Unit or generic diagonal.
 
enum  o2cblas_side { o2cblas_Left =141, o2cblas_Right =142 }
 Left or right sided operation.
 

Functions

Level-1 BLAS functions
template<class vec_t >
double dasum (const size_t N, const vec_t &X)
 Compute the absolute sum of vector elements. More...
 
template<class vec_t , class vec2_t >
void daxpy (const double alpha, const size_t N, const vec_t &X, vec2_t &Y)
 Compute $ y= \alpha x+y $. More...
 
template<class vec_t , class vec2_t >
double ddot (const size_t N, const vec_t &X, const vec2_t &Y)
 Compute $ r=x \cdot y $.
 
template<class vec_t >
double dnrm2 (const size_t N, const vec_t &X)
 Compute the norm of the vector X. More...
 
template<class vec_t >
void dscal (const double alpha, const size_t N, vec_t &X)
 Compute $ x=\alpha x $.
 
Level-2 BLAS functions
template<class mat_t , class vec_t , class vec2_t >
void dgemv (const enum o2cblas_order order, const enum o2cblas_transpose TransA, const size_t M, const size_t N, const double alpha, const mat_t &A, const vec_t &X, const double beta, vec2_t &Y)
 Compute $ y=\alpha \left[\mathrm{op}(A)\right] x+ \beta y $. More...
 
template<class mat_t , class vec_t >
void dtrsv (const enum o2cblas_order order, const enum o2cblas_uplo Uplo, const enum o2cblas_transpose TransA, const enum o2cblas_diag Diag, const size_t M, const size_t N, const mat_t &A, vec_t &X)
 Compute $ x=\mathrm{op} (A)^{-1} x $. More...
 
template<class mat_t , class vec_t >
void dtrmv (const enum o2cblas_order Order, const enum o2cblas_uplo Uplo, const enum o2cblas_transpose TransA, const enum o2cblas_diag Diag, const size_t N, const mat_t &A, vec_t &x)
 Compute $ x=op(A) x $ for the triangular matrix A.
 
Level-3 BLAS functions
template<class mat_t >
void dgemm (const enum o2cblas_order Order, const enum o2cblas_transpose TransA, const enum o2cblas_transpose TransB, const size_t M, const size_t N, const size_t K, const double alpha, const mat_t &A, const mat_t &B, const double beta, mat_t &C)
 Compute $ y=\alpha \mathrm{op}(A) \mathrm{op}(B) + \beta C $.
 
Helper BLAS functions - Subvectors
template<class vec_t , class vec2_t >
void daxpy_subvec (const double alpha, const size_t N, const vec_t &X, vec2_t &Y, const size_t ie)
 Compute $ y=\alpha x+y $ beginning with index ie and ending with index N-1. More...
 
template<class vec_t , class vec2_t >
double ddot_subvec (const size_t N, const vec_t &X, const vec2_t &Y, const size_t ie)
 Compute $ r=x \cdot y $ beginning with index ie and ending with index N-1. More...
 
template<class vec_t >
double dnrm2_subvec (const size_t N, const vec_t &X, const size_t ie)
 Compute the norm of the vector X beginning with index ie and ending with index N-1. More...
 
template<class vec_t >
void dscal_subvec (const double alpha, const size_t N, vec_t &X, const size_t ie)
 Compute $ x=\alpha x $ beginning with index ie and ending with index N-1. More...
 
Helper BLAS functions - Subcolums of a matrix
template<class mat_t , class vec_t >
void daxpy_subcol (const double alpha, const size_t M, const mat_t &X, const size_t ir, const size_t ic, vec_t &y)
 Compute $ y=\alpha x+y $ for a subcolumn of a matrix. More...
 
template<class mat_t , class vec_t >
double ddot_subcol (const size_t M, const mat_t &X, const size_t ir, const size_t ic, const vec_t &y)
 Compute $ r=x \cdot y $ for a subcolumn of a matrix. More...
 
template<class mat_t >
double dnrm2_subcol (const mat_t &A, const size_t ir, const size_t ic, const size_t M)
 Compute the norm of a subcolumn of a matrix. More...
 
template<class mat_t >
void dscal_subcol (mat_t &A, const size_t ir, const size_t ic, const size_t M, const double alpha)
 Compute $ x=\alpha x $ for a subcolumn of a matrix. More...
 
template<class mat_t >
double dasum_subcol (mat_t &A, const size_t ir, const size_t ic, const size_t M)
 Compute $ x=\alpha x $ for a subcolumn of a matrix. More...
 
Helper BLAS functions - Subrows of a matrix
template<class mat_t , class vec_t >
void daxpy_subrow (const double alpha, const size_t N, const mat_t &X, const size_t ir, const size_t ic, vec_t &Y)
 Compute $ y=\alpha x+y $ for a subrow of a matrix. More...
 
template<class mat_t , class vec_t >
double ddot_subrow (const size_t N, const mat_t &X, const size_t ir, const size_t ic, const vec_t &Y)
 Compute $ r=x \cdot y $ for a subrow of a matrix. More...
 
template<class mat_t >
double dnrm2_subrow (const mat_t &M, const size_t ir, const size_t ic, const size_t N)
 Compute the norm of a subrow of a matrix. More...
 
template<class mat_t >
void dscal_subrow (mat_t &A, const size_t ir, const size_t ic, const size_t N, const double alpha)
 Compute $ x=\alpha x $ for a subrow of a matrix. More...
 

Detailed Description

These functions are only intended as a fallback for situations where an optimized BLAS is not available.

Level-1 BLAS functions

Some functionality which would otherwise appear here is already given in vector.h.

Level-2 BLAS functions

Currently only dgemv(), dtrmv(), and dtrsv() are implemented.

Level-3 BLAS functions

Currently only dgemm() is implemented.

Helper BLAS functions

There are several basic BLAS functions which are helpful to operate on only a part of a vector or matrix to ensure that the linear algebra routines are flexible with the types that they can handle.

The subvector functions operate only one set of adjacent vector elements. For a vector defined by with

\[ {\vec x} = \left( \begin{array}{c} x_0 \\ x_1 \\ . \\ . \\ x_{\mathrm{ie}} \\ x_{\mathrm{ie}+1} \\ . \\ . \\ x_{\mathrm{N}-1} \\ x_{\mathrm{N}} \\ x_{\mathrm{N}+1} \\ . \\ . \end{array} \right) \]

the functions with suffix subvec operate only on elements from $ x_{\mathrm{ie}} $ to $ x_{\mathrm{N}-1} $ (inclusive).

The subcolumn functions operate only on a part of a column of a matrix. For a matrix defined by

\[ m = \left( \begin{array}{ccccccc} m_{0,0} & m_{0,1} & . & . & m_{0,\mathrm{ic}} & . & . \\ m_{1,0} & m_{1,1} & . & . & m_{1,\mathrm{ic}} & . & . \\ . & . & . & . & . & . & . \\ . & . & . & . & m_{\mathrm{ir},\mathrm{ic}} & . & . \\ . & . & . & . & m_{\mathrm{ir}+1,\mathrm{ic}} & . & . \\ . & . & . & . & . & . & . \\ . & . & . & . & . & . & . \\ . & . & . & . & m_{\mathrm{N}-1,\mathrm{ic}} & . & . \\ . & . & . & . & m_{\mathrm{N},\mathrm{ic}} & . & . \\ . & . & . & . & m_{\mathrm{N}+1,\mathrm{ic}} & . & . \\ . & . & . & . & . & . & . \\ \end{array} \right) \]

the functions with suffix subcol operate only on elements in the column from $ m_{\mathrm{ir},\mathrm{ic}} $ to $ m_{\mathrm{N}-1,\mathrm{ic}} $ inclusive.

The subrow functions operate only on a part of a row of a matrix. For a matrix defined by

\[ m = \left( \begin{array}{ccccccccccc} m_{0,0} & m_{0,1} & . & . & . & . & . & . & . & . & . \\ m_{1,0} & m_{1,1} & . & . & . & . & . & . & . & . & . \\ . & . & . & . & . & . & . & . & . & . & . \\ . & . & . & . & . & . & . & . & . & . & . \\ m_{\mathrm{ir},0} & . & . & m_{\mathrm{ir},\mathrm{ic}} & m_{\mathrm{ir},\mathrm{ic}+1} & . & . & m_{\mathrm{ir},\mathrm{N}-1} & m_{\mathrm{ir},\mathrm{N}} & m_{\mathrm{ir},\mathrm{N}+1} & . \\ . & . & . & . & . & . & . & . & . & . & . \\ \end{array} \right) \]

the functions with suffix subrow operate only on elements in the column from $ m_{\mathrm{ir},\mathrm{ic}} $ to $ m_{\mathrm{ir},\mathrm{N}-1} $ inclusive.

This namespace is documented inside src/linalg/cblas.h.

Function Documentation

◆ dasum()

template<class vec_t >
double o2scl_cblas::dasum ( const size_t  N,
const vec_t &  X 
)

If alpha is zero, this function returns and performs no computations.

Definition at line 84 of file cblas_base.h.

◆ dasum_subcol()

template<class mat_t >
double o2scl_cblas::dasum_subcol ( mat_t &  A,
const size_t  ir,
const size_t  ic,
const size_t  M 
)

Given the matrix A, define the vector x as the column with index ic. This function computes $ x= \alpha x $ for elements in the vectors x from row ir to row M-1 (inclusive). All other elements in x are not referenced.

Used in householder_transform_subcol().

Definition at line 1131 of file cblas_base.h.

◆ daxpy()

template<class vec_t , class vec2_t >
void o2scl_cblas::daxpy ( const double  alpha,
const size_t  N,
const vec_t &  X,
vec2_t &  Y 
)

If alpha is zero, this function returns and performs no computations.

Definition at line 98 of file cblas_base.h.

◆ daxpy_subcol()

template<class mat_t , class vec_t >
void o2scl_cblas::daxpy_subcol ( const double  alpha,
const size_t  M,
const mat_t &  X,
const size_t  ir,
const size_t  ic,
vec_t &  y 
)

Given the matrix X, define the vector x as the column with index ic. This function computes $ y=\alpha x+y $ for elements in the vectors x and y from row ir to row M-1 (inclusive). All other elements in x and y are not referenced.

Used in householder_hv_sub().

Definition at line 959 of file cblas_base.h.

◆ daxpy_subrow()

template<class mat_t , class vec_t >
void o2scl_cblas::daxpy_subrow ( const double  alpha,
const size_t  N,
const mat_t &  X,
const size_t  ir,
const size_t  ic,
vec_t &  Y 
)

Given the matrix X, define the vector x as the row with index ir. This function computes $ y=\alpha x+y $ for elements in the vectors x from column ic to column N-1 (inclusive). All other elements in x and y are not referenced.

If ic is greater than N-1 then the error handler will be called if O2SCL_NO_RANGE_CHECK is not defined.

Used in householder_hv_sub().

Definition at line 1177 of file cblas_base.h.

◆ daxpy_subvec()

template<class vec_t , class vec2_t >
void o2scl_cblas::daxpy_subvec ( const double  alpha,
const size_t  N,
const vec_t &  X,
vec2_t &  Y,
const size_t  ie 
)

This function is used in householder_hv().

If alpha is identical with zero or N==ie, this function will perform no calculations and return without calling the error handler.

If ie is greater than N-1 then the error handler will be called if O2SCL_NO_RANGE_CHECK is not defined.

Definition at line 797 of file cblas_base.h.

◆ ddot_subcol()

template<class mat_t , class vec_t >
double o2scl_cblas::ddot_subcol ( const size_t  M,
const mat_t &  X,
const size_t  ir,
const size_t  ic,
const vec_t &  y 
)

Given the matrix X, define the vector x as the column with index ic. This function computes $ r=x \cdot y $ for elements in the vectors x and y from row ir to row M-1 (inclusive). All other elements in x and y are not referenced.

Used in householder_hv_sub().

Definition at line 1001 of file cblas_base.h.

◆ ddot_subrow()

template<class mat_t , class vec_t >
double o2scl_cblas::ddot_subrow ( const size_t  N,
const mat_t &  X,
const size_t  ir,
const size_t  ic,
const vec_t &  Y 
)

Given the matrix X, define the vector x as the row with index ir. This function computes $ r=x \cdot y $ for elements in the vectors x from column ic to column N-1 (inclusive). All other elements in x and y are not referenced.

If ic is greater than N-1 then the error handler will be called if O2SCL_NO_RANGE_CHECK is not defined.

Used in householder_hv_sub().

Definition at line 1223 of file cblas_base.h.

◆ ddot_subvec()

template<class vec_t , class vec2_t >
double o2scl_cblas::ddot_subvec ( const size_t  N,
const vec_t &  X,
const vec2_t &  Y,
const size_t  ie 
)

This function is used in householder_hv().

If ie is greater than N-1 then the error handler will be called if O2SCL_NO_RANGE_CHECK is not defined.

Definition at line 834 of file cblas_base.h.

◆ dgemv()

template<class mat_t , class vec_t , class vec2_t >
void o2scl_cblas::dgemv ( const enum o2cblas_order  order,
const enum o2cblas_transpose  TransA,
const size_t  M,
const size_t  N,
const double  alpha,
const mat_t &  A,
const vec_t &  X,
const double  beta,
vec2_t &  Y 
)

If M or N is zero, or if alpha is zero and beta is one, this function performs no calculations and returns without calling the error handler.

Definition at line 218 of file cblas_base.h.

◆ dnrm2()

template<class vec_t >
double o2scl_cblas::dnrm2 ( const size_t  N,
const vec_t &  X 
)
Note
The suffix "2" on the function name indicates that this computes the "2-norm", not that the norm is squared.

If N is less than or equal to zero, this function returns zero without calling the error handler.

This function works only with vectors which hold double. For the norm of a general floating point vector, see vector_norm().

Definition at line 156 of file cblas_base.h.

◆ dnrm2_subcol()

template<class mat_t >
double o2scl_cblas::dnrm2_subcol ( const mat_t &  A,
const size_t  ir,
const size_t  ic,
const size_t  M 
)

Given the matrix A, define the vector x as the column with index ic. This function computes the norm of the part of x from row ir to row M-1 (inclusive). All other elements in x are not referenced.

if M is zero, then this function silently returns zero without calling the error handler.

This function is used in householder_transform_subcol().

Note
The suffix "2" on the function name indicates that this computes the "2-norm", not that the norm is squared.

Definition at line 1044 of file cblas_base.h.

◆ dnrm2_subrow()

template<class mat_t >
double o2scl_cblas::dnrm2_subrow ( const mat_t &  M,
const size_t  ir,
const size_t  ic,
const size_t  N 
)

Given the matrix X, define the vector x as the row with index ir. This function computes the norm of the part of x from column ic to column N-1 (inclusive). All other elements in x are not referenced.

Note
The suffix "2" on the function name indicates that this computes the "2-norm", not that the norm is squared.

Definition at line 1262 of file cblas_base.h.

◆ dnrm2_subvec()

template<class vec_t >
double o2scl_cblas::dnrm2_subvec ( const size_t  N,
const vec_t &  X,
const size_t  ie 
)

Used in householder_transform().

Note
The suffix "2" on the function name indicates that this computes the "2-norm", not that the norm is squared.

If ie is greater than N-1 then the error handler will be called if O2SCL_NO_RANGE_CHECK is not defined.

Definition at line 875 of file cblas_base.h.

◆ dscal_subcol()

template<class mat_t >
void o2scl_cblas::dscal_subcol ( mat_t &  A,
const size_t  ir,
const size_t  ic,
const size_t  M,
const double  alpha 
)

Given the matrix A, define the vector x as the column with index ic. This function computes $ x= \alpha x $ for elements in the vectors x from row ir to row M-1 (inclusive). All other elements in x are not referenced.

Used in householder_transform_subcol().

Definition at line 1093 of file cblas_base.h.

◆ dscal_subrow()

template<class mat_t >
void o2scl_cblas::dscal_subrow ( mat_t &  A,
const size_t  ir,
const size_t  ic,
const size_t  N,
const double  alpha 
)

Given the matrix A, define the vector x as the row with index ir. This function computes $ x = \alpha x $ for elements in the vectors x from column ic to column N-1 (inclusive). All other elements in x and y are not referenced.

If ic is greater than N-1 then the error handler will be called if O2SCL_NO_RANGE_CHECK is not defined.

Definition at line 1305 of file cblas_base.h.

◆ dscal_subvec()

template<class vec_t >
void o2scl_cblas::dscal_subvec ( const double  alpha,
const size_t  N,
vec_t &  X,
const size_t  ie 
)

This function is used in householder_transform().

If ie is greater than N-1 then the error handler will be called if O2SCL_NO_RANGE_CHECK is not defined.

Definition at line 920 of file cblas_base.h.

◆ dtrsv()

template<class mat_t , class vec_t >
void o2scl_cblas::dtrsv ( const enum o2cblas_order  order,
const enum o2cblas_uplo  Uplo,
const enum o2cblas_transpose  TransA,
const enum o2cblas_diag  Diag,
const size_t  M,
const size_t  N,
const mat_t &  A,
vec_t &  X 
)

If N is zero, this function does nothing and returns zero.

Definition at line 308 of file cblas_base.h.

Documentation generated with Doxygen. Provided under the GNU Free Documentation License (see License Information).