Factorization

This section regroups all of the linear algebra functions concerning factorization which are currently implemented within castor. In order to access these functions, the user must include castor/linalg.hpp. Two levels of interface are available. The high-level interface provides functions with simplified arguments while the low-level interface is much closer to the BLAS/LAPACK API.

Some examples of use may also be found at Linear algebra.

aca

Warning

doxygenfunction: Unable to resolve function “aca” with arguments (matrix<T> const&, matrix<T> const&, double, std::size_t) in doxygen xml output for project “castor” from directory: ../xml. Potential matches:

- auto aca(matrix<std::size_t> I, matrix<std::size_t> J, std::function<matrix<double>(matrix<std::size_t>, matrix<std::size_t>)> const &fct, double tol = 1e-6, std::size_t rmax = 1e6, bool acaplus = true)
- auto aca(matrix<std::size_t> I, matrix<std::size_t> J, std::function<matrix<std::complex<double>>(matrix<std::size_t>, matrix<std::size_t>)> const &fct, double tol = 1e-6, std::size_t rmax = 1e6, bool acaplus = true)
- template<typename T> auto aca(matrix<T> const &A, matrix<T> const &B, double tol = 1e-6, std::size_t rmax = 1e6, bool acaplus = true)
- template<typename T> auto aca(matrix<T> const &M, double tol = 1e-6, std::size_t rmax = 1e6, bool acaplus = true)

Warning

doxygenfunction: Unable to resolve function “aca” with arguments (matrix<T> const&, double, std::size_t) in doxygen xml output for project “castor” from directory: ../xml. Potential matches:

- auto aca(matrix<std::size_t> I, matrix<std::size_t> J, std::function<matrix<double>(matrix<std::size_t>, matrix<std::size_t>)> const &fct, double tol = 1e-6, std::size_t rmax = 1e6, bool acaplus = true)
- auto aca(matrix<std::size_t> I, matrix<std::size_t> J, std::function<matrix<std::complex<double>>(matrix<std::size_t>, matrix<std::size_t>)> const &fct, double tol = 1e-6, std::size_t rmax = 1e6, bool acaplus = true)
- template<typename T> auto aca(matrix<T> const &A, matrix<T> const &B, double tol = 1e-6, std::size_t rmax = 1e6, bool acaplus = true)
- template<typename T> auto aca(matrix<T> const &M, double tol = 1e-6, std::size_t rmax = 1e6, bool acaplus = true)

Warning

doxygenfunction: Unable to resolve function “aca” with arguments (matrix<std::size_t>, matrix<std::size_t>, std::function<matrix<std::complex<double>>(matrix<std::size_t>, matrix<std::size_t>)> const&, double, std::size_t) in doxygen xml output for project “castor” from directory: ../xml. Potential matches:

- auto aca(matrix<std::size_t> I, matrix<std::size_t> J, std::function<matrix<double>(matrix<std::size_t>, matrix<std::size_t>)> const &fct, double tol = 1e-6, std::size_t rmax = 1e6, bool acaplus = true)
- auto aca(matrix<std::size_t> I, matrix<std::size_t> J, std::function<matrix<std::complex<double>>(matrix<std::size_t>, matrix<std::size_t>)> const &fct, double tol = 1e-6, std::size_t rmax = 1e6, bool acaplus = true)
- template<typename T> auto aca(matrix<T> const &A, matrix<T> const &B, double tol = 1e-6, std::size_t rmax = 1e6, bool acaplus = true)
- template<typename T> auto aca(matrix<T> const &M, double tol = 1e-6, std::size_t rmax = 1e6, bool acaplus = true)

Warning

doxygenfunction: Unable to resolve function “aca” with arguments (matrix<std::size_t>, matrix<std::size_t>, std::function<matrix<double>(matrix<std::size_t>, matrix<std::size_t>)> const&, double, std::size_t) in doxygen xml output for project “castor” from directory: ../xml. Potential matches:

- auto aca(matrix<std::size_t> I, matrix<std::size_t> J, std::function<matrix<double>(matrix<std::size_t>, matrix<std::size_t>)> const &fct, double tol = 1e-6, std::size_t rmax = 1e6, bool acaplus = true)
- auto aca(matrix<std::size_t> I, matrix<std::size_t> J, std::function<matrix<std::complex<double>>(matrix<std::size_t>, matrix<std::size_t>)> const &fct, double tol = 1e-6, std::size_t rmax = 1e6, bool acaplus = true)
- template<typename T> auto aca(matrix<T> const &A, matrix<T> const &B, double tol = 1e-6, std::size_t rmax = 1e6, bool acaplus = true)
- template<typename T> auto aca(matrix<T> const &M, double tol = 1e-6, std::size_t rmax = 1e6, bool acaplus = true)

See svd, rank.

lu

auto castor::lu(matrix<std::complex<double>> const &A)
auto castor::lu(matrix<double> const &A)
auto castor::lu(matrix<std::complex<float>> const &A)
auto castor::lu(matrix<float> const &A)

LU factorization.

[L,U] = lu(A) returns an upper triangular matrix in U and a permuted lower triangular matrix in L, such that A = L*U. The input matrix A can be rectangular.

matrix<> A = rand(3,4);
matrix<> L, U;
std::tie(L,U) = lu(A);
disp(mtimes(L,U)-A);

See qr, linsolve, inv.

qr

auto castor::qr(matrix<std::complex<double>> const &A)
auto castor::qr(matrix<double> const &A)
auto castor::qr(matrix<std::complex<float>> const &A)
auto castor::qr(matrix<float> const &A)

Orthogonal-triangular decomposition.

[Q,R] = qr(A), where A is m-by-n, produces an l-by-n upper triangular matrix R and an m-by-l unitary matrix Q so that A = Q*R.

matrix<> A = rand(4,3);
matrix<> Q, R;
std::tie(Q,R) = qr(A);
disp(mtimes(Q,R)-A);

See eig, svd, lu.