These functions change the data in some direction like differentiations, integrations and so on. The direction in which the change will applied is specified by the string parameter, which may contain ‘x’, ‘y’ or ‘z’ characters for 1-st, 2-nd and 3-d dimension correspondingly.
dat 'dir'
¶mglData
: void
CumSum (const char *
dir)
¶mglDataC
: void
CumSum (const char *
dir)
¶void
mgl_data_cumsum (HMDT
dat, const char *
dir)
¶void
mgl_datac_cumsum (HADT
dat, const char *
dir)
¶Cumulative summation of the data in given direction or directions.
dat 'dir'
¶mglData
: void
Integral (const char *
dir)
¶mglDataC
: void
Integral (const char *
dir)
¶void
mgl_data_integral (HMDT
dat, const char *
dir)
¶void
mgl_datac_integral (HADT
dat, const char *
dir)
¶Integrates (like cumulative summation) the data in given direction or directions.
dat 'dir'
¶mglData
: void
Diff (const char *
dir)
¶mglDataC
: void
Diff (const char *
dir)
¶void
mgl_data_diff (HMDT
dat, const char *
dir)
¶void
mgl_datac_diff (HADT
dat, const char *
dir)
¶Differentiates the data in given direction or directions.
dat xdat ydat [zdat]
¶mglData
: void
Diff (const mglDataA &
x)
¶mglData
: void
Diff (const mglDataA &
x, const mglDataA &
y)
¶mglData
: void
Diff (const mglDataA &
x, const mglDataA &
y, const mglDataA &
z)
¶mglDataC
: void
Diff (const mglDataA &
x)
¶mglDataC
: void
Diff (const mglDataA &
x, const mglDataA &
y)
¶mglDataC
: void
Diff (const mglDataA &
x, const mglDataA &
y, const mglDataA &
z)
¶void
mgl_data_diff_par (HMDT
dat, HCDT
x, HCDT
y, HCDT
z)
¶void
mgl_datac_diff_par (HADT
dat, HCDT
x, HCDT
y, HCDT
z)
¶Differentiates the data specified parametrically in direction x with y, z=constant. Parametrical differentiation uses the formula (for 2D case): da/dx = (a_j*y_i-a_i*y_j)/(x_j*y_i-x_i*y_j) where a_i=da/di, a_j=da/dj denotes usual differentiation along 1st and 2nd dimensions. The similar formula is used for 3D case. Note, that you may change the order of arguments – for example, if you have 2D data a(i,j) which depend on coordinates {x(i,j), y(i,j)} then usual derivative along ‘x’ will be Diff(x,y);
and usual derivative along ‘y’ will be Diff(y,x);
.
dat 'dir'
¶mglData
: void
Diff2 (const char *
dir)
¶mglDataC
: void
Diff2 (const char *
dir)
¶void
mgl_data_diff2 (HMDT
dat, const char *
dir)
¶void
mgl_datac_diff2 (HADT
dat, const char *
dir)
¶Double-differentiates (like Laplace operator) the data in given direction.
dat 'dir'
¶mglData
: void
SinFFT (const char *
dir)
¶void
mgl_data_sinfft (HMDT
dat, const char *
dir)
¶Do Sine transform of the data in given direction or directions. The Sine transform is \sum a_j \sin(k j) (see http://en.wikipedia.org/wiki/Discrete_sine_transform#DST-I).
dat 'dir'
¶mglData
: void
CosFFT (const char *
dir)
¶void
mgl_data_cosfft (HMDT
dat, const char *
dir)
¶Do Cosine transform of the data in given direction or directions. The Cosine transform is \sum a_j \cos(k j) (see http://en.wikipedia.org/wiki/Discrete_cosine_transform#DCT-I).
mglDataC
: void
FFT (const char *
dir)
¶void
mgl_datac_fft (HADT
dat, const char *
dir)
¶Do Fourier transform of the data in given direction or directions. If dir contain ‘i’ then inverse Fourier is used. The Fourier transform is \sum a_j \exp(i k j) (see http://en.wikipedia.org/wiki/Discrete_Fourier_transform).
dat 'dir'
¶mglData
: void
Hankel (const char *
dir)
¶mglDataC
: void
Hankel (const char *
dir)
¶void
mgl_data_hankel (HMDT
dat, const char *
dir)
¶void
mgl_datac_hankel (HADT
dat, const char *
dir)
¶Do Hankel transform of the data in given direction or directions. The Hankel transform is \sum a_j J_0(k j) (see http://en.wikipedia.org/wiki/Hankel_transform).
dat 'dir' k
¶mglData
: void
Wavelet (const char *
dir, int
k)
¶void
mgl_data_wavelet (HMDT
dat, const char *
dir, int
k)
¶Apply wavelet transform of the data in given direction or directions. Parameter dir set the kind of wavelet transform: ‘d’ for daubechies, ‘D’ for centered daubechies, ‘h’ for haar, ‘H’ for centered haar, ‘b’ for bspline, ‘B’ for centered bspline. If string dir contain symbol ‘i’ then inverse wavelet transform is applied. Parameter k set the size of wavelet transform.
dat 'dir'
¶mglData
: void
Swap (const char *
dir)
¶mglDataC
: void
Swap (const char *
dir)
¶void
mgl_data_swap (HMDT
dat, const char *
dir)
¶void
mgl_datac_swap (HADT
dat, const char *
dir)
¶Swaps the left and right part of the data in given direction (useful for Fourier spectrum).
dat 'dir' num
¶mglData
: void
Roll (char
dir, num
)
¶mglDataC
: void
Roll (char
dir, num
)
¶void
mgl_data_roll (HMDT
dat, char
dir, num
)
¶void
mgl_datac_roll (HADT
dat, char
dir, num
)
¶Rolls the data along direction dir. Resulting array will be out[i] = ini[(i+num)%nx] if dir='x'
.
dat 'dir'
¶mglData
: void
Mirror (const char *
dir)
¶mglDataC
: void
Mirror (const char *
dir)
¶void
mgl_data_mirror (HMDT
dat, const char *
dir)
¶void
mgl_datac_mirror (HADT
dat, const char *
dir)
¶Mirror the left-to-right part of the data in given direction. Looks like change the value index i->n-i. Note, that the similar effect in graphics you can reach by using options (see Command options), for example, surf dat; xrange 1 -1
.
dat ['dir'='xyz' da=2*pi
]
¶mglData
: void
Sew (const char *
dir, mreal
da=2*M_PI
)
¶void
mgl_data_sew (HMDT
dat, const char *
dir, mreal
da)
¶Remove value steps (like phase jumps after inverse trigonometric functions) with period da in given direction.
data ['dir'='xyz']
¶mglData
: void
Smooth (const char *
dir="xyz"
, mreal
delta=0
)
¶mglDataC
: void
Smooth (const char *
dir="xyz"
, mreal
delta=0
)
¶void
mgl_data_smooth (HMDT
dat, const char *
dir, mreal
delta)
¶void
mgl_datac_smooth (HADT
dat, const char *
dir, mreal
delta)
¶Smooths the data on specified direction or directions. String dirs specifies the dimensions which will be smoothed. It may contain characters:
By default quadratic averaging over 5 points is used.
dat ['dir'='x']
¶mglData
: void
Envelop (char
dir='x'
)
¶void
mgl_data_envelop (HMDT
dat, char
dir)
¶Find envelop for data values along direction dir.
dat 'how' q
¶mglDataC
: void
Diffraction (const char *
how, mreal
q)
¶void
mgl_datac_diffr (HADT
dat, const char *
how, mreal
q)
¶Calculates one step of diffraction by finite-difference method with parameter q=\delta t/\delta x^2 using method with 3-d order of accuracy. Parameter how may contain:
dat v1 v2 [sym=off dim=0]
¶mglData
: void
Norm (mreal
v1=0
, mreal
v2=1
, bool
sym=false
, long
dim=0
)
¶void
mgl_data_norm (HMDT
dat, mreal
v1, mreal
v2, int
sym, long
dim)
¶Normalizes the data to range [v1,v2]. If flag sym=true
then symmetrical interval [-max(|v1|,|v2|), max(|v1|,|v2|)] is used. Modification will be applied only for slices >=dim.
dat v1 v2
['dir'='z' keep=on sym=off
]
¶mglData
: void
NormSl (mreal
v1=0
, mreal
v2=1
, char
dir='z'
, bool
keep=true
, bool
sym=false
)
¶void
mgl_data_norm_slice (HMDT
dat, mreal
v1, mreal
v2, char
dir, int
keep, int
sym)
¶Normalizes data slice-by-slice along direction dir the data in slices to range [v1,v2]. If flag sym=true
then symmetrical interval [-max(|v1|,|v2|), max(|v1|,|v2|)] is used. If keep is set then maximal value of k-th slice will be limited by
\sqrt{\sum a_ij(k)/\sum a_ij(0)}.
dat 'dir' i [j=0]
¶mglData
: void
Keep (const char *
dir, long
i, long
j=0)
¶mglDataC
: void
Keep (const char *
dir, long
i, long
j=0)
¶void
mgl_data_keep (HMDT
dat, const char *
dir, long
i, long
j)
¶void
mgl_datac_keep (HADT
dat, const char *
dir, long
i, long
j=0)
¶Conserves phase/sign or amplitude (if dir contain ‘a’) of data along directions dir by fixing one at point {i,j} of the initial slice. The function is useful for removing common phase change of a complex data. See Sample ‘keep’, for sample code and picture.
dat val
¶mglData
: void
Limit (mreal
val)
¶mglDataC
: void
Limit (mreal
val)
¶void
mgl_data_limit (HMDT
dat, mreal
val)
¶void
mgl_datac_limit (HADT
dat, mreal
val)
¶Limits the data values to be inside the range [-val,val], keeping the original sign of the value (phase for complex numbers). This is equivalent to operation a[i] *= abs(a[i])<val?1.:val/abs(a[i]);
.
dat v1 v2 [sep=on]
¶mglData
: void
Coil (mreal
v1, mreal
v2, bool
sep=true
)
¶void
mgl_data_coil (HMDT
dat, mreal
v1, mreal
v2, int
sep)
¶Project the periodical data to range [v1,v2] (like mod()
function). Separate branches by NAN
if sep=true
.
dat [val=1 step=1]
¶mglData
: void
Dilate (mreal
val=1
, long
step=1
)
¶void
mgl_data_dilate (HMDT
dat, mreal
val, long
step)
¶Return dilated by step cells array of 0 or 1 for data values larger val.
dat [val=1 step=1]
¶mglData
: void
Erode (mreal
val=1
, long
step=1
)
¶void
mgl_data_erode (HMDT
dat, mreal
val, long
step)
¶Return eroded by step cells array of 0 or 1 for data values larger val.
dat mask 'how' kdx [iter=0]
¶mglData
: void
Mode (const mglDataA &
mask, const mglDataA &
pot, const char *
how, double
kdx=0
, long
iter=0
))
¶mglData
: void
Mode (const mglDataA &
mask, const char *
how, double
kdx=0
, long
iter=0
))
¶mglDataC
: void
Mode (const mglDataA &
mask, const mglDataA &
pot, const char *
how, double
kdx=0
, long
iter=0
))
¶mglDataC
: void
Mode (const mglDataA &
mask, const char *
how, double
kdx=0
, long
iter=0
))
¶void
mgl_data_mode (HMDT
dat, HCDT
mask, HCDT
pot, const char *
how, double
kdx, long
iter)
¶void
mgl_datac_mode (HADT
dat, HCDT
mask, HCDT
pot, const char *
how, double
kdx, long
iter)
¶Replace initial mode d by found mode solution for Poisson equation u_xx+pot*u=0 in waveguide with boundary defined by mask. If pot is absent (NULL) then zero values are used. Parameter how may contain following symbols (default is "xyz0"):
Parameter iter set maximal number of iterations (0 is automatic).