3#ifndef DUNE_DYNMATRIXEIGENVALUES_HH
4#define DUNE_DYNMATRIXEIGENVALUES_HH
18 namespace DynamicMatrixHelp {
21 extern void eigenValuesNonsymLapackCall(
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 ];
67 eigenValuesNonsymLapackCall(&jobvl, &jobvr, &N, &matrixVector[0], &N,
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]);
size_type rows() const
number of rows
Definition: densematrix.hh:704
Construct a matrix with a dynamic size.
Definition: dynmatrix.hh:58
Construct a vector with a dynamic size.
Definition: dynvector.hh:53
Default exception if a function was called while the object is not in a valid state for that function...
Definition: exceptions.hh:307
This file implements a dense matrix with dynamic numbers of rows and columns.
static void eigenValuesNonSym(const DynamicMatrix< K > &matrix, DynamicVector< C > &eigenValues)
calculates the eigenvalues of a symmetric field matrix
Definition: dynmatrixev.hh:35
#define DUNE_THROW(E, m)
Definition: exceptions.hh:244
Dune namespace.
Definition: alignment.hh:14