JDFTx  1.7.0
matrix.h File Reference
#include <core/ManagedMemory.h>
#include <core/scaled.h>
#include <core/matrix3.h>
#include <gsl/gsl_cblas.h>

Classes

class  diagMatrix
 Real diagonal matrix. More...
 
class  matrix
 General complex matrix. More...
 
struct  matrixScaledTransOp
 Matrix with pending scale, submatrix and/or transpose operations. More...
 
class  tiledBlockMatrix
 A block matrix formed by repeating (tiling) a dense matrix along the diagonal. More...
 

Functions

matrix conj (const scaled< matrix > &A)
 return element-wise complex conjugate of A
 
matrixScaledTransOp dagger (const matrixScaledTransOp &A)
 return hermitian adjoint of A
 
matrixScaledTransOp transpose (const matrixScaledTransOp &A)
 return transpose of A
 
matrix dagger_symmetrize (const matrixScaledTransOp &A)
 
matrix transpose_symmetrize (const matrixScaledTransOp &A)
 return adjoint symmetric part: (A + Adag)/2
 
double nrm2 (const matrixScaledTransOp &A)
 return transpose symmetric part: (A + AT)/2 More...
 
matrixoperator*= (matrix &m, double s)
 
scaled< matrixoperator* (double s, const matrix &m)
 
scaled< matrixoperator* (const matrix &m, double s)
 
scaled< matrixoperator- (const matrix &m)
 
matrixoperator*= (matrix &m, complex s)
 
matrix operator* (complex s, const matrix &m)
 
matrix operator* (const matrix &m, complex s)
 
diagMatrix operator* (double s, const diagMatrix &m)
 
diagMatrix operator* (const diagMatrix &m, double s)
 
diagMatrix operator- (const diagMatrix &m)
 
matrix operator* (const matrixScaledTransOp &, const matrixScaledTransOp &)
 
matrix operator* (const diagMatrix &, const matrix &)
 
matrix operator* (const matrix &, const diagMatrix &)
 
matrix operator* (const std::vector< complex > &d, const matrix &m)
 
matrix operator* (const matrix &m, const std::vector< complex > &d)
 
diagMatrix operator* (const diagMatrix &, const diagMatrix &)
 
matrixoperator+= (matrix &m1, const matrix &m2)
 
matrixoperator-= (matrix &m1, const matrix &m2)
 
matrix operator+ (const matrix &m1, const matrix &m2)
 
matrix operator- (const matrix &m1, const matrix &m2)
 
void axpy (double alpha, const diagMatrix &x, matrix &y)
 
matrixoperator+= (matrix &m, const diagMatrix &d)
 
matrixoperator-= (matrix &m, const diagMatrix &d)
 
matrix operator+ (const matrix &m, const diagMatrix &d)
 
matrix operator+ (const diagMatrix &d, const matrix &m)
 
matrix operator- (const matrix &m, const diagMatrix &d)
 
matrix operator- (const diagMatrix &d, const matrix &m)
 
void axpy (double alpha, const diagMatrix &x, diagMatrix &y)
 
diagMatrixoperator+= (diagMatrix &d1, const diagMatrix &d2)
 
diagMatrixoperator-= (diagMatrix &d1, const diagMatrix &d2)
 
diagMatrix operator+ (const diagMatrix &d1, const diagMatrix &d2)
 
diagMatrix operator- (const diagMatrix &d1, const diagMatrix &d2)
 
diagMatrix clone (const diagMatrix &x)
 
matrix clone (const matrix &x)
 
double dot (const diagMatrix &x, const diagMatrix &y)
 
double dot (const matrix &x, const matrix &y)
 
void randomize (diagMatrix &x)
 
void randomize (matrix &x)
 
diagMatrix diagDot (const matrix &X, const matrix &Y)
 Compute diag(dagger(X)*Y) efficiently (avoid the off-diagonals)
 
matrix inv (const matrix &A)
 Compute / apply inverse: More...
 
diagMatrix inv (const diagMatrix &A)
 inverse of diagonal matrix
 
matrix invTriangular (const matrix &T, bool upper)
 return inv(T) for triangular matrix T (upper/lower for upper=true/false)
 
matrix invApply (const matrix &A, const matrix &b)
 return inv(A) * b (A must be hermitian, positive-definite)
 
matrix LU (const matrix &A)
 Compute the LU decomposition of the matrix.
 
matrix cholesky (const matrix &A, bool upper)
 
complex det (const matrix &A)
 
double det (const diagMatrix &A)
 Compute the determinant of an diagonal matrix A.
 
matrix pow (const matrix &A, double exponent, matrix *Aevecs=0, diagMatrix *Aeigs=0, bool *isSingular=0)
 
matrix invsqrt (const matrix &A, matrix *Aevecs=0, diagMatrix *Aeigs=0, bool *isSingular=0)
 
matrix orthoMatrix (const matrix &A)
 
matrix cis (const matrix &A, matrix *Aevecs=0, diagMatrix *Aeigs=0)
 Compute cis(A) = exp(iota A) and optionally the eigensystem of A (if non-null)
 
matrix cisInv (const matrix &A, matrix *Bevecs=0, diagMatrix *Beigs=0)
 
matrix sqrt_grad (const matrix &grad_sqrtA, const matrix &Aevecs, const diagMatrix &Aeigs)
 Return gradient w.r.t A given gradient w.r.t sqrt(A) and A's eigensystem.
 
matrix cis_grad (const matrix &grad_cisA, const matrix &Aevecs, const diagMatrix &Aeigs)
 Return gradient w.r.t A given gradient w.r.t cis(A) and A's eigensystem.
 
complex trace (const matrix &m)
 trace of matrix
 
double trace (const diagMatrix &m)
 trace of diagonal matrix
 
double nrm2 (const diagMatrix &m)
 RMS of matrix entries.
 
diagMatrix diag (const matrix &m)
 obtain the real diagonal part of a hermitian matrix
 
diagMatrix eye (int N)
 identity
 
matrix zeroes (int nRows, int nCols)
 a dense-matrix of zeroes
 
matrix operator* (const matrix &m, const tiledBlockMatrix &tbm)
 multiply dense matrix by block matrix
 

Detailed Description

General size diagonal and dense matrices, and their operators