CASM  1.1.0
A Clusters Approach to Statistical Mechanics
CASM_Eigen_math.hh File Reference
#include <boost/math/special_functions/round.hpp>
#include <cassert>
#include <cmath>
#include <complex>
#include <type_traits>
#include <vector>
#include "./KroneckerTensorProduct.h"
#include "casm/external/Eigen/Eigenvalues"
#include "casm/global/definitions.hh"
#include "casm/global/eigen.hh"
#include "casm/misc/CASM_math.hh"

Go to the source code of this file.

Namespaces

 Local
 
 CASM
 Main CASM namespace.
 
 CASM::normal_form_impl
 
 Eigen
 

Functions

template<typename T >
static bool Local::_compare (T const &a, T const &b, double tol)
 
template<>
bool Local::_compare (std::complex< double > const &a, std::complex< double > const &b, double tol)
 
bool CASM::float_lexicographical_compare (const Eigen::Ref< const Eigen::MatrixXd > &A, const Eigen::Ref< const Eigen::MatrixXd > &B, double tol)
 Floating point lexicographical comparison with tol. More...
 
template<typename Derived >
bool CASM::colmajor_lex_compare (const Eigen::MatrixBase< Derived > &A, const Eigen::MatrixBase< Derived > &B, double tol)
 Floating point lexicographical comparison with tol. More...
 
template<typename Derived >
Derived::PlainObject CASM::reduced_column_echelon (Eigen::MatrixBase< Derived > const &M, double _tol)
 
Eigen::VectorXd CASM::eigen_vector_from_string (const std::string &tstr, const int &size)
 
double CASM::hungarian_method (const Eigen::MatrixXd &cost_matrix, std::vector< Index > &optimal_assignments, const double _tol)
 
template<typename Derived >
Derived::Scalar * CASM::end_ptr (Eigen::PlainObjectBase< Derived > &container)
 Return pointer one past end of vector. Equivalent to convainer.data()+container.size() More...
 
template<typename Derived >
Derived::Scalar const * CASM::end_ptr (Eigen::PlainObjectBase< Derived > const &container)
 Return const pointer one past end of vector. Equivalent to convainer.data()+container.size() More...
 
void CASM::get_Hermitian (Eigen::MatrixXcd &original_mat, Eigen::MatrixXcd &hermitian_mat, Eigen::MatrixXcd &antihermitian_mat)
 
bool CASM::is_Hermitian (Eigen::MatrixXcd &mat)
 
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_product (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(Local::round_l< typename Derived::Scalar >), const Derived > CASM::round (const Eigen::MatrixBase< Derived > &val)
 Round Eigen::MatrixXd. More...
 
template<typename Derived >
Eigen::CwiseUnaryOp< decltype(Local::iround_l< 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(Local::lround_l< 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 Scalar >
Eigen::Matrix< Scalar, 3, 3 > CASM::normal_form_impl::_elementary_hermite_op (Scalar a, Scalar b, Scalar i, Scalar j)
 Return an elementary hermite transformation. 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...
 
Eigen::Matrix3d CASM::polar_decomposition (Eigen::Matrix3d const &mat)
 
std::vector< Eigen::Matrix3i > CASM::_unimodular_matrices (bool positive, bool negative, int range=1)
 
const std::vector< Eigen::Matrix3i > & CASM::positive_unimodular_matrices ()
 
const std::vector< Eigen::Matrix3i > & CASM::negative_unimodular_matrices ()
 
template<int range = 1>
const std::vector< Eigen::Matrix3i > & CASM::unimodular_matrices ()
 
template<typename Derived >
bool Eigen::almost_zero (const MatrixBase< Derived > &val, double tol=CASM::TOL)
 Round Eigen::MatrixXd. More...
 
template<typename Derived >
double Eigen::length (const Eigen::MatrixBase< Derived > &value)
 
template<typename Derived >
Eigen::Matrix< int, Derived::RowsAtCompileTime, Derived::ColsAtCompileTime > Eigen::scale_to_int (const Eigen::MatrixBase< Derived > &val, double _tol=CASM::TOL)
 
template<typename Derived1 , typename Derived2 >
bool Eigen::almost_equal (const Eigen::MatrixBase< Derived1 > &val1, const Eigen::MatrixBase< Derived2 > &val2, double tol=CASM::TOL)
 
template<typename Derived >
bool Eigen::is_symmetric (const Eigen::MatrixBase< Derived > &test_mat, double test_tol=CASM::TOL)
 
template<typename Derived >
bool Eigen::is_persymmetric (const Eigen::MatrixBase< Derived > &test_mat, double test_tol=CASM::TOL)
 
template<typename Derived >
bool Eigen::is_bisymmetric (const Eigen::MatrixBase< Derived > &test_mat, double test_tol=CASM::TOL)
 
template<typename Derived >
std::vector< CASM::IndexEigen::partition_distinct_values (const Eigen::MatrixBase< Derived > &value, double tol=CASM::TOL)
 
template<typename Derived , typename Index = typename Derived::Index>
Index Eigen::print_matrix_width (std::ostream &s, const Derived &m, Index width)
 

Variables

template<typename T >
auto Local::round_l = [](T val) { return boost::math::round<T>(val); }
 
template<typename T >
auto Local::iround_l = [](T val) { return boost::math::iround<T>(val); }
 
template<typename T >
auto Local::lround_l = [](T val) { return boost::math::lround<T>(val); }