Class: MathGL::MglData
- Inherits:
-
Object
- Object
- MathGL::MglData
- Defined in:
- ../lib/mathgl/doc/libdoc_core_en.rb,
../lib/mathgl/doc/libdoc_data_en.rb
Overview
MglData class
Instance Method Summary (collapse)
-
- (Object) *
Operators.
-
- (Object) +
Operators.
-
- (Object) -
Operators.
-
- (Object) /
Operators.
-
- (MglData) auto_correl(dir)
Make another data.
-
- (nil) clean(idx)
Data resizing.
-
- (MglData) column(eq)
Make another data.
-
- (MglData) combine(a)
Make another data.
-
- (MglData) correl(b, dir)
Make another data.
-
- (nil) cos_fft(dir)
Data changing.
-
- (nil) create(mx, my = 1, mz = 1)
Data resizing.
-
- (nil) crop(n1, n2, dir = 'x')
Data resizing.
-
- (nil) cum_sum(dir)
Data changing.
-
- (nil) delete(dir, pos = 0, num = 1)
Data resizing.
-
- (Object) diff
Data changing.
-
- (nil) diff2(dir)
Data changing.
-
- (nil) envelop(dir = 'x')
Data changing.
-
- (Object) evaluate
Make another data.
-
- (nil) extend(n1, n2 = 0)
Data resizing.
-
- (nil) fill(v1, v2, dir = 'x')
Data filling.
-
- (nil) fill_sample(how)
Data filling.
-
- (Float) get_val(i)
Public variables.
-
- (MglData) grid(x, y, z, p1, p2)
Data filling.
-
- (nil) hankel(dir)
Data changing.
-
- (Object) hist
Make another data.
-
- (nil) import(fname, scheme, v1 = 0, v2 = 1)
File I/O.
-
- (MglData) initialize(fname)
constructor
Data constructor.
-
- (nil) insert(dir, pos = 0, num = 1)
Data resizing.
-
- (nil) integral(dir)
Data changing.
-
- (nil) join(vdat)
Data resizing.
-
- (Float) linear(dif, x, y = 0, z = 0)
Interpolation.
-
- (Float) linear1(dif, x, y = 0, z = 0)
Interpolation.
-
- (Object) link
Data filling.
-
- (MglData) max(dir)
Make another data.
-
- (MglData) min(dir)
Make another data.
-
- (nil) mirror(dir)
Data changing.
-
- (Object) modify
Data filling.
-
- (MglData) momentum(dir, how)
Make another data.
-
- (nil) norm(v1 = 0, v2 = 1, sym = false, dim = 0)
Data changing.
-
- (nil) norm_sl(v1 = 0, v2 = 1, dir = 'z', keep_en = true, sym = false)
Data changing.
-
- (nil) put(v, i = -1, j = -1, k = -1)
Data filling.
-
- (bool) read(fname, mx, my = 1, mz = 1)
File I/O.
-
- (nil) read_all(templ, as_slice = false)
File I/O.
-
- (nil) read_hdf(fname, dname)
File I/O.
-
- (bool) read_mat(fname, dim = 2)
File I/O.
-
- (nil) read_range(templ, from, to, step = 1, as_slice = false)
File I/O.
-
- (nil) rearrange(mx, my = 0, mz = 0)
Data resizing.
-
- (Object) refill
Data filling.
-
- (nil) refill_gs(x, v, x1, x2, sl = -1)
Data filling.
-
- (MglData) resize(mx, my = 0, mz = 0, x1 = 0, x2 = 1, y1 = 0, y2 = 1, z1 = 0, z2 = 1)
Make another data.
-
- (nil) roll(dir, num)
Data changing.
-
- (MglData) roots(func, var)
Make another data.
-
- (nil) set(str, nx, ny = 1, nz = 1)
Data filling.
-
- (nil) set_column_id(ids)
Data filling.
-
- (nil) set_val(val, i)
Public variables.
-
- (nil) sew(dir, m_pi)
Data changing.
-
- (nil) sin_fft(dir)
Data changing.
-
- (nil) smooth(dir = "xyz", delta = 0)
Data changing.
-
- (Object) solve
Make another data.
-
- (nil) sort(idx, idy = -1)
Data resizing.
-
- (Float) spline(dif, x, y = 0, z = 0)
Interpolation.
-
- (Float) spline1(dif, x, y = 0, z = 0)
Interpolation.
-
- (nil) squeeze(rx, ry = 1, rz = 1, smooth = false)
Data resizing.
-
- (Object) sub_data
Make another data.
-
- (MglData) sum(dir)
Make another data.
-
- (nil) swap(dir)
Data changing.
-
- (MglData) trace
Make another data.
-
- (nil) transpose(dim = "yx")
Data resizing.
Constructor Details
- (MglData) initialize(fname)
Data constructor. Reads data from tab-separated text file with auto determining sizes of the data.
38 39 |
# File '../lib/mathgl/doc/libdoc_data_en.rb', line 38 def initialize end |
Instance Method Details
- (MglData) *(b) - (MglData) *(b)
Operators. Multiplies by the other data or the number.
1122 1123 |
# File '../lib/mathgl/doc/libdoc_data_en.rb', line 1122 def * end |
- (MglData) +(b) - (MglData) +(b)
Operators. Adds the other data or the number.
1094 1095 |
# File '../lib/mathgl/doc/libdoc_data_en.rb', line 1094 def + end |
- (MglData) -(b) - (MglData) -(b)
Operators. Subtracts the other data or the number.
1108 1109 |
# File '../lib/mathgl/doc/libdoc_data_en.rb', line 1108 def - end |
- (MglData) /(b) - (MglData) /(b)
Operators. Divides by the other data or the number.
1136 1137 |
# File '../lib/mathgl/doc/libdoc_data_en.rb', line 1136 def / end |
- (MglData) auto_correl(dir)
Make another data. 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.
803 804 |
# File '../lib/mathgl/doc/libdoc_data_en.rb', line 803 def auto_correl end |
- (nil) clean(idx)
Data resizing. Delete rows which values are equal to next row for given column idx.
210 211 |
# File '../lib/mathgl/doc/libdoc_data_en.rb', line 210 def clean end |
- (MglData) column(eq)
Make another data. 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.
628 629 |
# File '../lib/mathgl/doc/libdoc_data_en.rb', line 628 def column end |
- (MglData) combine(a)
Make another data. 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.
773 774 |
# File '../lib/mathgl/doc/libdoc_data_en.rb', line 773 def combine end |
- (MglData) correl(b, dir)
Make another data. 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.
793 794 |
# File '../lib/mathgl/doc/libdoc_data_en.rb', line 793 def correl end |
- (nil) cos_fft(dir)
Data changing. Do Cosine transform of the data in given direction or directions. The Cosine transform is sum a_j cos(k j) (see en.wikipedia.org/wiki/Discrete_cosine_transform#DCT-I).
880 881 |
# File '../lib/mathgl/doc/libdoc_data_en.rb', line 880 def cos_fft end |
- (nil) create(mx, my = 1, mz = 1)
Data resizing. Creates or recreates the array with specified size and fills it by zero. This function does nothing if one of parameters mx, my, mz is zero or negative.
107 108 |
# File '../lib/mathgl/doc/libdoc_data_en.rb', line 107 def create end |
- (nil) crop(n1, n2, dir = 'x')
Data resizing. Cuts off edges of the data i<n1 and i>n2 if n2>0 or i>n(xyz)-n2 if n2<=0 along direction dir.
165 166 |
# File '../lib/mathgl/doc/libdoc_data_en.rb', line 165 def crop end |
- (nil) cum_sum(dir)
Data changing. Cumulative summation of the data in given direction or directions.
813 814 |
# File '../lib/mathgl/doc/libdoc_data_en.rb', line 813 def cum_sum end |
- (nil) delete(dir, pos = 0, num = 1)
Data resizing. Delete num slices along dir-direction at position pos.
189 190 |
# File '../lib/mathgl/doc/libdoc_data_en.rb', line 189 def delete end |
- (nil) diff(x, y) - (nil) diff(x, y, z)
Data changing. 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);.
833 834 |
# File '../lib/mathgl/doc/libdoc_data_en.rb', line 833 def diff end |
- (nil) diff2(dir)
Data changing. Double-differentiates (like Laplace operator) the data in given direction.
860 861 |
# File '../lib/mathgl/doc/libdoc_data_en.rb', line 860 def diff2 end |
- (nil) envelop(dir = 'x')
Data changing. Find envelop for data values along direction dir.
953 954 |
# File '../lib/mathgl/doc/libdoc_data_en.rb', line 953 def envelop end |
- (MglData) evaluate(idat, norm = true) - (MglData) evaluate(idat, jdat, norm = true) - (MglData) evaluate(idat, jdat, kdat, norm = true)
Make another data. 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.
670 671 |
# File '../lib/mathgl/doc/libdoc_data_en.rb', line 670 def evaluate end |
- (nil) extend(n1, n2 = 0)
Data resizing. Increase the dimensions of the data by inserting new (|n1|+1)-th slices after (for n1>0) or before (for n1<0) of existed one. It is possible to insert 2 dimensions simultaneously for 1d data by using parameter n2. Data to new slices is copy from existed one. For example, for n1>0 new array will be
140 141 |
# File '../lib/mathgl/doc/libdoc_data_en.rb', line 140 def extend end |
- (nil) fill(v1, v2, dir = 'x')
Data filling. Equidistantly fills the data values to range (v1, v2) in direction dir=('x','y','z').
366 367 |
# File '../lib/mathgl/doc/libdoc_data_en.rb', line 366 def fill end |
- (nil) fill_sample(how)
Data filling. Fills data by 'x' or 'k' samples for Hankel ('h') or Fourier ('f') transform.
398 399 |
# File '../lib/mathgl/doc/libdoc_data_en.rb', line 398 def fill_sample end |
- (Float) get_val(i)
Public variables. Gets or sets the value in by “flat” index i without border checking. Index i should be in range (0, nx*ny*nz-1).
15 16 |
# File '../lib/mathgl/doc/libdoc_data_en.rb', line 15 def get_val end |
- (MglData) grid(x, y, z, p1, p2)
Data filling. Fills the value of array according to the linear interpolation of triangulated surface assuming x-,y-coordinates equidistantly distributed in axis range (or in range (x1,x2)*(y1,y2)). Triangulated surface is found for arbitrary placed points 'x', 'y', 'z'. NAN value is used for grid points placed outside of triangulated surface. Making regular data
412 413 |
# File '../lib/mathgl/doc/libdoc_data_en.rb', line 412 def grid end |
- (nil) hankel(dir)
Data changing. Do Hankel transform of the data in given direction or directions. The Hankel transform is sum a_j J_0(k j) (see en.wikipedia.org/wiki/Hankel_transform).
890 891 |
# File '../lib/mathgl/doc/libdoc_data_en.rb', line 890 def hankel end |
- (MglData) hist(n, v1 = 0, v2 = 1, nsub = 0) - (MglData) hist(w, n, v1 = 0, v2 = 1, nsub = 0)
Make another data. 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). Function return NULL or create empty data if data cannot be created for given arguments. See also Data manipulation
721 722 |
# File '../lib/mathgl/doc/libdoc_data_en.rb', line 721 def hist end |
- (nil) import(fname, scheme, v1 = 0, v2 = 1)
File I/O. Reads data from bitmap file (now support only PNG format). The RGB values of bitmap pixels are transformed to mreal values in range (v1, v2) using color scheme scheme (Color scheme).
585 586 |
# File '../lib/mathgl/doc/libdoc_data_en.rb', line 585 def import end |
- (nil) insert(dir, pos = 0, num = 1)
Data resizing. Insert num slices along dir-direction at position pos and fill it by zeros.
177 178 |
# File '../lib/mathgl/doc/libdoc_data_en.rb', line 177 def insert end |
- (nil) integral(dir)
Data changing. Integrates (like cumulative summation) the data in given direction or directions.
823 824 |
# File '../lib/mathgl/doc/libdoc_data_en.rb', line 823 def integral end |
- (nil) join(vdat)
Data resizing. Join data cells from vdat to dat. At this, function increase dat sizes according following: z-size for 3D data arrays arrays with equal x-,y-sizes; or y-size for 2D data arrays with equal x-sizes; or x-size otherwise.
220 221 |
# File '../lib/mathgl/doc/libdoc_data_en.rb', line 220 def join end |
- (Float) linear(dif, x, y = 0, z = 0)
Interpolation. Interpolates data by linear function to the given point x in (0…nx-1), y in (0…ny-1), z in (0…nz-1). The values of derivatives at the point are saved in dif.
1042 1043 |
# File '../lib/mathgl/doc/libdoc_data_en.rb', line 1042 def linear end |
- (Float) linear1(dif, x, y = 0, z = 0)
Interpolation. Interpolates data by linear function to the given point x, y, z which assumed to be normalized in range (0, 1). The values of derivatives at the point are saved in dif.
1054 1055 |
# File '../lib/mathgl/doc/libdoc_data_en.rb', line 1054 def linear1 end |
- (nil) link(from) - (nil) link(a, nx, ny = 1, nz = 1)
Data filling. Links external data array, i.e. don't delete this array at exit.
354 355 |
# File '../lib/mathgl/doc/libdoc_data_en.rb', line 354 def link end |
- (MglData) max(dir)
Make another data. 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.
753 754 |
# File '../lib/mathgl/doc/libdoc_data_en.rb', line 753 def max end |
- (MglData) min(dir)
Make another data. 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.
763 764 |
# File '../lib/mathgl/doc/libdoc_data_en.rb', line 763 def min end |
- (nil) mirror(dir)
Data changing. 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 (Command options), for example, surf dat; xrange 1 -1.
921 922 |
# File '../lib/mathgl/doc/libdoc_data_en.rb', line 921 def mirror end |
- (nil) modify(eq, dim = 0) - (nil) modify(eq, v) - (nil) modify(eq, v, w)
Data filling. The same as previous ones but coordinates 'x', 'y', 'z' are supposed to be normalized in range (0,1). If dim>0 is specified then modification will be fulfilled only for slices >=dim.
388 389 |
# File '../lib/mathgl/doc/libdoc_data_en.rb', line 388 def modify end |
- (MglData) momentum(dir, how)
Make another data. Gets momentum (1d-array) of the data along direction dir. String how contain kind of momentum. The momentum is defined like as 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.
733 734 |
# File '../lib/mathgl/doc/libdoc_data_en.rb', line 733 def momentum end |
- (nil) norm(v1 = 0, v2 = 1, sym = false, dim = 0)
Data changing. 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.
966 967 |
# File '../lib/mathgl/doc/libdoc_data_en.rb', line 966 def norm end |
- (nil) norm_sl(v1 = 0, v2 = 1, dir = 'z', keep_en = true, sym = false)
Data changing. 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_en is set then maximal value of k-th slice will be limited by
980 981 |
# File '../lib/mathgl/doc/libdoc_data_en.rb', line 980 def norm_sl end |
- (nil) put(v, i = -1, j = -1, k = -1)
Data filling. Copies value(s) from array v to the range of original array. Negative indexes i, j, k=-1 set the range in corresponding direction(s). At this minor dimensions of array v should be large than corresponding dimensions of this array. For example, Put(v,-1,0,-1); sets a(i,0,j)=v.ny>nz ? v(i,j) : v(i), where i=0…(nx-1), j=0…(nz-1) and condition v.nx>=nx is true.
425 426 |
# File '../lib/mathgl/doc/libdoc_data_en.rb', line 425 def put end |
- (bool) read(fname, mx, my = 1, mz = 1)
File I/O. Reads data from text file with specified data sizes. This function does nothing if one of parameters mx, my or mz is zero or negative.
512 513 |
# File '../lib/mathgl/doc/libdoc_data_en.rb', line 512 def read end |
- (nil) read_all(templ, as_slice = false)
File I/O. Join data arrays from several text files which filenames satisfied the template templ (for example, templ=“t_*.dat”). The data load one-by-one in the same slice if as_slice=false or as slice-by-slice if as_slice=true.
561 562 |
# File '../lib/mathgl/doc/libdoc_data_en.rb', line 561 def read_all end |
- (nil) read_hdf(fname, dname)
File I/O. Reads data array named dname from HDF5 or HDF4 file. This function does nothing if HDF5|HDF4 was disabled during library compilation.
572 573 |
# File '../lib/mathgl/doc/libdoc_data_en.rb', line 572 def read_hdf end |
- (bool) read_mat(fname, dim = 2)
File I/O. Read data from text file with size specified at beginning of the file by first dim numbers. At this, variable dim set data dimensions.
536 537 |
# File '../lib/mathgl/doc/libdoc_data_en.rb', line 536 def read_mat end |
- (nil) read_range(templ, from, to, step = 1, as_slice = false)
File I/O. Join data arrays from several text files. The file names are determined by function call sprintf(fname,templ,val);, where val changes from from to to with step step. The data load one-by-one in the same slice if as_slice=false or as slice-by-slice if as_slice=true.
550 551 |
# File '../lib/mathgl/doc/libdoc_data_en.rb', line 550 def read_range end |
- (nil) rearrange(mx, my = 0, mz = 0)
Data resizing. Rearrange dimensions without changing data array so that resulting sizes should be mx*my*mz < nx*ny*nz. If some of parameter my or mz are zero then it will be selected to optimal fill of data array. For example, if my=0 then it will be change to my=nx*ny*nz/mx and mz=1.
119 120 |
# File '../lib/mathgl/doc/libdoc_data_en.rb', line 119 def rearrange end |
- (nil) refill(x, v, x1, x2, sl = -1) - (nil) refill(x, v, p1, p2, sl = -1) - (nil) refill(x, y, v, p1, p2, sl = -1) - (nil) refill(x, y, z, v, p1, p2)
Data filling. Fills by interpolated values of array v at the point (x, y, z)=(X(i), Y(j), Z(k)) (or (x, y, z)=(X(i,j,k), Y(i,j,k), Z(i,j,k)) if x, y, z are not 1d arrays), where X,Y,Z are equidistantly distributed in range (x1,x2)*(y1,y2)*(z1,z2) and have the same sizes as this array. If parameter sl is 0 or positive then changes will be applied only for slice sl.
4618 4619 |
# File '../lib/mathgl/doc/libdoc_core_en.rb', line 4618 def refill end |
- (nil) refill_gs(x, v, x1, x2, sl = -1)
Data filling. Fills by global cubic spline values of array v at the point x=X(i), where X are equidistantly distributed in range (x1,x2) and have the same sizes as this array. If parameter sl is 0 or positive then changes will be applied only for slice sl.
492 493 |
# File '../lib/mathgl/doc/libdoc_data_en.rb', line 492 def refill_gs end |
- (MglData) resize(mx, my = 0, mz = 0, x1 = 0, x2 = 1, y1 = 0, y2 = 1, z1 = 0, z2 = 1)
Make another data. 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.
646 647 |
# File '../lib/mathgl/doc/libdoc_data_en.rb', line 646 def resize end |
- (nil) roll(dir, num)
Data changing. Rolls the data along direction dir. Resulting array will be out(i) = ini((i+num)%nx) if dir='x'.
911 912 |
# File '../lib/mathgl/doc/libdoc_data_en.rb', line 911 def roll end |
- (MglData) roots(func, var)
Make another data. 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.
700 701 |
# File '../lib/mathgl/doc/libdoc_data_en.rb', line 700 def roots end |
- (nil) set(str, nx, ny = 1, nz = 1)
Data filling. Allocates memory and scanf the data from the string.
240 241 |
# File '../lib/mathgl/doc/libdoc_data_en.rb', line 240 def set end |
- (nil) set_column_id(ids)
Data filling. Sets the symbol ids for data columns. The string should contain one symbol 'a'…'z' per column. These ids are used in column.
502 503 |
# File '../lib/mathgl/doc/libdoc_data_en.rb', line 502 def set_column_id end |
- (nil) set_val(val, i)
Public variables. Gets or sets the value in by “flat” index i without border checking. Index i should be in range (0, nx*ny*nz-1).
26 27 |
# File '../lib/mathgl/doc/libdoc_data_en.rb', line 26 def set_val end |
- (nil) sew(dir, m_pi)
Data changing. Remove value steps (like phase jumps after inverse trigonometric functions) with period da in given direction.
932 933 |
# File '../lib/mathgl/doc/libdoc_data_en.rb', line 932 def sew end |
- (nil) sin_fft(dir)
Data changing. Do Sine transform of the data in given direction or directions. The Sine transform is sum a_j sin(k j) (see en.wikipedia.org/wiki/Discrete_sine_transform#DST-I).
870 871 |
# File '../lib/mathgl/doc/libdoc_data_en.rb', line 870 def sin_fft end |
- (nil) smooth(dir = "xyz", delta = 0)
Data changing. Smooths the data on specified direction or directions. String dirs specifies the dimensions which will be smoothed. It may contain characters: 'x' for 1st dimension, 'y' for 2nd dimension, 'z' for 3d dimension. If string dir contain: '0' then does nothing, '3' – linear averaging over 3 points, '5' – linear averaging over 5 points. By default quadratic averaging over 5 points is used.
943 944 |
# File '../lib/mathgl/doc/libdoc_data_en.rb', line 943 def smooth end |
- (MglData) solve(val, dir, norm = true) - (MglData) solve(val, dir, idat, norm = true)
Make another data. 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 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. Solve sample
689 690 |
# File '../lib/mathgl/doc/libdoc_data_en.rb', line 689 def solve end |
- (nil) sort(idx, idy = -1)
Data resizing. Sort data rows (or slices in 3D case) by values of specified column idx (or cell (idx,idy) for 3D case). Note, this function is not thread safe!
200 201 |
# File '../lib/mathgl/doc/libdoc_data_en.rb', line 200 def sort end |
- (Float) spline(dif, x, y = 0, z = 0)
Interpolation. Interpolates data by cubic spline to the given point x in (0…nx-1), y in (0…ny-1), z in (0…nz-1). The values of derivatives at the point are saved in dif.
992 993 |
# File '../lib/mathgl/doc/libdoc_data_en.rb', line 992 def spline end |
- (Float) spline1(dif, x, y = 0, z = 0)
Interpolation. Interpolates data by cubic spline to the given point x, y, z which assumed to be normalized in range (0, 1). The values of derivatives at the point are saved in dif.
1004 1005 |
# File '../lib/mathgl/doc/libdoc_data_en.rb', line 1004 def spline1 end |
- (nil) squeeze(rx, ry = 1, rz = 1, smooth = false)
Data resizing. Reduces the data size by excluding data elements which indexes are not divisible by rx, ry, rz correspondingly. Parameter smooth set to use smoothing
153 154 |
# File '../lib/mathgl/doc/libdoc_data_en.rb', line 153 def squeeze end |
- (MglData) sub_data(xx, yy, zz) - (MglData) sub_data(xx, yy) - (MglData) sub_data(xx)
Make another data. 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.
597 598 |
# File '../lib/mathgl/doc/libdoc_data_en.rb', line 597 def sub_data end |
- (MglData) sum(dir)
Make another data. 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.
743 744 |
# File '../lib/mathgl/doc/libdoc_data_en.rb', line 743 def sum end |
- (nil) swap(dir)
Data changing. Swaps the left and right part of the data in given direction (useful for Fourier spectrum).
900 901 |
# File '../lib/mathgl/doc/libdoc_data_en.rb', line 900 def swap end |
- (MglData) trace
Make another data. 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.
782 783 |
# File '../lib/mathgl/doc/libdoc_data_en.rb', line 782 def trace end |
- (nil) transpose(dim = "yx")
Data resizing. Transposes (shift order of) dimensions of the data. New order of dimensions is specified in string dim. This function can be useful also after reading of one-dimensional data.
129 130 |
# File '../lib/mathgl/doc/libdoc_data_en.rb', line 129 def transpose end |