Class: MathGL::MglData

Inherits:
Object
  • Object
show all
Defined in:
lib/mathgl/doc/libdoc_core_en.rb,
lib/mathgl/doc/libdoc_data_en.rb,
ext/mathgl/mathgl.cxx

Overview

Proxy of C++ MathGL::MglData class

Instance Method Summary collapse

Constructor Details

#initialize(fname) ⇒ MglData

Data constructor. Reads data from tab-separated text file with auto determining sizes of the data.

Parameters:

  • fname (String)

38
39
# File 'lib/mathgl/doc/libdoc_data_en.rb', line 38

def initialize
end

Instance Method Details

#*(b) ⇒ MglData #*(b) ⇒ MglData

Operators. Multiplies by the other data or the number.

Overloads:


1122
1123
# File 'lib/mathgl/doc/libdoc_data_en.rb', line 1122

def *
end

#+(b) ⇒ MglData #+(b) ⇒ MglData

Operators. Adds the other data or the number.

Overloads:


1094
1095
# File 'lib/mathgl/doc/libdoc_data_en.rb', line 1094

def +
end

#-(b) ⇒ MglData #-(b) ⇒ MglData

Operators. Subtracts the other data or the number.

Overloads:


1108
1109
# File 'lib/mathgl/doc/libdoc_data_en.rb', line 1108

def -
end

#/(b) ⇒ MglData #/(b) ⇒ MglData

Operators. Divides by the other data or the number.

Overloads:


1136
1137
# File 'lib/mathgl/doc/libdoc_data_en.rb', line 1136

def /
end

#auto_correl(dir) ⇒ MglData

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.

Parameters:

  • dir (String)

Returns:


803
804
# File 'lib/mathgl/doc/libdoc_data_en.rb', line 803

def auto_correl
end

#clean(idx) ⇒ nil

Data resizing. Delete rows which values are equal to next row for given column idx.

Parameters:

  • idx (lond)

Returns:

  • (nil)

210
211
# File 'lib/mathgl/doc/libdoc_data_en.rb', line 210

def clean
end

#column(eq) ⇒ MglData

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.

Parameters:

  • eq (String)

Returns:


628
629
# File 'lib/mathgl/doc/libdoc_data_en.rb', line 628

def column
end

#combine(a) ⇒ MglData

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.

Parameters:

Returns:


773
774
# File 'lib/mathgl/doc/libdoc_data_en.rb', line 773

def combine
end

#correl(b, dir) ⇒ MglData

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.

Parameters:

Returns:


793
794
# File 'lib/mathgl/doc/libdoc_data_en.rb', line 793

def correl
end

#cos_fft(dir) ⇒ nil

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).

Parameters:

  • dir (String)

Returns:

  • (nil)

880
881
# File 'lib/mathgl/doc/libdoc_data_en.rb', line 880

def cos_fft
end

#create(mx, my = 1, mz = 1) ⇒ nil

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.

Parameters:

  • mx (Integer)
  • my (Integer) (defaults to: 1)

    default=1

  • mz (Integer) (defaults to: 1)

    default=1

Returns:

  • (nil)

107
108
# File 'lib/mathgl/doc/libdoc_data_en.rb', line 107

def create
end

#crop(n1, n2, dir = 'x') ⇒ nil

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.

Parameters:

  • n1 (Integer)
  • n2 (Integer)
  • dir (String) (defaults to: 'x')

    default='x'

Returns:

  • (nil)

165
166
# File 'lib/mathgl/doc/libdoc_data_en.rb', line 165

def crop
end

#cum_sum(dir) ⇒ nil

Data changing. Cumulative summation of the data in given direction or directions.

Parameters:

  • dir (String)

Returns:

  • (nil)

813
814
# File 'lib/mathgl/doc/libdoc_data_en.rb', line 813

def cum_sum
end

#delete(dir, pos = 0, num = 1) ⇒ nil

Data resizing. Delete num slices along dir-direction at position pos.

Parameters:

  • dir (String)
  • pos (Integer) (defaults to: 0)

    default=0

  • num (Integer) (defaults to: 1)

    default=1

Returns:

  • (nil)

189
190
# File 'lib/mathgl/doc/libdoc_data_en.rb', line 189

def delete
end

#diff(x, y) ⇒ nil #diff(x, y, z) ⇒ nil

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);.

Overloads:


833
834
# File 'lib/mathgl/doc/libdoc_data_en.rb', line 833

def diff
end

#diff2(dir) ⇒ nil

Data changing. Double-differentiates (like Laplace operator) the data in given direction.

Parameters:

  • dir (String)

Returns:

  • (nil)

860
861
# File 'lib/mathgl/doc/libdoc_data_en.rb', line 860

def diff2
end

#envelop(dir = 'x') ⇒ nil

Data changing. Find envelop for data values along direction dir.

Parameters:

  • dir (String) (defaults to: 'x')

    default='x'

Returns:

  • (nil)

953
954
# File 'lib/mathgl/doc/libdoc_data_en.rb', line 953

def envelop
end

#evaluate(idat, norm = true) ⇒ MglData #evaluate(idat, jdat, norm = true) ⇒ MglData #evaluate(idat, jdat, kdat, norm = true) ⇒ MglData

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.

Overloads:

  • #evaluate(idat, norm = true) ⇒ MglData

    Parameters:

    • idat (MglData)
    • norm (bool) (defaults to: true)

      default=true

    Returns:

  • #evaluate(idat, jdat, norm = true) ⇒ MglData

    Parameters:

    • idat (MglData)
    • jdat (MglData)
    • norm (bool) (defaults to: true)

      default=true

    Returns:

  • #evaluate(idat, jdat, kdat, norm = true) ⇒ MglData

    Parameters:

    Returns:


670
671
# File 'lib/mathgl/doc/libdoc_data_en.rb', line 670

def evaluate
end

#extend(n1, n2 = 0) ⇒ nil

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

Parameters:

  • n1 (Integer)
  • n2 (Integer) (defaults to: 0)

    default=0

Returns:

  • (nil)

140
141
# File 'lib/mathgl/doc/libdoc_data_en.rb', line 140

def extend
end

#fill(v1, v2, dir = 'x') ⇒ nil

Data filling. Equidistantly fills the data values to range (v1, v2) in direction dir=('x','y','z').

Parameters:

  • v1 (Float)
  • v2 (Float)
  • dir (String) (defaults to: 'x')

    default='x'

Returns:

  • (nil)

366
367
# File 'lib/mathgl/doc/libdoc_data_en.rb', line 366

def fill
end

#fill_sample(how) ⇒ nil

Data filling. Fills data by 'x' or 'k' samples for Hankel ('h') or Fourier ('f') transform.

Parameters:

  • how (String)

Returns:

  • (nil)

398
399
# File 'lib/mathgl/doc/libdoc_data_en.rb', line 398

def fill_sample
end

#get_val(i) ⇒ Float

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).

Parameters:

  • i (long)

Returns:

  • (Float)

15
16
# File 'lib/mathgl/doc/libdoc_data_en.rb', line 15

def get_val
end

#grid(x, y, z, p1, p2) ⇒ MglData

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

Parameters:

Returns:


412
413
# File 'lib/mathgl/doc/libdoc_data_en.rb', line 412

def grid
end

#hankel(dir) ⇒ nil

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).

Parameters:

  • dir (String)

Returns:

  • (nil)

890
891
# File 'lib/mathgl/doc/libdoc_data_en.rb', line 890

def hankel
end

#hist(n, v1 = 0, v2 = 1, nsub = 0) ⇒ MglData #hist(w, n, v1 = 0, v2 = 1, nsub = 0) ⇒ MglData

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

Overloads:

  • #hist(n, v1 = 0, v2 = 1, nsub = 0) ⇒ MglData

    Parameters:

    • n (Integer)
    • v1 (Float) (defaults to: 0)

      default=0

    • v2 (Float) (defaults to: 1)

      default=1

    • nsub (Integer) (defaults to: 0)

      default=0

    Returns:

  • #hist(w, n, v1 = 0, v2 = 1, nsub = 0) ⇒ MglData

    Parameters:

    • w (MglData)
    • n (Integer)
    • v1 (Float) (defaults to: 0)

      default=0

    • v2 (Float) (defaults to: 1)

      default=1

    • nsub (Integer) (defaults to: 0)

      default=0

    Returns:


721
722
# File 'lib/mathgl/doc/libdoc_data_en.rb', line 721

def hist
end

#import(fname, scheme, v1 = 0, v2 = 1) ⇒ nil

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).

Parameters:

  • fname (String)
  • scheme (String)
  • v1 (Float) (defaults to: 0)

    default=0

  • v2 (Float) (defaults to: 1)

    default=1

Returns:

  • (nil)

585
586
# File 'lib/mathgl/doc/libdoc_data_en.rb', line 585

def import
end

#insert(dir, pos = 0, num = 1) ⇒ nil

Data resizing. Insert num slices along dir-direction at position pos and fill it by zeros.

Parameters:

  • dir (String)
  • pos (Integer) (defaults to: 0)

    default=0

  • num (Integer) (defaults to: 1)

    default=1

Returns:

  • (nil)

177
178
# File 'lib/mathgl/doc/libdoc_data_en.rb', line 177

def insert
end

#integral(dir) ⇒ nil

Data changing. Integrates (like cumulative summation) the data in given direction or directions.

Parameters:

  • dir (String)

Returns:

  • (nil)

823
824
# File 'lib/mathgl/doc/libdoc_data_en.rb', line 823

def integral
end

#join(vdat) ⇒ nil

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.

Parameters:

Returns:

  • (nil)

220
221
# File 'lib/mathgl/doc/libdoc_data_en.rb', line 220

def join
end

#linear(dif, x, y = 0, z = 0) ⇒ Float

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.

Parameters:

  • dif (MglPoint)
  • x (Float)
  • y (Float) (defaults to: 0)

    default=0

  • z (Float) (defaults to: 0)

    default=0

Returns:

  • (Float)

1042
1043
# File 'lib/mathgl/doc/libdoc_data_en.rb', line 1042

def linear
end

#linear1(dif, x, y = 0, z = 0) ⇒ Float

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.

Parameters:

  • dif (MglPoint)
  • x (Float)
  • y (Float) (defaults to: 0)

    default=0

  • z (Float) (defaults to: 0)

    default=0

Returns:

  • (Float)

1054
1055
# File 'lib/mathgl/doc/libdoc_data_en.rb', line 1054

def linear1
end

Data filling. Links external data array, i.e. don't delete this array at exit.

Overloads:

  • #link(from) ⇒ nil

    Parameters:

    Returns:

    • (nil)
  • #link(a, nx, ny = 1, nz = 1) ⇒ nil

    Parameters:

    • a (Float)
    • nx (Integer)
    • ny (Integer) (defaults to: 1)

      default=1

    • nz (Integer) (defaults to: 1)

      default=1

    Returns:

    • (nil)

354
355
# File 'lib/mathgl/doc/libdoc_data_en.rb', line 354

def link
end

#max(dir) ⇒ MglData

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.

Parameters:

  • dir (String)

Returns:


753
754
# File 'lib/mathgl/doc/libdoc_data_en.rb', line 753

def max
end

#min(dir) ⇒ MglData

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.

Parameters:

  • dir (String)

Returns:


763
764
# File 'lib/mathgl/doc/libdoc_data_en.rb', line 763

def min
end

#mirror(dir) ⇒ nil

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.

Parameters:

  • dir (String)

Returns:

  • (nil)

921
922
# File 'lib/mathgl/doc/libdoc_data_en.rb', line 921

def mirror
end

#modify(eq, dim = 0) ⇒ nil #modify(eq, v) ⇒ nil #modify(eq, v, w) ⇒ nil

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.

Overloads:

  • #modify(eq, dim = 0) ⇒ nil

    Parameters:

    • eq (String)
    • dim (Integer) (defaults to: 0)

      default=0

    Returns:

    • (nil)
  • #modify(eq, v) ⇒ nil

    Parameters:

    Returns:

    • (nil)
  • #modify(eq, v, w) ⇒ nil

    Parameters:

    Returns:

    • (nil)

388
389
# File 'lib/mathgl/doc/libdoc_data_en.rb', line 388

def modify
end

#momentum(dir, how) ⇒ MglData

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.

Parameters:

  • dir (String)
  • how (String)

Returns:


733
734
# File 'lib/mathgl/doc/libdoc_data_en.rb', line 733

def momentum
end

#norm(v1 = 0, v2 = 1, sym = false, dim = 0) ⇒ nil

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.

Parameters:

  • v1 (Float) (defaults to: 0)

    default=0

  • v2 (Float) (defaults to: 1)

    default=1

  • sym (bool) (defaults to: false)

    default=false

  • dim (Integer) (defaults to: 0)

    default=0

Returns:

  • (nil)

966
967
# File 'lib/mathgl/doc/libdoc_data_en.rb', line 966

def norm
end

#norm_sl(v1 = 0, v2 = 1, dir = 'z', keep_en = true, sym = false) ⇒ nil

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

Parameters:

  • v1 (Float) (defaults to: 0)

    default=0

  • v2 (Float) (defaults to: 1)

    default=1

  • dir (String) (defaults to: 'z')

    default='z'

  • keep_en (bool) (defaults to: true)

    default=true

  • sym (bool) (defaults to: false)

    default=false

Returns:

  • (nil)

980
981
# File 'lib/mathgl/doc/libdoc_data_en.rb', line 980

def norm_sl
end

#put(v, i = -1, j = -1, k = -1) ⇒ nil

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.

Parameters:

  • v (MglData)
  • i (Integer) (defaults to: -1)

    default=-1

  • j (Integer) (defaults to: -1)

    default=-1

  • k (Integer) (defaults to: -1)

    default=-1

Returns:

  • (nil)

425
426
# File 'lib/mathgl/doc/libdoc_data_en.rb', line 425

def put
end

#read(fname, mx, my = 1, mz = 1) ⇒ bool

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.

Parameters:

  • fname (String)
  • mx (Integer)
  • my (Integer) (defaults to: 1)

    default=1

  • mz (Integer) (defaults to: 1)

    default=1

Returns:

  • (bool)

512
513
# File 'lib/mathgl/doc/libdoc_data_en.rb', line 512

def read
end

#read_all(templ, as_slice = false) ⇒ nil

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.

Parameters:

  • templ (String)
  • as_slice (bool) (defaults to: false)

    default=false

Returns:

  • (nil)

561
562
# File 'lib/mathgl/doc/libdoc_data_en.rb', line 561

def read_all
end

#read_hdf(fname, dname) ⇒ nil

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.

Parameters:

  • fname (String)
  • dname (String)

Returns:

  • (nil)

572
573
# File 'lib/mathgl/doc/libdoc_data_en.rb', line 572

def read_hdf
end

#read_mat(fname, dim = 2) ⇒ bool

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.

Parameters:

  • fname (String)
  • dim (Integer) (defaults to: 2)

    default=2

Returns:

  • (bool)

536
537
# File 'lib/mathgl/doc/libdoc_data_en.rb', line 536

def read_mat
end

#read_range(templ, from, to, step = 1, as_slice = false) ⇒ nil

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.

Parameters:

  • templ (String)
  • from (Float)
  • to (Float)
  • step (Float) (defaults to: 1)

    default=1

  • as_slice (bool) (defaults to: false)

    default=false

Returns:

  • (nil)

550
551
# File 'lib/mathgl/doc/libdoc_data_en.rb', line 550

def read_range
end

#rearrange(mx, my = 0, mz = 0) ⇒ nil

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.

Parameters:

  • mx (Integer)
  • my (Integer) (defaults to: 0)

    default=0

  • mz (Integer) (defaults to: 0)

    default=0

Returns:

  • (nil)

119
120
# File 'lib/mathgl/doc/libdoc_data_en.rb', line 119

def rearrange
end

#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) ⇒ nil

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.

Overloads:

  • #refill(x, v, x1, x2, sl = -1) ⇒ nil

    Parameters:

    • x (MglData)
    • v (MglData)
    • x1 (Float)
    • x2 (Float)
    • sl (long) (defaults to: -1)

      default=-1

    Returns:

    • (nil)
  • #refill(x, v, p1, p2, sl = -1) ⇒ nil

    Parameters:

    Returns:

    • (nil)
  • #refill(x, y, v, p1, p2, sl = -1) ⇒ nil

    Parameters:

    Returns:

    • (nil)
  • #refill(x, y, z, v, p1, p2) ⇒ nil

    Parameters:

    Returns:

    • (nil)

4618
4619
# File 'lib/mathgl/doc/libdoc_core_en.rb', line 4618

def refill
end

#refill_gs(x, v, x1, x2, sl = -1) ⇒ nil

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.

Parameters:

  • x (MglData)
  • v (MglData)
  • x1 (Float)
  • x2 (Float)
  • sl (long) (defaults to: -1)

    default=-1

Returns:

  • (nil)

492
493
# File 'lib/mathgl/doc/libdoc_data_en.rb', line 492

def refill_gs
end

#resize(mx, my = 0, mz = 0, x1 = 0, x2 = 1, y1 = 0, y2 = 1, z1 = 0, z2 = 1) ⇒ MglData

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.

Parameters:

  • mx (Integer)
  • my (Integer) (defaults to: 0)

    default=0

  • mz (Integer) (defaults to: 0)

    default=0

  • x1 (Float) (defaults to: 0)

    default=0

  • x2 (Float) (defaults to: 1)

    default=1

  • y1 (Float) (defaults to: 0)

    default=0

  • y2 (Float) (defaults to: 1)

    default=1

  • z1 (Float) (defaults to: 0)

    default=0

  • z2 (Float) (defaults to: 1)

    default=1

Returns:


646
647
# File 'lib/mathgl/doc/libdoc_data_en.rb', line 646

def resize
end

#roll(dir, num) ⇒ nil

Data changing. Rolls the data along direction dir. Resulting array will be out(i) = ini((i+num)%nx) if dir='x'.

Parameters:

  • dir (String)
  • num (Numeric)

Returns:

  • (nil)

911
912
# File 'lib/mathgl/doc/libdoc_data_en.rb', line 911

def roll
end

#roots(func, var) ⇒ MglData

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.

Parameters:

  • func (String)
  • var (String)

Returns:


700
701
# File 'lib/mathgl/doc/libdoc_data_en.rb', line 700

def roots
end

#set(str, nx, ny = 1, nz = 1) ⇒ nil

Data filling. Allocates memory and scanf the data from the string.

Parameters:

  • str (String)
  • nx (Integer)
  • ny (Integer) (defaults to: 1)

    default=1

  • nz (Integer) (defaults to: 1)

    default=1

Returns:

  • (nil)

240
241
# File 'lib/mathgl/doc/libdoc_data_en.rb', line 240

def set
end

#set_column_id(ids) ⇒ nil

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.

Parameters:

  • ids (String)

Returns:

  • (nil)

502
503
# File 'lib/mathgl/doc/libdoc_data_en.rb', line 502

def set_column_id
end

#set_val(val, i) ⇒ nil

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).

Parameters:

  • val (Float)
  • i (long)

Returns:

  • (nil)

26
27
# File 'lib/mathgl/doc/libdoc_data_en.rb', line 26

def set_val
end

#sew(dir, m_pi) ⇒ nil

Data changing. Remove value steps (like phase jumps after inverse trigonometric functions) with period da in given direction.

Parameters:

  • dir (String)
  • m_pi (mreal da=2)

Returns:

  • (nil)

932
933
# File 'lib/mathgl/doc/libdoc_data_en.rb', line 932

def sew
end

#sin_fft(dir) ⇒ nil

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).

Parameters:

  • dir (String)

Returns:

  • (nil)

870
871
# File 'lib/mathgl/doc/libdoc_data_en.rb', line 870

def sin_fft
end

#smooth(dir = "xyz", delta = 0) ⇒ nil

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.

Parameters:

  • dir (String) (defaults to: "xyz")

    default=“xyz”

  • delta (Float) (defaults to: 0)

    default=0

Returns:

  • (nil)

943
944
# File 'lib/mathgl/doc/libdoc_data_en.rb', line 943

def smooth
end

#solve(val, dir, norm = true) ⇒ MglData #solve(val, dir, idat, norm = true) ⇒ MglData

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

Overloads:

  • #solve(val, dir, norm = true) ⇒ MglData

    Parameters:

    • val (Float)
    • dir (String)
    • norm (bool) (defaults to: true)

      default=true

    Returns:

  • #solve(val, dir, idat, norm = true) ⇒ MglData

    Parameters:

    • val (Float)
    • dir (String)
    • idat (MglData)
    • norm (bool) (defaults to: true)

      default=true

    Returns:


689
690
# File 'lib/mathgl/doc/libdoc_data_en.rb', line 689

def solve
end

#sort(idx, idy = -1) ⇒ nil

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!

Parameters:

  • idx (lond)
  • idy (long) (defaults to: -1)

    default=-1

Returns:

  • (nil)

200
201
# File 'lib/mathgl/doc/libdoc_data_en.rb', line 200

def sort
end

#spline(dif, x, y = 0, z = 0) ⇒ Float

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.

Parameters:

  • dif (MglPoint)
  • x (Float)
  • y (Float) (defaults to: 0)

    default=0

  • z (Float) (defaults to: 0)

    default=0

Returns:

  • (Float)

992
993
# File 'lib/mathgl/doc/libdoc_data_en.rb', line 992

def spline
end

#spline1(dif, x, y = 0, z = 0) ⇒ Float

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.

Parameters:

  • dif (MglPoint)
  • x (Float)
  • y (Float) (defaults to: 0)

    default=0

  • z (Float) (defaults to: 0)

    default=0

Returns:

  • (Float)

1004
1005
# File 'lib/mathgl/doc/libdoc_data_en.rb', line 1004

def spline1
end

#squeeze(rx, ry = 1, rz = 1, smooth = false) ⇒ nil

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

Parameters:

  • rx (Integer)
  • ry (Integer) (defaults to: 1)

    default=1

  • rz (Integer) (defaults to: 1)

    default=1

  • smooth (bool) (defaults to: false)

    default=false

Returns:

  • (nil)

153
154
# File 'lib/mathgl/doc/libdoc_data_en.rb', line 153

def squeeze
end

#sub_data(xx, yy, zz) ⇒ MglData #sub_data(xx, yy) ⇒ MglData #sub_data(xx) ⇒ MglData

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.

Overloads:


597
598
# File 'lib/mathgl/doc/libdoc_data_en.rb', line 597

def sub_data
end

#sum(dir) ⇒ MglData

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.

Parameters:

  • dir (String)

Returns:


743
744
# File 'lib/mathgl/doc/libdoc_data_en.rb', line 743

def sum
end

#swap(dir) ⇒ nil

Data changing. Swaps the left and right part of the data in given direction (useful for Fourier spectrum).

Parameters:

  • dir (String)

Returns:

  • (nil)

900
901
# File 'lib/mathgl/doc/libdoc_data_en.rb', line 900

def swap
end

#traceMglData

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.

Returns:


782
783
# File 'lib/mathgl/doc/libdoc_data_en.rb', line 782

def trace
end

#transpose(dim = "yx") ⇒ nil

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.

Parameters:

  • dim (String) (defaults to: "yx")

    default=“yx”

Returns:

  • (nil)

129
130
# File 'lib/mathgl/doc/libdoc_data_en.rb', line 129

def transpose
end