Linear Algebra¶
Linear algebra contents¶
Linear algebra introduction¶
O₂scl contains a small set of linear algebra routines but is also is designed to be used with Armadillo and/or Eigen, both of which are high performance C++ linear algebra libraries. In the case that O₂scl was compiled with support for either the Armadillo or Eigen libraries, some O₂scl template functions are overloaded with the respective Armadillo or Eigen versions.
The fallback O₂scl linear algebra routines offer a more generic and
flexible interface: they work for almost all vector and matrix types.
For matrix types which use operator(,)
, the linear algebra
routines routines are inside the o2scl_linalg
namespaces. For
matrix types using operator[][]
, the linear algebra routines are
inside the o2scl_linalg_bracket
namespace.
The linear algebra classes and functions include:
Householder transformations,
src/linalg/householder.h
Householder solver,
src/linalg/hh.h
LU decomposition and solver,
src/linalg/lu.h
Cholesky decomposition,
src/linalg/cholesky.h
QR decomposition,
src/linalg/qr.h
o2scl_linalg::QR_decomp_unpack()
(there is also an Eigen specialization with the same class name)
QR solver,
src/linalg/qrpt.h
Solve tridiagonal systems,
src/linalg/tridiag.h
Givens rotations,
src/linalg/givens.h
Bidiagonalizations,
src/linalg/bidiag.h
Singular value decompositions (experimental),
src/linalg/svd.h
Singular value decompositions step (experimental),
src/linalg/svdstep.h
Lanczos diagonalization,
src/linalg/lanczos.h
o2scl_linalg::lanczos
(largest eigenvalues of a symmetric matrix)
Linear solvers (
o2scl_linalg
only),src/linalg/linear_solver.h
o2scl_linalg::linear_solver_LU
(by LU decomposition)o2scl_linalg::linear_solver_QR
(by QR decomposition)o2scl_linalg::linear_solver_HH
(using Householder transformations)
Armadillo linear solver wrapper (
o2scl_linalg
only),src/linalg/linear_solver.h
Eigen linear solver wrappers (
o2scl_linalg
only),src/linalg/linear_solver.h
Matrix inversion interface (
o2scl_linalg
only),src/linalg/invert.h
o2scl_linalg::matrix_invert_det_LU
(inversion using LU decomposition)o2scl_linalg::matrix_invert_det_cholesky
(inversion of positive symmetric matrices using the Cholesky decomposition)o2scl_linalg::matrix_invert_det_arma
(Armadillo wrapper)o2scl_linalg::matrix_invert_det_sympd_arma
(Armadillo wrapper for positive symmetric matrices)o2scl_linalg::matrix_invert_det_eigen
(Eigen wrapper)o2scl_linalg::matrix_invert_det_eigen_decomp
(Eigen wrapper allowing specification of the decomposition)
BLAS functions¶
The fallback O₂scl BLAS routines work for almost all vector and matrix
types. They also support any floating point type, so long as the
vector and matrix types are built on the same floating point type.
Specializations for double-precision numbers are preceded by the
letter d
.
Similar to the linear algebra functions described above, BLAS
functions for matrix types using operator(,)
are inside the
o2scl_cblas
. For matrix types using operator[][]
, the BLAS
functions are in the o2scl_cblas_bracket
namespace.
Level 1
Level 2
Level 3
Level 1 helper functions – subvectors
Level 1 helper functions – matrix subcolumns
Level 1 helper functions – matrix subrows
Linear algebra enums¶
-
enum o2scl_cblas::o2cblas_order¶
Matrix order, either column-major or row-major.
Values:
-
enumerator o2cblas_RowMajor¶
-
enumerator o2cblas_ColMajor¶
-
enumerator o2cblas_RowMajor¶
-
enum o2scl_cblas::o2cblas_transpose¶
Transpose operations.
Values:
-
enumerator o2cblas_NoTrans¶
-
enumerator o2cblas_Trans¶
-
enumerator o2cblas_ConjTrans¶
-
enumerator o2cblas_NoTrans¶
-
enum o2scl_cblas::o2cblas_uplo¶
Upper- or lower-triangular.
Values:
-
enumerator o2cblas_Upper¶
-
enumerator o2cblas_Lower¶
-
enumerator o2cblas_Upper¶