Jutho / TensorKit.jl

A Julia package for large-scale tensor computations, with a hint of category theory
MIT License
230 stars 41 forks source link

Question: solving linear equations #165

Closed Yue-Zhengyuan closed 3 days ago

Yue-Zhengyuan commented 5 days ago

There's no discussion section in this repo, so I have to ask here...

Suppose that three linear maps are related by A * X = B; or more generally, three tensors (possibly fermionic) A, X, C are related by some @tensor or @ncon expression. Is it currently implemented to solve X from A and B, or we have to solve in each symmetry block manually?

Jutho commented 5 days ago

If it is A * X = B, common linear algebra operations like inv, pinv, \ and / should work on (Abstract)TensorMap instances. If it is some more complicated linear operation like an @ncon expression, an alternative may be to solve it using KrylovKit.jl's linsolve. That is supposed to be for large-scale operations where you do not want to compute the exact inverse, but if optimal performance is not really necessary, it should deal with small problems just fine.

Yue-Zhengyuan commented 3 days ago

Figured out how to use KrylovKit's linsolve after a while. Thank you!