Set sparsity mode.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(numdiff_type), | intent(inout) | :: | me | |||
integer, | intent(in) | :: | sparsity_mode |
the sparsity computation method:
1 - assume dense,
2 - three-point simple method,
3 - will be specified by the user in
a subsequent call to set_sparsity_pattern.
4 - computes a two-point jacobian
at |
||
real(kind=wp), | intent(in), | optional, | dimension(:) | :: | xlow_for_sparsity |
lower bounds on |
real(kind=wp), | intent(in), | optional, | dimension(:) | :: | xhigh_for_sparsity |
upper bounds on |
subroutine set_sparsity_mode(me,sparsity_mode,xlow_for_sparsity,xhigh_for_sparsity) implicit none class(numdiff_type),intent(inout) :: me integer,intent(in) :: sparsity_mode !! the sparsity computation method: !! **1** - assume dense, !! **2** - three-point simple method, !! **3** - will be specified by the user in !! a subsequent call to [[set_sparsity_pattern]]. !! **4** - computes a two-point jacobian !! at `num_sparsity_points` points. real(wp),dimension(:),intent(in),optional :: xlow_for_sparsity !! lower bounds on `x` used for !! sparsity computation (when !! `sparsity_mode` is 2). If not !! present, then `xlow` is used. real(wp),dimension(:),intent(in),optional :: xhigh_for_sparsity !! upper bounds on `x` used for !! sparsity computation (when !! `sparsity_mode` is 2). If not !! present, then `xhigh` is used. if (me%exception_raised) return ! check for exceptions ! set the sparsity function select case (sparsity_mode) case(1) ! dense me%compute_sparsity => compute_sparsity_dense case(3) ! user defined me%compute_sparsity => null() case(2) ! three-point simple method me%compute_sparsity => compute_sparsity_random ! in this case, we have the option of specifying ! separate bounds for computing the sparsity: call me%set_numdiff_sparsity_bounds(xlow_for_sparsity,xhigh_for_sparsity) case(4) ! compute 2-point jacobian in specified number of points me%compute_sparsity => compute_sparsity_random_2 ! in this case, we have the option of specifying ! separate bounds for computing the sparsity: call me%set_numdiff_sparsity_bounds(xlow_for_sparsity,xhigh_for_sparsity) case default call me%raise_exception(5,'set_sparsity_mode',& 'sparsity_mode must be 1, 2, 3, or 4.') return end select end subroutine set_sparsity_mode