mathgl 0.0.5 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/README.md +3 -2
- data/ext/mathgl/data.i +507 -0
- data/ext/mathgl/depend +1 -1
- data/ext/mathgl/mathgl.cxx +70062 -60001
- data/ext/mathgl/mathgl.i +12 -13
- data/ext/mathgl/mgl.i +1349 -0
- data/ext/mathgl/type.i +100 -0
- data/lib/mathgl/version.rb +1 -1
- data/mathgl.gemspec +1 -1
- data/misc/Rakefile +2 -2
- data/misc/conv_texi.rb +10 -7
- data/setup.rb +9 -6
- metadata +12 -9
- data/misc/lib/mathgl/libdoc_core_en.rb +0 -4271
- data/misc/lib/mathgl/libdoc_data_en.rb +0 -1364
- data/misc/lib/mathgl/libdoc_other_en.rb +0 -215
- data/misc/lib/mathgl/libdoc_parse_en.rb +0 -175
- data/misc/lib/mathgl/libdoc_window_en.rb +0 -38
@@ -1,1364 +0,0 @@
|
|
1
|
-
# This document is converted from data_en.texi.
|
2
|
-
|
3
|
-
# module MathGL
|
4
|
-
module MathGL
|
5
|
-
|
6
|
-
# MglData class
|
7
|
-
class MglData
|
8
|
-
|
9
|
-
# Public variables.
|
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
|
-
#
|
12
|
-
# @overload get_val(i)
|
13
|
-
# @param [long] i
|
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
|
-
#
|
22
|
-
# @overload set_val(val,i)
|
23
|
-
# @param [Float] val
|
24
|
-
# @param [long] i
|
25
|
-
# @return [nil]
|
26
|
-
def set_val
|
27
|
-
end
|
28
|
-
|
29
|
-
|
30
|
-
# Public variables.
|
31
|
-
# Gets the x-, y-, z-size of the data.
|
32
|
-
#
|
33
|
-
# @overload get_nx()
|
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
|
-
#
|
42
|
-
# @overload get_ny()
|
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
|
-
#
|
51
|
-
# @overload get_nz()
|
52
|
-
# @return [long]
|
53
|
-
def get_nz
|
54
|
-
end
|
55
|
-
|
56
|
-
|
57
|
-
# Data constructor.
|
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
|
-
#
|
60
|
-
# @overload initialize(mx=1,my=1,mz=1)
|
61
|
-
# @param [Integer] mx default=1
|
62
|
-
# @param [Integer] my default=1
|
63
|
-
# @param [Integer] mz default=1
|
64
|
-
# @return [MglData]
|
65
|
-
def initialize
|
66
|
-
end
|
67
|
-
|
68
|
-
|
69
|
-
# Data constructor.
|
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
|
-
#
|
72
|
-
# @overload initialize(dat2)
|
73
|
-
# @param [MglData] dat2
|
74
|
-
# @return [MglData]
|
75
|
-
#
|
76
|
-
# @overload initialize(dat2)
|
77
|
-
# @param [MglData] dat2
|
78
|
-
# @return [MglData]
|
79
|
-
#
|
80
|
-
# @overload initialize(size,dat2)
|
81
|
-
# @param [Integer] size
|
82
|
-
# @param [float] dat2
|
83
|
-
# @return [MglData]
|
84
|
-
#
|
85
|
-
# @overload initialize(size,cols,dat2)
|
86
|
-
# @param [Integer] size
|
87
|
-
# @param [Integer] cols
|
88
|
-
# @param [float] dat2
|
89
|
-
# @return [MglData]
|
90
|
-
#
|
91
|
-
# @overload initialize(size,dat2)
|
92
|
-
# @param [Integer] size
|
93
|
-
# @param [Float] dat2
|
94
|
-
# @return [MglData]
|
95
|
-
#
|
96
|
-
# @overload initialize(size,cols,dat2)
|
97
|
-
# @param [Integer] size
|
98
|
-
# @param [Integer] cols
|
99
|
-
# @param [Float] dat2
|
100
|
-
# @return [MglData]
|
101
|
-
#
|
102
|
-
# @overload initialize(dat2,size)
|
103
|
-
# @param [Float] dat2
|
104
|
-
# @param [Integer] size
|
105
|
-
# @return [MglData]
|
106
|
-
#
|
107
|
-
# @overload initialize(dat2,size,cols)
|
108
|
-
# @param [Float] dat2
|
109
|
-
# @param [Integer] size
|
110
|
-
# @param [Integer] cols
|
111
|
-
# @return [MglData]
|
112
|
-
def initialize
|
113
|
-
end
|
114
|
-
|
115
|
-
|
116
|
-
# Data constructor.
|
117
|
-
# Reads data from tab-separated text file with auto determining sizes of the data.
|
118
|
-
#
|
119
|
-
# @overload initialize(fname)
|
120
|
-
# @param [String] fname
|
121
|
-
# @return [MglData]
|
122
|
-
def initialize
|
123
|
-
end
|
124
|
-
|
125
|
-
|
126
|
-
# Data resizing.
|
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
|
-
#
|
129
|
-
# @overload create(mx,my=1,mz=1)
|
130
|
-
# @param [Integer] mx
|
131
|
-
# @param [Integer] my default=1
|
132
|
-
# @param [Integer] mz default=1
|
133
|
-
# @return [nil]
|
134
|
-
def create
|
135
|
-
end
|
136
|
-
|
137
|
-
|
138
|
-
# Data resizing.
|
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
|
-
#
|
141
|
-
# @overload rearrange(mx,my=0,mz=0)
|
142
|
-
# @param [Integer] mx
|
143
|
-
# @param [Integer] my default=0
|
144
|
-
# @param [Integer] mz default=0
|
145
|
-
# @return [nil]
|
146
|
-
def rearrange
|
147
|
-
end
|
148
|
-
|
149
|
-
|
150
|
-
# Data resizing.
|
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
|
-
#
|
153
|
-
# @overload transpose(dim="yx")
|
154
|
-
# @param [String] dim default="yx"
|
155
|
-
# @return [nil]
|
156
|
-
def transpose
|
157
|
-
end
|
158
|
-
|
159
|
-
|
160
|
-
# Data resizing.
|
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
|
-
#
|
163
|
-
# @overload extend(n1,n2=0)
|
164
|
-
# @param [Integer] n1
|
165
|
-
# @param [Integer] n2 default=0
|
166
|
-
# @return [nil]
|
167
|
-
def extend
|
168
|
-
end
|
169
|
-
|
170
|
-
|
171
|
-
# Data resizing.
|
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
|
-
#
|
174
|
-
# @overload squeeze(rx,ry=1,rz=1,smooth=false)
|
175
|
-
# @param [Integer] rx
|
176
|
-
# @param [Integer] ry default=1
|
177
|
-
# @param [Integer] rz default=1
|
178
|
-
# @param [bool] smooth default=false
|
179
|
-
# @return [nil]
|
180
|
-
def squeeze
|
181
|
-
end
|
182
|
-
|
183
|
-
|
184
|
-
# Data resizing.
|
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
|
-
#
|
187
|
-
# @overload crop(n1,n2,dir='x')
|
188
|
-
# @param [Integer] n1
|
189
|
-
# @param [Integer] n2
|
190
|
-
# @param [String] dir default='x'
|
191
|
-
# @return [nil]
|
192
|
-
def crop
|
193
|
-
end
|
194
|
-
|
195
|
-
|
196
|
-
# Data resizing.
|
197
|
-
# Insert num slices along dir-direction at position pos and fill it by zeros.
|
198
|
-
#
|
199
|
-
# @overload insert(dir,pos=0,num=1)
|
200
|
-
# @param [String] dir
|
201
|
-
# @param [Integer] pos default=0
|
202
|
-
# @param [Integer] num default=1
|
203
|
-
# @return [nil]
|
204
|
-
def insert
|
205
|
-
end
|
206
|
-
|
207
|
-
|
208
|
-
# Data resizing.
|
209
|
-
# Delete num slices along dir-direction at position pos.
|
210
|
-
#
|
211
|
-
# @overload delete(dir,pos=0,num=1)
|
212
|
-
# @param [String] dir
|
213
|
-
# @param [Integer] pos default=0
|
214
|
-
# @param [Integer] num default=1
|
215
|
-
# @return [nil]
|
216
|
-
def delete
|
217
|
-
end
|
218
|
-
|
219
|
-
|
220
|
-
# Data resizing.
|
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
|
-
#
|
223
|
-
# @overload sort(idx,idy=-1)
|
224
|
-
# @param [lond] idx
|
225
|
-
# @param [long] idy default=-1
|
226
|
-
# @return [nil]
|
227
|
-
def sort
|
228
|
-
end
|
229
|
-
|
230
|
-
|
231
|
-
# Data resizing.
|
232
|
-
# Delete rows which values are equal to next row for given column idx.
|
233
|
-
#
|
234
|
-
# @overload clean(idx)
|
235
|
-
# @param [lond] idx
|
236
|
-
# @return [nil]
|
237
|
-
def clean
|
238
|
-
end
|
239
|
-
|
240
|
-
|
241
|
-
# Data resizing.
|
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
|
-
#
|
244
|
-
# @overload join(vdat)
|
245
|
-
# @param [MglData] vdat
|
246
|
-
# @return [nil]
|
247
|
-
def join
|
248
|
-
end
|
249
|
-
|
250
|
-
|
251
|
-
# Data filling.
|
252
|
-
# Allocates memory and copies the data from the flat float* or double* array.
|
253
|
-
#
|
254
|
-
# @overload set(a,nx,ny=1,nz=1)
|
255
|
-
# @param [float] a
|
256
|
-
# @param [Integer] nx
|
257
|
-
# @param [Integer] ny default=1
|
258
|
-
# @param [Integer] nz default=1
|
259
|
-
# @return [nil]
|
260
|
-
#
|
261
|
-
# @overload set(a,nx,ny=1,nz=1)
|
262
|
-
# @param [Float] a
|
263
|
-
# @param [Integer] nx
|
264
|
-
# @param [Integer] ny default=1
|
265
|
-
# @param [Integer] nz default=1
|
266
|
-
# @return [nil]
|
267
|
-
def set
|
268
|
-
end
|
269
|
-
|
270
|
-
|
271
|
-
# Data filling.
|
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
|
-
#
|
274
|
-
# @overload set(a,n1,n2)
|
275
|
-
# @param [float] a
|
276
|
-
# @param [Integer] n1
|
277
|
-
# @param [Integer] n2
|
278
|
-
# @return [nil]
|
279
|
-
#
|
280
|
-
# @overload set(a,n1,n2)
|
281
|
-
# @param [Float] a
|
282
|
-
# @param [Integer] n1
|
283
|
-
# @param [Integer] n2
|
284
|
-
# @return [nil]
|
285
|
-
def set
|
286
|
-
end
|
287
|
-
|
288
|
-
|
289
|
-
# Data filling.
|
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
|
-
#
|
292
|
-
# @overload set(a,n1,n2)
|
293
|
-
# @param [float] a
|
294
|
-
# @param [Integer] n1
|
295
|
-
# @param [Integer] n2
|
296
|
-
# @return [nil]
|
297
|
-
#
|
298
|
-
# @overload set(a,n1,n2)
|
299
|
-
# @param [Float] a
|
300
|
-
# @param [Integer] n1
|
301
|
-
# @param [Integer] n2
|
302
|
-
# @return [nil]
|
303
|
-
def set
|
304
|
-
end
|
305
|
-
|
306
|
-
|
307
|
-
# Data filling.
|
308
|
-
# Allocates memory and copies the data from the gsl_vector * structure.
|
309
|
-
#
|
310
|
-
# @overload set(v)
|
311
|
-
# @param [gsl_vector] v
|
312
|
-
# @return [nil]
|
313
|
-
def set
|
314
|
-
end
|
315
|
-
|
316
|
-
|
317
|
-
# Data filling.
|
318
|
-
# Allocates memory and copies the data from the gsl_matrix * structure.
|
319
|
-
#
|
320
|
-
# @overload set(m)
|
321
|
-
# @param [gsl_matrix] m
|
322
|
-
# @return [nil]
|
323
|
-
def set
|
324
|
-
end
|
325
|
-
|
326
|
-
|
327
|
-
# Data filling.
|
328
|
-
# Copies the data from mglData (or mglDataA) instance from.
|
329
|
-
#
|
330
|
-
# @overload set(from)
|
331
|
-
# @param [MglData] from
|
332
|
-
# @return [nil]
|
333
|
-
def set
|
334
|
-
end
|
335
|
-
|
336
|
-
|
337
|
-
# Data filling.
|
338
|
-
# Allocates memory and copies the data from the std::vector<T> array.
|
339
|
-
#
|
340
|
-
# @overload set(d)
|
341
|
-
# @param [std::vector<int>] d
|
342
|
-
# @return [nil]
|
343
|
-
#
|
344
|
-
# @overload set(d)
|
345
|
-
# @param [std::vector<float>] d
|
346
|
-
# @return [nil]
|
347
|
-
#
|
348
|
-
# @overload set(d)
|
349
|
-
# @param [std::vector<double>] d
|
350
|
-
# @return [nil]
|
351
|
-
def set
|
352
|
-
end
|
353
|
-
|
354
|
-
|
355
|
-
# Data filling.
|
356
|
-
# Allocates memory and scanf the data from the string.
|
357
|
-
#
|
358
|
-
# @overload set(str,nx,ny=1,nz=1)
|
359
|
-
# @param [String] str
|
360
|
-
# @param [Integer] nx
|
361
|
-
# @param [Integer] ny default=1
|
362
|
-
# @param [Integer] nz default=1
|
363
|
-
# @return [nil]
|
364
|
-
def set
|
365
|
-
end
|
366
|
-
|
367
|
-
|
368
|
-
# Data filling.
|
369
|
-
# Links external data array, i.e. don't delete this array at exit.
|
370
|
-
#
|
371
|
-
# @overload link(from)
|
372
|
-
# @param [MglData] from
|
373
|
-
# @return [nil]
|
374
|
-
#
|
375
|
-
# @overload link(a,nx,ny=1,nz=1)
|
376
|
-
# @param [Float] a
|
377
|
-
# @param [Integer] nx
|
378
|
-
# @param [Integer] ny default=1
|
379
|
-
# @param [Integer] nz default=1
|
380
|
-
# @return [nil]
|
381
|
-
def link
|
382
|
-
end
|
383
|
-
|
384
|
-
|
385
|
-
# Data filling.
|
386
|
-
# Equidistantly fills the data values to range (v1, v2) in direction dir=('x','y','z').
|
387
|
-
#
|
388
|
-
# @overload fill(v1,v2,dir='x')
|
389
|
-
# @param [Float] v1
|
390
|
-
# @param [Float] v2
|
391
|
-
# @param [String] dir default='x'
|
392
|
-
# @return [nil]
|
393
|
-
def fill
|
394
|
-
end
|
395
|
-
|
396
|
-
|
397
|
-
# Data filling.
|
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
|
-
#
|
400
|
-
# @overload modify(eq,dim=0)
|
401
|
-
# @param [String] eq
|
402
|
-
# @param [Integer] dim default=0
|
403
|
-
# @return [nil]
|
404
|
-
#
|
405
|
-
# @overload modify(eq,v)
|
406
|
-
# @param [String] eq
|
407
|
-
# @param [MglData] v
|
408
|
-
# @return [nil]
|
409
|
-
#
|
410
|
-
# @overload modify(eq,v,w)
|
411
|
-
# @param [String] eq
|
412
|
-
# @param [MglData] v
|
413
|
-
# @param [MglData] w
|
414
|
-
# @return [nil]
|
415
|
-
def modify
|
416
|
-
end
|
417
|
-
|
418
|
-
|
419
|
-
# Data filling.
|
420
|
-
# Fills data by 'x' or 'k' samples for Hankel ('h') or Fourier ('f') transform.
|
421
|
-
#
|
422
|
-
# @overload fill_sample(how)
|
423
|
-
# @param [String] how
|
424
|
-
# @return [nil]
|
425
|
-
def fill_sample
|
426
|
-
end
|
427
|
-
|
428
|
-
|
429
|
-
# Data filling.
|
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
|
-
#
|
432
|
-
# @overload put(val,i=-1,j=-1,k=-1)
|
433
|
-
# @param [Float] val
|
434
|
-
# @param [Integer] i default=-1
|
435
|
-
# @param [Integer] j default=-1
|
436
|
-
# @param [Integer] k default=-1
|
437
|
-
# @return [nil]
|
438
|
-
def put
|
439
|
-
end
|
440
|
-
|
441
|
-
|
442
|
-
# Data filling.
|
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
|
-
#
|
445
|
-
# @overload put(v,i=-1,j=-1,k=-1)
|
446
|
-
# @param [MglData] v
|
447
|
-
# @param [Integer] i default=-1
|
448
|
-
# @param [Integer] j default=-1
|
449
|
-
# @param [Integer] k default=-1
|
450
|
-
# @return [nil]
|
451
|
-
def put
|
452
|
-
end
|
453
|
-
|
454
|
-
|
455
|
-
# Data filling.
|
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
|
-
#
|
458
|
-
# @overload set_column_id(ids)
|
459
|
-
# @param [String] ids
|
460
|
-
# @return [nil]
|
461
|
-
def set_column_id
|
462
|
-
end
|
463
|
-
|
464
|
-
|
465
|
-
# File I/O.
|
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
|
-
#
|
468
|
-
# @overload read(fname)
|
469
|
-
# @param [String] fname
|
470
|
-
# @return [bool]
|
471
|
-
def read
|
472
|
-
end
|
473
|
-
|
474
|
-
|
475
|
-
# File I/O.
|
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
|
-
#
|
478
|
-
# @overload read(fname,mx,my=1,mz=1)
|
479
|
-
# @param [String] fname
|
480
|
-
# @param [Integer] mx
|
481
|
-
# @param [Integer] my default=1
|
482
|
-
# @param [Integer] mz default=1
|
483
|
-
# @return [bool]
|
484
|
-
def read
|
485
|
-
end
|
486
|
-
|
487
|
-
|
488
|
-
# File I/O.
|
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
|
-
#
|
491
|
-
# @overload read_mat(fname,dim=2)
|
492
|
-
# @param [String] fname
|
493
|
-
# @param [Integer] dim default=2
|
494
|
-
# @return [bool]
|
495
|
-
def read_mat
|
496
|
-
end
|
497
|
-
|
498
|
-
|
499
|
-
# File I/O.
|
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
|
-
#
|
502
|
-
# @overload read_range(templ,from,to,step=1,as_slice=false)
|
503
|
-
# @param [String] templ
|
504
|
-
# @param [Float] from
|
505
|
-
# @param [Float] to
|
506
|
-
# @param [Float] step default=1
|
507
|
-
# @param [bool] as_slice default=false
|
508
|
-
# @return [nil]
|
509
|
-
def read_range
|
510
|
-
end
|
511
|
-
|
512
|
-
|
513
|
-
# File I/O.
|
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
|
-
#
|
516
|
-
# @overload read_all(templ,as_slice=false)
|
517
|
-
# @param [String] templ
|
518
|
-
# @param [bool] as_slice default=false
|
519
|
-
# @return [nil]
|
520
|
-
def read_all
|
521
|
-
end
|
522
|
-
|
523
|
-
|
524
|
-
# File I/O.
|
525
|
-
# Saves the whole data array (for ns=-1) or only ns-th slice to text file.
|
526
|
-
#
|
527
|
-
# @overload save(fname,ns=-1)
|
528
|
-
# @param [String] fname
|
529
|
-
# @param [Integer] ns default=-1
|
530
|
-
# @return [nil]
|
531
|
-
def save
|
532
|
-
end
|
533
|
-
|
534
|
-
|
535
|
-
# File I/O.
|
536
|
-
# Reads data array named dname from HDF5 or HDF4 file. This function does nothing if HDF5|HDF4 was disabled during library compilation.
|
537
|
-
#
|
538
|
-
# @overload read_hdf(fname,dname)
|
539
|
-
# @param [String] fname
|
540
|
-
# @param [String] dname
|
541
|
-
# @return [nil]
|
542
|
-
def read_hdf
|
543
|
-
end
|
544
|
-
|
545
|
-
|
546
|
-
# File I/O.
|
547
|
-
# Saves data array named dname to HDF5 file. This function does nothing if HDF5 was disabled during library compilation.
|
548
|
-
#
|
549
|
-
# @overload save_hdf(fname,dname,rewrite=false)
|
550
|
-
# @param [String] fname
|
551
|
-
# @param [String] dname
|
552
|
-
# @param [bool] rewrite default=false
|
553
|
-
# @return [nil]
|
554
|
-
def save_hdf
|
555
|
-
end
|
556
|
-
|
557
|
-
|
558
|
-
# File I/O.
|
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
|
-
#
|
561
|
-
# @overload datas_hdf(fname,buf,size)
|
562
|
-
# @param [String] fname
|
563
|
-
# @param [String] buf
|
564
|
-
# @param [long] size
|
565
|
-
# @return [Integer]
|
566
|
-
def datas_hdf
|
567
|
-
end
|
568
|
-
|
569
|
-
|
570
|
-
# File I/O.
|
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
|
-
#
|
573
|
-
# @overload import(fname,scheme,v1=0,v2=1)
|
574
|
-
# @param [String] fname
|
575
|
-
# @param [String] scheme
|
576
|
-
# @param [Float] v1 default=0
|
577
|
-
# @param [Float] v2 default=1
|
578
|
-
# @return [nil]
|
579
|
-
def import
|
580
|
-
end
|
581
|
-
|
582
|
-
|
583
|
-
# File I/O.
|
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
|
-
#
|
586
|
-
# @overload export(fname,scheme,v1=0,v2=0,ns=-1)
|
587
|
-
# @param [String] fname
|
588
|
-
# @param [String] scheme
|
589
|
-
# @param [Float] v1 default=0
|
590
|
-
# @param [Float] v2 default=0
|
591
|
-
# @param [Integer] ns default=-1
|
592
|
-
# @return [nil]
|
593
|
-
def export
|
594
|
-
end
|
595
|
-
|
596
|
-
|
597
|
-
# Make another data.
|
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
|
-
#
|
600
|
-
# @overload sub_data(xx,yy=-1,zz=-1)
|
601
|
-
# @param [Float] xx
|
602
|
-
# @param [Float] yy default=-1
|
603
|
-
# @param [Float] zz default=-1
|
604
|
-
# @return [MglData]
|
605
|
-
def sub_data
|
606
|
-
end
|
607
|
-
|
608
|
-
|
609
|
-
# Make another data.
|
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
|
-
#
|
612
|
-
# @overload sub_data(xx,yy,zz)
|
613
|
-
# @param [MglData] xx
|
614
|
-
# @param [MglData] yy
|
615
|
-
# @param [MglData] zz
|
616
|
-
# @return [MglData]
|
617
|
-
def sub_data
|
618
|
-
end
|
619
|
-
|
620
|
-
|
621
|
-
# Make another data.
|
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
|
-
#
|
624
|
-
# @overload column(eq)
|
625
|
-
# @param [String] eq
|
626
|
-
# @return [MglData]
|
627
|
-
def column
|
628
|
-
end
|
629
|
-
|
630
|
-
|
631
|
-
# Make another data.
|
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
|
-
#
|
634
|
-
# @overload resize(mx,my=1,mz=1,x1=0,x2=1,y1=0,y2=1,z1=0,z2=1)
|
635
|
-
# @param [Integer] mx
|
636
|
-
# @param [Integer] my default=1
|
637
|
-
# @param [Integer] mz default=1
|
638
|
-
# @param [Float] x1 default=0
|
639
|
-
# @param [Float] x2 default=1
|
640
|
-
# @param [Float] y1 default=0
|
641
|
-
# @param [Float] y2 default=1
|
642
|
-
# @param [Float] z1 default=0
|
643
|
-
# @param [Float] z2 default=1
|
644
|
-
# @return [MglData]
|
645
|
-
def resize
|
646
|
-
end
|
647
|
-
|
648
|
-
|
649
|
-
# Make another data.
|
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
|
-
#
|
652
|
-
# @overload evaluate(idat,norm=true)
|
653
|
-
# @param [MglData] idat
|
654
|
-
# @param [bool] norm default=true
|
655
|
-
# @return [MglData]
|
656
|
-
#
|
657
|
-
# @overload evaluate(idat,jdat,norm=true)
|
658
|
-
# @param [MglData] idat
|
659
|
-
# @param [MglData] jdat
|
660
|
-
# @param [bool] norm default=true
|
661
|
-
# @return [MglData]
|
662
|
-
#
|
663
|
-
# @overload evaluate(idat,jdat,kdat,norm=true)
|
664
|
-
# @param [MglData] idat
|
665
|
-
# @param [MglData] jdat
|
666
|
-
# @param [MglData] kdat
|
667
|
-
# @param [bool] norm default=true
|
668
|
-
# @return [MglData]
|
669
|
-
def evaluate
|
670
|
-
end
|
671
|
-
|
672
|
-
|
673
|
-
# Make another data.
|
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
|
-
#
|
676
|
-
# @overload solve(val,dir,norm=true)
|
677
|
-
# @param [Float] val
|
678
|
-
# @param [String] dir
|
679
|
-
# @param [bool] norm default=true
|
680
|
-
# @return [MglData]
|
681
|
-
#
|
682
|
-
# @overload solve(val,dir,idat,norm=true)
|
683
|
-
# @param [Float] val
|
684
|
-
# @param [String] dir
|
685
|
-
# @param [MglData] idat
|
686
|
-
# @param [bool] norm default=true
|
687
|
-
# @return [MglData]
|
688
|
-
def solve
|
689
|
-
end
|
690
|
-
|
691
|
-
|
692
|
-
# Make another data.
|
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
|
-
#
|
695
|
-
# @overload hist(n,v1=0,v2=1,nsub=0)
|
696
|
-
# @param [Integer] n
|
697
|
-
# @param [Float] v1 default=0
|
698
|
-
# @param [Float] v2 default=1
|
699
|
-
# @param [Integer] nsub default=0
|
700
|
-
# @return [MglData]
|
701
|
-
#
|
702
|
-
# @overload hist(w,n,v1=0,v2=1,nsub=0)
|
703
|
-
# @param [MglData] w
|
704
|
-
# @param [Integer] n
|
705
|
-
# @param [Float] v1 default=0
|
706
|
-
# @param [Float] v2 default=1
|
707
|
-
# @param [Integer] nsub default=0
|
708
|
-
# @return [MglData]
|
709
|
-
def hist
|
710
|
-
end
|
711
|
-
|
712
|
-
|
713
|
-
# Make another data.
|
714
|
-
# Gets momentum (1d-array) of the data along direction dir. String how contain kind of momentum. The momentum is defined like as
|
715
|
-
# if dir='z' and so on. Coordinates 'x', 'y', 'z' are data indexes normalized in range (0,1).
|
716
|
-
#
|
717
|
-
# @overload momentum(dir,how)
|
718
|
-
# @param [String] dir
|
719
|
-
# @param [String] how
|
720
|
-
# @return [MglData]
|
721
|
-
def momentum
|
722
|
-
end
|
723
|
-
|
724
|
-
|
725
|
-
# Make another data.
|
726
|
-
# Gets array which is the result of summation in given direction or direction(s).
|
727
|
-
#
|
728
|
-
# @overload sum(dir)
|
729
|
-
# @param [String] dir
|
730
|
-
# @return [MglData]
|
731
|
-
def sum
|
732
|
-
end
|
733
|
-
|
734
|
-
|
735
|
-
# Make another data.
|
736
|
-
# Gets array which is the maximal data values in given direction or direction(s).
|
737
|
-
#
|
738
|
-
# @overload max(dir)
|
739
|
-
# @param [String] dir
|
740
|
-
# @return [MglData]
|
741
|
-
def max
|
742
|
-
end
|
743
|
-
|
744
|
-
|
745
|
-
# Make another data.
|
746
|
-
# Gets array which is the maximal data values in given direction or direction(s).
|
747
|
-
#
|
748
|
-
# @overload min(dir)
|
749
|
-
# @param [String] dir
|
750
|
-
# @return [MglData]
|
751
|
-
def min
|
752
|
-
end
|
753
|
-
|
754
|
-
|
755
|
-
# Make another data.
|
756
|
-
# Returns direct multiplication of arrays (like, res(i,j) = this(i)*a(j) and so on).
|
757
|
-
#
|
758
|
-
# @overload combine(a)
|
759
|
-
# @param [MglData] a
|
760
|
-
# @return [MglData]
|
761
|
-
def combine
|
762
|
-
end
|
763
|
-
|
764
|
-
|
765
|
-
# Make another data.
|
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
|
-
#
|
768
|
-
# @overload trace()
|
769
|
-
# @return [MglData]
|
770
|
-
def trace
|
771
|
-
end
|
772
|
-
|
773
|
-
|
774
|
-
# Make another data.
|
775
|
-
# Find roots of equation 'func'=0 for variable var with initial guess ini. Secant method is used for root finding.
|
776
|
-
#
|
777
|
-
# @overload roots(func,var)
|
778
|
-
# @param [String] func
|
779
|
-
# @param [String] var
|
780
|
-
# @return [MglData]
|
781
|
-
def roots
|
782
|
-
end
|
783
|
-
|
784
|
-
|
785
|
-
# Data changing.
|
786
|
-
# Cumulative summation of the data in given direction or directions.
|
787
|
-
#
|
788
|
-
# @overload cum_sum(dir)
|
789
|
-
# @param [String] dir
|
790
|
-
# @return [nil]
|
791
|
-
def cum_sum
|
792
|
-
end
|
793
|
-
|
794
|
-
|
795
|
-
# Data changing.
|
796
|
-
# Integrates (like cumulative summation) the data in given direction or directions.
|
797
|
-
#
|
798
|
-
# @overload integral(dir)
|
799
|
-
# @param [String] dir
|
800
|
-
# @return [nil]
|
801
|
-
def integral
|
802
|
-
end
|
803
|
-
|
804
|
-
|
805
|
-
# Data changing.
|
806
|
-
# Differentiates the data in given direction or directions.
|
807
|
-
#
|
808
|
-
# @overload diff(dir)
|
809
|
-
# @param [String] dir
|
810
|
-
# @return [nil]
|
811
|
-
def diff
|
812
|
-
end
|
813
|
-
|
814
|
-
|
815
|
-
# Data changing.
|
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
|
-
#
|
818
|
-
# @overload diff(x,y)
|
819
|
-
# @param [MglData] x
|
820
|
-
# @param [MglData] y
|
821
|
-
# @return [nil]
|
822
|
-
#
|
823
|
-
# @overload diff(x,y,z)
|
824
|
-
# @param [MglData] x
|
825
|
-
# @param [MglData] y
|
826
|
-
# @param [MglData] z
|
827
|
-
# @return [nil]
|
828
|
-
def diff
|
829
|
-
end
|
830
|
-
|
831
|
-
|
832
|
-
# Data changing.
|
833
|
-
# Double-differentiates (like Laplace operator) the data in given direction.
|
834
|
-
#
|
835
|
-
# @overload diff2(dir)
|
836
|
-
# @param [String] dir
|
837
|
-
# @return [nil]
|
838
|
-
def diff2
|
839
|
-
end
|
840
|
-
|
841
|
-
|
842
|
-
# Data changing.
|
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
|
-
#
|
845
|
-
# @overload sin_fft(dir)
|
846
|
-
# @param [String] dir
|
847
|
-
# @return [nil]
|
848
|
-
def sin_fft
|
849
|
-
end
|
850
|
-
|
851
|
-
|
852
|
-
# Data changing.
|
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
|
-
#
|
855
|
-
# @overload cos_fft(dir)
|
856
|
-
# @param [String] dir
|
857
|
-
# @return [nil]
|
858
|
-
def cos_fft
|
859
|
-
end
|
860
|
-
|
861
|
-
|
862
|
-
# Data changing.
|
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
|
-
#
|
865
|
-
# @overload hankel(dir)
|
866
|
-
# @param [String] dir
|
867
|
-
# @return [nil]
|
868
|
-
def hankel
|
869
|
-
end
|
870
|
-
|
871
|
-
|
872
|
-
# Data changing.
|
873
|
-
# Swaps the left and right part of the data in given direction (useful for Fourier spectrum).
|
874
|
-
#
|
875
|
-
# @overload swap(dir)
|
876
|
-
# @param [String] dir
|
877
|
-
# @return [nil]
|
878
|
-
def swap
|
879
|
-
end
|
880
|
-
|
881
|
-
|
882
|
-
# Data changing.
|
883
|
-
# Rolls the data along direction dir. Resulting array will be out(i) = ini((i+num)%nx) if dir='x'.
|
884
|
-
#
|
885
|
-
# @overload roll(dir,num)
|
886
|
-
# @param [String] dir
|
887
|
-
# @param [Numeric] num
|
888
|
-
# @return [nil]
|
889
|
-
def roll
|
890
|
-
end
|
891
|
-
|
892
|
-
|
893
|
-
# Data changing.
|
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
|
-
#
|
896
|
-
# @overload mirror(dir)
|
897
|
-
# @param [String] dir
|
898
|
-
# @return [nil]
|
899
|
-
def mirror
|
900
|
-
end
|
901
|
-
|
902
|
-
|
903
|
-
# Data changing.
|
904
|
-
# Remove value steps (like phase jumps after inverse trigonometric functions) with period da in given direction.
|
905
|
-
#
|
906
|
-
# @overload sew(dir,m_pi)
|
907
|
-
# @param [String] dir
|
908
|
-
# @param [mreal da=2] m_pi
|
909
|
-
# @return [nil]
|
910
|
-
def sew
|
911
|
-
end
|
912
|
-
|
913
|
-
|
914
|
-
# Data changing.
|
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
|
-
#
|
917
|
-
# @overload smooth(dir="xyz",delta=0)
|
918
|
-
# @param [String] dir default="xyz"
|
919
|
-
# @param [Float] delta default=0
|
920
|
-
# @return [nil]
|
921
|
-
def smooth
|
922
|
-
end
|
923
|
-
|
924
|
-
|
925
|
-
# Data changing.
|
926
|
-
# Find envelop for data values along direction dir.
|
927
|
-
#
|
928
|
-
# @overload envelop(dir='x')
|
929
|
-
# @param [String] dir default='x'
|
930
|
-
# @return [nil]
|
931
|
-
def envelop
|
932
|
-
end
|
933
|
-
|
934
|
-
|
935
|
-
# Data changing.
|
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
|
-
#
|
938
|
-
# @overload norm(v1=0,v2=1,sym=false,dim=0)
|
939
|
-
# @param [Float] v1 default=0
|
940
|
-
# @param [Float] v2 default=1
|
941
|
-
# @param [bool] sym default=false
|
942
|
-
# @param [Integer] dim default=0
|
943
|
-
# @return [nil]
|
944
|
-
def norm
|
945
|
-
end
|
946
|
-
|
947
|
-
|
948
|
-
# Data changing.
|
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
|
-
#
|
951
|
-
# @overload norm_sl(v1=0,v2=1,dir='z',keep_en=true,sym=false)
|
952
|
-
# @param [Float] v1 default=0
|
953
|
-
# @param [Float] v2 default=1
|
954
|
-
# @param [String] dir default='z'
|
955
|
-
# @param [bool] keep_en default=true
|
956
|
-
# @param [bool] sym default=false
|
957
|
-
# @return [nil]
|
958
|
-
def norm_sl
|
959
|
-
end
|
960
|
-
|
961
|
-
|
962
|
-
# Interpolation.
|
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
|
-
#
|
965
|
-
# @overload spline(x,y=0,z=0)
|
966
|
-
# @param [Float] x
|
967
|
-
# @param [Float] y default=0
|
968
|
-
# @param [Float] z default=0
|
969
|
-
# @return [Float]
|
970
|
-
def spline
|
971
|
-
end
|
972
|
-
|
973
|
-
|
974
|
-
# Interpolation.
|
975
|
-
# Interpolates data by cubic spline to the given point x, y, z which assumed to be normalized in range (0, 1).
|
976
|
-
#
|
977
|
-
# @overload spline1(x,y=0,z=0)
|
978
|
-
# @param [Float] x
|
979
|
-
# @param [Float] y default=0
|
980
|
-
# @param [Float] z default=0
|
981
|
-
# @return [Float]
|
982
|
-
def spline1
|
983
|
-
end
|
984
|
-
|
985
|
-
|
986
|
-
# Interpolation.
|
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
|
-
#
|
989
|
-
# @overload spline(dif,x,y=0,z=0)
|
990
|
-
# @param [MglPoint] dif
|
991
|
-
# @param [Float] x
|
992
|
-
# @param [Float] y default=0
|
993
|
-
# @param [Float] z default=0
|
994
|
-
# @return [Float]
|
995
|
-
def spline
|
996
|
-
end
|
997
|
-
|
998
|
-
|
999
|
-
# Interpolation.
|
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
|
-
#
|
1002
|
-
# @overload spline1(dif,x,y=0,z=0)
|
1003
|
-
# @param [MglPoint] dif
|
1004
|
-
# @param [Float] x
|
1005
|
-
# @param [Float] y default=0
|
1006
|
-
# @param [Float] z default=0
|
1007
|
-
# @return [Float]
|
1008
|
-
def spline1
|
1009
|
-
end
|
1010
|
-
|
1011
|
-
|
1012
|
-
# Interpolation.
|
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
|
-
#
|
1015
|
-
# @overload linear(x,y=0,z=0)
|
1016
|
-
# @param [Float] x
|
1017
|
-
# @param [Float] y default=0
|
1018
|
-
# @param [Float] z default=0
|
1019
|
-
# @return [Float]
|
1020
|
-
def linear
|
1021
|
-
end
|
1022
|
-
|
1023
|
-
|
1024
|
-
# Interpolation.
|
1025
|
-
# Interpolates data by linear function to the given point x, y, z which assumed to be normalized in range (0, 1).
|
1026
|
-
#
|
1027
|
-
# @overload linear1(x,y=0,z=0)
|
1028
|
-
# @param [Float] x
|
1029
|
-
# @param [Float] y default=0
|
1030
|
-
# @param [Float] z default=0
|
1031
|
-
# @return [Float]
|
1032
|
-
def linear1
|
1033
|
-
end
|
1034
|
-
|
1035
|
-
|
1036
|
-
# Interpolation.
|
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
|
-
#
|
1039
|
-
# @overload linear(dif,x,y=0,z=0)
|
1040
|
-
# @param [MglPoint] dif
|
1041
|
-
# @param [Float] x
|
1042
|
-
# @param [Float] y default=0
|
1043
|
-
# @param [Float] z default=0
|
1044
|
-
# @return [Float]
|
1045
|
-
def linear
|
1046
|
-
end
|
1047
|
-
|
1048
|
-
|
1049
|
-
# Interpolation.
|
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
|
-
#
|
1052
|
-
# @overload linear1(dif,x,y=0,z=0)
|
1053
|
-
# @param [MglPoint] dif
|
1054
|
-
# @param [Float] x
|
1055
|
-
# @param [Float] y default=0
|
1056
|
-
# @param [Float] z default=0
|
1057
|
-
# @return [Float]
|
1058
|
-
def linear1
|
1059
|
-
end
|
1060
|
-
|
1061
|
-
|
1062
|
-
# Data information.
|
1063
|
-
# Gets or prints to file fp or as message (in MGL) information about the data (sizes, maximum/minimum, momentums and so on).
|
1064
|
-
#
|
1065
|
-
# @overload print_info()
|
1066
|
-
# @return [String]
|
1067
|
-
#
|
1068
|
-
# @overload print_info(fp)
|
1069
|
-
# @param [FILE] fp
|
1070
|
-
# @return [nil]
|
1071
|
-
def print_info
|
1072
|
-
end
|
1073
|
-
|
1074
|
-
|
1075
|
-
# Data information.
|
1076
|
-
# Gets the x-, y-, z-size of the data.
|
1077
|
-
#
|
1078
|
-
# @overload get_nx()
|
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
|
-
#
|
1087
|
-
# @overload get_ny()
|
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
|
-
#
|
1096
|
-
# @overload get_nz()
|
1097
|
-
# @return [long]
|
1098
|
-
def get_nz
|
1099
|
-
end
|
1100
|
-
|
1101
|
-
|
1102
|
-
# Data information.
|
1103
|
-
# Gets maximal value of the data.
|
1104
|
-
#
|
1105
|
-
# @overload maximal()
|
1106
|
-
# @return [Float]
|
1107
|
-
def maximal
|
1108
|
-
end
|
1109
|
-
|
1110
|
-
|
1111
|
-
# Data information.
|
1112
|
-
# Gets minimal value of the data.
|
1113
|
-
#
|
1114
|
-
# @overload minimal()
|
1115
|
-
# @return [Float]
|
1116
|
-
def minimal
|
1117
|
-
end
|
1118
|
-
|
1119
|
-
|
1120
|
-
# Data information.
|
1121
|
-
# Gets position of minimum to variables i, j, k and returns the minimal value.
|
1122
|
-
#
|
1123
|
-
# @overload minimal(i,j,k)
|
1124
|
-
# @param [Integer] i
|
1125
|
-
# @param [Integer] j
|
1126
|
-
# @param [Integer] k
|
1127
|
-
# @return [Float]
|
1128
|
-
def minimal
|
1129
|
-
end
|
1130
|
-
|
1131
|
-
|
1132
|
-
# Data information.
|
1133
|
-
# Gets position of maximum to variables i, j, k and returns the maximal value.
|
1134
|
-
#
|
1135
|
-
# @overload maximal(i,j,k)
|
1136
|
-
# @param [Integer] i
|
1137
|
-
# @param [Integer] j
|
1138
|
-
# @param [Integer] k
|
1139
|
-
# @return [Float]
|
1140
|
-
def maximal
|
1141
|
-
end
|
1142
|
-
|
1143
|
-
|
1144
|
-
# Data information.
|
1145
|
-
# Gets approximated (interpolated) position of minimum to variables x, y, z and returns the minimal value.
|
1146
|
-
#
|
1147
|
-
# @overload minimal(x,y,z)
|
1148
|
-
# @param [Float] x
|
1149
|
-
# @param [Float] y
|
1150
|
-
# @param [Float] z
|
1151
|
-
# @return [Float]
|
1152
|
-
def minimal
|
1153
|
-
end
|
1154
|
-
|
1155
|
-
|
1156
|
-
# Data information.
|
1157
|
-
# Gets approximated (interpolated) position of maximum to variables x, y, z and returns the maximal value.
|
1158
|
-
#
|
1159
|
-
# @overload maximal(x,y,z)
|
1160
|
-
# @param [Float] x
|
1161
|
-
# @param [Float] y
|
1162
|
-
# @param [Float] z
|
1163
|
-
# @return [Float]
|
1164
|
-
def maximal
|
1165
|
-
end
|
1166
|
-
|
1167
|
-
|
1168
|
-
# Data information.
|
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
|
-
#
|
1171
|
-
# @overload momentum(dir,a,w)
|
1172
|
-
# @param [String] dir
|
1173
|
-
# @param [Float] a
|
1174
|
-
# @param [Float] w
|
1175
|
-
# @return [Float]
|
1176
|
-
#
|
1177
|
-
# @overload momentum(dir,m,w,s,k)
|
1178
|
-
# @param [String] dir
|
1179
|
-
# @param [Float] m
|
1180
|
-
# @param [Float] w
|
1181
|
-
# @param [Float] s
|
1182
|
-
# @param [Float] k
|
1183
|
-
# @return [Float]
|
1184
|
-
def momentum
|
1185
|
-
end
|
1186
|
-
|
1187
|
-
|
1188
|
-
# Data information.
|
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
|
-
#
|
1191
|
-
# @overload find(cond,i,j,k)
|
1192
|
-
# @param [String] cond
|
1193
|
-
# @param [Integer] i
|
1194
|
-
# @param [Integer] j
|
1195
|
-
# @param [Integer] k
|
1196
|
-
# @return [Float]
|
1197
|
-
def find
|
1198
|
-
end
|
1199
|
-
|
1200
|
-
|
1201
|
-
# Data information.
|
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
|
-
#
|
1204
|
-
# @overload last(cond,i,j,k)
|
1205
|
-
# @param [String] cond
|
1206
|
-
# @param [Integer] i
|
1207
|
-
# @param [Integer] j
|
1208
|
-
# @param [Integer] k
|
1209
|
-
# @return [Float]
|
1210
|
-
def last
|
1211
|
-
end
|
1212
|
-
|
1213
|
-
|
1214
|
-
# Data information.
|
1215
|
-
# Return position of first in direction dir nonzero value of formula cond. The search is started from point (i,j,k).
|
1216
|
-
#
|
1217
|
-
# @overload find(cond,dir,i=0,j=0,k=0)
|
1218
|
-
# @param [String] cond
|
1219
|
-
# @param [String] dir
|
1220
|
-
# @param [Integer] i default=0
|
1221
|
-
# @param [Integer] j default=0
|
1222
|
-
# @param [Integer] k default=0
|
1223
|
-
# @return [Integer]
|
1224
|
-
def find
|
1225
|
-
end
|
1226
|
-
|
1227
|
-
|
1228
|
-
# Data information.
|
1229
|
-
# Determines if any nonzero value of formula in the data array.
|
1230
|
-
#
|
1231
|
-
# @overload find_any(cond)
|
1232
|
-
# @param [String] cond
|
1233
|
-
# @return [bool]
|
1234
|
-
def find_any
|
1235
|
-
end
|
1236
|
-
|
1237
|
-
|
1238
|
-
# Operators.
|
1239
|
-
# Adds the other data or the number.
|
1240
|
-
#
|
1241
|
-
# @overload +(b)
|
1242
|
-
# @param [MglData] b
|
1243
|
-
# @return [MglData]
|
1244
|
-
#
|
1245
|
-
# @overload +(b)
|
1246
|
-
# @param [Float] b
|
1247
|
-
# @return [MglData]
|
1248
|
-
def +
|
1249
|
-
end
|
1250
|
-
|
1251
|
-
|
1252
|
-
# Operators.
|
1253
|
-
# Subtracts the other data or the number.
|
1254
|
-
#
|
1255
|
-
# @overload -(b)
|
1256
|
-
# @param [MglData] b
|
1257
|
-
# @return [MglData]
|
1258
|
-
#
|
1259
|
-
# @overload -(b)
|
1260
|
-
# @param [Float] b
|
1261
|
-
# @return [MglData]
|
1262
|
-
def -
|
1263
|
-
end
|
1264
|
-
|
1265
|
-
|
1266
|
-
# Operators.
|
1267
|
-
# Multiplies by the other data or the number.
|
1268
|
-
#
|
1269
|
-
# @overload *(b)
|
1270
|
-
# @param [MglData] b
|
1271
|
-
# @return [MglData]
|
1272
|
-
#
|
1273
|
-
# @overload *(b)
|
1274
|
-
# @param [Float] b
|
1275
|
-
# @return [MglData]
|
1276
|
-
def *
|
1277
|
-
end
|
1278
|
-
|
1279
|
-
|
1280
|
-
# Operators.
|
1281
|
-
# Divides by the other data or the number.
|
1282
|
-
#
|
1283
|
-
# @overload /(b)
|
1284
|
-
# @param [MglData] b
|
1285
|
-
# @return [MglData]
|
1286
|
-
#
|
1287
|
-
# @overload /(b)
|
1288
|
-
# @param [Float] b
|
1289
|
-
# @return [MglData]
|
1290
|
-
def /
|
1291
|
-
end
|
1292
|
-
|
1293
|
-
|
1294
|
-
end # MglData
|
1295
|
-
|
1296
|
-
|
1297
|
-
# MglExpr class
|
1298
|
-
class MglExpr
|
1299
|
-
|
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
|
1307
|
-
# @return [Float]
|
1308
|
-
def eval
|
1309
|
-
end
|
1310
|
-
|
1311
|
-
|
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
|
1319
|
-
end
|
1320
|
-
|
1321
|
-
|
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)
|
1326
|
-
# @param [String] dir
|
1327
|
-
# @param [Float] x
|
1328
|
-
# @param [Float] y
|
1329
|
-
# @param [Float] z
|
1330
|
-
# @return [Float]
|
1331
|
-
def diff
|
1332
|
-
end
|
1333
|
-
|
1334
|
-
|
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)
|
1339
|
-
# @param [String] dir
|
1340
|
-
# @param [Float] var
|
1341
|
-
# @return [Float]
|
1342
|
-
def diff
|
1343
|
-
end
|
1344
|
-
|
1345
|
-
|
1346
|
-
end # MglExpr
|
1347
|
-
|
1348
|
-
|
1349
|
-
# MglVar class
|
1350
|
-
class MglVar < MglData
|
1351
|
-
|
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
|
1357
|
-
# @return [nil]
|
1358
|
-
def move_after
|
1359
|
-
end
|
1360
|
-
|
1361
|
-
|
1362
|
-
end # MglVar
|
1363
|
-
|
1364
|
-
end
|