GetDiagonal
This subroutine returns the diagonal entries of sparse matrix.
This Routine calls the Saad's sparse library.
offset: containing theoffsetof the wanted diagonal. The diagonal extracted is the one corresponding to the entriesa(i,j)withj-i = offset. Therefore,offset = 0means the main diagonaldiag: real array of lengthnrowcontaining the wanted diagonal.diagcontains the diagonal (a(i,j),j-i = offset) as defined above.idiag= integer array. It contains the poisitions of diagonal in the original arraysA. Ifidiag(i)=0then it means that there was no diagonal found inrow=i.
MODULE SUBROUTINE GetDiagonal( obj, A, diag, idiag, offset )
TYPE( CSRSparsity_ ), INTENT( IN ) :: obj
REAL( DFP ), INTENT( IN ) :: A( : )
REAL( DFP ), ALLOCATABLE, INTENT( INOUT ) :: diag( : )
!! Diagonal entries
INTEGER( I4B ), ALLOCATABLE, INTENT( INOUT ) :: idiag( : )
!! Position of diagonal entries in `A(:)`
INTEGER( I4B ), OPTIONAL, INTENT( IN ) :: offset
!! offset of the wanted diagonal
END SUBROUTINE GetDiagonal
The following routine is similar to the above routine, however, this routine does not return the position of diagonal in A.
MODULE SUBROUTINE GetDiagonal( obj, A, diag, offset )
TYPE( CSRSparsity_ ), INTENT( INOUT ) :: obj
REAL( DFP ), INTENT( IN ) :: A( : )
!! Sparse matrix values
REAL( DFP ), ALLOCATABLE, INTENT( INOUT ) :: diag( : )
!! Diagonal entries
INTEGER( I4B ), OPTIONAL, INTENT( IN ) :: offset
!! offset of diagonal
END SUBROUTINE GetDiagonal