Computes the sparsity pattern and return it. Uses the settings currently in the class.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(numdiff_type), | intent(inout) | :: | me | |||
real(kind=wp), | intent(in), | dimension(:) | :: | x |
vector of variables (size |
|
integer, | intent(out), | dimension(:), allocatable | :: | irow |
sparsity pattern nonzero elements row indices |
|
integer, | intent(out), | dimension(:), allocatable | :: | icol |
sparsity pattern nonzero elements column indices |
|
integer, | intent(out), | optional, | dimension(:), allocatable | :: | linear_irow |
linear sparsity pattern nonzero elements row indices |
integer, | intent(out), | optional, | dimension(:), allocatable | :: | linear_icol |
linear sparsity pattern nonzero elements column indices |
real(kind=wp), | intent(out), | optional, | dimension(:), allocatable | :: | linear_vals |
linear sparsity values (constant elements of the Jacobian) |
subroutine compute_sparsity_pattern(me,x,irow,icol,linear_irow,linear_icol,linear_vals) implicit none class(numdiff_type),intent(inout) :: me real(wp),dimension(:),intent(in) :: x !! vector of variables (size `n`) integer,dimension(:),allocatable,intent(out) :: irow !! sparsity pattern nonzero elements row indices integer,dimension(:),allocatable,intent(out) :: icol !! sparsity pattern nonzero elements column indices integer,dimension(:),allocatable,intent(out),optional :: linear_irow !! linear sparsity pattern !! nonzero elements row indices integer,dimension(:),allocatable,intent(out),optional :: linear_icol !! linear sparsity pattern nonzero !! elements column indices real(wp),dimension(:),allocatable,intent(out),optional :: linear_vals !! linear sparsity values (constant !! elements of the Jacobian) if (me%exception_raised) return ! check for exceptions if (associated(me%compute_sparsity)) then call me%compute_sparsity(x) if (me%exception_raised) return ! check for exceptions call me%get_sparsity_pattern(irow,icol,linear_irow,linear_icol,linear_vals) end if end subroutine compute_sparsity_pattern