dune-common  2.7.1
Functions
Dune::FMatrixHelp Namespace Reference

Functions

template<typename K >
static K invertMatrix (const FieldMatrix< K, 1, 1 > &matrix, FieldMatrix< K, 1, 1 > &inverse)
 invert scalar without changing the original matrix More...
 
template<typename K >
static K invertMatrix_retTransposed (const FieldMatrix< K, 1, 1 > &matrix, FieldMatrix< K, 1, 1 > &inverse)
 invert scalar without changing the original matrix More...
 
template<typename K >
static K invertMatrix (const FieldMatrix< K, 2, 2 > &matrix, FieldMatrix< K, 2, 2 > &inverse)
 invert 2x2 Matrix without changing the original matrix More...
 
template<typename K >
static K invertMatrix_retTransposed (const FieldMatrix< K, 2, 2 > &matrix, FieldMatrix< K, 2, 2 > &inverse)
 
template<typename K >
static K invertMatrix (const FieldMatrix< K, 3, 3 > &matrix, FieldMatrix< K, 3, 3 > &inverse)
 invert 3x3 Matrix without changing the original matrix More...
 
template<typename K >
static K invertMatrix_retTransposed (const FieldMatrix< K, 3, 3 > &matrix, FieldMatrix< K, 3, 3 > &inverse)
 invert 3x3 Matrix without changing the original matrix More...
 
template<class K , int m, int n, int p>
static void multMatrix (const FieldMatrix< K, m, n > &A, const FieldMatrix< K, n, p > &B, FieldMatrix< K, m, p > &ret)
 calculates ret = A * B More...
 
template<typename K , int rows, int cols>
static void multTransposedMatrix (const FieldMatrix< K, rows, cols > &matrix, FieldMatrix< K, cols, cols > &ret)
 calculates ret= A_t*A More...
 
template<typename K , int rows, int cols>
static void multAssignTransposed (const FieldMatrix< K, rows, cols > &matrix, const FieldVector< K, rows > &x, FieldVector< K, cols > &ret)
 calculates ret = matrix^T * x More...
 
template<typename K , int rows, int cols>
static FieldVector< K, rows > mult (const FieldMatrix< K, rows, cols > &matrix, const FieldVector< K, cols > &x)
 calculates ret = matrix * x More...
 
template<typename K , int rows, int cols>
static FieldVector< K, cols > multTransposed (const FieldMatrix< K, rows, cols > &matrix, const FieldVector< K, rows > &x)
 calculates ret = matrix^T * x More...
 
void eigenValuesLapackCall (const char *jobz, const char *uplo, const long int *n, double *a, const long int *lda, double *w, double *work, const long int *lwork, long int *info)
 
void eigenValuesNonsymLapackCall (const char *jobvl, const char *jobvr, const long int *n, double *a, const long int *lda, double *wr, double *wi, double *vl, const long int *ldvl, double *vr, const long int *ldvr, double *work, const long int *lwork, long int *info)
 
template<typename K >
static void eigenValues (const FieldMatrix< K, 1, 1 > &matrix, FieldVector< K, 1 > &eigenvalues)
 calculates the eigenvalues of a symmetric field matrix More...
 
template<typename K >
static void eigenValues (const FieldMatrix< K, 2, 2 > &matrix, FieldVector< K, 2 > &eigenvalues)
 calculates the eigenvalues of a symmetric field matrix More...
 
template<typename K >
static void eigenValues (const FieldMatrix< K, 3, 3 > &matrix, FieldVector< K, 3 > &eigenvalues)
 Calculates the eigenvalues of a symmetric 3x3 field matrix. More...
 
template<int dim, typename K >
static void eigenValuesVectorsLapack (const FieldMatrix< K, dim, dim > &matrix, FieldVector< K, dim > &eigenValues, FieldMatrix< K, dim, dim > &eigenVectors, const char &jobz)
 calculates the eigenvalues and/or eigenvectors of a symmetric field matrix More...
 
template<int dim, typename K >
static void eigenValues (const FieldMatrix< K, dim, dim > &matrix, FieldVector< K, dim > &eigenValues)
 calculates the eigenvalues of a symmetric field matrix More...
 
template<int dim, typename K >
static void eigenValuesVectors (const FieldMatrix< K, dim, dim > &matrix, FieldVector< K, dim > &eigenValues, FieldMatrix< K, dim, dim > &eigenVectors)
 calculates the eigenvalues and eigenvectors of a symmetric field matrix More...
 
template<int dim, typename K , class C >
static void eigenValuesNonSym (const FieldMatrix< K, dim, dim > &matrix, FieldVector< C, dim > &eigenValues)
 calculates the eigenvalues of a non-symmetric field matrix More...
 

Function Documentation

◆ eigenValues() [1/4]

template<typename K >
static void Dune::FMatrixHelp::eigenValues ( const FieldMatrix< K, 1, 1 > &  matrix,
FieldVector< K, 1 > &  eigenvalues 
)
static

calculates the eigenvalues of a symmetric field matrix

Parameters
[in]matrixmatrix eigenvalues are calculated for
[out]eigenvaluesFieldVector that contains eigenvalues in ascending order

◆ eigenValues() [2/4]

template<typename K >
static void Dune::FMatrixHelp::eigenValues ( const FieldMatrix< K, 2, 2 > &  matrix,
FieldVector< K, 2 > &  eigenvalues 
)
static

calculates the eigenvalues of a symmetric field matrix

Parameters
[in]matrixmatrix eigenvalues are calculated for
[out]eigenvaluesFieldVector that contains eigenvalues in ascending order

◆ eigenValues() [3/4]

template<typename K >
static void Dune::FMatrixHelp::eigenValues ( const FieldMatrix< K, 3, 3 > &  matrix,
FieldVector< K, 3 > &  eigenvalues 
)
static

Calculates the eigenvalues of a symmetric 3x3 field matrix.

Parameters
[in]matrixmatrix eigenvalues are calculated for
[out]eigenvaluesEigenvalues in ascending order
Note
If the input matrix is not symmetric the behavior of this method is undefined.

This implementation was adapted from the pseudo-code (Python?) implementation found on http://en.wikipedia.org/wiki/Eigenvalue_algorithm (retrieved late August 2014). Wikipedia claims to have taken it from Smith, Oliver K. (April 1961), Eigenvalues of a symmetric 3 × 3 matrix., Communications of the ACM 4 (4): 168, doi:10.1145/355578.366316

◆ eigenValues() [4/4]

template<int dim, typename K >
static void Dune::FMatrixHelp::eigenValues ( const FieldMatrix< K, dim, dim > &  matrix,
FieldVector< K, dim > &  eigenValues 
)
static

calculates the eigenvalues of a symmetric field matrix

Parameters
[in]matrixmatrix eigenvalues are calculated for
[out]eigenValuesFieldVector that contains eigenvalues in ascending order
Note
LAPACK::dsyev is used to calculate the eigenvalues

◆ eigenValuesLapackCall()

void Dune::FMatrixHelp::eigenValuesLapackCall ( const char *  jobz,
const char *  uplo,
const long int *  n,
double *  a,
const long int *  lda,
double *  w,
double *  work,
const long int *  lwork,
long int *  info 
)

◆ eigenValuesNonSym()

template<int dim, typename K , class C >
static void Dune::FMatrixHelp::eigenValuesNonSym ( const FieldMatrix< K, dim, dim > &  matrix,
FieldVector< C, dim > &  eigenValues 
)
static

calculates the eigenvalues of a non-symmetric field matrix

Parameters
[in]matrixmatrix eigenvalues are calculated for
[out]eigenValuesFieldVector that contains eigenvalues in ascending order
Note
LAPACK::dgeev is used to calculate the eigen values

◆ eigenValuesNonsymLapackCall()

void Dune::FMatrixHelp::eigenValuesNonsymLapackCall ( const char *  jobvl,
const char *  jobvr,
const long int *  n,
double *  a,
const long int *  lda,
double *  wr,
double *  wi,
double *  vl,
const long int *  ldvl,
double *  vr,
const long int *  ldvr,
double *  work,
const long int *  lwork,
long int *  info 
)

◆ eigenValuesVectors()

template<int dim, typename K >
static void Dune::FMatrixHelp::eigenValuesVectors ( const FieldMatrix< K, dim, dim > &  matrix,
FieldVector< K, dim > &  eigenValues,
FieldMatrix< K, dim, dim > &  eigenVectors 
)
static

calculates the eigenvalues and eigenvectors of a symmetric field matrix

Parameters
[in]matrixmatrix eigenvalues are calculated for
[out]eigenValuesFieldVector that contains eigenvalues in ascending order
[out]eigenVectorsFieldMatrix that contains the eigenvectors
Note
LAPACK::dsyev is used to calculate the eigenvalues and eigenvectors

◆ eigenValuesVectorsLapack()

template<int dim, typename K >
static void Dune::FMatrixHelp::eigenValuesVectorsLapack ( const FieldMatrix< K, dim, dim > &  matrix,
FieldVector< K, dim > &  eigenValues,
FieldMatrix< K, dim, dim > &  eigenVectors,
const char &  jobz 
)
static

calculates the eigenvalues and/or eigenvectors of a symmetric field matrix

Parameters
[in]matrixmatrix eigenvalues are calculated for
[out]eigenValuesFieldVector that contains eigenvalues in ascending order
[out]eigenVectorsFieldMatrix that contains the eigenvectors
[in]jobzjobz=n (only eigenvalues), jobz=v (eigenvalues and eigenvetors)
Note
LAPACK::dsyev is used to calculate the eigenvalues and/or eigenvectors

◆ invertMatrix() [1/3]

template<typename K >
static K Dune::FMatrixHelp::invertMatrix ( const FieldMatrix< K, 1, 1 > &  matrix,
FieldMatrix< K, 1, 1 > &  inverse 
)
inlinestatic

invert scalar without changing the original matrix

◆ invertMatrix() [2/3]

template<typename K >
static K Dune::FMatrixHelp::invertMatrix ( const FieldMatrix< K, 2, 2 > &  matrix,
FieldMatrix< K, 2, 2 > &  inverse 
)
inlinestatic

invert 2x2 Matrix without changing the original matrix

◆ invertMatrix() [3/3]

template<typename K >
static K Dune::FMatrixHelp::invertMatrix ( const FieldMatrix< K, 3, 3 > &  matrix,
FieldMatrix< K, 3, 3 > &  inverse 
)
inlinestatic

invert 3x3 Matrix without changing the original matrix

◆ invertMatrix_retTransposed() [1/3]

template<typename K >
static K Dune::FMatrixHelp::invertMatrix_retTransposed ( const FieldMatrix< K, 1, 1 > &  matrix,
FieldMatrix< K, 1, 1 > &  inverse 
)
inlinestatic

invert scalar without changing the original matrix

◆ invertMatrix_retTransposed() [2/3]

template<typename K >
static K Dune::FMatrixHelp::invertMatrix_retTransposed ( const FieldMatrix< K, 2, 2 > &  matrix,
FieldMatrix< K, 2, 2 > &  inverse 
)
inlinestatic

invert 2x2 Matrix without changing the original matrix return transposed matrix

◆ invertMatrix_retTransposed() [3/3]

template<typename K >
static K Dune::FMatrixHelp::invertMatrix_retTransposed ( const FieldMatrix< K, 3, 3 > &  matrix,
FieldMatrix< K, 3, 3 > &  inverse 
)
inlinestatic

invert 3x3 Matrix without changing the original matrix

◆ mult()

template<typename K , int rows, int cols>
static FieldVector<K,rows> Dune::FMatrixHelp::mult ( const FieldMatrix< K, rows, cols > &  matrix,
const FieldVector< K, cols > &  x 
)
inlinestatic

calculates ret = matrix * x

◆ multAssignTransposed()

template<typename K , int rows, int cols>
static void Dune::FMatrixHelp::multAssignTransposed ( const FieldMatrix< K, rows, cols > &  matrix,
const FieldVector< K, rows > &  x,
FieldVector< K, cols > &  ret 
)
inlinestatic

calculates ret = matrix^T * x

◆ multMatrix()

template<class K , int m, int n, int p>
static void Dune::FMatrixHelp::multMatrix ( const FieldMatrix< K, m, n > &  A,
const FieldMatrix< K, n, p > &  B,
FieldMatrix< K, m, p > &  ret 
)
inlinestatic

calculates ret = A * B

◆ multTransposed()

template<typename K , int rows, int cols>
static FieldVector<K,cols> Dune::FMatrixHelp::multTransposed ( const FieldMatrix< K, rows, cols > &  matrix,
const FieldVector< K, rows > &  x 
)
inlinestatic

calculates ret = matrix^T * x

◆ multTransposedMatrix()

template<typename K , int rows, int cols>
static void Dune::FMatrixHelp::multTransposedMatrix ( const FieldMatrix< K, rows, cols > &  matrix,
FieldMatrix< K, cols, cols > &  ret 
)
inlinestatic

calculates ret= A_t*A