linspace Function

public function linspace(left, right, npoints, endpoint, stagger) result(points)

Returns an array of evenly spaced points over an interval from left to right. The endpoints on both sides can optionally be included. Optionally staggering can be used which effectively shifts all points by half the grid spacing to the right, creating a staggered grid. In that case the rightmost point will exceed the right boundary specified.

Arguments

Type IntentOptional Attributes Name
real(kind=FP), intent(in) :: left

Starting point (from)

real(kind=FP), intent(in) :: right

Ending point (to)

integer, intent(in) :: npoints

Number of points. Should be >1, for =1 the left point is returned.

logical, intent(in), optional :: endpoint

If true, the endpoint is included in the points (default = false)

logical, intent(in), optional :: stagger

If true, points are staggered (default = false)

Return Value real(kind=FP), dimension(npoints)

Array of points generated (output)