Implement a better test for implicit
While working on #97 (closed) I accidentally broke the implicit mode by not ensuring that an intermediate product is wrapped in a LinearOperator
. This resulted in docs failing to build, but did pass our CI. I fixed the docs to stop building when there are errors in notebooks, however I think it would be good to have a test that is more likely to fail when we accidentally generate a dense matrix.
A way to do so would be to track memory allocations. If our Hamiltonian is sufficiently big (already a few hundred will do), then storing a single H_BB
is going to cost much larger than any other part of the algorithm. Python has tracemalloc
, and numpy docs have an example of how to track its memory usage.