|
CASM
AClustersApproachtoStatisticalMechanics
|
Linear algebra routines.
Namespaces | |
| CASM::normal_form_impl | |
Functions | |
| void | CASM::get_Hermitian (Eigen::MatrixXcd &original_mat, Eigen::MatrixXcd &hermitian_mat, Eigen::MatrixXcd &antihermitian_mat) |
| bool | CASM::is_Hermitian (Eigen::MatrixXcd &mat) |
| void | CASM::poly_fit (Eigen::VectorXcd &xvec, Eigen::VectorXcd &yvec, Eigen::VectorXcd &coeffs, int degree) |
| std::pair< Eigen::MatrixXi, Eigen::MatrixXi > | CASM::hermite_normal_form (const Eigen::MatrixXi &M) |
| Return the hermite normal form, M == H*V. More... | |
| double | CASM::angle (const Eigen::Ref< const Eigen::Vector3d > &a, const Eigen::Ref< const Eigen::Vector3d > &b) |
| Get angle, in radians, between two vectors on range [0,pi]. More... | |
| double | CASM::signed_angle (const Eigen::Ref< const Eigen::Vector3d > &a, const Eigen::Ref< const Eigen::Vector3d > &b, const Eigen::Ref< const Eigen::Vector3d > &pos_ref) |
| signed angle, in radians, between -pi and pi that describe separation in direction of two vectors More... | |
| Eigen::MatrixXd | CASM::pretty (const Eigen::MatrixXd &M, double tol) |
| Round entries that are within tol of being integer to that integer value. More... | |
| template<typename Derived > | |
| Derived::Scalar | CASM::triple_prod (const Derived &vec0, const Derived &vec1, const Derived &vec2) |
| template<typename Derived > | |
| bool | CASM::is_integer (const Eigen::MatrixBase< Derived > &M, double tol) |
| Check if Eigen::Matrix is integer. More... | |
| template<typename Derived > | |
| bool | CASM::is_unimodular (const Eigen::MatrixBase< Derived > &M, double tol) |
| Check if Eigen::Matrix is unimodular. More... | |
| template<typename Derived > | |
| bool | CASM::is_diagonal (const Eigen::MatrixBase< Derived > &M, double tol=TOL) |
| Check if Eigen::Matrix is diagonal. More... | |
| template<typename Derived > | |
| Eigen::CwiseUnaryOp< decltype(std::ptr_fun(boost::math::iround < typename Derived::Scalar > )), const Derived > | CASM::iround (const Eigen::MatrixBase< Derived > &val) |
| Round Eigen::MatrixXd to Eigen::MatrixXi. More... | |
| template<typename Derived > | |
| Eigen::CwiseUnaryOp< decltype(std::ptr_fun(boost::math::lround < typename Derived::Scalar > )), const Derived > | CASM::lround (const Eigen::MatrixBase< Derived > &val) |
| Round Eigen::MatrixXd to Eigen::MatrixXl. More... | |
| template<typename Derived > | |
| Derived::Scalar | CASM::matrix_minor (const Eigen::MatrixBase< Derived > &M, int row, int col) |
| Return the minor of integer Matrix M element row, col. More... | |
| template<typename Derived > | |
| Eigen::Matrix< typename Derived::Scalar, Derived::RowsAtCompileTime, Derived::ColsAtCompileTime > | CASM::cofactor (const Eigen::MatrixBase< Derived > &M) |
| Return cofactor matrix. More... | |
| template<typename Derived > | |
| Eigen::Matrix< typename Derived::Scalar, Derived::RowsAtCompileTime, Derived::ColsAtCompileTime > | CASM::adjugate (const Eigen::MatrixBase< Derived > &M) |
| Return adjugate matrix. More... | |
| template<typename Derived > | |
| Eigen::Matrix< typename Derived::Scalar, Derived::RowsAtCompileTime, Derived::ColsAtCompileTime > | CASM::inverse (const Eigen::MatrixBase< Derived > &M) |
| Return the integer inverse matrix of an invertible integer matrix. More... | |
| template<typename DerivedIn , typename DerivedOut > | |
| void | CASM::smith_normal_form (const Eigen::MatrixBase< DerivedIn > &M, Eigen::MatrixBase< DerivedOut > &U, Eigen::MatrixBase< DerivedOut > &S, Eigen::MatrixBase< DerivedOut > &V) |
| Return the smith normal form, M == U*S*V. More... | |
| std::vector< Eigen::Matrix3i > | CASM::_unimodular_matrices (bool positive, bool negative) |
| const std::vector < Eigen::Matrix3i > & | CASM::positive_unimodular_matrices () |
| const std::vector < Eigen::Matrix3i > & | CASM::negative_unimodular_matrices () |
| const std::vector < Eigen::Matrix3i > & | CASM::unimodular_matrices () |
| std::vector< Eigen::Matrix3i > CASM::_unimodular_matrices | ( | bool | positive, |
| bool | negative | ||
| ) |
Definition at line 182 of file LinearAlgebra.cc.
| Eigen::Matrix<typename Derived::Scalar, Derived::RowsAtCompileTime, Derived::ColsAtCompileTime> CASM::adjugate | ( | const Eigen::MatrixBase< Derived > & | M | ) |
Return adjugate matrix.
| M | matrix |
The adjugate matrix is the transpose of the cofactor matrix. The adjugate matrix is related to the inverse of a matrix through
Definition at line 184 of file LinearAlgebra.hh.
| double CASM::angle | ( | const Eigen::Ref< const Eigen::Vector3d > & | a, |
| const Eigen::Ref< const Eigen::Vector3d > & | b | ||
| ) |
Get angle, in radians, between two vectors on range [0,pi].
Definition at line 154 of file LinearAlgebra.cc.
| Eigen::Matrix<typename Derived::Scalar, Derived::RowsAtCompileTime, Derived::ColsAtCompileTime> CASM::cofactor | ( | const Eigen::MatrixBase< Derived > & | M | ) |
Return cofactor matrix.
| M | matrix |
The cofactor matrix is
Definition at line 156 of file LinearAlgebra.hh.
| void CASM::get_Hermitian | ( | Eigen::MatrixXcd & | original_mat, |
| Eigen::MatrixXcd & | hermitian_mat, | ||
| Eigen::MatrixXcd & | antihermitian_mat | ||
| ) |
Given a matrix, original_mat, this function calculates both the Hermitian and anti-Hermitian parts.
| [in] | original_mat | The matrix we want to get the Hermitian and anti-Hermitian parts of |
| [in,out] | hermitian_mat | The Hermitian matrix |
| [in,out] | antihermitian_mat | The anti-Hermitian matrix |
Definition at line 21 of file LinearAlgebra.cc.
| std::pair< Eigen::MatrixXi, Eigen::MatrixXi > CASM::hermite_normal_form | ( | const Eigen::MatrixXi & | M | ) |
Return the hermite normal form, M == H*V.
| M | a square integer matrix |
| std::runtime_error | if M is not full rank |
H set to upper triangular matrix H with:
Definition at line 61 of file LinearAlgebra.cc.
| Eigen::Matrix<typename Derived::Scalar, Derived::RowsAtCompileTime, Derived::ColsAtCompileTime> CASM::inverse | ( | const Eigen::MatrixBase< Derived > & | M | ) |
Return the integer inverse matrix of an invertible integer matrix.
| M | an 3x3 invertible integer matrix |
Definition at line 222 of file LinearAlgebra.hh.
| Eigen::CwiseUnaryOp< decltype(std::ptr_fun(boost::math::iround<typename Derived::Scalar>)) , const Derived > CASM::iround | ( | const Eigen::MatrixBase< Derived > & | val | ) |
Round Eigen::MatrixXd to Eigen::MatrixXi.
| M | Eigen::MatrixXd to be rounded to integer |
For each coefficient, sets
Definition at line 93 of file LinearAlgebra.hh.
| bool CASM::is_diagonal | ( | const Eigen::MatrixBase< Derived > & | M, |
| double | tol = TOL |
||
| ) |
Check if Eigen::Matrix is diagonal.
Definition at line 79 of file LinearAlgebra.hh.
| bool CASM::is_Hermitian | ( | Eigen::MatrixXcd & | mat | ) |
Returns true if the specified matrix is Hermitian.
Checks if the matrix is the same as the conjugate
Definition at line 37 of file LinearAlgebra.cc.
| bool CASM::is_integer | ( | const Eigen::MatrixBase< Derived > & | M, |
| double | tol | ||
| ) |
Check if Eigen::Matrix is integer.
Definition at line 61 of file LinearAlgebra.hh.
| bool CASM::is_unimodular | ( | const Eigen::MatrixBase< Derived > & | M, |
| double | tol | ||
| ) |
Check if Eigen::Matrix is unimodular.
Definition at line 73 of file LinearAlgebra.hh.
| Eigen::CwiseUnaryOp< decltype(std::ptr_fun(boost::math::lround<typename Derived::Scalar>)) , const Derived > CASM::lround | ( | const Eigen::MatrixBase< Derived > & | val | ) |
Round Eigen::MatrixXd to Eigen::MatrixXl.
| M | Eigen::MatrixXd to be rounded to integer |
For each coefficient, sets
Definition at line 107 of file LinearAlgebra.hh.
| Derived::Scalar CASM::matrix_minor | ( | const Eigen::MatrixBase< Derived > & | M, |
| int | row, | ||
| int | col | ||
| ) |
Return the minor of integer Matrix M element row, col.
| M | matrix |
| row,col | element row and column |
The minor of element row, col of a matrix is the determinant of the submatrix of M which does not include any elements from row 'row' or column 'col'
Definition at line 122 of file LinearAlgebra.hh.
| const std::vector< Eigen::Matrix3i > & CASM::negative_unimodular_matrices | ( | ) |
Definition at line 212 of file LinearAlgebra.cc.
| void CASM::poly_fit | ( | Eigen::VectorXcd & | xvec, |
| Eigen::VectorXcd & | yvec, | ||
| Eigen::VectorXcd & | coeffs, | ||
| int | degree | ||
| ) |
Definition at line 308 of file CASM_math.cc.
| const std::vector< Eigen::Matrix3i > & CASM::positive_unimodular_matrices | ( | ) |
Definition at line 207 of file LinearAlgebra.cc.
| Eigen::MatrixXd CASM::pretty | ( | const Eigen::MatrixXd & | M, |
| double | tol | ||
| ) |
Round entries that are within tol of being integer to that integer value.
Definition at line 170 of file LinearAlgebra.cc.
| double CASM::signed_angle | ( | const Eigen::Ref< const Eigen::Vector3d > & | a, |
| const Eigen::Ref< const Eigen::Vector3d > & | b, | ||
| const Eigen::Ref< const Eigen::Vector3d > & | pos_ref | ||
| ) |
signed angle, in radians, between -pi and pi that describe separation in direction of two vectors
return signed angle, in radians, between -pi and pi that describe separation in direction of two vectors
Definition at line 159 of file LinearAlgebra.cc.
| void CASM::smith_normal_form | ( | const Eigen::MatrixBase< DerivedIn > & | M, |
| Eigen::MatrixBase< DerivedOut > & | U, | ||
| Eigen::MatrixBase< DerivedOut > & | S, | ||
| Eigen::MatrixBase< DerivedOut > & | V | ||
| ) |
Return the smith normal form, M == U*S*V.
| M | 3x3 integer matrix | |
| [out] | U | set to U: is integer, U.determinant() == 1 |
| [out] | S | set to S: is diagonal, integer, and nonnegative, S(i,i) divides S(i+1,i+1) for all i |
| [out] | V | set to V: is integer, V.determinant() == 1 |
Adapted from Matlab implementation written by John Gilbert (gilbert@parc.xerox.com):
Definition at line 237 of file LinearAlgebra.hh.
| Derived::Scalar CASM::triple_prod | ( | const Derived & | vec0, |
| const Derived & | vec1, | ||
| const Derived & | vec2 | ||
| ) |
Definition at line 53 of file LinearAlgebra.hh.
| const std::vector< Eigen::Matrix3i > & CASM::unimodular_matrices | ( | ) |
Definition at line 217 of file LinearAlgebra.cc.