3 #ifndef DUNE_DYNMATRIXEIGENVALUES_HH
4 #define DUNE_DYNMATRIXEIGENVALUES_HH
18 namespace DynamicMatrixHelp {
22 const char* jobvl,
const char* jobvr,
const long
23 int* n,
double* a,
const long int* lda,
double* wr,
double* wi,
double* vl,
24 const long int* ldvl,
double* vr,
const long int* ldvr,
double* work,
25 const long int* lwork,
const long int* info);
34 template <
typename K,
class C>
39 const long int N = matrix.
rows();
40 const char jobvl =
'n';
41 const char jobvr =
'n';
45 double matrixVector[N * N];
49 for(
int i=0; i<N; ++i)
51 for(
int j=0; j<N; ++j, ++row)
53 matrixVector[ row ] = matrix[ i ][ j ];
68 &eigenR[0], &eigenI[0], 0, &N, 0, &N, &work[0],
73 std::cerr <<
"For matrix " << matrix <<
" eigenvalue calculation failed! " << std::endl;
76 for (
int i=0; i<N; ++i)
77 eigenValues[i] = std::complex<double>(eigenR[i], eigenI[i]);
Dune namespace.
Definition: alignment.hh:13
Construct a matrix with a dynamic size.
Definition: dynmatrix.hh:28
Construct a vector with a dynamic size.
Definition: dynvector.hh:30
static void eigenValues(const FieldMatrix< K, 1, 1 > &matrix, FieldVector< K, 1 > &eigenvalues)
calculates the eigenvalues of a symmetric field matrix
Definition: fmatrixev.hh:45
#define DUNE_THROW(E, m)
Definition: exceptions.hh:244
static void eigenValuesNonSym(const DynamicMatrix< K > &matrix, DynamicVector< C > &eigenValues)
calculates the eigenvalues of a symmetric field matrix
Definition: dynmatrixev.hh:35
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, const long int *info)
Definition: dynmatrixev.cc:136
Default exception if a function was called while the object is not in a valid state for that function...
Definition: exceptions.hh:307
size_type rows() const
number of rows
Definition: densematrix.hh:704
This file implements a dense matrix with dynamic numbers of rows and columns.