Releases: jewettaij/jacobi_pd
updated test code
many small changes that could break backward compatibility
- I changed "matrix_alloc" to "matrix_alloc_jpd" everywhere to reduce the chance of future naming collisions.
(This should not effect most users unless they were explicitly using "#include<matrix_alloc.hpp>", in their code. In that case they will have to change that line to "#include<matrix_alloc_jpd.hpp>". However there is no reason I can think of that most users would want to include this header file in their code, so hopefully this small change won't effect many people.) - Jacobi::Diagonalize() now returns number of iterations (ie. the number of off-diagonal pivots considered, which is always > 0), or 0 when convergence failed. (In the past, it used to return the number of sweeps, where each "sweep" corresponds to n(n-1)/2 iterations.) Now it's much easier to tell if it converged or not, simply by checking whether the return value is 0. (Note: If you were not checking for convergence, then this change to jacobi_pd should not break compatibility with your code.)
- This code now runs on 1x1 matrices without crashing.
- "include<cassert>" was removed. (I also commented out all of the assert() statements. I left them in the code because I think they improve code readability.)
I don't anticipate making any future modifications which will break backward compatibility.
renamed files and added a missing #include
renamed:
-jacobi.hpp -> jacobi_pd.h
-jacobi_public_doman -> jacobi_pd
added:
#include <algorithm>
corrected a typo in the C++11 move constructor
I discovered that in some 3rd-party code which uses the Jacobi class, that typo was causing compile failures. I also improved the automated tests using examples containing const vector<vector>, const array<array>, and const fixed-size arrays.
automated tests should be more robust now
In previous releases, the tests run by travis (tests/test_jacobi.cpp) only work if the arguments supplied are chosen to avoid large differences in eigenvalue magnitudes. Due to numeric underflow, it is normal for significant errors to appear in low-magnitude eigenvalues (and corresponding eigenvectors) whenever the difference between the magnitudes of the smallest and largest eigenvalues exceed 1.0e10. This is normal even if the algorithm is working correctly. To be fair, huge differences in eigenvalue magnitudes like this are not usually encountered. However such matrices would cause the automated tests to fail. Now, the automated tests are smart enough to avoid concluding that the test has failed in these cases.
A new argument (eps) was also introduced allowing the tolerance to be set by the caller (instead of a constant). (It is 1.0e-06 by default.)
simplified matrix_alloc.hpp
matrix_alloc.hpp is shorter.
(One or two outdated irrelevant crufty comments were removed.)
added a default template argument and simplified examples
Creating a new instance of Jacobi currently only requires a minimum of 3 template arguments. This was used to simplify the example in the README.md file. (In the past, 4 template arguments were rewuired.) Several other small changes were also made.
added a default constructor and a set function (Jacobi::SetSize())
Added a default constructor and made "Jacobi::SetSize()" public. (It is conceivable that some use cases may require a default constructor.) This way, the size of the matrices to be analyzed by Jacobi::Diagonalized() can be specified later after an instance of Jacobi is created.
coverage and benchmark tests added
A couple small changes in jacobi.hpp were to make it easier to perform code coverage tests. In addition, some small changes were made to "test_jacobi.cpp" (formerly "test.cpp") to make it easier to do benchmarking tests. (Code-coverage and benchmark results were also added to the README.md file.)
now also works with C arrays of fixed size
unit tests also test for compatibility with fixed size C arrays (in addition to several other array types that were tested earlier). Only the testing code was effected. The jacobi.hpp file remains unchanged from the v1.1.0 release.