-
Notifications
You must be signed in to change notification settings - Fork 192
Open
Labels
ideaProposition of an idea and opening an issue to discuss itProposition of an idea and opening an issue to discuss ittopic: linalgLinear algebraLinear algebra
Description
In support of: j3-fortran/fortran_proposals#14
Prior art:
- Python numpy.fill_diagonal
- Julia LinearAlgebra.diagind (returns indices of diagonal elements which can then be used to assign to a diagonal)
- MATLAB diag (enabled by MATLAB's special assignment syntax)
Target module: stdlib_linalg
Proposed signature:
! Scalar diagonal variant
pure subroutine set_diag(d, A, k)
{integer(*), real(*)}, complex(*)}, intent(in) :: d !! Value to set the diagonal to
{integer(*), real(*)}, complex(*)}, intent(inout) :: A(:,:) !! Matrix to set the diagonal in
integer, intent(in), optional :: k !! Number of the diagonal
! Array diagonal variant
pure subroutine set_diag(d, A, k)
{integer(*), real(*)}, complex(*)}, intent(in) :: d(:) !! Values to set the diagonal to
{integer(*), real(*)}, complex(*)}, intent(inout) :: A(:,:) !! Matrix to set the diagonal in
integer, intent(in), optional :: k !! Number of the diagonal
Metadata
Metadata
Assignees
Labels
ideaProposition of an idea and opening an issue to discuss itProposition of an idea and opening an issue to discuss ittopic: linalgLinear algebraLinear algebra