Linear algebra helper functions. More...
Functions | |
double | xAx_symmetric (const Eigen::MatrixXd &A, Eigen::Ref< const Eigen::VectorXd > x) |
Calculates x^T A x for a symmetric matrix A. More... | |
void | xxT (const Eigen::VectorXd &x, Eigen::MatrixXd &dest) |
Calculates x * x^T and places it in dest. More... | |
void | add_a_xxT (const Eigen::VectorXd &x, Eigen::MatrixXd &dest, double a) |
Adds a * x * x^T to A. More... | |
Linear algebra helper functions.
double ml::LinearAlgebra::xAx_symmetric | ( | const Eigen::MatrixXd & | A, |
Eigen::Ref< const Eigen::VectorXd > | x | ||
) |
Calculates x^T A x for a symmetric matrix A.
A | Symmetric square matrix. |
x | Vector. |
std::invalid_argument | If A is not square or x.size() != A.rows() . |
void ml::LinearAlgebra::xxT | ( | const Eigen::VectorXd & | x, |
Eigen::MatrixXd & | dest | ||
) |
Calculates x * x^T and places it in dest.
[in] | x | Vector of length N. |
[out] | dest | Output matrix, resized if necessary. Assumed to be non-aliasing with x . |
void ml::LinearAlgebra::add_a_xxT | ( | const Eigen::VectorXd & | x, |
Eigen::MatrixXd & | dest, | ||
double | a | ||
) |
Adds a * x * x^T to A.
[in] | x | Vector of length N. |
[out] | A | Existing N x N matrix. |
std::invalid_argument | If A is not square or x.size() != A.rows() . |