A sparsity pattern
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
logical, | private | :: | sparsity_computed | = | .false. |
has the sparsity pattern already been computed? |
|
integer, | private | :: | num_nonzero_elements | = | 0 |
number of nonzero elements in the jacobian
(will be the dimension of |
|
integer, | private, | dimension(:), allocatable | :: | irow |
sparsity pattern - rows of non-zero elements |
||
integer, | private, | dimension(:), allocatable | :: | icol |
sparsity pattern - columns of non-zero elements |
||
logical, | private | :: | linear_sparsity_computed | = | .false. |
if the linear pattern has been populated |
|
integer, | private | :: | num_nonzero_linear_elements | = | 0 |
number of constant elements in the jacobian |
|
integer, | private, | dimension(:), allocatable | :: | linear_irow |
linear sparsity pattern - rows of non-zero elements |
||
integer, | private, | dimension(:), allocatable | :: | linear_icol |
linear sparsity pattern - columns of non-zero elements |
||
real(kind=wp), | private, | dimension(:), allocatable | :: | linear_vals |
linear elements of the jacobian |
||
integer, | private, | dimension(:), allocatable | :: | indices |
index vector
|
||
integer, | private | :: | maxgrp | = | 0 |
the number of groups in the partition
of the columns of |
|
integer, | private, | dimension(:), allocatable | :: | ngrp |
specifies the partition of the columns of |
Wrapper for dsm to compute the sparsity pattern partition.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(sparsity_pattern), | intent(inout) | :: | me | |||
integer, | intent(in) | :: | n |
number of columns of jacobian matrix |
||
integer, | intent(in) | :: | m |
number of rows of jacobian matrix |
||
integer, | intent(out) | :: | info |
status output from dsm |
Computes the indices
vector in the class.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(sparsity_pattern), | intent(inout) | :: | me |
destroy a sparsity_pattern type.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(sparsity_pattern), | intent(out) | :: | me |
Print the sparsity pattern.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(sparsity_pattern), | intent(in) | :: | me | |||
integer, | intent(in) | :: | n |
number of variables (columns of jacobian) |
||
integer, | intent(in) | :: | m |
number of functions (rows of jacobian) |
||
integer, | intent(in) | :: | iunit |
file unit to write to. (assumed to be already opened) |
||
logical, | intent(in), | optional | :: | dense |
if present and true, the matrix form of the sparsity pattern is printed (default is vector form) |
Returns the columns in a sparsity partition group.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(sparsity_pattern), | intent(in) | :: | me | |||
integer, | intent(in) | :: | igroup |
group number. Should be |
||
integer, | intent(out) | :: | n_cols |
number of columns in the |
||
integer, | intent(out), | dimension(:), allocatable | :: | cols |
the column numbers in the |
|
integer, | intent(out), | dimension(:), allocatable | :: | nonzero_rows |
the row numbers of all the nonzero Jacobian elements in this group |
|
integer, | intent(out), | dimension(:), allocatable | :: | indices |
nonzero indices in |
|
logical, | intent(out) | :: | status_ok |
true if the partition is valid |
type,public :: sparsity_pattern !! A sparsity pattern private logical :: sparsity_computed = .false. !! has the sparsity pattern already been computed? integer :: num_nonzero_elements = 0 !! number of nonzero elements in the jacobian !! (will be the dimension of `irow` and `icol`) integer,dimension(:),allocatable :: irow !! sparsity pattern - rows of non-zero elements integer,dimension(:),allocatable :: icol !! sparsity pattern - columns of non-zero elements logical :: linear_sparsity_computed = .false. !! if the linear pattern has been populated integer :: num_nonzero_linear_elements = 0 !! number of constant elements in the jacobian integer,dimension(:),allocatable :: linear_irow !! linear sparsity pattern - rows of non-zero elements integer,dimension(:),allocatable :: linear_icol !! linear sparsity pattern - columns of non-zero elements real(wp),dimension(:),allocatable :: linear_vals !! linear elements of the jacobian integer,dimension(:),allocatable :: indices !! index vector !! `[1,2,...,num_nonzero_elements]` !! for putting `df` into `jac` integer :: maxgrp = 0 !! the number of groups in the partition !! of the columns of `a`. integer,dimension(:),allocatable :: ngrp !! specifies the partition of the columns of `a`. !! column `jcol` belongs to group `ngrp(jcol)`. !! `size(n)` contains private procedure :: dsm_wrapper procedure :: compute_indices procedure,public :: destroy => destroy_sparsity procedure,public :: print => print_sparsity procedure,public :: columns_in_partition_group end type sparsity_pattern