ToCS means Torch Complex Solver.
This repository gives you the complex version of "torch.solve".
With ToCS, you can solve Ax = b such that A,b,x are complex.
TCS works on both CPUs and GPUs.
When you want to use ToCS on GPUs, you need to build the c++ & cuda extension code.
Run the below line once. The line enables ToCS to use cuSolver.
python setup_cuSol.py install
Usage as a torch.nn.functional. Replace of "torch.solve"
import tocs
~
# x = torch.solve(b,A)
x_r,x_i = tocs.Csolve(b_r,b_i,A_r,A_i)
_r, _i mean real, imaginary part of the tensor respectively.
On CPUs, scipy.linalg.solve works.
On GPUs, cuSolver's Dense linear solver works.
On both CPUs and GPUs, Batch is parallely computed.
- ubuntu 18
- python 3.8
- pytorch 1.4
- cuda tool kit 10
- GeForce GTX 1080 Ti