RES dat xx [yy=all zz=all]
¶mglData
: mglData
SubData (mreal
xx, mreal
yy=-1
, mreal
zz=-1
) const
¶mglDataC
: mglData
SubData (mreal
xx, mreal
yy=-1
, mreal
zz=-1
) const
¶HMDT
mgl_data_subdata (HCDT
dat, mreal
xx, mreal
yy, mreal
zz)
¶Extracts sub-array data from the original data array keeping fixed positive index. For example SubData(-1,2)
extracts 3d row (indexes are zero based), SubData(4,-1)
extracts 5th column, SubData(-1,-1,3)
extracts 4th slice and so on. If argument(s) are non-integer then linear interpolation between slices is used. In MGL version this command usually is used as inline one dat(xx,yy,zz)
. Function return NULL or create empty data if data cannot be created for given arguments.
RES dat xdat [ydat zdat]
¶mglData
: mglData
SubData (const mglDataA &
xx, const mglDataA &
yy, const mglDataA &
zz) const
¶mglDataC
: mglData
SubData (const mglDataA &
xx, const mglDataA &
yy, const mglDataA &
zz) const
¶mglData
: mglData
SubData (const mglDataA &
xx, const mglDataA &
yy) const
¶mglDataC
: mglData
SubData (const mglDataA &
xx, const mglDataA &
yy) const
¶mglData
: mglData
SubData (const mglDataA &
xx) const
¶mglDataC
: mglData
SubData (const mglDataA &
xx) const
¶HMDT
mgl_data_subdata_ext (HCDT
dat, HCDT
xx, HCDT
yy, HCDT
zz)
¶HADT
mgl_datac_subdata_ext (HCDT
dat, HCDT
xx, HCDT
yy, HCDT
zz)
¶Extracts sub-array data from the original data array for indexes specified by arrays xx, yy, zz (indirect access). This function work like previous one for 1D arguments or numbers, and resulting array dimensions are equal dimensions of 1D arrays for corresponding direction. For 2D and 3D arrays in arguments, the resulting array have the same dimensions as input arrays. The dimensions of all argument must be the same (or to be scalar 1*1*1) if they are 2D or 3D arrays. In MGL version this command usually is used as inline one dat(xx,yy,zz)
. Function return NULL or create empty data if data cannot be created for given arguments. In C function some of xx, yy, zz can be NULL.
RES dat 'eq'
¶mglData
: mglData
Column (const char *
eq) const
¶mglDataC
: mglData
Column (const char *
eq) const
¶HMDT
mgl_data_column (HCDT
dat, const char *
eq)
¶Get column (or slice) of the data filled by formula eq on column ids. For example, Column("n*w^2/exp(t)");
. The column ids must be defined first by idset function or read from files. In MGL version this command usually is used as inline one dat('eq')
. Function return NULL or create empty data if data cannot be created for given arguments.
RES dat mx [my=1 mz=1]
¶mglData
: mglData
Resize (int
mx, int
my=0
, int
mz=0
, mreal
x1=0
, mreal
x2=1
, mreal
y1=0
, mreal
y2=1
, mreal
z1=0
, mreal
z2=1
) const
¶mglDataC
: mglData
Resize (int
mx, int
my=0
, int
mz=0
, mreal
x1=0
, mreal
x2=1
, mreal
y1=0
, mreal
y2=1
, mreal
z1=0
, mreal
z2=1
) const
¶HMDT
mgl_data_resize (HCDT
dat, int
mx, int
my, int
mz)
¶HMDT
mgl_data_resize_box (HCDT
dat, int
mx, int
my, int
mz, mreal
x1, mreal
x2, mreal
y1, mreal
y2, mreal
z1, mreal
z2)
¶Resizes the data to new size mx, my, mz from box (part) [x1,x2] x [y1,y2] x [z1,z2] of original array. Initially x,y,z coordinates are supposed to be in [0,1]. If one of sizes mx, my or mz is 0 then initial size is used. Function return NULL or create empty data if data cannot be created for given arguments.
RES dat idat [norm=on
]
¶RES dat idat jdat [norm=on
]
¶RES dat idat jdat kdat [norm=on
]
¶mglData
: mglData
Evaluate (const mglDataA &
idat, bool
norm=true
) const
¶mglData
: mglData
Evaluate (const mglDataA &
idat, const mglDataA &
jdat, bool
norm=true
) const
¶mglData
: mglData
Evaluate (const mglDataA &
idat, const mglDataA &
jdat, const mglDataA &
kdat, bool
norm=true
) const
¶mglDataC
: mglData
Evaluate (const mglDataA &
idat, bool
norm=true
) const
¶mglDataC
: mglData
Evaluate (const mglDataA &
idat, const mglDataA &
jdat, bool
norm=true
) const
¶mglDataC
: mglData
Evaluate (const mglDataA &
idat, const mglDataA &
jdat, const mglDataA &
kdat, bool
norm=true
) const
¶HMDT
mgl_data_evaluate (HCDT
dat, HCDT
idat, HCDT
jdat, HCDT
kdat, int
norm)
¶Gets array which values is result of interpolation of original array for coordinates from other arrays. All dimensions must be the same for data idat, jdat, kdat. Coordinates from idat, jdat, kdat are supposed to be normalized in range [0,1] (if norm=true
) or in ranges [0,nx], [0,ny], [0,nz] correspondingly. Function return NULL or create empty data if data cannot be created for given arguments.
RES dat ids ['dir'='y' val=nan
]
¶RES dat id
['dir'='y' val=nan
]
¶mglData
: mglData
Section (const mglDataA &
ids, const char *
dir='y'
, mreal
val=NAN
) const
¶mglData
: mglData
Section (long
id, const char *
dir='y'
, mreal
val=NAN
) const
¶mglDataC
: mglData
Section (const mglDataA &
ids, const char *
dir='y'
, mreal
val=NAN
) const
¶mglDataC
: mglData
Section (long
id, const char *
dir='y'
, mreal
val=NAN
) const
¶HMDT
mgl_data_section (HCDT
dat, HCDT
ids, const char *
dir, mreal
val)
¶HMDT
mgl_data_section_val (HCDT
dat, long
id, const char *
dir, mreal
val)
¶HADT
mgl_datac_section (HCDT
dat, HCDT
ids, const char *
dir, mreal
val)
¶HADT
mgl_datac_section_val (HCDT
dat, long
id, const char *
dir, mreal
val)
¶Gets array which is id-th section (range of slices separated by value val) of original array dat. For id<0 the reverse order is used (i.e. -1 give last section). If several ids are provided then output array will be result of sequential joining of sections.
RES dat val
'dir' [norm=on
]
¶RES dat val
'dir' idat [norm=on
]
¶mglData
: mglData
Solve (mreal
val, char
dir, bool
norm=true
) const
¶mglData
: mglData
Solve (mreal
val, char
dir, const mglDataA &
idat, bool
norm=true
) const
¶HMDT
mgl_data_solve (HCDT
dat, mreal
val, char
dir, HCDT
idat, int
norm)
¶Gets array which values is indexes (roots) along given direction dir, where interpolated values of data dat are equal to val. Output data will have the sizes of dat in directions transverse to dir. If data idat is provided then its values are used as starting points. This allows one to find several branches by consequentive calls. Indexes are supposed to be normalized in range [0,1] (if norm=true
) or in ranges [0,nx], [0,ny], [0,nz] correspondingly. Function return NULL or create empty data if data cannot be created for given arguments. See Solve sample, for sample code and picture.
RES 'func' ini ['var'='x']
¶RES 'func' ini
['var'='x']
¶mglData
: mglData
Roots (const char *
func, char
var) const
¶HMDT
mgl_data_roots (const char *
func, HCDT
ini, char
var)
¶mreal
mgl_find_root_txt (const char *
func, mreal
ini, char
var)
¶Find roots of equation ’func’=0 for variable var with initial guess ini. Secant method is used for root finding. Function return NULL or create empty data if data cannot be created for given arguments.
RES 'funcs' 'vars' ini
¶mglData
: mglData
MultiRoots (const char *
funcs, const char *
vars) const
¶mglDataC
: mglDataC
MultiRoots (const char *
funcs, const char *
vars) const
¶HMDT
mgl_find_roots_txt (const char *
func, const char *
vars, HCDT
ini)
¶HADT
mgl_find_roots_txt_c (const char *
func, const char *
vars, HCDT
ini)
¶Find roots of system of equations ’funcs’=0 for variables vars with initial guesses ini. Secant method is used for root finding. Function return NULL or create empty data if data cannot be created for given arguments.
RES dat lvl dj [di=0 minlen=0]
¶mglData
: mglData
Detect (mreal
lvl, mreal
dj, mreal
di=0
, mreal
minlen=0
) const
¶HMDT
mgl_data_detect (HCDT
dat, mreal
lvl, mreal
dj, mreal
di, mreal
minlen)
¶Get curves {x,y}, separated by NAN values, for local maximal values of array dat as function of x-coordinate. Noises below lvl amplitude are ignored. Parameter dj (in range [0,ny]) set the "attraction" y-distance of points to the curve. Similarly, di continue curve in x-direction through gaps smaller than di points. Curves with minimal length smaller than minlen will be ignored.
RES dat n v1 v2 [nsub=0]
¶RES dat wdat n v1 v2 [nsub=0]
¶mglData
: mglData
Hist (int
n, mreal
v1=0
, mreal
v2=1
, int
nsub=0
) const
¶mglData
: mglData
Hist (const mglDataA &
w, int
n, mreal
v1=0
, mreal
v2=1
, int
nsub=0
) const
¶mglDataC
: mglData
Hist (int
n, mreal
v1=0
, mreal
v2=1
, int
nsub=0
) const
¶mglDataC
: mglData
Hist (const mglDataA &
w, int
n, mreal
v1=0
, mreal
v2=1
, int
nsub=0
) const
¶HMDT
mgl_data_hist (HCDT
dat, int
n, mreal
v1, mreal
v2, int
nsub)
¶HMDT
mgl_data_hist_w (HCDT
dat, HCDT
w, int
n, mreal
v1, mreal
v2, int
nsub)
¶Creates n-th points distribution of the data values in range [v1, v2]. Array w specifies weights of the data elements (by default is 1). Parameter nsub define the number of additional interpolated points (for smoothness of histogram). If nsub<0 then linear interpolation is used instead of spline one. Function return NULL or create empty data if data cannot be created for given arguments. See also histl, Data manipulation
RES dat n v1 v2
¶RES dat wdat n v1 v2
¶mglData
: mglData
HistL (int
n, mreal
v1=0
, mreal
v2=1
) const
¶mglData
: mglData
HistL (const mglDataA &
w, int
n, mreal
v1=0
, mreal
v2=1
) const
¶mglDataC
: mglData
HistL (int
n, mreal
v1=0
, mreal
v2=1
) const
¶mglDataC
: mglData
HistL (const mglDataA &
w, int
n, mreal
v1=0
, mreal
v2=1
) const
¶HMDT
mgl_data_hist_l (HCDT
dat, HCDT
w, int
n, mreal
v1, mreal
v2)
¶Creates n-th points distribution of the data values in range [v1, v2] using linear interpolation between data points. Array w specifies weights of the data elements (by default is 1). Function return NULL or create empty data if data cannot be created for given arguments. See also hist, Data manipulation
RES dat 'how' ['dir'='z']
¶mglData
: mglData
Momentum (char
dir, const char *
how) const
¶mglDataC
: mglData
Momentum (char
dir, const char *
how) const
¶HMDT
mgl_data_momentum (HCDT
dat, char
dir, const char *
how)
¶Gets momentum (1d-array) of the data along direction dir. String how contain kind of momentum. The momentum is defined like as res_k = \sum_ij how(x_i,y_j,z_k) a_ij/ \sum_ij a_ij if dir=‘z’ and so on. Coordinates ‘x’, ‘y’, ‘z’ are data indexes normalized in range [0,1]. Function return NULL or create empty data if data cannot be created for given arguments.
RES dat 'dir'
¶mglData
: mglData
Sum (const char *
dir) const
¶mglDataC
: mglData
Sum (const char *
dir) const
¶HMDT
mgl_data_sum (HCDT
dat, const char *
dir)
¶Gets array which is the result of summation in given direction or direction(s). Function return NULL or create empty data if data cannot be created for given arguments.
RES dat 'dir'
¶mglData
: mglData
Max (const char *
dir) const
¶mglDataC
: mglData
Max (const char *
dir) const
¶HMDT
mgl_data_max_dir (HCDT
dat, const char *
dir)
¶Gets array which is the maximal data values in given direction or direction(s). Function return NULL or create empty data if data cannot be created for given arguments.
RES dat 'dir'
¶mglData
: mglData
Min (const char *
dir) const
¶mglDataC
: mglData
Min (const char *
dir) const
¶HMDT
mgl_data_min_dir (HCDT
dat, const char *
dir)
¶Gets array which is the maximal data values in given direction or direction(s). Function return NULL or create empty data if data cannot be created for given arguments.
RES dat
¶mglData
: mglData
MinMax () const
¶HMDT
mgl_data_minmax (HCDT
dat)
¶Gets positions of local maximums and minimums. Function return NULL or create empty data if there is no minimums and maximums.
RES val
dat
¶mglData
: mglData
Conts (mreal
val) const
¶HMDT
mgl_data_conts (mreal
val, HCDT
dat)
¶Gets coordinates of contour lines for dat[i,j]=val. NAN values separate the the curves. Function return NULL or create empty data if there is contour lines.
RES adat bdat
¶mglData
: mglData
Combine (const mglDataA &
a) const
¶mglDataC
: mglData
Combine (const mglDataA &
a) const
¶HMDT
mgl_data_combine (HCDT
dat, HCDT
a)
¶Returns direct multiplication of arrays (like, res[i,j] = this[i]*a[j] and so on). Function return NULL or create empty data if data cannot be created for given arguments.
RES dat
¶mglData
: mglData
Trace () const
¶mglDataC
: mglData
Trace () const
¶HMDT
mgl_data_trace (HCDT
dat)
¶Gets array of diagonal elements a[i,i] (for 2D case) or a[i,i,i] (for 3D case) where i=0...nx-1. Function return copy of itself for 1D case. Data array must have dimensions ny,nz >= nx or ny,nz = 1. Function return NULL or create empty data if data cannot be created for given arguments.
RES adat bdat 'dir'
¶mglData
: mglData
Correl (const mglDataA &
b, const char *
dir) const
¶mglData
: mglData
AutoCorrel (const char *
dir) const
¶mglDataC
: mglDataC
Correl (const mglDataA &
b, const char *
dir) const
¶mglDataC
: mglDataC
AutoCorrel (const char *
dir) const
¶HMDT
mgl_data_correl (HCDT
a, HCDT
b, const char *
dir)
¶HADT
mgl_datac_correl (HCDT
a, HCDT
b, const char *
dir)
¶Find correlation between data a (or this in C++) and b along directions dir. Fourier transform is used to find the correlation. So, you may want to use functions swap or norm before plotting it. Function return NULL or create empty data if data cannot be created for given arguments.
mglDataC
: mglData
Real () const
¶HMDT
mgl_datac_real (HCDT
dat)
¶Gets array of real parts of the data.
mglDataC
: mglData
Imag () const
¶HMDT
mgl_datac_imag (HCDT
dat)
¶Gets array of imaginary parts of the data.
mglDataC
: mglData
Abs () const
¶HMDT
mgl_datac_abs (HCDT
dat)
¶Gets array of absolute values of the data.
mglDataC
: mglData
Arg () const
¶HMDT
mgl_datac_arg (HCDT
dat)
¶Gets array of arguments of the data.
RES dat 'dir'
¶mglData
: mglData
Pulse (const char *
dir) const
¶HMDT
mgl_data_pulse (HCDT
dat, const char *
dir)
¶Find pulse properties along direction dir: pulse maximum (in column 0) and its position (in column 1), pulse width near maximum (in column 3) and by half height (in column 2), energy in first pulse (in column 4). NAN values are used for widths if maximum is located near the edges. Note, that there is uncertainty for complex data. Usually one should use square of absolute value (i.e. |dat[i]|^2) for them. So, MathGL don’t provide this function for complex data arrays. However, C function will work even in this case but use absolute value (i.e. |dat[i]|). Function return NULL or create empty data if data cannot be created for given arguments. See also max, min, momentum, sum. See Pulse properties, for sample code and picture.
RES dat 'dir' val
¶mglData
: mglData
First (const char *
dir, mreal
val) const
¶mglDataC
: mglData
First (const char *
dir, mreal
val) const
¶HMDT
mgl_data_first_dir (HCDT
dat, const char *
dir, mreal
val)
¶Get array of positions of first value large val. For complex data the absolute value is used. See also last.
RES dat 'dir' val
¶mglData
: mglData
Last (const char *
dir, mreal
val) const
¶mglDataC
: mglData
Last (const char *
dir, mreal
val) const
¶HMDT
mgl_data_last_dir (HCDT
dat, const char *
dir, mreal
val)
¶Get array of positions of last value large val. For complex data the absolute value is used. See also first.
HMDT
mgl_formula_calc (const char *
str, long
n, ...)
¶HADT
mgl_formula_calc_c (const char *
str, long
n, ...)
¶Evaluate formula str for the given list of n data arrays of type HCDT
. Variable names correspond to data names. You need to delete returned data array after usage! See also fill.