SoftSUSY is hosted by Hepforge, IPPP Durham
SOFTSUSY  4.0
ComplexMatrix Class Reference

matrix of complex double values dimensions (rows x cols) More...

#include <linalg.h>

Inheritance diagram for ComplexMatrix:
MatIndexable< Complex, ComplexMatrix >

Public Member Functions

 ComplexMatrix (int r, int c)
 Default constructor: full of zeroes.
 
 ComplexMatrix (const DoubleMatrix &m)
 Constructor sets matrix equal to m.
 
 ComplexMatrix (const ComplexVector &v)
 Constructor sets square matrix's diagonal values equal to elements of v.
 
template<class E >
ComplexMatrixoperator= (const MatXpr< Complex, E > &x)
 this is the only required operator to make this class work with ETs
 
ComplexMatrixoperator= (const ComplexMatrix &other)
 
template<typename E >
 ComplexMatrix (const MatXpr< Complex, E > &m)
 
Complexoperator() (int i, int j)
 Returns ijth element.
 
Complex operator() (int i, int j) const
 
Complex display (int i, int j) const
 returns ijth element
 
int displayRows () const
 
int displayCols () const
 
const ComplexMatrixdisplay () const
 
std::size_t size () const
 returns whole matrix
 
const ComplexMatrixoperator= (const Complex &v)
 Sets diagonal entries equal to v, rest are 0.
 
Complex min (int &k, int &l) const
 
void swaprows (int i, int j)
 Obvious elementary row/column operations. More...
 
void swapcols (int i, int j)
 Swaps column i with column j.
 
void setCols (int)
 change number of columns (Warning: can be slow because it internally copys a std::valarray<double>)
 
void setRows (int)
 change number of rows (Warning: can be slow because it internally copys a std::valarray<double>)
 
void resize (int, int)
 resize matrix (Warning: can be slow because it internally copys a std::valarray<double>)
 
Complex trace () const
 
ComplexMatrix transpose () const
 
ComplexMatrix hermitianConjugate () const
 
ComplexMatrix complexConjugate () const
 
DoubleMatrix real () const
 Real part of matrix.
 
DoubleMatrix imag () const
 Imaginary part of matrix.
 
double nonHermiticity () const
 Measures how far from Hermitian your matrix is.
 
void symmetrise ()
 Fills in lower bottom half of a square matrix copying the top right.
 
double compare (const ComplexMatrix &a) const
 Returns the sum of the modulus of the difference of each element.
 
DoubleMatrix makeHermitianRealForDiag () const
 This should only be applied to Hermitian matrices. More...
 
double diagonaliseHerm (ComplexMatrix &v, DoubleVector &w) const
 Again, only for Hermitian matrices. More...
 
double takagi (ComplexMatrix &v, ComplexVector &w) const
 
double diagonaliseSym2by2 (ComplexMatrix &v, ComplexVector &w) const
 
double diagonalise (ComplexMatrix &u, ComplexMatrix &v, DoubleVector &w) const
 Now for any Complex matrix. More...
 
ComplexMatrix apply (Complex(*fn)(Complex)) const
 Applies fn to every element.
 
- Public Member Functions inherited from MatIndexable< Complex, ComplexMatrix >
Complex operator() (int m, int n) const
 
int displayRows () const
 
int displayCols () const
 
ComplexMatrixassign_from (const MatXpr< Complex, E > &x)
 
ComplexMatrix copy_from (const MatXpr< Complex, E > &x)
 
MatIndexableoperator+= (const MatXpr< Complex, E > &x)
 
MatIndexableoperator*= (Complexx)
 

Friends

class DoubleMatrix
 

Detailed Description

matrix of complex double values dimensions (rows x cols)

Member Function Documentation

double ComplexMatrix::diagonalise ( ComplexMatrix u,
ComplexMatrix v,
DoubleVector w 
) const

Now for any Complex matrix.

For general non-singular complex matrices $ W = U A V^\dag $, where $ W $ is a matrix of diagonal values. The double output is an estimate of how accurate the diagonalisation is.

Multiply $ i^{th} $ column of V by exp(i theta) in order to end up with real eigenvalues

double ComplexMatrix::diagonaliseHerm ( ComplexMatrix v,
DoubleVector w 
) const

Again, only for Hermitian matrices.

For HERMITIAN MATRICES ONLY! $ A = V W V^\dag $ where W is a matrix of the eigenvalues therefore $ W = V^\dag A V $. The double output is an estimate of how accurate the diagonalisation is.

Store every other eigenvalue in w (they are repeated when realified)

double ComplexMatrix::diagonaliseSym2by2 ( ComplexMatrix v,
ComplexVector w 
) const

For Complex Symmetric matrices only. Performs eigenvalue factorisation, ie $ U A U^T = diag(\sigma_1, \sigma_2) $ for the 2 by 2 case. w has eigenvalues and the double return is numerical error. The matrices CANNOT be singular. From physics/0607103

DoubleMatrix ComplexMatrix::makeHermitianRealForDiag ( ) const

This should only be applied to Hermitian matrices.

This should only be applied to Hermitian matrices: makes a 2n x 2n real matrix out of [ A -B ] ready for diagonalisation. It's especially not [ B A ] efficient for large matrices.

Complex ComplexMatrix::min ( int &  k,
int &  l 
) const

smallest absolute element

void ComplexMatrix::swaprows ( int  i,
int  j 
)

Obvious elementary row/column operations.

Swaps row i with row j

double ComplexMatrix::takagi ( ComplexMatrix v,
ComplexVector w 
) const

For Complex Symmetric matrices only. Performs Takagi factorisation, ie $ U^* A U^\dag = diag(\sigma_1, \sigma_2) $ for the 2 by 2 case. w has eigenvalues and the double return is numerical error. The matrices can be singular.

Choice of sign for numerical round-off


The documentation for this class was generated from the following files: