fortran-lang / stdlib

Fortran Standard Library
https://stdlib.fortran-lang.org
MIT License
1.02k stars 161 forks source link

linalg: solve #806

Closed perazz closed 1 month ago

perazz commented 2 months ago

Linear system solution $Ax=b$, for both 1-rhs (b(:)) or n-rhs (b(:,:)) cases, based on LAPACK *GESV functions.

Prior art:

Proposed implementation:

Example calls:

cc: @jvdp1 @zoziha @jalvesz @fortran-lang/stdlib: I believe this is ready for consideration.

perazz commented 2 months ago

@jvdp1 @zoziha I've implemented a pure subroutine interface, that looks like this:

call solve_lu(a,b,x,pivot=ipiv,overwrite_a=.true.,err=err)

Please, let me know what you think of this approach, I will complete the documentation for this after we've defined the final version. Thanks!

jvdp1 commented 2 months ago

@jvdp1 @zoziha I've implemented a pure subroutine interface

Great! Thanks @perazz. LGTM

  • Is solve_lu a good name? I've chosen this because it follows the same pattern as solve_lstsq in the least-squares interface

LGTM. it makes sense and gives some info on how it is solves.

perazz commented 1 month ago

Dear all @jvdp1 @jalvesz @zoziha I've documented the subroutine interface and added a no-allocation example. I believe this should be ready now. pivot is the only pre-allocated array needed in this case. I suggest we wait until we have the full picture (what pre-allocated arrays do svd, eig, etc. need? ) so we can create a linalg_storage type a posteriori

jvdp1 commented 1 month ago

Thank you @perazz . I will merge it. As discussed here, I will prepare a new release today/tomorrow.

perazz commented 1 month ago

Thanks a lot @jvdp1