Closed perazz closed 2 months ago
Thanks @jvdp1 @jalvesz, great to iterate on the format, the more time we spend on this first LAPACK-backed function, the easier will be later.
The submodule
one is a great idea and here is an implementation.
gfortran
returns an error though:
Fixed thanks to Fortran Discourse
Thanks a lot @jvdp1 - your edits look good! I've just added that it works for either real
or complex
matrices (it would seem it was for real
only).
Thank you @jvdp1 @jalvesz for the reviews, let's wait a bit more, and if there are no further comments, I believe we could merge this before the end of the week.
I'll merge this PR. Thank you @perazz for this nice feature.
Introduce determinant operator, based on LAPACK
*GETRF
functions.xdp
Prior art:
det(a)
det(a, overwrite_a=False, check_finite=True)
DET(a)
Proposed implementation: generic interface
1)
d = det(a)
->pure
function, no additional inputs,a
is unchanged 2)d = det(a,overwrite_a=.false.,err=state)
-> not pure, option tooverwrite_a
(do not allocate a temporary), return error state handler 3).det.a
Fortran operator interface, similar to 1), pure, but with the operator methodError handling returns:
LINALG_ERROR
on singular matrixLINALG_VALUE_ERROR
on invalid matrix sizecc @jvdp1 @jalvesz @fortran-lang/stdlib