qttools.wave_function_solver#
source package qttools.wave_function_solver
Classes
Bases : ABC
Abstract base class for wave function solvers.
Methods
-
solve — Solves the sparse linear system a @ x = b.
source method WFSolver.solve(a: sparse.spmatrix, b: NDArray) → NDArray
Solves the sparse linear system a @ x = b.
Parameters
-
a : sparse.spmatrix — The sparse system matrix.
-
b : NDArray — The right-hand side vector.
Returns
-
x : NDArray — The solution vector.
Bases : WFSolver
Wave function solver using LU decomposition for solving.
This solver uses the SuperLU on the CPU for facorization. Depending on the chosen array module, the solution phase is computed on the CPU or GPU.
Methods
-
solve — Solves the sparse system a @ x = b using LU decomposition.
source method SuperLU.solve(a: sparse.spmatrix, b: NDArray) → NDArray
Solves the sparse system a @ x = b using LU decomposition.
Parameters
-
a : sparse.spmatrix — The sparse system matrix.
-
b : NDArray — The right-hand side vector.
Returns
-
x : NDArray — The solution vector.
source class MUMPS(reuse_analysis: bool = True, ordering: str = 'metis', verbose: bool = False)
Bases : WFSolver
Wave function solver using MUMPS for sparse matrix solving.
This solver uses MUMPS to solve sparse linear systems on the CPU. It can reuse the analysis phase if configured to do so, which can speed up repeated solves with the same matrix structure.
Initializes the MUMPS wave function solver.
Parameters
-
reuse_analysis : bool, optional — If True, reuse the analysis phase for subsequent solves with the same matrix structure. Default is True.
-
ordering : str, optional — The ordering method to use for the matrix factorization. Valid options are 'amd', 'amf', 'scotch', 'pord', 'metis', 'qamd', and 'auto'. Default is 'auto'. The 'metis' and 'scotch' orderings are apparently usually pretty good. The 'auto' option will let MUMPS choose the "best" ordering. Default is 'metis'.
-
verbose : bool, optional — If True, enable verbose output from MUMPS. Default is False.
Methods
-
solve — Solves the sparse linear system a @ x = b using MUMPS.
source method MUMPS.solve(a: sparse.spmatrix, b: NDArray) → NDArray
Solves the sparse linear system a @ x = b using MUMPS.
Parameters
-
a : sparse.spmatrix — The sparse system matrix.
-
b : NDArray — The right-hand side vector.
Returns
-
x : NDArray — The solution vector.
source class cuDSS(explicitely_reset_operands: str = 'b', use_multithreading: bool = True)
Bases : WFSolver
Wave function solver using cuDSS for sparse matrix solving.
This solver uses the cuDSS library to solve sparse linear systems on NVIDIA GPUs.
Initializes the cuDSS wave function solver.
Parameters
-
explicitely_reset_operands : str, optional — String indicating which operands to reset explicitly. If "a" is in the string, the system matrix
awill be reset before solving. If "b" is in the string, the right-hand side vectorbwill be reset before solving. Default is "b", meaning only the right-hand side vector will be reset. -
use_multithreading : bool, optional — Whether to use multithreading for the solver. If True, it will attempt to find a suitable multithreading library. Default is True.
Methods
-
solve — Solves the sparse linear system a @ x = b using cuDSS.
source method cuDSS.solve(a: sparse.spmatrix, b: NDArray) → NDArray
Solves the sparse linear system a @ x = b using cuDSS.
Parameters
-
a : sparse.spmatrix — The sparse system matrix.
-
b : NDArray — The right-hand side vector.
Returns
-
x : NDArray — The solution vector.