Skip to content
Snippets Groups Projects
Verified Commit f7b40ba5 authored by Nils-Arne Dreier's avatar Nils-Arne Dreier
Browse files

move the LAPACK not found guard to eigenValuesVectorsLapackImpl

parent 876989bc
Branches
Tags
1 merge request!787add eigenvalues and vectors computation for FieldMatrices for field_type float
......@@ -206,7 +206,6 @@ extern "C" {
const long int* lwork, long int* info);
} // end extern C
#endif
namespace Dune {
......@@ -217,16 +216,8 @@ namespace Dune {
int* n, double* a, const long int* lda, double* w,
double* work, const long int* lwork, long int* info)
{
#if HAVE_LAPACK
// call LAPACK dsyev
DSYEV_FORTRAN(jobz, uplo, n, a, lda, w, work, lwork, info);
#else
// silence unused variable warnings
DUNE_UNUSED_PARAMETER(jobz), DUNE_UNUSED_PARAMETER(uplo), DUNE_UNUSED_PARAMETER(n);
DUNE_UNUSED_PARAMETER(a), DUNE_UNUSED_PARAMETER(lda), DUNE_UNUSED_PARAMETER(w);
DUNE_UNUSED_PARAMETER(work), DUNE_UNUSED_PARAMETER(lwork), DUNE_UNUSED_PARAMETER(info);
DUNE_THROW(NotImplemented,"eigenValuesLapackCall: LAPACK not found!");
#endif
}
void eigenValuesLapackCall(
......@@ -234,16 +225,8 @@ namespace Dune {
int* n, float* a, const long int* lda, float* w,
float* work, const long int* lwork, long int* info)
{
#if HAVE_LAPACK
// call LAPACK dsyev
SSYEV_FORTRAN(jobz, uplo, n, a, lda, w, work, lwork, info);
#else
// silence unused variable warnings
DUNE_UNUSED_PARAMETER(jobz), DUNE_UNUSED_PARAMETER(uplo), DUNE_UNUSED_PARAMETER(n);
DUNE_UNUSED_PARAMETER(a), DUNE_UNUSED_PARAMETER(lda), DUNE_UNUSED_PARAMETER(w);
DUNE_UNUSED_PARAMETER(work), DUNE_UNUSED_PARAMETER(lwork), DUNE_UNUSED_PARAMETER(info);
DUNE_THROW(NotImplemented,"eigenValuesLapackCall: LAPACK not found!");
#endif
}
void eigenValuesNonsymLapackCall(
......@@ -252,18 +235,9 @@ namespace Dune {
const long int* ldvl, double* vr, const long int* ldvr, double* work,
const long int* lwork, long int* info)
{
#if HAVE_LAPACK
// call LAPACK dgeev
DGEEV_FORTRAN(jobvl, jobvr, n, a, lda, wr, wi, vl, ldvl, vr, ldvr,
work, lwork, info);
#else
// silence unused variable warnings
DUNE_UNUSED_PARAMETER(jobvl), DUNE_UNUSED_PARAMETER(jobvr), DUNE_UNUSED_PARAMETER(n);
DUNE_UNUSED_PARAMETER(a), DUNE_UNUSED_PARAMETER(lda), DUNE_UNUSED_PARAMETER(wr), DUNE_UNUSED_PARAMETER(wi);
DUNE_UNUSED_PARAMETER(vl), DUNE_UNUSED_PARAMETER(ldvl), DUNE_UNUSED_PARAMETER(vr);
DUNE_UNUSED_PARAMETER(ldvr), DUNE_UNUSED_PARAMETER(work), DUNE_UNUSED_PARAMETER(lwork), DUNE_UNUSED_PARAMETER(info);
DUNE_THROW(NotImplemented,"eigenValuesNonsymLapackCall: LAPACK not found!");
#endif
}
void eigenValuesNonsymLapackCall(
......@@ -272,20 +246,11 @@ namespace Dune {
const long int* ldvl, float* vr, const long int* ldvr, float* work,
const long int* lwork, long int* info)
{
#if HAVE_LAPACK
// call LAPACK dgeev
SGEEV_FORTRAN(jobvl, jobvr, n, a, lda, wr, wi, vl, ldvl, vr, ldvr,
work, lwork, info);
#else
// silence unused variable warnings
DUNE_UNUSED_PARAMETER(jobvl), DUNE_UNUSED_PARAMETER(jobvr), DUNE_UNUSED_PARAMETER(n);
DUNE_UNUSED_PARAMETER(a), DUNE_UNUSED_PARAMETER(lda), DUNE_UNUSED_PARAMETER(wr), DUNE_UNUSED_PARAMETER(wi);
DUNE_UNUSED_PARAMETER(vl), DUNE_UNUSED_PARAMETER(ldvl), DUNE_UNUSED_PARAMETER(vr);
DUNE_UNUSED_PARAMETER(ldvr), DUNE_UNUSED_PARAMETER(work), DUNE_UNUSED_PARAMETER(lwork), DUNE_UNUSED_PARAMETER(info);
DUNE_THROW(NotImplemented,"eigenValuesNonsymLapackCall: LAPACK not found!");
#endif
}
#endif
} // end namespace FMatrixHelp
} // end namespace Dune
......
......@@ -26,6 +26,7 @@ namespace Dune {
namespace FMatrixHelp {
#if HAVE_LAPACK
// defined in fmatrixev.cc
extern void eigenValuesLapackCall(
const char* jobz, const char* uplo, const long
......@@ -49,6 +50,8 @@ namespace Dune {
const long int* ldvl, float* vr, const long int* ldvr, float* work,
const long int* lwork, long int* info);
#endif
namespace Impl {
//internal tag to activate/disable code for eigenvector calculation at compile time
enum Jobs { OnlyEigenvalues=0, EigenvaluesEigenvectors=1 };
......@@ -385,6 +388,7 @@ namespace Dune {
FieldMatrix<K, dim, dim>& eigenVectors)
{
{
#if HAVE_LAPACK
/*Lapack uses a proprietary tag to determine whether both eigenvalues and
-vectors ('v') or only eigenvalues ('n') should be calculated */
const char jobz = "nv"[Tag];
......@@ -435,6 +439,9 @@ namespace Dune {
std::cerr << "For matrix " << matrix << " eigenvalue calculation failed! " << std::endl;
DUNE_THROW(InvalidStateException,"eigenValues: Eigenvalue calculation failed!");
}
#else
DUNE_THROW(NotImplemented,"LAPACK not found!");
#endif
}
}
......@@ -521,6 +528,7 @@ namespace Dune {
static void eigenValuesNonSym(const FieldMatrix<K, dim, dim>& matrix,
FieldVector<C, dim>& eigenValues)
{
#if HAVE_LAPACK
{
const long int N = dim ;
const char jobvl = 'n';
......@@ -563,6 +571,9 @@ namespace Dune {
eigenValues[i].imag = eigenI[i];
}
}
#else
DUNE_THROW(NotImplemented,"LAPACK not found!");
#endif
}
} // end namespace FMatrixHelp
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment