ampsci
c++ program for high-precision atomic structure calculations of single-valence systems
Classes | Functions
LinAlg Namespace Reference

Defines Matrix, Vector classes, and linear some algebra functions. More...

Classes

class  View
 Proved a "view" onto an array. More...
 
class  Matrix
 Matrix class; row-major. More...
 
class  Vector
 Vector class (inherits from Matrix) More...
 

Functions

template<typename T >
constexpr auto myEps ()
 
template<typename T >
bool equal (const Matrix< T > &lhs, const Matrix< T > &rhs, T eps=myEps< T >())
 Compares two matrices; returns true iff all elements compare relatively to better than eps.
 
template<typename T >
Matrix< T > operator* (const Matrix< T > &a, const Matrix< T > &b)
 
template<typename T >
std::ostream & operator<< (std::ostream &os, const Matrix< T > &a)
 
template<typename T >
Vector< T > solve_Axeqb (Matrix< T > Am, const Vector< T > &b)
 Solves matrix equation Ax=b for x, for known square matrix A and vector b.
 
template<typename T >
std::pair< Vector< double >, Matrix< T > > symmhEigensystem (Matrix< T > A)
 Solves Av = ev for eigenvalues e and eigenvectors v of symmetric/Hermetian matrix A. Returns [e,v], where v(i,j) is the jth element of the ith eigenvector corresponding to ith eigenvalue, e(i). e is always real.
 
template<typename T >
std::pair< Vector< double >, Matrix< T > > symmhEigensystem (Matrix< T > A, int number)
 Solves Av=ev for first N eigenvals/vecs v of symmetric matrix A.
 
template<typename T >
std::pair< Vector< double >, Matrix< T > > symmhEigensystem (Matrix< T > A, Matrix< T > B)
 Solves Av = eBv for eigenvalues e and eigenvectors v of symmetric/Hermetian matrix pair A,B. Returns [e,v], where v(i,j) is the jth element of the ith eigenvector corresponding to ith eigenvalue, e(i). e is always real.
 
template<typename T >
std::pair< Vector< std::complex< double > >, Matrix< std::complex< double > > > genEigensystem (Matrix< T > A, bool sort)
 Solves Av = ev for eigenvalues e and eigenvectors v of non-symmetric real matrix A. Returns [e,v], where v(i,j) is the jth element of the ith eigenvector corresponding to ith eigenvalue, e(i). A must be real, while e and v are complex.
 

Detailed Description

Defines Matrix, Vector classes, and linear some algebra functions.