I’m using a few LAPACK routines and to ensure that I use them properly, I’ve written interface blocks like
pure subroutine dgesv(n,nrhs,a,lda,ipiv,b,ldb,info)
integer, intent(in) :: n,nrhs,lda,ldb
real, intent(inout), dimension(lda,n) :: a
integer, intent(out), dimension(n) :: ipiv
real, intent(inout), dimension(ldb,nrhs) :: b
integer, intent(out) :: info
end subroutine dgesv
where the pure
attribute is debatable because some routines can write to screen.
Theoretically, the interfaces can be auto-generated from the LAPACK Doxygen documentation, but that would require that it follows a very rigid scheme of notation.
I was wondering if such interfaces are available somewhere, @ivanpribec for example uses
subroutine factorize_sp(this,info)
use lapack, only: lapack_factorize => sgetrf
type(lu_workspace(sp,*)), intent(inout) :: this
integer, intent(out), optional :: info
include "lu_pdt.inc"
end subroutine
in Purpose of kind parameters in derived types - #2 by ivanpribec.
As far as I see, LAPACK95 -- Fortran95 interface to LAPACK has a similar/the same aim but it seems to be abandoned for 20 years.