You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fromlinear_operator.operatorsimportDiagLinearOperator, LowRankRootLinearOperator# C = torch.randn(1000, 20)# d = torch.randn(1000)# b = torch.randn(1000)A=LowRankRootLinearOperator(C) +DiagLinearOperator(d) # represents C C^T + diag(d)torch.linalg.solve(A, b) # computes A^{-1} b efficiently!
will give
NotPSDError: Matrix not positive definite after repeatedly adding jitter up to 1.0e-06.
** Think you know how to fix the docs? ** (If so, we'd love a pull request from you!)
fromlinear_operator.operatorsimportDiagLinearOperator, LowRankRootLinearOperatorC=torch.randn(1000, 20)
d=torch.ones(1000) *1e-9b=torch.randn(1000)
A=LowRankRootLinearOperator(C) +DiagLinearOperator(d)
torch.linalg.solve(A, b)
Hmm yeah d should just not be sampled from a normal distribution - you'll end up adding negative values to the diagonal. Something like d = 1e-9 + torch.rand(1000) should be safe.
📚 Documentation/Examples
** Is documentation wrong? **
In readme example for LinearOperator: https://github.com/cornellius-gp/linear_operator?tab=readme-ov-file#with-linearoperator
will give
** Think you know how to fix the docs? ** (If so, we'd love a pull request from you!)
should solve the issue
(Link to LinearOperator documentation)
The text was updated successfully, but these errors were encountered: