Open ivan-pi opened 4 years ago
I was working on some Kalman filter stuff today, and I realized this would be useful to check I am calling the right sequence of BLAS and LAPACK routines.
Nice proposition. It is something I often use in Octave.
Point for discussion: two separate functions (without or with diagonal) as shown above or only a single interface using the
present
intrinsic?
Why would you like 2 separate functions? I would suggest to implement only one function and use the optval
function for the optional
integer.
- Would we like a subroutine version which works in-place? In Julia they use the
tril!(M)
andtriu!(M)
syntax for this purpose.
Yes, I would. However, I don't really like the sign "!" used in Julia.
Great idea, thanks.
Regarding in-place, see #177 for a discussion about the syntax. We can't use ! in Fortran (plus I don't really like it anyway).
triu and tril
tril
- lower triangular part of an arraytriu
- upper triangular part of an arrayReturn a copy of the lower/upper triangular part of a rank-2 array. The elements below/above the
k
-th diagonal are replaced with zeroes (defaultk=0
)Useful to recover the lower or upper part of a matrix factorization.
Interface
Analogous interface for
triu
. The interfaces would go to the filestdlib_experimental_linalg.f90
. Implementations would go to the submodulestdlib_experimental_linalg_trilu.f90
.Point for discussion: two separate functions (without or with diagonal) as shown above or only a single interface using the
present
intrinsic?Other languages
Julia
MATLAB
Python (NumPy)
C++
Other
tril!(M)
andtriu!(M)
syntax for this purpose.