For num_points greater than about 80, the largest points are
clamped to the upper bound, and the duplicates are removed, so
fewer than num_points points are returned.
numdiff_type limits num_sparsity_points to 50 for this reason.
Arguments
Type
Intent
Optional
Attributes
Name
integer,
intent(in)
::
num_points
the number of points in the interval
Return Value
real(kind=wp), dimension(:), allocatable
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed
arrows point from an interface to procedures which implement that interface.
This could include the module procedures in a generic interface or the
implementation in a submodule of an interface in a parent module.
Nodes of different colours represent the following:
Solid arrows point from a procedure to one which it calls. Dashed
arrows point from an interface to procedures which implement that interface.
This could include the module procedures in a generic interface or the
implementation in a submodule of an interface in a parent module.
Source Code
function divide_interval(num_points)result(points)implicit noneinteger,intent(in)::num_points!! the number of points in the intervalreal(wp),dimension(:),allocatable::points!! the resultant vectorreal(wp),parameter::noise=1.012345678901234567_wp!! a noise value. Not a round number!! so as to avoid freak zeros in the!! jacobianreal(wp),parameter::min_val=10.0_wp*epsilon(1.0_wp)!! the minimize distance from the lower boundreal(wp),parameter::max_val=1.0_wp-min_val!! the minimize distance from the upper boundinteger::i!! counterreal(wp)::delta!! step sizereal(wp),dimension(:),allocatable::tmp!! a temp array to hold the valuesdelta=1.0_wp/(num_points+1)allocate(tmp(num_points))do i=1,num_pointstmp(i)=min(max(min_val,delta*i*noise),max_val)end do! this is to protect for the min/max case if there! are enough points so that some are duplicated near! the bounds:points=unique(tmp,chunk_size=10)end function divide_interval