devzhk / Pytorch-linalg

6 stars 1 forks source link

Speed / accuracy comparison against `torch.linalg.solve` #1

Open lezcano opened 3 weeks ago

lezcano commented 3 weeks ago

I would expect this Python implementation to be quite a bit slower than linalg.solve. If this is the case, the applications of this would be to use it with custom operators, which PyTorch doesn't currently support natively (see https://github.com/pytorch/pytorch/issues/28341)

devzhk commented 3 weeks ago

I'd like to elaborate on more fundamental reasons why CG and GMRES are needed and where they may be useful.

In summary,

devzhk commented 3 weeks ago

The specific implementation can always be optimized later; however, it is probably better to consider whether it's good to incorporate these new algorithms from a more strategic, long-term perspective for the development of PyTorch.

lezcano commented 3 weeks ago

For generic systems we have lstsq. For symmetric non-definite systems we have https://pytorch.org/docs/stable/generated/torch.linalg.ldl_factor.html.

That being said, I do agree that these solvers could potentially be of interest, but before adding them to PyTorch core, we would need to: