Skip to content
Snippets Groups Projects
Commit 39d83533 authored by Dr. Felix Tobias Schindler's avatar Dr. Felix Tobias Schindler
Browse files

[eigen-solver] allow to specify "matrix-inverter" options

parent 29b1e461
No related branches found
No related tags found
No related merge requests found
...@@ -29,7 +29,7 @@ namespace LA { ...@@ -29,7 +29,7 @@ namespace LA {
/** /**
* \brief A means to obtain available options at compile time. * \brief A means to obtain available options at compile time.
* \note This class needs to bespecialized for each MatrixType, the purpose of this class is merely to document the * \note This class needs to be specialized for each MatrixType, the purpose of this variant is merely to document the
* expected functionality. * expected functionality.
*/ */
template <class MatrixType> template <class MatrixType>
......
...@@ -64,6 +64,10 @@ static Common::Configuration default_eigen_solver_options() ...@@ -64,6 +64,10 @@ static Common::Configuration default_eigen_solver_options()
} // ... default_eigen_solver_options(...) } // ... default_eigen_solver_options(...)
/**
* \sa default_eigen_solver_options()
* \note If the provided options contain a subtree "matrix-inverter" that one is forwarded on eigenvector inversion.
*/
template <class MatrixImp, class FieldImp, class RealMatrixImp, class ComplexMatrixImp> template <class MatrixImp, class FieldImp, class RealMatrixImp, class ComplexMatrixImp>
class EigenSolverBase class EigenSolverBase
{ {
...@@ -511,7 +515,11 @@ protected: ...@@ -511,7 +515,11 @@ protected:
{ {
assert(eigenvectors_ && "This must not happen when you call this function!"); assert(eigenvectors_ && "This must not happen when you call this function!");
try { try {
eigenvectors_inverse_ = std::make_unique<ComplexMatrixType>(invert_matrix(*eigenvectors_)); if (options_.has_sub("matrix-inverter")) {
eigenvectors_inverse_ =
std::make_unique<ComplexMatrixType>(invert_matrix(*eigenvectors_, options_.sub("matrix-inverter")));
} else
eigenvectors_inverse_ = std::make_unique<ComplexMatrixType>(invert_matrix(*eigenvectors_));
} catch (const Exceptions::matrix_invert_failed& ee) { } catch (const Exceptions::matrix_invert_failed& ee) {
DUNE_THROW(Exceptions::eigen_solver_failed, DUNE_THROW(Exceptions::eigen_solver_failed,
"The computed matrix of eigenvectors is not invertible!" "The computed matrix of eigenvectors is not invertible!"
...@@ -532,7 +540,11 @@ protected: ...@@ -532,7 +540,11 @@ protected:
{ {
assert(real_eigenvectors_ && "This must not happen when you call this function!"); assert(real_eigenvectors_ && "This must not happen when you call this function!");
try { try {
real_eigenvectors_inverse_ = std::make_unique<MatrixType>(invert_matrix(*real_eigenvectors_)); if (options_.has_sub("matrix-inverter")) {
real_eigenvectors_inverse_ =
std::make_unique<MatrixType>(invert_matrix(*real_eigenvectors_, options_.sub("matrix-inverter")));
} else
real_eigenvectors_inverse_ = std::make_unique<MatrixType>(invert_matrix(*real_eigenvectors_));
} catch (const Exceptions::matrix_invert_failed& ee) { } catch (const Exceptions::matrix_invert_failed& ee) {
DUNE_THROW(Exceptions::eigen_solver_failed, DUNE_THROW(Exceptions::eigen_solver_failed,
"The computed matrix of eigenvectors is not invertible!" "The computed matrix of eigenvectors is not invertible!"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment