softsusy is hosted by Hepforge, IPPP Durham
SOFTSUSY  4.1
DoubleMatrix Class Reference

Matrix from 1..rows, 1..cols of double values. More...

#include <linalg.h>

Inheritance diagram for DoubleMatrix:
MatIndexable< double, DoubleMatrix >

Public Member Functions

 DoubleMatrix (int r, int c)
 Constructor for matrix of zeroes 1..r,1..c.
 
 DoubleMatrix (const DoubleVector &v)
 Makes diagonal square matrix: diagonal elements are from v, in order.
 
template<class E >
DoubleMatrixoperator= (const MatXpr< double, E > &x)
 this is the only required operator to make this class work with ETs
 
DoubleMatrixoperator= (const DoubleMatrix &other)
 
template<typename E >
 DoubleMatrix (const MatXpr< double, E > &m)
 
double operator() (int i, int j) const
 to reference one element
 
double & operator() (int i, int j)
 to reference one element
 
double display (int i, int j) const
 ijth element
 
double sumElements () const
 
int displayRows () const
 Routines for outputting size of matrix.
 
int displayCols () const
 
const DoubleMatrixdisplay () const
 whole matrix returned
 
DoubleVector displayRow (int i) const
 
DoubleVector displayCol (int i) const
 
void operator+= (DoubleMatrix &f)
 
double nmin (int &k, int &l) const
 
DoubleMatrix apply (double(*fn)(double)) const
 Applies fn to every element of a matrix.
 
const DoubleMatrixoperator= (double v)
 Sets diagonal entries equal to v, rest are 0.
 
double min (int &k, int &l) const
 minimum element
 
double max (int &k, int &l) const
 
void swaprows (int i, int j)
 Obvious elementary row/column operations.
 
void swapcols (int i, int j)
 
std::size_t size () const
 
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>)
 
double trace () const
 trace must only be performed on a square matrix
 
DoubleMatrix transpose () const
 can be any size
 
bool testNan () const
 tests that all elements are not Nans
 
void associateOrderAbs (DoubleVector &v)
 
void associateOrderAbs (DoubleMatrix &u, DoubleMatrix &v, DoubleVector &w) const
 
void symmetrise ()
 fills in bottom-left hand corner of a matrix
 
double compare (const DoubleMatrix &a) const
 
double compare (const ComplexMatrix &a) const
 
DoubleVector diagVals () const
 Just returns a vector filled with the diagonal values.
 
DoubleMatrix inverse () const
 returns inverse of a matrix
 
double diagonalise (DoubleMatrix &u, DoubleMatrix &v, DoubleVector &w) const
 
double diagonaliseSym (DoubleMatrix &v, DoubleVector &w) const
 
double diagonaliseSym (ComplexMatrix &v, DoubleVector &w) const
 
DoubleVector sym2by2 (double &theta) const
 
DoubleVector asy2by2 (double &thetaL, double &thetaR) const
 2 by 2 asymmetric matrices
 
DoubleVector vectorfy () const
 converts a list of entries into a vector
 
double determinant () const
 Determinant of your matrix.
 
DoubleMatrix ludcmp (double &d) const
 
void fillArray (double *array, unsigned offset=0) const
 fill array, starting at offset
 
- Public Member Functions inherited from MatIndexable< double, DoubleMatrix >
double operator() (int m, int n) const
 
int displayRows () const
 
int displayCols () const
 
DoubleMatrixassign_from (const MatXpr< double, E > &x)
 
DoubleMatrix copy_from (const MatXpr< double, E > &x)
 
MatIndexableoperator+= (const MatXpr< double, E > &x)
 
MatIndexableoperator*= (double x)
 

Friends

class ComplexMatrix
 

Detailed Description

Matrix from 1..rows, 1..cols of double values.

Member Function Documentation

◆ associateOrderAbs() [1/2]

void DoubleMatrix::associateOrderAbs ( DoubleMatrix u,
DoubleMatrix v,
DoubleVector w 
) const

diag = U^T double M V. It will put the diag evals in abs ascending order and changes U,V accordingly

◆ associateOrderAbs() [2/2]

void DoubleMatrix::associateOrderAbs ( DoubleVector v)

Perform on a mixing matrix O such that diag v = O^double M O. It will put the diag evals in abs ascending order and change O accordingly

◆ compare()

double DoubleMatrix::compare ( const DoubleMatrix a) const

Sums up the absolute value of the difference in each element of two matrices

◆ diagonalise()

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

Uses singular SVD algorithm: \( A = U.W.V^T \) where W is a matrix of the eigenvalues, therefore \( W = U^T A V \).

◆ diagonaliseSym()

double DoubleMatrix::diagonaliseSym ( DoubleMatrix v,
DoubleVector w 
) const

For SYMMETRIC MATRICES ONLY! \( A = V.W.V^T \) where W is a vector of the eigenvalues therefore \( W = V^T A V \).

◆ ludcmp()

DoubleMatrix DoubleMatrix::ludcmp ( double &  d) const

Returns LU decomposition of a matrix. d gives whether there are an even or odd number of permutations

indx records the row permutation undergone. d=+1 or -1 depending on whether the permutation is even or odd.

◆ max()

double DoubleMatrix::max ( int &  k,
int &  l 
) const

maximum element

◆ sym2by2()

DoubleVector DoubleMatrix::sym2by2 ( double &  theta) const

Special case that's often used: eigenvalues of 2 by 2 symmetric matrix A(2,1) is assumed to be equal to A(1,2). theta is the mixing angle: m1 is NOT NECESSARILY > m2


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