sparse_dot icon indicating copy to clipboard operation
sparse_dot copied to clipboard

Solve sparse linear system for complex numbers

Open GitHubOpenIssue opened this issue 1 year ago • 5 comments

GitHubOpenIssue avatar Sep 14 '24 13:09 GitHubOpenIssue

The MKL sparse QR solver doesn't support complex floats, only reals: https://www.intel.com/content/www/us/en/docs/onemkl/developer-reference-c/2024-0/sparse-qr-routines.html

asistradition avatar Sep 16 '24 15:09 asistradition

Is it true? pyMKL is a Python wrapper of Intel MKL routines and solves sparce linear systems with support for complex numbers.

I'm a bit confused. Maybe the last MKL version erased it?

GitHubOpenIssue avatar Sep 16 '24 20:09 GitHubOpenIssue

The pardiso solver supports complex floats. Wrapping it for python wouldn't be terribly difficult but the interface is complex compared to the QR solver.

asistradition avatar Sep 16 '24 22:09 asistradition

Thank you for your replay,

Yes but I need it for electromagnetc field simulation where fields are complex numbers. That is the reason.


GitHubOpenIssue avatar Sep 23 '24 19:09 GitHubOpenIssue

Aight I have added a wrapper for pardisoinit and pardiso in d12521d2eac15d826ee6eb172fdf0d7b9f7b6a66 and they can be called as follows:

from sparse_dot_mkl.solvers import pardiso, pardisoinit

pt, iparm = pardisoinit(11, single_precision=True)

X, pt, perm, error = pardiso(
    A,    # CSR MATRIX
    B,    # Dense Matrix
    pt,
    11,  # mtype
    iparm,
    13   # phase
)

I can't promise every pardiso option will work; I've only added tests for real & complex nonsymmetric A.

asistradition avatar Oct 03 '24 21:10 asistradition