mathgl 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -7
- data/lib/mathgl/version.rb +2 -2
- data/mathgl.gemspec +1 -1
- data/misc/Rakefile +10 -0
- data/misc/conv_texi.rb +35 -14
- data/{lib → misc/lib}/mathgl/libdoc_core_en.rb +507 -11
- data/{lib → misc/lib}/mathgl/libdoc_data_en.rb +209 -889
- data/{lib → misc/lib}/mathgl/libdoc_other_en.rb +26 -0
- data/{lib → misc/lib}/mathgl/libdoc_parse_en.rb +22 -0
- data/misc/lib/mathgl/libdoc_window_en.rb +38 -0
- metadata +8 -6
@@ -1,35 +1,62 @@
|
|
1
1
|
# This document is converted from data_en.texi.
|
2
2
|
|
3
|
+
# module MathGL
|
4
|
+
module MathGL
|
5
|
+
|
3
6
|
# MglData class
|
4
7
|
class MglData
|
5
8
|
|
6
9
|
# Public variables.
|
7
10
|
# Gets or sets the value in by "flat" index i without border checking. Index i should be in range (0, nx*ny*nz-1).
|
11
|
+
#
|
8
12
|
# @overload get_val(i)
|
9
13
|
# @param [long] i
|
10
14
|
# @return [Float]
|
15
|
+
def get_val
|
16
|
+
end
|
17
|
+
|
18
|
+
|
19
|
+
# Public variables.
|
20
|
+
# Gets or sets the value in by "flat" index i without border checking. Index i should be in range (0, nx*ny*nz-1).
|
21
|
+
#
|
11
22
|
# @overload set_val(val,i)
|
12
23
|
# @param [Float] val
|
13
24
|
# @param [long] i
|
14
25
|
# @return [nil]
|
15
|
-
def
|
26
|
+
def set_val
|
16
27
|
end
|
17
28
|
|
18
29
|
|
19
30
|
# Public variables.
|
20
31
|
# Gets the x-, y-, z-size of the data.
|
32
|
+
#
|
21
33
|
# @overload get_nx()
|
22
34
|
# @return [long]
|
35
|
+
def get_nx
|
36
|
+
end
|
37
|
+
|
38
|
+
|
39
|
+
# Public variables.
|
40
|
+
# Gets the x-, y-, z-size of the data.
|
41
|
+
#
|
23
42
|
# @overload get_ny()
|
24
43
|
# @return [long]
|
44
|
+
def get_ny
|
45
|
+
end
|
46
|
+
|
47
|
+
|
48
|
+
# Public variables.
|
49
|
+
# Gets the x-, y-, z-size of the data.
|
50
|
+
#
|
25
51
|
# @overload get_nz()
|
26
52
|
# @return [long]
|
27
|
-
def
|
53
|
+
def get_nz
|
28
54
|
end
|
29
55
|
|
30
56
|
|
31
57
|
# Data constructor.
|
32
58
|
# Default constructor. Allocates the memory for data array and initializes it by zero. If string eq is specified then data will be filled by corresponding formula as in fill.
|
59
|
+
#
|
33
60
|
# @overload initialize(mx=1,my=1,mz=1)
|
34
61
|
# @param [Integer] mx default=1
|
35
62
|
# @param [Integer] my default=1
|
@@ -41,34 +68,42 @@ end
|
|
41
68
|
|
42
69
|
# Data constructor.
|
43
70
|
# Copy constructor. Allocates the memory for data array and copy values from other array. At this, if parameter eq is specified then the data will be modified by corresponding formula similarly to fill.
|
71
|
+
#
|
44
72
|
# @overload initialize(dat2)
|
45
73
|
# @param [MglData] dat2
|
46
74
|
# @return [MglData]
|
75
|
+
#
|
47
76
|
# @overload initialize(dat2)
|
48
77
|
# @param [MglData] dat2
|
49
78
|
# @return [MglData]
|
79
|
+
#
|
50
80
|
# @overload initialize(size,dat2)
|
51
81
|
# @param [Integer] size
|
52
82
|
# @param [float] dat2
|
53
83
|
# @return [MglData]
|
84
|
+
#
|
54
85
|
# @overload initialize(size,cols,dat2)
|
55
86
|
# @param [Integer] size
|
56
87
|
# @param [Integer] cols
|
57
88
|
# @param [float] dat2
|
58
89
|
# @return [MglData]
|
90
|
+
#
|
59
91
|
# @overload initialize(size,dat2)
|
60
92
|
# @param [Integer] size
|
61
93
|
# @param [Float] dat2
|
62
94
|
# @return [MglData]
|
95
|
+
#
|
63
96
|
# @overload initialize(size,cols,dat2)
|
64
97
|
# @param [Integer] size
|
65
98
|
# @param [Integer] cols
|
66
99
|
# @param [Float] dat2
|
67
100
|
# @return [MglData]
|
101
|
+
#
|
68
102
|
# @overload initialize(dat2,size)
|
69
103
|
# @param [Float] dat2
|
70
104
|
# @param [Integer] size
|
71
105
|
# @return [MglData]
|
106
|
+
#
|
72
107
|
# @overload initialize(dat2,size,cols)
|
73
108
|
# @param [Float] dat2
|
74
109
|
# @param [Integer] size
|
@@ -80,6 +115,7 @@ end
|
|
80
115
|
|
81
116
|
# Data constructor.
|
82
117
|
# Reads data from tab-separated text file with auto determining sizes of the data.
|
118
|
+
#
|
83
119
|
# @overload initialize(fname)
|
84
120
|
# @param [String] fname
|
85
121
|
# @return [MglData]
|
@@ -89,6 +125,7 @@ end
|
|
89
125
|
|
90
126
|
# Data resizing.
|
91
127
|
# 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.
|
128
|
+
#
|
92
129
|
# @overload create(mx,my=1,mz=1)
|
93
130
|
# @param [Integer] mx
|
94
131
|
# @param [Integer] my default=1
|
@@ -100,6 +137,7 @@ end
|
|
100
137
|
|
101
138
|
# Data resizing.
|
102
139
|
# 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.
|
140
|
+
#
|
103
141
|
# @overload rearrange(mx,my=0,mz=0)
|
104
142
|
# @param [Integer] mx
|
105
143
|
# @param [Integer] my default=0
|
@@ -111,6 +149,7 @@ end
|
|
111
149
|
|
112
150
|
# Data resizing.
|
113
151
|
# 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.
|
152
|
+
#
|
114
153
|
# @overload transpose(dim="yx")
|
115
154
|
# @param [String] dim default="yx"
|
116
155
|
# @return [nil]
|
@@ -120,6 +159,7 @@ end
|
|
120
159
|
|
121
160
|
# Data resizing.
|
122
161
|
# 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
|
162
|
+
#
|
123
163
|
# @overload extend(n1,n2=0)
|
124
164
|
# @param [Integer] n1
|
125
165
|
# @param [Integer] n2 default=0
|
@@ -130,6 +170,7 @@ end
|
|
130
170
|
|
131
171
|
# Data resizing.
|
132
172
|
# Reduces the data size by excluding data elements which indexes are not divisible by rx, ry, rz correspondingly. Parameter smooth set to use smoothing
|
173
|
+
#
|
133
174
|
# @overload squeeze(rx,ry=1,rz=1,smooth=false)
|
134
175
|
# @param [Integer] rx
|
135
176
|
# @param [Integer] ry default=1
|
@@ -142,6 +183,7 @@ end
|
|
142
183
|
|
143
184
|
# Data resizing.
|
144
185
|
# 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.
|
186
|
+
#
|
145
187
|
# @overload crop(n1,n2,dir='x')
|
146
188
|
# @param [Integer] n1
|
147
189
|
# @param [Integer] n2
|
@@ -153,6 +195,7 @@ end
|
|
153
195
|
|
154
196
|
# Data resizing.
|
155
197
|
# Insert num slices along dir-direction at position pos and fill it by zeros.
|
198
|
+
#
|
156
199
|
# @overload insert(dir,pos=0,num=1)
|
157
200
|
# @param [String] dir
|
158
201
|
# @param [Integer] pos default=0
|
@@ -164,6 +207,7 @@ end
|
|
164
207
|
|
165
208
|
# Data resizing.
|
166
209
|
# Delete num slices along dir-direction at position pos.
|
210
|
+
#
|
167
211
|
# @overload delete(dir,pos=0,num=1)
|
168
212
|
# @param [String] dir
|
169
213
|
# @param [Integer] pos default=0
|
@@ -175,6 +219,7 @@ end
|
|
175
219
|
|
176
220
|
# Data resizing.
|
177
221
|
# 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!
|
222
|
+
#
|
178
223
|
# @overload sort(idx,idy=-1)
|
179
224
|
# @param [lond] idx
|
180
225
|
# @param [long] idy default=-1
|
@@ -185,6 +230,7 @@ end
|
|
185
230
|
|
186
231
|
# Data resizing.
|
187
232
|
# Delete rows which values are equal to next row for given column idx.
|
233
|
+
#
|
188
234
|
# @overload clean(idx)
|
189
235
|
# @param [lond] idx
|
190
236
|
# @return [nil]
|
@@ -194,6 +240,7 @@ end
|
|
194
240
|
|
195
241
|
# Data resizing.
|
196
242
|
# 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.
|
243
|
+
#
|
197
244
|
# @overload join(vdat)
|
198
245
|
# @param [MglData] vdat
|
199
246
|
# @return [nil]
|
@@ -203,12 +250,14 @@ end
|
|
203
250
|
|
204
251
|
# Data filling.
|
205
252
|
# Allocates memory and copies the data from the flat float* or double* array.
|
253
|
+
#
|
206
254
|
# @overload set(a,nx,ny=1,nz=1)
|
207
255
|
# @param [float] a
|
208
256
|
# @param [Integer] nx
|
209
257
|
# @param [Integer] ny default=1
|
210
258
|
# @param [Integer] nz default=1
|
211
259
|
# @return [nil]
|
260
|
+
#
|
212
261
|
# @overload set(a,nx,ny=1,nz=1)
|
213
262
|
# @param [Float] a
|
214
263
|
# @param [Integer] nx
|
@@ -221,11 +270,13 @@ end
|
|
221
270
|
|
222
271
|
# Data filling.
|
223
272
|
# Allocates memory and copies the data from the float** or double** array with dimensions N1, N2, i.e. from array defined as mreal a(N1)(N2);.
|
273
|
+
#
|
224
274
|
# @overload set(a,n1,n2)
|
225
275
|
# @param [float] a
|
226
276
|
# @param [Integer] n1
|
227
277
|
# @param [Integer] n2
|
228
278
|
# @return [nil]
|
279
|
+
#
|
229
280
|
# @overload set(a,n1,n2)
|
230
281
|
# @param [Float] a
|
231
282
|
# @param [Integer] n1
|
@@ -237,11 +288,13 @@ end
|
|
237
288
|
|
238
289
|
# Data filling.
|
239
290
|
# Allocates memory and copies the data from the float*** or double*** array with dimensions N1, N2, N3, i.e. from array defined as mreal a(N1)(N2)(N3);.
|
291
|
+
#
|
240
292
|
# @overload set(a,n1,n2)
|
241
293
|
# @param [float] a
|
242
294
|
# @param [Integer] n1
|
243
295
|
# @param [Integer] n2
|
244
296
|
# @return [nil]
|
297
|
+
#
|
245
298
|
# @overload set(a,n1,n2)
|
246
299
|
# @param [Float] a
|
247
300
|
# @param [Integer] n1
|
@@ -253,6 +306,7 @@ end
|
|
253
306
|
|
254
307
|
# Data filling.
|
255
308
|
# Allocates memory and copies the data from the gsl_vector * structure.
|
309
|
+
#
|
256
310
|
# @overload set(v)
|
257
311
|
# @param [gsl_vector] v
|
258
312
|
# @return [nil]
|
@@ -262,6 +316,7 @@ end
|
|
262
316
|
|
263
317
|
# Data filling.
|
264
318
|
# Allocates memory and copies the data from the gsl_matrix * structure.
|
319
|
+
#
|
265
320
|
# @overload set(m)
|
266
321
|
# @param [gsl_matrix] m
|
267
322
|
# @return [nil]
|
@@ -271,6 +326,7 @@ end
|
|
271
326
|
|
272
327
|
# Data filling.
|
273
328
|
# Copies the data from mglData (or mglDataA) instance from.
|
329
|
+
#
|
274
330
|
# @overload set(from)
|
275
331
|
# @param [MglData] from
|
276
332
|
# @return [nil]
|
@@ -280,12 +336,15 @@ end
|
|
280
336
|
|
281
337
|
# Data filling.
|
282
338
|
# Allocates memory and copies the data from the std::vector<T> array.
|
339
|
+
#
|
283
340
|
# @overload set(d)
|
284
341
|
# @param [std::vector<int>] d
|
285
342
|
# @return [nil]
|
343
|
+
#
|
286
344
|
# @overload set(d)
|
287
345
|
# @param [std::vector<float>] d
|
288
346
|
# @return [nil]
|
347
|
+
#
|
289
348
|
# @overload set(d)
|
290
349
|
# @param [std::vector<double>] d
|
291
350
|
# @return [nil]
|
@@ -295,6 +354,7 @@ end
|
|
295
354
|
|
296
355
|
# Data filling.
|
297
356
|
# Allocates memory and scanf the data from the string.
|
357
|
+
#
|
298
358
|
# @overload set(str,nx,ny=1,nz=1)
|
299
359
|
# @param [String] str
|
300
360
|
# @param [Integer] nx
|
@@ -307,9 +367,11 @@ end
|
|
307
367
|
|
308
368
|
# Data filling.
|
309
369
|
# Links external data array, i.e. don't delete this array at exit.
|
370
|
+
#
|
310
371
|
# @overload link(from)
|
311
372
|
# @param [MglData] from
|
312
373
|
# @return [nil]
|
374
|
+
#
|
313
375
|
# @overload link(a,nx,ny=1,nz=1)
|
314
376
|
# @param [Float] a
|
315
377
|
# @param [Integer] nx
|
@@ -322,6 +384,7 @@ end
|
|
322
384
|
|
323
385
|
# Data filling.
|
324
386
|
# Equidistantly fills the data values to range (v1, v2) in direction dir=('x','y','z').
|
387
|
+
#
|
325
388
|
# @overload fill(v1,v2,dir='x')
|
326
389
|
# @param [Float] v1
|
327
390
|
# @param [Float] v2
|
@@ -333,14 +396,17 @@ end
|
|
333
396
|
|
334
397
|
# Data filling.
|
335
398
|
# 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.
|
399
|
+
#
|
336
400
|
# @overload modify(eq,dim=0)
|
337
401
|
# @param [String] eq
|
338
402
|
# @param [Integer] dim default=0
|
339
403
|
# @return [nil]
|
404
|
+
#
|
340
405
|
# @overload modify(eq,v)
|
341
406
|
# @param [String] eq
|
342
407
|
# @param [MglData] v
|
343
408
|
# @return [nil]
|
409
|
+
#
|
344
410
|
# @overload modify(eq,v,w)
|
345
411
|
# @param [String] eq
|
346
412
|
# @param [MglData] v
|
@@ -352,6 +418,7 @@ end
|
|
352
418
|
|
353
419
|
# Data filling.
|
354
420
|
# Fills data by 'x' or 'k' samples for Hankel ('h') or Fourier ('f') transform.
|
421
|
+
#
|
355
422
|
# @overload fill_sample(how)
|
356
423
|
# @param [String] how
|
357
424
|
# @return [nil]
|
@@ -361,6 +428,7 @@ end
|
|
361
428
|
|
362
429
|
# Data filling.
|
363
430
|
# Sets value(s) of array a(i, j, k) = val. Negative indexes i, j, k=-1 set the value val to whole range in corresponding direction(s). For example, Put(val,-1,0,-1); sets a(i,0,j)=val for i=0...(nx-1), j=0...(nz-1).
|
431
|
+
#
|
364
432
|
# @overload put(val,i=-1,j=-1,k=-1)
|
365
433
|
# @param [Float] val
|
366
434
|
# @param [Integer] i default=-1
|
@@ -373,6 +441,7 @@ end
|
|
373
441
|
|
374
442
|
# Data filling.
|
375
443
|
# 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.
|
444
|
+
#
|
376
445
|
# @overload put(v,i=-1,j=-1,k=-1)
|
377
446
|
# @param [MglData] v
|
378
447
|
# @param [Integer] i default=-1
|
@@ -385,6 +454,7 @@ end
|
|
385
454
|
|
386
455
|
# Data filling.
|
387
456
|
# Sets the symbol ids for data columns. The string should contain one symbol 'a'...'z' per column. These ids are used in column.
|
457
|
+
#
|
388
458
|
# @overload set_column_id(ids)
|
389
459
|
# @param [String] ids
|
390
460
|
# @return [nil]
|
@@ -394,6 +464,7 @@ end
|
|
394
464
|
|
395
465
|
# File I/O.
|
396
466
|
# Reads data from tab-separated text file with auto determining sizes of the data. Double newline means the beginning of new z-slice.
|
467
|
+
#
|
397
468
|
# @overload read(fname)
|
398
469
|
# @param [String] fname
|
399
470
|
# @return [bool]
|
@@ -403,6 +474,7 @@ end
|
|
403
474
|
|
404
475
|
# File I/O.
|
405
476
|
# 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.
|
477
|
+
#
|
406
478
|
# @overload read(fname,mx,my=1,mz=1)
|
407
479
|
# @param [String] fname
|
408
480
|
# @param [Integer] mx
|
@@ -415,6 +487,7 @@ end
|
|
415
487
|
|
416
488
|
# File I/O.
|
417
489
|
# Read data from text file with size specified at beginning of the file by first dim numbers. At this, variable dim set data dimensions.
|
490
|
+
#
|
418
491
|
# @overload read_mat(fname,dim=2)
|
419
492
|
# @param [String] fname
|
420
493
|
# @param [Integer] dim default=2
|
@@ -425,6 +498,7 @@ end
|
|
425
498
|
|
426
499
|
# File I/O.
|
427
500
|
# 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.
|
501
|
+
#
|
428
502
|
# @overload read_range(templ,from,to,step=1,as_slice=false)
|
429
503
|
# @param [String] templ
|
430
504
|
# @param [Float] from
|
@@ -438,6 +512,7 @@ end
|
|
438
512
|
|
439
513
|
# File I/O.
|
440
514
|
# 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.
|
515
|
+
#
|
441
516
|
# @overload read_all(templ,as_slice=false)
|
442
517
|
# @param [String] templ
|
443
518
|
# @param [bool] as_slice default=false
|
@@ -448,6 +523,7 @@ end
|
|
448
523
|
|
449
524
|
# File I/O.
|
450
525
|
# Saves the whole data array (for ns=-1) or only ns-th slice to text file.
|
526
|
+
#
|
451
527
|
# @overload save(fname,ns=-1)
|
452
528
|
# @param [String] fname
|
453
529
|
# @param [Integer] ns default=-1
|
@@ -458,6 +534,7 @@ end
|
|
458
534
|
|
459
535
|
# File I/O.
|
460
536
|
# Reads data array named dname from HDF5 or HDF4 file. This function does nothing if HDF5|HDF4 was disabled during library compilation.
|
537
|
+
#
|
461
538
|
# @overload read_hdf(fname,dname)
|
462
539
|
# @param [String] fname
|
463
540
|
# @param [String] dname
|
@@ -468,6 +545,7 @@ end
|
|
468
545
|
|
469
546
|
# File I/O.
|
470
547
|
# Saves data array named dname to HDF5 file. This function does nothing if HDF5 was disabled during library compilation.
|
548
|
+
#
|
471
549
|
# @overload save_hdf(fname,dname,rewrite=false)
|
472
550
|
# @param [String] fname
|
473
551
|
# @param [String] dname
|
@@ -479,6 +557,7 @@ end
|
|
479
557
|
|
480
558
|
# File I/O.
|
481
559
|
# Put data names from HDF5 file fname into buf as '\t' separated fields. In MGL version the list of data names will be printed as message. This function does nothing if HDF5 was disabled during library compilation.
|
560
|
+
#
|
482
561
|
# @overload datas_hdf(fname,buf,size)
|
483
562
|
# @param [String] fname
|
484
563
|
# @param [String] buf
|
@@ -490,6 +569,7 @@ end
|
|
490
569
|
|
491
570
|
# File I/O.
|
492
571
|
# 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).
|
572
|
+
#
|
493
573
|
# @overload import(fname,scheme,v1=0,v2=1)
|
494
574
|
# @param [String] fname
|
495
575
|
# @param [String] scheme
|
@@ -502,6 +582,7 @@ end
|
|
502
582
|
|
503
583
|
# File I/O.
|
504
584
|
# Saves data matrix (or ns-th slice for 3d data) to bitmap file (now support only PNG format). The data values are transformed from range (v1, v2) to RGB pixels of bitmap using color scheme scheme (Color scheme). If v1>=v2 then the values of v1, v2 are automatically determined as minimal and maximal value of the data array.
|
585
|
+
#
|
505
586
|
# @overload export(fname,scheme,v1=0,v2=0,ns=-1)
|
506
587
|
# @param [String] fname
|
507
588
|
# @param [String] scheme
|
@@ -515,6 +596,7 @@ end
|
|
515
596
|
|
516
597
|
# Make another data.
|
517
598
|
# 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).
|
599
|
+
#
|
518
600
|
# @overload sub_data(xx,yy=-1,zz=-1)
|
519
601
|
# @param [Float] xx
|
520
602
|
# @param [Float] yy default=-1
|
@@ -526,6 +608,7 @@ end
|
|
526
608
|
|
527
609
|
# Make another data.
|
528
610
|
# 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).
|
611
|
+
#
|
529
612
|
# @overload sub_data(xx,yy,zz)
|
530
613
|
# @param [MglData] xx
|
531
614
|
# @param [MglData] yy
|
@@ -537,6 +620,7 @@ end
|
|
537
620
|
|
538
621
|
# Make another data.
|
539
622
|
# 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').
|
623
|
+
#
|
540
624
|
# @overload column(eq)
|
541
625
|
# @param [String] eq
|
542
626
|
# @return [MglData]
|
@@ -546,6 +630,7 @@ end
|
|
546
630
|
|
547
631
|
# Make another data.
|
548
632
|
# 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).
|
633
|
+
#
|
549
634
|
# @overload resize(mx,my=1,mz=1,x1=0,x2=1,y1=0,y2=1,z1=0,z2=1)
|
550
635
|
# @param [Integer] mx
|
551
636
|
# @param [Integer] my default=1
|
@@ -563,15 +648,18 @@ end
|
|
563
648
|
|
564
649
|
# Make another data.
|
565
650
|
# 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.
|
651
|
+
#
|
566
652
|
# @overload evaluate(idat,norm=true)
|
567
653
|
# @param [MglData] idat
|
568
654
|
# @param [bool] norm default=true
|
569
655
|
# @return [MglData]
|
656
|
+
#
|
570
657
|
# @overload evaluate(idat,jdat,norm=true)
|
571
658
|
# @param [MglData] idat
|
572
659
|
# @param [MglData] jdat
|
573
660
|
# @param [bool] norm default=true
|
574
661
|
# @return [MglData]
|
662
|
+
#
|
575
663
|
# @overload evaluate(idat,jdat,kdat,norm=true)
|
576
664
|
# @param [MglData] idat
|
577
665
|
# @param [MglData] jdat
|
@@ -584,11 +672,13 @@ end
|
|
584
672
|
|
585
673
|
# Make another data.
|
586
674
|
# 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. Solve sample
|
675
|
+
#
|
587
676
|
# @overload solve(val,dir,norm=true)
|
588
677
|
# @param [Float] val
|
589
678
|
# @param [String] dir
|
590
679
|
# @param [bool] norm default=true
|
591
680
|
# @return [MglData]
|
681
|
+
#
|
592
682
|
# @overload solve(val,dir,idat,norm=true)
|
593
683
|
# @param [Float] val
|
594
684
|
# @param [String] dir
|
@@ -601,12 +691,14 @@ end
|
|
601
691
|
|
602
692
|
# Make another data.
|
603
693
|
# 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). See also Data manipulation
|
694
|
+
#
|
604
695
|
# @overload hist(n,v1=0,v2=1,nsub=0)
|
605
696
|
# @param [Integer] n
|
606
697
|
# @param [Float] v1 default=0
|
607
698
|
# @param [Float] v2 default=1
|
608
699
|
# @param [Integer] nsub default=0
|
609
700
|
# @return [MglData]
|
701
|
+
#
|
610
702
|
# @overload hist(w,n,v1=0,v2=1,nsub=0)
|
611
703
|
# @param [MglData] w
|
612
704
|
# @param [Integer] n
|
@@ -621,6 +713,7 @@ end
|
|
621
713
|
# Make another data.
|
622
714
|
# Gets momentum (1d-array) of the data along direction dir. String how contain kind of momentum. The momentum is defined like as
|
623
715
|
# if dir='z' and so on. Coordinates 'x', 'y', 'z' are data indexes normalized in range (0,1).
|
716
|
+
#
|
624
717
|
# @overload momentum(dir,how)
|
625
718
|
# @param [String] dir
|
626
719
|
# @param [String] how
|
@@ -631,6 +724,7 @@ end
|
|
631
724
|
|
632
725
|
# Make another data.
|
633
726
|
# Gets array which is the result of summation in given direction or direction(s).
|
727
|
+
#
|
634
728
|
# @overload sum(dir)
|
635
729
|
# @param [String] dir
|
636
730
|
# @return [MglData]
|
@@ -640,6 +734,7 @@ end
|
|
640
734
|
|
641
735
|
# Make another data.
|
642
736
|
# Gets array which is the maximal data values in given direction or direction(s).
|
737
|
+
#
|
643
738
|
# @overload max(dir)
|
644
739
|
# @param [String] dir
|
645
740
|
# @return [MglData]
|
@@ -649,6 +744,7 @@ end
|
|
649
744
|
|
650
745
|
# Make another data.
|
651
746
|
# Gets array which is the maximal data values in given direction or direction(s).
|
747
|
+
#
|
652
748
|
# @overload min(dir)
|
653
749
|
# @param [String] dir
|
654
750
|
# @return [MglData]
|
@@ -658,6 +754,7 @@ end
|
|
658
754
|
|
659
755
|
# Make another data.
|
660
756
|
# Returns direct multiplication of arrays (like, res(i,j) = this(i)*a(j) and so on).
|
757
|
+
#
|
661
758
|
# @overload combine(a)
|
662
759
|
# @param [MglData] a
|
663
760
|
# @return [MglData]
|
@@ -667,6 +764,7 @@ end
|
|
667
764
|
|
668
765
|
# Make another data.
|
669
766
|
# 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.
|
767
|
+
#
|
670
768
|
# @overload trace()
|
671
769
|
# @return [MglData]
|
672
770
|
def trace
|
@@ -675,6 +773,7 @@ end
|
|
675
773
|
|
676
774
|
# Make another data.
|
677
775
|
# Find roots of equation 'func'=0 for variable var with initial guess ini. Secant method is used for root finding.
|
776
|
+
#
|
678
777
|
# @overload roots(func,var)
|
679
778
|
# @param [String] func
|
680
779
|
# @param [String] var
|
@@ -685,6 +784,7 @@ end
|
|
685
784
|
|
686
785
|
# Data changing.
|
687
786
|
# Cumulative summation of the data in given direction or directions.
|
787
|
+
#
|
688
788
|
# @overload cum_sum(dir)
|
689
789
|
# @param [String] dir
|
690
790
|
# @return [nil]
|
@@ -694,6 +794,7 @@ end
|
|
694
794
|
|
695
795
|
# Data changing.
|
696
796
|
# Integrates (like cumulative summation) the data in given direction or directions.
|
797
|
+
#
|
697
798
|
# @overload integral(dir)
|
698
799
|
# @param [String] dir
|
699
800
|
# @return [nil]
|
@@ -703,6 +804,7 @@ end
|
|
703
804
|
|
704
805
|
# Data changing.
|
705
806
|
# Differentiates the data in given direction or directions.
|
807
|
+
#
|
706
808
|
# @overload diff(dir)
|
707
809
|
# @param [String] dir
|
708
810
|
# @return [nil]
|
@@ -712,10 +814,12 @@ end
|
|
712
814
|
|
713
815
|
# Data changing.
|
714
816
|
# 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);.
|
817
|
+
#
|
715
818
|
# @overload diff(x,y)
|
716
819
|
# @param [MglData] x
|
717
820
|
# @param [MglData] y
|
718
821
|
# @return [nil]
|
822
|
+
#
|
719
823
|
# @overload diff(x,y,z)
|
720
824
|
# @param [MglData] x
|
721
825
|
# @param [MglData] y
|
@@ -727,6 +831,7 @@ end
|
|
727
831
|
|
728
832
|
# Data changing.
|
729
833
|
# Double-differentiates (like Laplace operator) the data in given direction.
|
834
|
+
#
|
730
835
|
# @overload diff2(dir)
|
731
836
|
# @param [String] dir
|
732
837
|
# @return [nil]
|
@@ -736,6 +841,7 @@ end
|
|
736
841
|
|
737
842
|
# Data changing.
|
738
843
|
# 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).
|
844
|
+
#
|
739
845
|
# @overload sin_fft(dir)
|
740
846
|
# @param [String] dir
|
741
847
|
# @return [nil]
|
@@ -745,6 +851,7 @@ end
|
|
745
851
|
|
746
852
|
# Data changing.
|
747
853
|
# 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).
|
854
|
+
#
|
748
855
|
# @overload cos_fft(dir)
|
749
856
|
# @param [String] dir
|
750
857
|
# @return [nil]
|
@@ -754,6 +861,7 @@ end
|
|
754
861
|
|
755
862
|
# Data changing.
|
756
863
|
# 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).
|
864
|
+
#
|
757
865
|
# @overload hankel(dir)
|
758
866
|
# @param [String] dir
|
759
867
|
# @return [nil]
|
@@ -763,6 +871,7 @@ end
|
|
763
871
|
|
764
872
|
# Data changing.
|
765
873
|
# Swaps the left and right part of the data in given direction (useful for Fourier spectrum).
|
874
|
+
#
|
766
875
|
# @overload swap(dir)
|
767
876
|
# @param [String] dir
|
768
877
|
# @return [nil]
|
@@ -772,9 +881,10 @@ end
|
|
772
881
|
|
773
882
|
# Data changing.
|
774
883
|
# Rolls the data along direction dir. Resulting array will be out(i) = ini((i+num)%nx) if dir='x'.
|
775
|
-
#
|
884
|
+
#
|
885
|
+
# @overload roll(dir,num)
|
776
886
|
# @param [String] dir
|
777
|
-
# @param [
|
887
|
+
# @param [Numeric] num
|
778
888
|
# @return [nil]
|
779
889
|
def roll
|
780
890
|
end
|
@@ -782,6 +892,7 @@ end
|
|
782
892
|
|
783
893
|
# Data changing.
|
784
894
|
# 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.
|
895
|
+
#
|
785
896
|
# @overload mirror(dir)
|
786
897
|
# @param [String] dir
|
787
898
|
# @return [nil]
|
@@ -791,6 +902,7 @@ end
|
|
791
902
|
|
792
903
|
# Data changing.
|
793
904
|
# Remove value steps (like phase jumps after inverse trigonometric functions) with period da in given direction.
|
905
|
+
#
|
794
906
|
# @overload sew(dir,m_pi)
|
795
907
|
# @param [String] dir
|
796
908
|
# @param [mreal da=2] m_pi
|
@@ -801,6 +913,7 @@ end
|
|
801
913
|
|
802
914
|
# Data changing.
|
803
915
|
# 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.
|
916
|
+
#
|
804
917
|
# @overload smooth(dir="xyz",delta=0)
|
805
918
|
# @param [String] dir default="xyz"
|
806
919
|
# @param [Float] delta default=0
|
@@ -811,6 +924,7 @@ end
|
|
811
924
|
|
812
925
|
# Data changing.
|
813
926
|
# Find envelop for data values along direction dir.
|
927
|
+
#
|
814
928
|
# @overload envelop(dir='x')
|
815
929
|
# @param [String] dir default='x'
|
816
930
|
# @return [nil]
|
@@ -820,6 +934,7 @@ end
|
|
820
934
|
|
821
935
|
# Data changing.
|
822
936
|
# 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.
|
937
|
+
#
|
823
938
|
# @overload norm(v1=0,v2=1,sym=false,dim=0)
|
824
939
|
# @param [Float] v1 default=0
|
825
940
|
# @param [Float] v2 default=1
|
@@ -832,6 +947,7 @@ end
|
|
832
947
|
|
833
948
|
# Data changing.
|
834
949
|
# 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
|
950
|
+
#
|
835
951
|
# @overload norm_sl(v1=0,v2=1,dir='z',keep_en=true,sym=false)
|
836
952
|
# @param [Float] v1 default=0
|
837
953
|
# @param [Float] v2 default=1
|
@@ -845,6 +961,7 @@ end
|
|
845
961
|
|
846
962
|
# Interpolation.
|
847
963
|
# Interpolates data by cubic spline to the given point x in (0...nx-1), y in (0...ny-1), z in (0...nz-1).
|
964
|
+
#
|
848
965
|
# @overload spline(x,y=0,z=0)
|
849
966
|
# @param [Float] x
|
850
967
|
# @param [Float] y default=0
|
@@ -856,6 +973,7 @@ end
|
|
856
973
|
|
857
974
|
# Interpolation.
|
858
975
|
# Interpolates data by cubic spline to the given point x, y, z which assumed to be normalized in range (0, 1).
|
976
|
+
#
|
859
977
|
# @overload spline1(x,y=0,z=0)
|
860
978
|
# @param [Float] x
|
861
979
|
# @param [Float] y default=0
|
@@ -867,6 +985,7 @@ end
|
|
867
985
|
|
868
986
|
# Interpolation.
|
869
987
|
# 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.
|
988
|
+
#
|
870
989
|
# @overload spline(dif,x,y=0,z=0)
|
871
990
|
# @param [MglPoint] dif
|
872
991
|
# @param [Float] x
|
@@ -879,6 +998,7 @@ end
|
|
879
998
|
|
880
999
|
# Interpolation.
|
881
1000
|
# 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.
|
1001
|
+
#
|
882
1002
|
# @overload spline1(dif,x,y=0,z=0)
|
883
1003
|
# @param [MglPoint] dif
|
884
1004
|
# @param [Float] x
|
@@ -891,6 +1011,7 @@ end
|
|
891
1011
|
|
892
1012
|
# Interpolation.
|
893
1013
|
# Interpolates data by linear function to the given point x in (0...nx-1), y in (0...ny-1), z in (0...nz-1).
|
1014
|
+
#
|
894
1015
|
# @overload linear(x,y=0,z=0)
|
895
1016
|
# @param [Float] x
|
896
1017
|
# @param [Float] y default=0
|
@@ -902,6 +1023,7 @@ end
|
|
902
1023
|
|
903
1024
|
# Interpolation.
|
904
1025
|
# Interpolates data by linear function to the given point x, y, z which assumed to be normalized in range (0, 1).
|
1026
|
+
#
|
905
1027
|
# @overload linear1(x,y=0,z=0)
|
906
1028
|
# @param [Float] x
|
907
1029
|
# @param [Float] y default=0
|
@@ -913,6 +1035,7 @@ end
|
|
913
1035
|
|
914
1036
|
# Interpolation.
|
915
1037
|
# 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.
|
1038
|
+
#
|
916
1039
|
# @overload linear(dif,x,y=0,z=0)
|
917
1040
|
# @param [MglPoint] dif
|
918
1041
|
# @param [Float] x
|
@@ -925,6 +1048,7 @@ end
|
|
925
1048
|
|
926
1049
|
# Interpolation.
|
927
1050
|
# 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.
|
1051
|
+
#
|
928
1052
|
# @overload linear1(dif,x,y=0,z=0)
|
929
1053
|
# @param [MglPoint] dif
|
930
1054
|
# @param [Float] x
|
@@ -937,8 +1061,10 @@ end
|
|
937
1061
|
|
938
1062
|
# Data information.
|
939
1063
|
# Gets or prints to file fp or as message (in MGL) information about the data (sizes, maximum/minimum, momentums and so on).
|
1064
|
+
#
|
940
1065
|
# @overload print_info()
|
941
1066
|
# @return [String]
|
1067
|
+
#
|
942
1068
|
# @overload print_info(fp)
|
943
1069
|
# @param [FILE] fp
|
944
1070
|
# @return [nil]
|
@@ -948,18 +1074,34 @@ end
|
|
948
1074
|
|
949
1075
|
# Data information.
|
950
1076
|
# Gets the x-, y-, z-size of the data.
|
1077
|
+
#
|
951
1078
|
# @overload get_nx()
|
952
1079
|
# @return [long]
|
1080
|
+
def get_nx
|
1081
|
+
end
|
1082
|
+
|
1083
|
+
|
1084
|
+
# Data information.
|
1085
|
+
# Gets the x-, y-, z-size of the data.
|
1086
|
+
#
|
953
1087
|
# @overload get_ny()
|
954
1088
|
# @return [long]
|
1089
|
+
def get_ny
|
1090
|
+
end
|
1091
|
+
|
1092
|
+
|
1093
|
+
# Data information.
|
1094
|
+
# Gets the x-, y-, z-size of the data.
|
1095
|
+
#
|
955
1096
|
# @overload get_nz()
|
956
1097
|
# @return [long]
|
957
|
-
def
|
1098
|
+
def get_nz
|
958
1099
|
end
|
959
1100
|
|
960
1101
|
|
961
1102
|
# Data information.
|
962
1103
|
# Gets maximal value of the data.
|
1104
|
+
#
|
963
1105
|
# @overload maximal()
|
964
1106
|
# @return [Float]
|
965
1107
|
def maximal
|
@@ -968,6 +1110,7 @@ end
|
|
968
1110
|
|
969
1111
|
# Data information.
|
970
1112
|
# Gets minimal value of the data.
|
1113
|
+
#
|
971
1114
|
# @overload minimal()
|
972
1115
|
# @return [Float]
|
973
1116
|
def minimal
|
@@ -976,6 +1119,7 @@ end
|
|
976
1119
|
|
977
1120
|
# Data information.
|
978
1121
|
# Gets position of minimum to variables i, j, k and returns the minimal value.
|
1122
|
+
#
|
979
1123
|
# @overload minimal(i,j,k)
|
980
1124
|
# @param [Integer] i
|
981
1125
|
# @param [Integer] j
|
@@ -987,6 +1131,7 @@ end
|
|
987
1131
|
|
988
1132
|
# Data information.
|
989
1133
|
# Gets position of maximum to variables i, j, k and returns the maximal value.
|
1134
|
+
#
|
990
1135
|
# @overload maximal(i,j,k)
|
991
1136
|
# @param [Integer] i
|
992
1137
|
# @param [Integer] j
|
@@ -998,6 +1143,7 @@ end
|
|
998
1143
|
|
999
1144
|
# Data information.
|
1000
1145
|
# Gets approximated (interpolated) position of minimum to variables x, y, z and returns the minimal value.
|
1146
|
+
#
|
1001
1147
|
# @overload minimal(x,y,z)
|
1002
1148
|
# @param [Float] x
|
1003
1149
|
# @param [Float] y
|
@@ -1009,6 +1155,7 @@ end
|
|
1009
1155
|
|
1010
1156
|
# Data information.
|
1011
1157
|
# Gets approximated (interpolated) position of maximum to variables x, y, z and returns the maximal value.
|
1158
|
+
#
|
1012
1159
|
# @overload maximal(x,y,z)
|
1013
1160
|
# @param [Float] x
|
1014
1161
|
# @param [Float] y
|
@@ -1020,11 +1167,13 @@ end
|
|
1020
1167
|
|
1021
1168
|
# Data information.
|
1022
1169
|
# Gets zero-momentum (energy, I=\sum dat_i) and write first momentum (median, a = \sum \xi_i dat_i/I), second momentum (width, w^2 = \sum (\xi_i-a)^2 dat_i/I), third momentum (skewness, s = \sum (\xi_i-a)^3 dat_i/ I w^3) and fourth momentum (kurtosis, k = \sum (\xi_i-a)^4 dat_i / 3 I w^4) to variables. Here \xi is corresponding coordinate if dir is ''x'', ''y'' or ''z''. Otherwise median is a = \sum dat_i/N, width is w^2 = \sum (dat_i-a)^2/N and so on.
|
1170
|
+
#
|
1023
1171
|
# @overload momentum(dir,a,w)
|
1024
1172
|
# @param [String] dir
|
1025
1173
|
# @param [Float] a
|
1026
1174
|
# @param [Float] w
|
1027
1175
|
# @return [Float]
|
1176
|
+
#
|
1028
1177
|
# @overload momentum(dir,m,w,s,k)
|
1029
1178
|
# @param [String] dir
|
1030
1179
|
# @param [Float] m
|
@@ -1038,6 +1187,7 @@ end
|
|
1038
1187
|
|
1039
1188
|
# Data information.
|
1040
1189
|
# Find position (after specified in i, j, k) of first nonzero value of formula cond. Function return the data value at found position.
|
1190
|
+
#
|
1041
1191
|
# @overload find(cond,i,j,k)
|
1042
1192
|
# @param [String] cond
|
1043
1193
|
# @param [Integer] i
|
@@ -1050,6 +1200,7 @@ end
|
|
1050
1200
|
|
1051
1201
|
# Data information.
|
1052
1202
|
# Find position (before specified in i, j, k) of last nonzero value of formula cond. Function return the data value at found position.
|
1203
|
+
#
|
1053
1204
|
# @overload last(cond,i,j,k)
|
1054
1205
|
# @param [String] cond
|
1055
1206
|
# @param [Integer] i
|
@@ -1062,6 +1213,7 @@ end
|
|
1062
1213
|
|
1063
1214
|
# Data information.
|
1064
1215
|
# Return position of first in direction dir nonzero value of formula cond. The search is started from point (i,j,k).
|
1216
|
+
#
|
1065
1217
|
# @overload find(cond,dir,i=0,j=0,k=0)
|
1066
1218
|
# @param [String] cond
|
1067
1219
|
# @param [String] dir
|
@@ -1075,6 +1227,7 @@ end
|
|
1075
1227
|
|
1076
1228
|
# Data information.
|
1077
1229
|
# Determines if any nonzero value of formula in the data array.
|
1230
|
+
#
|
1078
1231
|
# @overload find_any(cond)
|
1079
1232
|
# @param [String] cond
|
1080
1233
|
# @return [bool]
|
@@ -1084,9 +1237,11 @@ end
|
|
1084
1237
|
|
1085
1238
|
# Operators.
|
1086
1239
|
# Adds the other data or the number.
|
1240
|
+
#
|
1087
1241
|
# @overload +(b)
|
1088
1242
|
# @param [MglData] b
|
1089
1243
|
# @return [MglData]
|
1244
|
+
#
|
1090
1245
|
# @overload +(b)
|
1091
1246
|
# @param [Float] b
|
1092
1247
|
# @return [MglData]
|
@@ -1096,9 +1251,11 @@ end
|
|
1096
1251
|
|
1097
1252
|
# Operators.
|
1098
1253
|
# Subtracts the other data or the number.
|
1254
|
+
#
|
1099
1255
|
# @overload -(b)
|
1100
1256
|
# @param [MglData] b
|
1101
1257
|
# @return [MglData]
|
1258
|
+
#
|
1102
1259
|
# @overload -(b)
|
1103
1260
|
# @param [Float] b
|
1104
1261
|
# @return [MglData]
|
@@ -1108,9 +1265,11 @@ end
|
|
1108
1265
|
|
1109
1266
|
# Operators.
|
1110
1267
|
# Multiplies by the other data or the number.
|
1268
|
+
#
|
1111
1269
|
# @overload *(b)
|
1112
1270
|
# @param [MglData] b
|
1113
1271
|
# @return [MglData]
|
1272
|
+
#
|
1114
1273
|
# @overload *(b)
|
1115
1274
|
# @param [Float] b
|
1116
1275
|
# @return [MglData]
|
@@ -1120,9 +1279,11 @@ end
|
|
1120
1279
|
|
1121
1280
|
# Operators.
|
1122
1281
|
# Divides by the other data or the number.
|
1282
|
+
#
|
1123
1283
|
# @overload /(b)
|
1124
1284
|
# @param [MglData] b
|
1125
1285
|
# @return [MglData]
|
1286
|
+
#
|
1126
1287
|
# @overload /(b)
|
1127
1288
|
# @param [Float] b
|
1128
1289
|
# @return [MglData]
|
@@ -1133,912 +1294,71 @@ end
|
|
1133
1294
|
end # MglData
|
1134
1295
|
|
1135
1296
|
|
1136
|
-
#
|
1137
|
-
class
|
1297
|
+
# MglExpr class
|
1298
|
+
class MglExpr
|
1138
1299
|
|
1139
|
-
#
|
1140
|
-
#
|
1141
|
-
#
|
1142
|
-
#
|
1300
|
+
# Evaluate expression.
|
1301
|
+
# Evaluates the formula for 'x','r'=x, 'y','n'=y, 'z','t'=z, 'a','u'=u.
|
1302
|
+
#
|
1303
|
+
# @overload eval(x,y,z)
|
1304
|
+
# @param [Float] x
|
1305
|
+
# @param [Float] y
|
1306
|
+
# @param [Float] z
|
1143
1307
|
# @return [Float]
|
1144
|
-
|
1145
|
-
# @param [Float] val
|
1146
|
-
# @param [long] i
|
1147
|
-
# @return [nil]
|
1148
|
-
def get_val
|
1149
|
-
end
|
1150
|
-
|
1151
|
-
|
1152
|
-
# Public variables.
|
1153
|
-
# Gets the x-, y-, z-size of the data.
|
1154
|
-
# @overload get_nx()
|
1155
|
-
# @return [long]
|
1156
|
-
# @overload get_ny()
|
1157
|
-
# @return [long]
|
1158
|
-
# @overload get_nz()
|
1159
|
-
# @return [long]
|
1160
|
-
def get_nx
|
1161
|
-
end
|
1162
|
-
|
1163
|
-
|
1164
|
-
# Data constructor.
|
1165
|
-
# Default constructor. Allocates the memory for data array and initializes it by zero. If string eq is specified then data will be filled by corresponding formula as in fill.
|
1166
|
-
# @overload initialize(mx=1,my=1,mz=1)
|
1167
|
-
# @param [Integer] mx default=1
|
1168
|
-
# @param [Integer] my default=1
|
1169
|
-
# @param [Integer] mz default=1
|
1170
|
-
# @return [MglDataC]
|
1171
|
-
def initialize
|
1172
|
-
end
|
1173
|
-
|
1174
|
-
|
1175
|
-
# Data constructor.
|
1176
|
-
# Copy constructor. Allocates the memory for data array and copy values from other array. At this, if parameter eq is specified then the data will be modified by corresponding formula similarly to fill.
|
1177
|
-
# @overload initialize(dat2)
|
1178
|
-
# @param [MglData] dat2
|
1179
|
-
# @return [MglDataC]
|
1180
|
-
# @overload initialize(dat2)
|
1181
|
-
# @param [MglData] dat2
|
1182
|
-
# @return [MglDataC]
|
1183
|
-
# @overload initialize(size,dat2)
|
1184
|
-
# @param [Integer] size
|
1185
|
-
# @param [float] dat2
|
1186
|
-
# @return [MglDataC]
|
1187
|
-
# @overload initialize(size,cols,dat2)
|
1188
|
-
# @param [Integer] size
|
1189
|
-
# @param [Integer] cols
|
1190
|
-
# @param [float] dat2
|
1191
|
-
# @return [MglDataC]
|
1192
|
-
# @overload initialize(size,dat2)
|
1193
|
-
# @param [Integer] size
|
1194
|
-
# @param [Float] dat2
|
1195
|
-
# @return [MglDataC]
|
1196
|
-
# @overload initialize(size,cols,dat2)
|
1197
|
-
# @param [Integer] size
|
1198
|
-
# @param [Integer] cols
|
1199
|
-
# @param [Float] dat2
|
1200
|
-
# @return [MglDataC]
|
1201
|
-
# @overload initialize(size,dat2)
|
1202
|
-
# @param [Integer] size
|
1203
|
-
# @param [dual] dat2
|
1204
|
-
# @return [MglDataC]
|
1205
|
-
# @overload initialize(size,cols,dat2)
|
1206
|
-
# @param [Integer] size
|
1207
|
-
# @param [Integer] cols
|
1208
|
-
# @param [dual] dat2
|
1209
|
-
# @return [MglDataC]
|
1210
|
-
def initialize
|
1211
|
-
end
|
1212
|
-
|
1213
|
-
|
1214
|
-
# Data constructor.
|
1215
|
-
# Reads data from tab-separated text file with auto determining sizes of the data.
|
1216
|
-
# @overload initialize(fname)
|
1217
|
-
# @param [String] fname
|
1218
|
-
# @return [MglDataC]
|
1219
|
-
def initialize
|
1220
|
-
end
|
1221
|
-
|
1222
|
-
|
1223
|
-
# Data resizing.
|
1224
|
-
# 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.
|
1225
|
-
# @overload create(mx,my=1,mz=1)
|
1226
|
-
# @param [Integer] mx
|
1227
|
-
# @param [Integer] my default=1
|
1228
|
-
# @param [Integer] mz default=1
|
1229
|
-
# @return [nil]
|
1230
|
-
def create
|
1231
|
-
end
|
1232
|
-
|
1233
|
-
|
1234
|
-
# Data resizing.
|
1235
|
-
# 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.
|
1236
|
-
# @overload rearrange(mx,my=0,mz=0)
|
1237
|
-
# @param [Integer] mx
|
1238
|
-
# @param [Integer] my default=0
|
1239
|
-
# @param [Integer] mz default=0
|
1240
|
-
# @return [nil]
|
1241
|
-
def rearrange
|
1242
|
-
end
|
1243
|
-
|
1244
|
-
|
1245
|
-
# Data resizing.
|
1246
|
-
# 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.
|
1247
|
-
# @overload transpose(dim="yx")
|
1248
|
-
# @param [String] dim default="yx"
|
1249
|
-
# @return [nil]
|
1250
|
-
def transpose
|
1251
|
-
end
|
1252
|
-
|
1253
|
-
|
1254
|
-
# Data resizing.
|
1255
|
-
# 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
|
1256
|
-
# @overload extend(n1,n2=0)
|
1257
|
-
# @param [Integer] n1
|
1258
|
-
# @param [Integer] n2 default=0
|
1259
|
-
# @return [nil]
|
1260
|
-
def extend
|
1261
|
-
end
|
1262
|
-
|
1263
|
-
|
1264
|
-
# Data resizing.
|
1265
|
-
# Reduces the data size by excluding data elements which indexes are not divisible by rx, ry, rz correspondingly. Parameter smooth set to use smoothing
|
1266
|
-
# @overload squeeze(rx,ry=1,rz=1,smooth=false)
|
1267
|
-
# @param [Integer] rx
|
1268
|
-
# @param [Integer] ry default=1
|
1269
|
-
# @param [Integer] rz default=1
|
1270
|
-
# @param [bool] smooth default=false
|
1271
|
-
# @return [nil]
|
1272
|
-
def squeeze
|
1308
|
+
def eval
|
1273
1309
|
end
|
1274
1310
|
|
1275
1311
|
|
1276
|
-
#
|
1277
|
-
#
|
1278
|
-
#
|
1279
|
-
#
|
1280
|
-
# @param [
|
1281
|
-
# @
|
1282
|
-
|
1283
|
-
def crop
|
1312
|
+
# Evaluate expression.
|
1313
|
+
# Evaluates the formula for variables in array var(0,...,'z'-'a').
|
1314
|
+
#
|
1315
|
+
# @overload eval(var)
|
1316
|
+
# @param [Float] var
|
1317
|
+
# @return [Float]
|
1318
|
+
def eval
|
1284
1319
|
end
|
1285
1320
|
|
1286
1321
|
|
1287
|
-
#
|
1288
|
-
#
|
1289
|
-
#
|
1322
|
+
# Evaluate expression.
|
1323
|
+
# Evaluates the formula derivation respect to dir for 'x','r'=x, 'y','n'=y, 'z','t'=z, 'a','u'=u.
|
1324
|
+
#
|
1325
|
+
# @overload diff(dir,x,y,z)
|
1290
1326
|
# @param [String] dir
|
1291
|
-
# @param [
|
1292
|
-
# @param [
|
1293
|
-
# @
|
1294
|
-
|
1327
|
+
# @param [Float] x
|
1328
|
+
# @param [Float] y
|
1329
|
+
# @param [Float] z
|
1330
|
+
# @return [Float]
|
1331
|
+
def diff
|
1295
1332
|
end
|
1296
1333
|
|
1297
1334
|
|
1298
|
-
#
|
1299
|
-
#
|
1300
|
-
#
|
1335
|
+
# Evaluate expression.
|
1336
|
+
# Evaluates the formula derivation respect to dir for variables in array var(0,...,'z'-'a').
|
1337
|
+
#
|
1338
|
+
# @overload diff(dir,var)
|
1301
1339
|
# @param [String] dir
|
1302
|
-
# @param [
|
1303
|
-
# @
|
1304
|
-
|
1305
|
-
def delete
|
1340
|
+
# @param [Float] var
|
1341
|
+
# @return [Float]
|
1342
|
+
def diff
|
1306
1343
|
end
|
1307
1344
|
|
1308
1345
|
|
1309
|
-
#
|
1310
|
-
# 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.
|
1311
|
-
# @overload join(vdat)
|
1312
|
-
# @param [MglData] vdat
|
1313
|
-
# @return [nil]
|
1314
|
-
def join
|
1315
|
-
end
|
1316
|
-
|
1346
|
+
end # MglExpr
|
1317
1347
|
|
1318
|
-
# Data filling.
|
1319
|
-
# Allocates memory and copies the data from the flat float* or double* array.
|
1320
|
-
# @overload set(a,nx,ny=1,nz=1)
|
1321
|
-
# @param [float] a
|
1322
|
-
# @param [Integer] nx
|
1323
|
-
# @param [Integer] ny default=1
|
1324
|
-
# @param [Integer] nz default=1
|
1325
|
-
# @return [nil]
|
1326
|
-
# @overload set(a,nx,ny=1,nz=1)
|
1327
|
-
# @param [Float] a
|
1328
|
-
# @param [Integer] nx
|
1329
|
-
# @param [Integer] ny default=1
|
1330
|
-
# @param [Integer] nz default=1
|
1331
|
-
# @return [nil]
|
1332
|
-
# @overload set(a,nx,ny=1,nz=1)
|
1333
|
-
# @param [dual] a
|
1334
|
-
# @param [Integer] nx
|
1335
|
-
# @param [Integer] ny default=1
|
1336
|
-
# @param [Integer] nz default=1
|
1337
|
-
# @return [nil]
|
1338
|
-
def set
|
1339
|
-
end
|
1340
1348
|
|
1349
|
+
# MglVar class
|
1350
|
+
class MglVar < MglData
|
1341
1351
|
|
1342
|
-
#
|
1343
|
-
#
|
1344
|
-
#
|
1345
|
-
#
|
1352
|
+
# MGL variables.
|
1353
|
+
# Evaluates the formula for 'x','r'=x, 'y','n'=y, 'z','t'=z, 'a','u'=u.
|
1354
|
+
#
|
1355
|
+
# @overload move_after(var)
|
1356
|
+
# @param [MglVar] var
|
1346
1357
|
# @return [nil]
|
1347
|
-
def
|
1358
|
+
def move_after
|
1348
1359
|
end
|
1349
1360
|
|
1350
1361
|
|
1351
|
-
#
|
1352
|
-
# Allocates memory and copies the data from the gsl_matrix * structure.
|
1353
|
-
# @overload set(m)
|
1354
|
-
# @param [gsl_matrix] m
|
1355
|
-
# @return [nil]
|
1356
|
-
def set
|
1357
|
-
end
|
1358
|
-
|
1362
|
+
end # MglVar
|
1359
1363
|
|
1360
|
-
# Data filling.
|
1361
|
-
# Copies the data from mglData (or mglDataA) instance from.
|
1362
|
-
# @overload set(from)
|
1363
|
-
# @param [MglData] from
|
1364
|
-
# @return [nil]
|
1365
|
-
def set
|
1366
1364
|
end
|
1367
|
-
|
1368
|
-
|
1369
|
-
# Data filling.
|
1370
|
-
# Copies the data from mglData instances for real and imaginary parts of complex data arrays.
|
1371
|
-
# @overload set(re,im)
|
1372
|
-
# @param [MglData] re
|
1373
|
-
# @param [MglData] im
|
1374
|
-
# @return [nil]
|
1375
|
-
def set
|
1376
|
-
end
|
1377
|
-
|
1378
|
-
|
1379
|
-
# Data filling.
|
1380
|
-
# Allocates memory and copies the data from the std::vector<T> array.
|
1381
|
-
# @overload set(d)
|
1382
|
-
# @param [std::vector<int>] d
|
1383
|
-
# @return [nil]
|
1384
|
-
# @overload set(d)
|
1385
|
-
# @param [std::vector<float>] d
|
1386
|
-
# @return [nil]
|
1387
|
-
# @overload set(d)
|
1388
|
-
# @param [std::vector<double>] d
|
1389
|
-
# @return [nil]
|
1390
|
-
# @overload set(d)
|
1391
|
-
# @param [std::vector<dual>] d
|
1392
|
-
# @return [nil]
|
1393
|
-
def set
|
1394
|
-
end
|
1395
|
-
|
1396
|
-
|
1397
|
-
# Data filling.
|
1398
|
-
# Allocates memory and scanf the data from the string.
|
1399
|
-
# @overload set(str,nx,ny=1,nz=1)
|
1400
|
-
# @param [String] str
|
1401
|
-
# @param [Integer] nx
|
1402
|
-
# @param [Integer] ny default=1
|
1403
|
-
# @param [Integer] nz default=1
|
1404
|
-
# @return [nil]
|
1405
|
-
def set
|
1406
|
-
end
|
1407
|
-
|
1408
|
-
|
1409
|
-
# Data filling.
|
1410
|
-
# Links external data array, i.e. don't delete this array at exit.
|
1411
|
-
# @overload link(from)
|
1412
|
-
# @param [MglDataC] from
|
1413
|
-
# @return [nil]
|
1414
|
-
# @overload link(a,nx,ny=1,nz=1)
|
1415
|
-
# @param [dual] a
|
1416
|
-
# @param [Integer] nx
|
1417
|
-
# @param [Integer] ny default=1
|
1418
|
-
# @param [Integer] nz default=1
|
1419
|
-
# @return [nil]
|
1420
|
-
def link
|
1421
|
-
end
|
1422
|
-
|
1423
|
-
|
1424
|
-
# Data filling.
|
1425
|
-
# Equidistantly fills the data values to range (v1, v2) in direction dir=('x','y','z').
|
1426
|
-
# @overload fill(v1,v2,dir='x')
|
1427
|
-
# @param [dual] v1
|
1428
|
-
# @param [dual] v2
|
1429
|
-
# @param [String] dir default='x'
|
1430
|
-
# @return [nil]
|
1431
|
-
def fill
|
1432
|
-
end
|
1433
|
-
|
1434
|
-
|
1435
|
-
# Data filling.
|
1436
|
-
# 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.
|
1437
|
-
# @overload modify(eq,dim=0)
|
1438
|
-
# @param [String] eq
|
1439
|
-
# @param [Integer] dim default=0
|
1440
|
-
# @return [nil]
|
1441
|
-
# @overload modify(eq,v)
|
1442
|
-
# @param [String] eq
|
1443
|
-
# @param [MglData] v
|
1444
|
-
# @return [nil]
|
1445
|
-
# @overload modify(eq,v,w)
|
1446
|
-
# @param [String] eq
|
1447
|
-
# @param [MglData] v
|
1448
|
-
# @param [MglData] w
|
1449
|
-
# @return [nil]
|
1450
|
-
def modify
|
1451
|
-
end
|
1452
|
-
|
1453
|
-
|
1454
|
-
# Data filling.
|
1455
|
-
# Sets the symbol ids for data columns. The string should contain one symbol 'a'...'z' per column. These ids are used in column.
|
1456
|
-
# @overload set_column_id(ids)
|
1457
|
-
# @param [String] ids
|
1458
|
-
# @return [nil]
|
1459
|
-
def set_column_id
|
1460
|
-
end
|
1461
|
-
|
1462
|
-
|
1463
|
-
# File I/O.
|
1464
|
-
# Reads data from tab-separated text file with auto determining sizes of the data. Double newline means the beginning of new z-slice.
|
1465
|
-
# @overload read(fname)
|
1466
|
-
# @param [String] fname
|
1467
|
-
# @return [bool]
|
1468
|
-
def read
|
1469
|
-
end
|
1470
|
-
|
1471
|
-
|
1472
|
-
# File I/O.
|
1473
|
-
# 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.
|
1474
|
-
# @overload read(fname,mx,my=1,mz=1)
|
1475
|
-
# @param [String] fname
|
1476
|
-
# @param [Integer] mx
|
1477
|
-
# @param [Integer] my default=1
|
1478
|
-
# @param [Integer] mz default=1
|
1479
|
-
# @return [bool]
|
1480
|
-
def read
|
1481
|
-
end
|
1482
|
-
|
1483
|
-
|
1484
|
-
# File I/O.
|
1485
|
-
# Read data from text file with size specified at beginning of the file by first dim numbers. At this, variable dim set data dimensions.
|
1486
|
-
# @overload read_mat(fname,dim=2)
|
1487
|
-
# @param [String] fname
|
1488
|
-
# @param [Integer] dim default=2
|
1489
|
-
# @return [bool]
|
1490
|
-
def read_mat
|
1491
|
-
end
|
1492
|
-
|
1493
|
-
|
1494
|
-
# File I/O.
|
1495
|
-
# 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.
|
1496
|
-
# @overload read_range(templ,from,to,step=1,as_slice=false)
|
1497
|
-
# @param [String] templ
|
1498
|
-
# @param [Float] from
|
1499
|
-
# @param [Float] to
|
1500
|
-
# @param [Float] step default=1
|
1501
|
-
# @param [bool] as_slice default=false
|
1502
|
-
# @return [nil]
|
1503
|
-
def read_range
|
1504
|
-
end
|
1505
|
-
|
1506
|
-
|
1507
|
-
# File I/O.
|
1508
|
-
# 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.
|
1509
|
-
# @overload read_all(templ,as_slice=false)
|
1510
|
-
# @param [String] templ
|
1511
|
-
# @param [bool] as_slice default=false
|
1512
|
-
# @return [nil]
|
1513
|
-
def read_all
|
1514
|
-
end
|
1515
|
-
|
1516
|
-
|
1517
|
-
# File I/O.
|
1518
|
-
# Saves the whole data array (for ns=-1) or only ns-th slice to text file.
|
1519
|
-
# @overload save(fname,ns=-1)
|
1520
|
-
# @param [String] fname
|
1521
|
-
# @param [Integer] ns default=-1
|
1522
|
-
# @return [nil]
|
1523
|
-
def save
|
1524
|
-
end
|
1525
|
-
|
1526
|
-
|
1527
|
-
# File I/O.
|
1528
|
-
# Reads data array named dname from HDF5 or HDF4 file. This function does nothing if HDF5|HDF4 was disabled during library compilation.
|
1529
|
-
# @overload read_hdf(fname,dname)
|
1530
|
-
# @param [String] fname
|
1531
|
-
# @param [String] dname
|
1532
|
-
# @return [nil]
|
1533
|
-
def read_hdf
|
1534
|
-
end
|
1535
|
-
|
1536
|
-
|
1537
|
-
# File I/O.
|
1538
|
-
# Saves data array named dname to HDF5 file. This function does nothing if HDF5 was disabled during library compilation.
|
1539
|
-
# @overload save_hdf(fname,dname,rewrite=false)
|
1540
|
-
# @param [String] fname
|
1541
|
-
# @param [String] dname
|
1542
|
-
# @param [bool] rewrite default=false
|
1543
|
-
# @return [nil]
|
1544
|
-
def save_hdf
|
1545
|
-
end
|
1546
|
-
|
1547
|
-
|
1548
|
-
# File I/O.
|
1549
|
-
# Put data names from HDF5 file fname into buf as '\t' separated fields. In MGL version the list of data names will be printed as message. This function does nothing if HDF5 was disabled during library compilation.
|
1550
|
-
# @overload datas_hdf(fname,buf,size)
|
1551
|
-
# @param [String] fname
|
1552
|
-
# @param [String] buf
|
1553
|
-
# @param [long] size
|
1554
|
-
# @return [Integer]
|
1555
|
-
def datas_hdf
|
1556
|
-
end
|
1557
|
-
|
1558
|
-
|
1559
|
-
# Make another data.
|
1560
|
-
# 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).
|
1561
|
-
# @overload sub_data(xx,yy=-1,zz=-1)
|
1562
|
-
# @param [Float] xx
|
1563
|
-
# @param [Float] yy default=-1
|
1564
|
-
# @param [Float] zz default=-1
|
1565
|
-
# @return [MglData]
|
1566
|
-
def sub_data
|
1567
|
-
end
|
1568
|
-
|
1569
|
-
|
1570
|
-
# Make another data.
|
1571
|
-
# 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).
|
1572
|
-
# @overload sub_data(xx,yy,zz)
|
1573
|
-
# @param [MglData] xx
|
1574
|
-
# @param [MglData] yy
|
1575
|
-
# @param [MglData] zz
|
1576
|
-
# @return [MglData]
|
1577
|
-
def sub_data
|
1578
|
-
end
|
1579
|
-
|
1580
|
-
|
1581
|
-
# Make another data.
|
1582
|
-
# 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').
|
1583
|
-
# @overload column(eq)
|
1584
|
-
# @param [String] eq
|
1585
|
-
# @return [MglData]
|
1586
|
-
def column
|
1587
|
-
end
|
1588
|
-
|
1589
|
-
|
1590
|
-
# Make another data.
|
1591
|
-
# 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).
|
1592
|
-
# @overload resize(mx,my=1,mz=1,x1=0,x2=1,y1=0,y2=1,z1=0,z2=1)
|
1593
|
-
# @param [Integer] mx
|
1594
|
-
# @param [Integer] my default=1
|
1595
|
-
# @param [Integer] mz default=1
|
1596
|
-
# @param [Float] x1 default=0
|
1597
|
-
# @param [Float] x2 default=1
|
1598
|
-
# @param [Float] y1 default=0
|
1599
|
-
# @param [Float] y2 default=1
|
1600
|
-
# @param [Float] z1 default=0
|
1601
|
-
# @param [Float] z2 default=1
|
1602
|
-
# @return [MglData]
|
1603
|
-
def resize
|
1604
|
-
end
|
1605
|
-
|
1606
|
-
|
1607
|
-
# Make another data.
|
1608
|
-
# 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.
|
1609
|
-
# @overload evaluate(idat,norm=true)
|
1610
|
-
# @param [MglData] idat
|
1611
|
-
# @param [bool] norm default=true
|
1612
|
-
# @return [MglData]
|
1613
|
-
# @overload evaluate(idat,jdat,norm=true)
|
1614
|
-
# @param [MglData] idat
|
1615
|
-
# @param [MglData] jdat
|
1616
|
-
# @param [bool] norm default=true
|
1617
|
-
# @return [MglData]
|
1618
|
-
# @overload evaluate(idat,jdat,kdat,norm=true)
|
1619
|
-
# @param [MglData] idat
|
1620
|
-
# @param [MglData] jdat
|
1621
|
-
# @param [MglData] kdat
|
1622
|
-
# @param [bool] norm default=true
|
1623
|
-
# @return [MglData]
|
1624
|
-
def evaluate
|
1625
|
-
end
|
1626
|
-
|
1627
|
-
|
1628
|
-
# Make another data.
|
1629
|
-
# 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). See also Data manipulation
|
1630
|
-
# @overload hist(n,v1=0,v2=1,nsub=0)
|
1631
|
-
# @param [Integer] n
|
1632
|
-
# @param [Float] v1 default=0
|
1633
|
-
# @param [Float] v2 default=1
|
1634
|
-
# @param [Integer] nsub default=0
|
1635
|
-
# @return [MglData]
|
1636
|
-
# @overload hist(w,n,v1=0,v2=1,nsub=0)
|
1637
|
-
# @param [MglData] w
|
1638
|
-
# @param [Integer] n
|
1639
|
-
# @param [Float] v1 default=0
|
1640
|
-
# @param [Float] v2 default=1
|
1641
|
-
# @param [Integer] nsub default=0
|
1642
|
-
# @return [MglData]
|
1643
|
-
def hist
|
1644
|
-
end
|
1645
|
-
|
1646
|
-
|
1647
|
-
# Make another data.
|
1648
|
-
# Gets momentum (1d-array) of the data along direction dir. String how contain kind of momentum. The momentum is defined like as
|
1649
|
-
# if dir='z' and so on. Coordinates 'x', 'y', 'z' are data indexes normalized in range (0,1).
|
1650
|
-
# @overload momentum(dir,how)
|
1651
|
-
# @param [String] dir
|
1652
|
-
# @param [String] how
|
1653
|
-
# @return [MglData]
|
1654
|
-
def momentum
|
1655
|
-
end
|
1656
|
-
|
1657
|
-
|
1658
|
-
# Make another data.
|
1659
|
-
# Gets array which is the result of summation in given direction or direction(s).
|
1660
|
-
# @overload sum(dir)
|
1661
|
-
# @param [String] dir
|
1662
|
-
# @return [MglData]
|
1663
|
-
def sum
|
1664
|
-
end
|
1665
|
-
|
1666
|
-
|
1667
|
-
# Make another data.
|
1668
|
-
# Gets array which is the maximal data values in given direction or direction(s).
|
1669
|
-
# @overload max(dir)
|
1670
|
-
# @param [String] dir
|
1671
|
-
# @return [MglData]
|
1672
|
-
def max
|
1673
|
-
end
|
1674
|
-
|
1675
|
-
|
1676
|
-
# Make another data.
|
1677
|
-
# Gets array which is the maximal data values in given direction or direction(s).
|
1678
|
-
# @overload min(dir)
|
1679
|
-
# @param [String] dir
|
1680
|
-
# @return [MglData]
|
1681
|
-
def min
|
1682
|
-
end
|
1683
|
-
|
1684
|
-
|
1685
|
-
# Make another data.
|
1686
|
-
# Returns direct multiplication of arrays (like, res(i,j) = this(i)*a(j) and so on).
|
1687
|
-
# @overload combine(a)
|
1688
|
-
# @param [MglData] a
|
1689
|
-
# @return [MglData]
|
1690
|
-
def combine
|
1691
|
-
end
|
1692
|
-
|
1693
|
-
|
1694
|
-
# Make another data.
|
1695
|
-
# 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.
|
1696
|
-
# @overload trace()
|
1697
|
-
# @return [MglData]
|
1698
|
-
def trace
|
1699
|
-
end
|
1700
|
-
|
1701
|
-
|
1702
|
-
# Make another data.
|
1703
|
-
# Gets array of real parts of the data.
|
1704
|
-
# @overload real()
|
1705
|
-
# @return [MglData]
|
1706
|
-
def real
|
1707
|
-
end
|
1708
|
-
|
1709
|
-
|
1710
|
-
# Make another data.
|
1711
|
-
# Gets array of imaginary parts of the data.
|
1712
|
-
# @overload imag()
|
1713
|
-
# @return [MglData]
|
1714
|
-
def imag
|
1715
|
-
end
|
1716
|
-
|
1717
|
-
|
1718
|
-
# Make another data.
|
1719
|
-
# Gets array of absolute values of the data.
|
1720
|
-
# @overload abs()
|
1721
|
-
# @return [MglData]
|
1722
|
-
def abs
|
1723
|
-
end
|
1724
|
-
|
1725
|
-
|
1726
|
-
# Make another data.
|
1727
|
-
# Gets array of arguments of the data.
|
1728
|
-
# @overload arg()
|
1729
|
-
# @return [MglData]
|
1730
|
-
def arg
|
1731
|
-
end
|
1732
|
-
|
1733
|
-
|
1734
|
-
# Data changing.
|
1735
|
-
# Cumulative summation of the data in given direction or directions.
|
1736
|
-
# @overload cum_sum(dir)
|
1737
|
-
# @param [String] dir
|
1738
|
-
# @return [nil]
|
1739
|
-
def cum_sum
|
1740
|
-
end
|
1741
|
-
|
1742
|
-
|
1743
|
-
# Data changing.
|
1744
|
-
# Integrates (like cumulative summation) the data in given direction or directions.
|
1745
|
-
# @overload integral(dir)
|
1746
|
-
# @param [String] dir
|
1747
|
-
# @return [nil]
|
1748
|
-
def integral
|
1749
|
-
end
|
1750
|
-
|
1751
|
-
|
1752
|
-
# Data changing.
|
1753
|
-
# Differentiates the data in given direction or directions.
|
1754
|
-
# @overload diff(dir)
|
1755
|
-
# @param [String] dir
|
1756
|
-
# @return [nil]
|
1757
|
-
def diff
|
1758
|
-
end
|
1759
|
-
|
1760
|
-
|
1761
|
-
# Data changing.
|
1762
|
-
# Double-differentiates (like Laplace operator) the data in given direction.
|
1763
|
-
# @overload diff2(dir)
|
1764
|
-
# @param [String] dir
|
1765
|
-
# @return [nil]
|
1766
|
-
def diff2
|
1767
|
-
end
|
1768
|
-
|
1769
|
-
|
1770
|
-
# Data changing.
|
1771
|
-
# 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).
|
1772
|
-
# @overload fft(dir)
|
1773
|
-
# @param [String] dir
|
1774
|
-
# @return [nil]
|
1775
|
-
def fft
|
1776
|
-
end
|
1777
|
-
|
1778
|
-
|
1779
|
-
# Data changing.
|
1780
|
-
# 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).
|
1781
|
-
# @overload hankel(dir)
|
1782
|
-
# @param [String] dir
|
1783
|
-
# @return [nil]
|
1784
|
-
def hankel
|
1785
|
-
end
|
1786
|
-
|
1787
|
-
|
1788
|
-
# Data changing.
|
1789
|
-
# Swaps the left and right part of the data in given direction (useful for Fourier spectrum).
|
1790
|
-
# @overload swap(dir)
|
1791
|
-
# @param [String] dir
|
1792
|
-
# @return [nil]
|
1793
|
-
def swap
|
1794
|
-
end
|
1795
|
-
|
1796
|
-
|
1797
|
-
# Data changing.
|
1798
|
-
# Rolls the data along direction dir. Resulting array will be out(i) = ini((i+num)%nx) if dir='x'.
|
1799
|
-
# @overload roll(dir,error)
|
1800
|
-
# @param [String] dir
|
1801
|
-
# @param [unknown] error
|
1802
|
-
# @return [nil]
|
1803
|
-
def roll
|
1804
|
-
end
|
1805
|
-
|
1806
|
-
|
1807
|
-
# Data changing.
|
1808
|
-
# 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.
|
1809
|
-
# @overload mirror(dir)
|
1810
|
-
# @param [String] dir
|
1811
|
-
# @return [nil]
|
1812
|
-
def mirror
|
1813
|
-
end
|
1814
|
-
|
1815
|
-
|
1816
|
-
# Data changing.
|
1817
|
-
# 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.
|
1818
|
-
# @overload smooth(dir="xyz",delta=0)
|
1819
|
-
# @param [String] dir default="xyz"
|
1820
|
-
# @param [Float] delta default=0
|
1821
|
-
# @return [nil]
|
1822
|
-
def smooth
|
1823
|
-
end
|
1824
|
-
|
1825
|
-
|
1826
|
-
# Interpolation.
|
1827
|
-
# Interpolates data by linear function to the given point x in (0...nx-1), y in (0...ny-1), z in (0...nz-1).
|
1828
|
-
# @overload linear(x,y=0,z=0)
|
1829
|
-
# @param [Float] x
|
1830
|
-
# @param [Float] y default=0
|
1831
|
-
# @param [Float] z default=0
|
1832
|
-
# @return [dual]
|
1833
|
-
def linear
|
1834
|
-
end
|
1835
|
-
|
1836
|
-
|
1837
|
-
# Interpolation.
|
1838
|
-
# Interpolates data by linear function to the given point x, y, z which assumed to be normalized in range (0, 1).
|
1839
|
-
# @overload linear1(x,y=0,z=0)
|
1840
|
-
# @param [Float] x
|
1841
|
-
# @param [Float] y default=0
|
1842
|
-
# @param [Float] z default=0
|
1843
|
-
# @return [dual]
|
1844
|
-
def linear1
|
1845
|
-
end
|
1846
|
-
|
1847
|
-
|
1848
|
-
# Interpolation.
|
1849
|
-
# 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.
|
1850
|
-
# @overload linear(dif,x,y=0,z=0)
|
1851
|
-
# @param [MglPoint] dif
|
1852
|
-
# @param [Float] x
|
1853
|
-
# @param [Float] y default=0
|
1854
|
-
# @param [Float] z default=0
|
1855
|
-
# @return [dual]
|
1856
|
-
def linear
|
1857
|
-
end
|
1858
|
-
|
1859
|
-
|
1860
|
-
# Interpolation.
|
1861
|
-
# 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.
|
1862
|
-
# @overload linear1(dif,x,y=0,z=0)
|
1863
|
-
# @param [MglPoint] dif
|
1864
|
-
# @param [Float] x
|
1865
|
-
# @param [Float] y default=0
|
1866
|
-
# @param [Float] z default=0
|
1867
|
-
# @return [dual]
|
1868
|
-
def linear1
|
1869
|
-
end
|
1870
|
-
|
1871
|
-
|
1872
|
-
# Data information.
|
1873
|
-
# Gets or prints to file fp or as message (in MGL) information about the data (sizes, maximum/minimum, momentums and so on).
|
1874
|
-
# @overload print_info()
|
1875
|
-
# @return [String]
|
1876
|
-
# @overload print_info(fp)
|
1877
|
-
# @param [FILE] fp
|
1878
|
-
# @return [nil]
|
1879
|
-
def print_info
|
1880
|
-
end
|
1881
|
-
|
1882
|
-
|
1883
|
-
# Data information.
|
1884
|
-
# Gets the x-, y-, z-size of the data.
|
1885
|
-
# @overload get_nx()
|
1886
|
-
# @return [long]
|
1887
|
-
# @overload get_ny()
|
1888
|
-
# @return [long]
|
1889
|
-
# @overload get_nz()
|
1890
|
-
# @return [long]
|
1891
|
-
def get_nx
|
1892
|
-
end
|
1893
|
-
|
1894
|
-
|
1895
|
-
# Data information.
|
1896
|
-
# Gets maximal value of the data.
|
1897
|
-
# @overload maximal()
|
1898
|
-
# @return [Float]
|
1899
|
-
def maximal
|
1900
|
-
end
|
1901
|
-
|
1902
|
-
|
1903
|
-
# Data information.
|
1904
|
-
# Gets minimal value of the data.
|
1905
|
-
# @overload minimal()
|
1906
|
-
# @return [Float]
|
1907
|
-
def minimal
|
1908
|
-
end
|
1909
|
-
|
1910
|
-
|
1911
|
-
# Data information.
|
1912
|
-
# Gets position of minimum to variables i, j, k and returns the minimal value.
|
1913
|
-
# @overload minimal(i,j,k)
|
1914
|
-
# @param [Integer] i
|
1915
|
-
# @param [Integer] j
|
1916
|
-
# @param [Integer] k
|
1917
|
-
# @return [Float]
|
1918
|
-
def minimal
|
1919
|
-
end
|
1920
|
-
|
1921
|
-
|
1922
|
-
# Data information.
|
1923
|
-
# Gets position of maximum to variables i, j, k and returns the maximal value.
|
1924
|
-
# @overload maximal(i,j,k)
|
1925
|
-
# @param [Integer] i
|
1926
|
-
# @param [Integer] j
|
1927
|
-
# @param [Integer] k
|
1928
|
-
# @return [Float]
|
1929
|
-
def maximal
|
1930
|
-
end
|
1931
|
-
|
1932
|
-
|
1933
|
-
# Data information.
|
1934
|
-
# Gets approximated (interpolated) position of minimum to variables x, y, z and returns the minimal value.
|
1935
|
-
# @overload minimal(x,y,z)
|
1936
|
-
# @param [Float] x
|
1937
|
-
# @param [Float] y
|
1938
|
-
# @param [Float] z
|
1939
|
-
# @return [Float]
|
1940
|
-
def minimal
|
1941
|
-
end
|
1942
|
-
|
1943
|
-
|
1944
|
-
# Data information.
|
1945
|
-
# Gets approximated (interpolated) position of maximum to variables x, y, z and returns the maximal value.
|
1946
|
-
# @overload maximal(x,y,z)
|
1947
|
-
# @param [Float] x
|
1948
|
-
# @param [Float] y
|
1949
|
-
# @param [Float] z
|
1950
|
-
# @return [Float]
|
1951
|
-
def maximal
|
1952
|
-
end
|
1953
|
-
|
1954
|
-
|
1955
|
-
end # MglDataC
|
1956
|
-
|
1957
|
-
|
1958
|
-
# MglExpr class
|
1959
|
-
class MglExpr
|
1960
|
-
|
1961
|
-
# Evaluate expression.
|
1962
|
-
# Evaluates the formula for 'x','r'=x, 'y','n'=y, 'z','t'=z, 'a','u'=u.
|
1963
|
-
# @overload eval(x,y,z)
|
1964
|
-
# @param [Float] x
|
1965
|
-
# @param [Float] y
|
1966
|
-
# @param [Float] z
|
1967
|
-
# @return [Float]
|
1968
|
-
def eval
|
1969
|
-
end
|
1970
|
-
|
1971
|
-
|
1972
|
-
# Evaluate expression.
|
1973
|
-
# Evaluates the formula for variables in array var(0,...,'z'-'a').
|
1974
|
-
# @overload var(error)
|
1975
|
-
# @param [unknown] error
|
1976
|
-
# @return [mreal Eval (mreal]
|
1977
|
-
def var
|
1978
|
-
end
|
1979
|
-
|
1980
|
-
|
1981
|
-
# Evaluate expression.
|
1982
|
-
# Evaluates the formula derivation respect to dir for 'x','r'=x, 'y','n'=y, 'z','t'=z, 'a','u'=u.
|
1983
|
-
# @overload diff(dir,x,y,z)
|
1984
|
-
# @param [String] dir
|
1985
|
-
# @param [Float] x
|
1986
|
-
# @param [Float] y
|
1987
|
-
# @param [Float] z
|
1988
|
-
# @return [Float]
|
1989
|
-
def diff
|
1990
|
-
end
|
1991
|
-
|
1992
|
-
|
1993
|
-
# Evaluate expression.
|
1994
|
-
# Evaluates the formula derivation respect to dir for variables in array var(0,...,'z'-'a').
|
1995
|
-
# @overload var(error)
|
1996
|
-
# @param [unknown] error
|
1997
|
-
# @return [mreal Diff (char dir, mreal]
|
1998
|
-
def var
|
1999
|
-
end
|
2000
|
-
|
2001
|
-
|
2002
|
-
end # MglExpr
|
2003
|
-
|
2004
|
-
|
2005
|
-
# MglExprC class
|
2006
|
-
class MglExprC
|
2007
|
-
|
2008
|
-
# Evaluate expression.
|
2009
|
-
# Evaluates the formula for 'x','r'=x, 'y','n'=y, 'z','t'=z, 'a','u'=u.
|
2010
|
-
# @overload eval(x,y,z)
|
2011
|
-
# @param [dual] x
|
2012
|
-
# @param [dual] y
|
2013
|
-
# @param [dual] z
|
2014
|
-
# @return [dual]
|
2015
|
-
def eval
|
2016
|
-
end
|
2017
|
-
|
2018
|
-
|
2019
|
-
# Evaluate expression.
|
2020
|
-
# Evaluates the formula for variables in array var(0,...,'z'-'a').
|
2021
|
-
# @overload var(error)
|
2022
|
-
# @param [unknown] error
|
2023
|
-
# @return [dual Eval (dual]
|
2024
|
-
def var
|
2025
|
-
end
|
2026
|
-
|
2027
|
-
|
2028
|
-
end # MglExprC
|
2029
|
-
|
2030
|
-
|
2031
|
-
# MglVar class
|
2032
|
-
class MglVar
|
2033
|
-
|
2034
|
-
# MGL variables.
|
2035
|
-
# Evaluates the formula for 'x','r'=x, 'y','n'=y, 'z','t'=z, 'a','u'=u.
|
2036
|
-
# @overload move_after(var)
|
2037
|
-
# @param [MglVar] var
|
2038
|
-
# @return [nil]
|
2039
|
-
def move_after
|
2040
|
-
end
|
2041
|
-
|
2042
|
-
|
2043
|
-
end # MglVar
|
2044
|
-
|