SF_ARRAYS

Description

SciFortran module for array creation and manipulation

Quick access

Routines:

linspace(), logspace(), arange(), upmspace(), upminterval(), powspace()

Subroutines and functions

function  sf_arrays/linspace(start, stop, num[, istart, iend, mesh])

Returns an array of evenly spaced numbers over a specified interval. Returns num evenly spaced samples, calculated over the interval [start, stop]. The start and end points of the interval can optionally be excluded.

Parameters:
  • start [real] – Starting value of the sequence

  • stop [real] – End value of the sequence

  • num [integer] – Number of samples to generate

Options:
  • istart [logical] – If .true., start is included in the resulting array. Default .true.

  • iend [logical] – If .true., stop is included in the resulting array. Default .true.

  • mesh [real] – If present, the step is saved in this variable

Return:

array (num) [real] – Contains num equally spaced samples in the interval [start, stop], left/right open or closed depending on istart and iend

function  sf_arrays/logspace(start, stop, num[, base])

Returns numbers spaced evenly on a log scale. In linear space, the sequence starts at start and ends with stop (differently from numpy).

Parameters:
  • start [real] – The starting value of the sequence. Must be positive. If set to 0, it will be reshifted to 1e-12

  • stop [real] – The end value of the sequence. Must be positive. If set to 0, it will be reshifted to 1e-12

  • num [integer] – Number of samples to generate

Options:

base [real] – The base of the exponential. Default 10

Return:

array (num) [real] – Contains num samples, equally spaced on a log scale in the closed interval [start, stop]

function  sf_arrays/arange(start, num)

Returns an array of num integers starting with start

Parameters:
  • start [integer] – First element of the array

  • num [integer] – Length of the array

Return:

array (num) [integer] – Contains the integer numbers in [start, start+num-1]

function  sf_arrays/upmspace(start, stop, p, u, ndim[, base, istart, iend, mesh])

Returns an array of number spaced linearly between exponentially spaced checkpoints. The interval [start, stop] is first divided into p coarse regions, the width of which is exponentially increasing so that the i-th checkpoint is (stop - start) \(\cdot\) base ^ ( - p + i ). Each of the coarse intervals is then linearly divided in u subintervals.

Parameters:
  • start [real] – First element of the array

  • stop [real] – Last element of the array

  • p [integer] – Number of coarse subdivisions

  • u [integer] – Number of fine subdivisions

Options:
  • ndim [integer] – Length of the out array, must be \(p \cdot u\) or \(p \cdot u + 1\)

  • base [real] – Base of the exponential spacing (default 2)

  • istart [logical] – If .true., start is included in the resulting array. Default .true.

  • iend [logical] – If .true., stop is included in the resulting array. Default .true.

  • mesh (ndim) [real] – If present, contains the distances between consecutive points in aout. The last element is \(aout(ndim) - aout(ndim-1)\)

Return:

aout (ndim) [real] – Contains p coarse exponentially-spaced checkpoints, each two of which separated by u linearly spaced points

function  sf_arrays/upminterval(start, stop, midpoint, p, q[, type, base, mesh])

Returns an array of number spaced linearly between exponentially spaced checkpoints, specularly around a middle point between the interval extrema. This is achieved by calling upmspace() twice in a mirror-like fashion. The exponential thickening of the mesh can be around the middle ( type !=0 ) or the boundaries( type =0 )

Parameters:
  • start [real] – First element of the array

  • stop [real] – Last element of the array

  • midpoint [real] – Middle point of the array. The distance between the coarse checkpoints behaves specularly on the two sides

  • p [integer, in,required] – Number of coarse subdivisions

  • q [integer, in,required] – If present, contains the distances between consecutive points in array. The last element is \(array(2 \cdot p \cdot q+1) - array(2 \cdotp \cdot q)\)

Options:
  • type [integer] – If =0, mesh is thicker around start and stop. If =1, mesh is thicker around midpoint. Default 0

  • base [real] – Base of the exponential spacing (default 2)

  • mesh (1 + 2 · p · q) [real] – If present, contains the distances between consecutive points in array. The last element is \(array(2 \cdot p \cdot q+1) - array(2 \cdotp \cdot q)\)

Return:

array (1 + 2 · p · q) [real] – Contains \(2 \cdot p \cdot q+1\) points

function  sf_arrays/powspace(start, stop, num[, base])

Returns numbers spaced evenly on an exponential scale. The i-th number is start + (stop - start) \(\cdot\) base ^ ( - num + i )

Parameters:
  • start [real] – first element of the array

  • stop [real] – last element of the array

  • num [integer] – number of elements of the array

Options:

base [real] – base of the exponential (defaule 2)

Return:

array (num) [real] – contains num exponentially spaced reals