SF_ARRAYS
Description
SciFortran module for array creation and manipulation
Quick access
- Routines:
arange(),linspace(),logspace(),powspace(),upminterval(),upmspace()
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
numevenly 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.,startis included in the resulting array. Default.true.iend [logical] – If
.true.,stopis included in the resulting array. Default.true.mesh [real] – If present, the step is saved in this variable
- Result:
array (num) [real] – Contains
numequally spaced samples in the interval [start,stop], left/right open or closed depending onistartandiend
- function sf_arrays/logspace(start, stop, num[, base])
Returns numbers spaced evenly on a log scale. In linear space, the sequence starts at
startand ends withstop(differently from numpy).- Parameters:
start [real] – The starting value of the sequence. Must be positive. If set to
0, it will be reshifted to1e-12stop [real] – The end value of the sequence. Must be positive. If set to
0, it will be reshifted to1e-12num [integer] – Number of samples to generate
- Options:
base [real] – The base of the exponential. Default
10- Result:
array (num) [real] – Contains
numsamples, equally spaced on a log scale in the closed interval [start, stop]
- function sf_arrays/arange(start, num)
Returns an array of
numintegers starting withstart- Parameters:
start [integer] – First element of the array
num [integer] – Length of the array
- Result:
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 intopcoarse 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 inusubintervals.- 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.,startis included in the resulting array. Default.true.iend [logical] – If
.true.,stopis included in the resulting array. Default.true.mesh (ndim) [real] – If present, contains the distances between consecutive points in
aout. The last element isaout(ndim) - aout(ndim-1)
- Result:
aout (ndim) [real] – Contains
pcoarse exponentially-spaced checkpoints, each two of which separated byulinearly 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 isarray(2 · p · q+1) - array(2 · p · q)
- Options:
type [integer] – If
=0, mesh is thicker aroundstartandstop. If=1, mesh is thicker aroundmidpoint. Default0base [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 isarray(2 · p · q+1) - array(2 · p · q)
- Result:
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 isstart+ (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)- Result:
array (num) [real] – contains
numexponentially spaced reals