torch_cg
torch_cg copied to clipboard
Preconditioned Conjugate Gradient in Pytorch
Hi, I needed an implementation of batched BICGSTAB, and found your code helpful as a starting point. I am opening this pull request in case you find this code useful...
Hi, when running your code, I spotted this small bug: https://github.com/sbarratt/torch_cg/blob/7504429f13cc66d6a4b0d5767f561abb557a2a1e/torch_cg/cg_batch.py#L104 Here, it should print "optimal" in the case when optimal, and else "reached max iter". So just switching `if`...
Hi, thanks for doing this. I'd just like to know why you moved away from C++ implementation? Was there a problem with it? Thanks,
In general, the most expensive part of any CG solve is computing `A_bmm`. This version will do it once per iteration rather than three times.