Skip to content
Snippets Groups Projects
Commit da604ca5 authored by Oliver Sander's avatar Oliver Sander
Browse files

eigenValuesNonSym: Set size of the output vector before filling it

Rather than assuming the caller has set it to the correct size already.
Setting the size in the method eigenValuesNonSym itself makes code
more robust.  Plus, the time needed for that should be negligible
compared to the actual eigenvalue computations.
parent 24b71c6d
No related branches found
No related tags found
No related merge requests found
...@@ -73,6 +73,8 @@ namespace Dune { ...@@ -73,6 +73,8 @@ namespace Dune {
std::cerr << "For matrix " << matrix << " eigenvalue calculation failed! " << std::endl; std::cerr << "For matrix " << matrix << " eigenvalue calculation failed! " << std::endl;
DUNE_THROW(InvalidStateException,"eigenValues: Eigenvalue calculation failed!"); DUNE_THROW(InvalidStateException,"eigenValues: Eigenvalue calculation failed!");
} }
eigenValues.resize(N);
for (int i=0; i<N; ++i) for (int i=0; i<N; ++i)
eigenValues[i] = std::complex<double>(eigenR[i], eigenI[i]); eigenValues[i] = std::complex<double>(eigenR[i], eigenI[i]);
} }
......
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