numba-scipy
numba-scipy copied to clipboard
Overloads for scipy.linalg functions
This PR provides numba overloads for functions in the scipy linalg library, including:
linalg.schur
linalg.qz
linalg.ordqz
linalg.solve_discrete_lyapunov
linalg.solve_continuous_lyapunov
The implementations are modeled on the numba.np.linalg
implementations, although without special cython wrappers. Instead, i use intrinsics and ctypes as suggested here and here. Functions can be called on all data types supported by LAPACK.
It's not completely ready to be merged. For one thing, the overloads from linalg.overloads
aren't automatically loaded via import numba_scipy
. In addition, the function signatures don't exactly match those in scipy.linalg
. Specifically, arguments related to configuring LAPACK functions, such as overwrite_a
and lwork
in linalg.schur
, are not supported. Instead, a workspace query is always run in any function that requires a workspace.
These functions were admittedly chosen somewhat randomly (based on my personal needs), but it is my hope this PR can serve as a starting point for a conversation about a larger effort to numbfy the scipy.linalg
package. Notably, #43 and #33 request linalg.logm
, which requires schur decomposition, so this PR would be a first step towards meeting those needs. It also suggests an extendable framework that allows more LAPACK wrappers to be easily written and transformed into overloads for linalg
functions.