Skip to content

Commit

Permalink
updated README.md and attempted to augment test_jacobi.cpp to test fo…
Browse files Browse the repository at this point in the history
…r convergence failure (in an effort to restore 100% code coverage again)
  • Loading branch information
jewettaij committed Nov 28, 2020
1 parent a5a9352 commit e72d33b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,14 @@ Jacobi<double, double*, double**> eigen_calc(n);

// Note:
// If the matrix you plan to diagonalize (M) is read-only, use this instead:
// Jacobi<double, double*, double**, double const*const*> eigen_calc(n);
// If you prefer using vectors over C-style pointers, this works also:
// Jacobi<double, vector<double>&, vector<vector<double>>&> eigen_calc(n);
// Jacobi<double, double*, double**, double const*const*> eigen_calc(n);
// If you prefer using C++ vectors over C-style pointers, this works also:
// Jacobi<double, vector<double>&, vector<vector<double>>&,
// const vector<vector<Scalar>>&> eigen_calc(n);

// Now, calculate the eigenvalues and eigenvectors of M

eigen_calc.Diagonalize(M, evals, evects);
eigen_calc.Diagonalize(M, evals, evects); //(succeeded if return value is != 0)
```
## Benchmarks
Expand Down
10 changes: 10 additions & 0 deletions tests/test_jacobi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,16 @@ void TestJacobi(int n, //<! matrix size
Scalar*,
Scalar**,
Scalar const*const*>::SORT_INCREASING_ABS_EVALS);
// Also make sure the code considers a scenario where convergence fails:
ecalc.Diagonalize(M,
evals,
evecs,
Jacobi<Scalar,
Scalar*,
Scalar**,
Scalar const*const*>::SORT_INCREASING_ABS_EVALS,
true,
0); //<-- set the maximum allowed iterations to 0
#endif

for (int i = 1; i < n; i++)
Expand Down

0 comments on commit e72d33b

Please sign in to comment.