mdarray 0.5.5.2-java → 0.5.6-java
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/config.rb +29 -95
- data/doc/BinaryOperator.html +20 -21
- data/doc/BitwiseOperators.html +18 -8
- data/doc/BitwiseOperators/BinaryAnd.html +189 -0
- data/doc/BitwiseOperators/BinaryLeftShift.html +189 -0
- data/doc/BitwiseOperators/BinaryOnesComplement.html +189 -0
- data/doc/BitwiseOperators/BinaryOr.html +189 -0
- data/doc/BitwiseOperators/BinaryRightShift.html +189 -0
- data/doc/BitwiseOperators/BinaryXor.html +189 -0
- data/doc/BooleanFunctions.html +18 -8
- data/doc/BooleanFunctions/And.html +189 -0
- data/doc/BooleanFunctions/Not.html +189 -0
- data/doc/BooleanFunctions/Or.html +189 -0
- data/doc/BooleanMDArray.html +10 -10
- data/doc/ByteMDArray.html +73 -14
- data/doc/CernDoubleFunctions.html +208 -0
- data/doc/CernFloatFunctions.html +208 -0
- data/doc/CernFunctions.html +828 -0
- data/doc/CernIntFunctions.html +208 -0
- data/doc/CernLongFunctions.html +208 -0
- data/doc/CharMDArray.html +181 -0
- data/doc/Colt.html +18 -20
- data/doc/ComparisonOperators.html +18 -8
- data/doc/ComparisonOperators/Eq.html +189 -0
- data/doc/ComparisonOperators/Ge.html +189 -0
- data/doc/ComparisonOperators/Gt.html +189 -0
- data/doc/ComparisonOperators/Le.html +189 -0
- data/doc/ComparisonOperators/Lt.html +189 -0
- data/doc/Const.html +107 -47
- data/doc/Csv.html +325 -113
- data/doc/Csv/Dimension.html +771 -0
- data/doc/Csv/Dimensions.html +654 -0
- data/doc/DDescriptive.html +573 -625
- data/doc/DoubleMDArray.html +40 -172
- data/doc/DoubleStatList.html +19 -20
- data/doc/FastBinaryOperator.html +166 -148
- data/doc/FastUnaryOperator.html +104 -109
- data/doc/FloatMDArray.html +55 -16
- data/doc/FunctionCreation.html +53 -273
- data/doc/FunctionMap.html +381 -93
- data/doc/GenericFunctions.html +18 -8
- data/doc/GenericFunctions/Null.html +187 -0
- data/doc/IntMDArray.html +77 -16
- data/doc/Java/CernJetMathTdouble/DoubleFunctions.html +120 -0
- data/doc/Java/CernJetMathTfloat/FloatFunctions.html +120 -0
- data/doc/Java/CernJetMathTint/IntFunctions.html +120 -0
- data/doc/Java/CernJetMathTlong/LongFunctions.html +120 -0
- data/doc/LazyBinaryOperator.html +714 -0
- data/doc/LazyMDArray.html +990 -0
- data/doc/LazyMDArray/BinaryComp.html +282 -0
- data/doc/LazyMDArray/UnaryComp.html +280 -0
- data/doc/LazyUnaryOperator.html +537 -0
- data/doc/LongMDArray.html +59 -15
- data/doc/MDArray.html +3223 -2181
- data/doc/MDArray/Counter.html +321 -1233
- data/doc/MDArray/IteratorFast.html +177 -116
- data/doc/MDArray/IteratorFastBoolean.html +37 -41
- data/doc/MDArray/IteratorFastByte.html +46 -39
- data/doc/MDArray/IteratorFastChar.html +37 -41
- data/doc/MDArray/IteratorFastDouble.html +37 -41
- data/doc/MDArray/IteratorFastFloat.html +37 -41
- data/doc/MDArray/IteratorFastInt.html +37 -41
- data/doc/MDArray/IteratorFastLong.html +37 -41
- data/doc/MDArray/IteratorFastShort.html +37 -41
- data/doc/MDArray/Section.html +561 -0
- data/doc/Nashorn.html +1407 -0
- data/doc/NetCDF.html +749 -0
- data/doc/NetCDF/Attribute.html +875 -0
- data/doc/NetCDF/AttributeWriter.html +286 -0
- data/doc/NetCDF/CDMNode.html +460 -0
- data/doc/NetCDF/Dimension.html +559 -0
- data/doc/NetCDF/DimensionWriter.html +642 -0
- data/doc/NetCDF/File.html +1593 -0
- data/doc/NetCDF/FileParent.html +674 -0
- data/doc/NetCDF/FileWriter.html +2875 -0
- data/doc/NetCDF/Group.html +685 -0
- data/doc/NetCDF/GroupWriter.html +851 -0
- data/doc/NetCDF/TimeVariable.html +646 -0
- data/doc/NetCDF/Variable.html +2994 -0
- data/doc/NetCDF/VariableWriter.html +420 -0
- data/doc/NonNumericalMDArray.html +11 -11
- data/doc/NumericFunctions.html +38 -30
- data/doc/NumericFunctions/Abs.html +189 -0
- data/doc/NumericFunctions/Add.html +189 -0
- data/doc/NumericFunctions/Ceil.html +189 -0
- data/doc/NumericFunctions/Cube.html +189 -0
- data/doc/NumericFunctions/Div.html +189 -0
- data/doc/NumericFunctions/Floor.html +189 -0
- data/doc/NumericFunctions/Fourth.html +189 -0
- data/doc/NumericFunctions/IsZero.html +189 -0
- data/doc/NumericFunctions/Max.html +189 -0
- data/doc/NumericFunctions/Min.html +189 -0
- data/doc/NumericFunctions/Mul.html +189 -0
- data/doc/NumericFunctions/Power.html +189 -0
- data/doc/NumericFunctions/Square.html +189 -0
- data/doc/NumericFunctions/Sub.html +189 -0
- data/doc/NumericFunctions/Truncate.html +189 -0
- data/doc/NumericalMDArray.html +14 -15
- data/doc/Operator.html +318 -109
- data/doc/Proc.html +120 -129
- data/doc/RubyBinaryOperator.html +66 -70
- data/doc/RubyFunctions.html +572 -27
- data/doc/RubyMath.html +18 -8
- data/doc/RubyMath/Acos.html +189 -0
- data/doc/RubyMath/Acosh.html +189 -0
- data/doc/RubyMath/Asin.html +189 -0
- data/doc/RubyMath/Asinh.html +189 -0
- data/doc/RubyMath/Atan.html +189 -0
- data/doc/RubyMath/Atan2.html +189 -0
- data/doc/RubyMath/Atanh.html +189 -0
- data/doc/RubyMath/Cbrt.html +189 -0
- data/doc/RubyMath/Cos.html +189 -0
- data/doc/RubyMath/Cosh.html +189 -0
- data/doc/RubyMath/Erf.html +189 -0
- data/doc/RubyMath/Erfc.html +189 -0
- data/doc/RubyMath/Exp.html +189 -0
- data/doc/RubyMath/Gamma.html +189 -0
- data/doc/RubyMath/Hypot.html +189 -0
- data/doc/RubyMath/Ldexp.html +189 -0
- data/doc/RubyMath/Log.html +189 -0
- data/doc/RubyMath/Log10.html +189 -0
- data/doc/RubyMath/Log2.html +189 -0
- data/doc/RubyMath/Neg.html +189 -0
- data/doc/RubyMath/Sin.html +189 -0
- data/doc/RubyMath/Sinh.html +189 -0
- data/doc/RubyMath/Sqrt.html +189 -0
- data/doc/RubyMath/Tan.html +189 -0
- data/doc/RubyMath/Tanh.html +189 -0
- data/doc/RubyStats.html +8 -8
- data/doc/RubyUnaryOperator.html +61 -65
- data/doc/ShortMDArray.html +69 -14
- data/doc/Sol.html +700 -0
- data/doc/Sol/BarChart.html +181 -0
- data/doc/Sol/BaseChart.html +800 -0
- data/doc/Sol/Bootstrap.html +1137 -0
- data/doc/Sol/Bridge.html +586 -0
- data/doc/Sol/Chart.html +1162 -0
- data/doc/Sol/CoordinateChart.html +679 -0
- data/doc/Sol/Dashboard.html +2094 -0
- data/doc/Sol/Dashboard/DCFX.html +786 -0
- data/doc/Sol/Dashboard/MyHandle.html +338 -0
- data/doc/Sol/Dashboard/MyService.html +202 -0
- data/doc/Sol/Dashboard/MyTask.html +291 -0
- data/doc/Sol/Interval.html +1213 -0
- data/doc/Sol/LineChart.html +346 -0
- data/doc/Sol/LinearScale.html +334 -0
- data/doc/Sol/Margins.html +219 -0
- data/doc/Sol/OrdinalScale.html +263 -0
- data/doc/Sol/Scale.html +462 -0
- data/doc/Sol/Stack.html +199 -0
- data/doc/Sol/TimeScale.html +397 -0
- data/doc/StatList.html +110 -125
- data/doc/StringMDArray.html +10 -10
- data/doc/StructureMDArray.html +10 -10
- data/doc/UnaryOperator.html +20 -21
- data/doc/UserFunction.html +51 -49
- data/doc/_index.html +881 -106
- data/doc/class_list.html +8 -3
- data/doc/css/style.css +2 -1
- data/doc/file.README.html +455 -104
- data/doc/file_list.html +7 -2
- data/doc/frames.html +5 -7
- data/doc/index.html +455 -104
- data/doc/js/app.js +7 -2
- data/doc/js/full_list.js +11 -3
- data/doc/method_list.html +3170 -1233
- data/doc/top-level-namespace.html +31 -8
- data/lib/colt/matrix/algebra.rb +5 -5
- data/lib/mdarray.rb +6 -3
- data/lib/mdarray/csv.rb +25 -5
- data/lib/mdarray/fast_operators.rb +1 -1
- data/lib/mdarray/function_creation.rb +3 -1
- data/lib/mdarray/hierarchy.rb +2 -0
- data/lib/mdarray/operators.rb +1 -1
- data/lib/mdarray/ruby_functions.rb +8 -4
- data/lib/mdarray/ruby_math.rb +0 -28
- data/test/colt/matrix/test_matrix2d_floatingalgebra.rb +31 -7
- data/test/complete.rb +4 -4
- data/test/mdarray/PETR4_2014.csv +249 -0
- data/test/mdarray/VALE_2014.csv +253 -0
- data/test/mdarray/VALE_PETR4.csv +501 -0
- data/test/mdarray/arithmetic_casting.rb +1 -0
- data/test/mdarray/test_access.rb +1 -0
- data/test/mdarray/test_boolean.rb +1 -0
- data/test/mdarray/test_comparison.rb +1 -0
- data/test/mdarray/test_complete.rb +2 -5
- data/test/mdarray/test_counter.rb +1 -0
- data/test/mdarray/test_creation.rb +1 -0
- data/test/mdarray/test_csv.rb +51 -0
- data/test/mdarray/test_error.rb +1 -0
- data/test/mdarray/test_non_numeric.rb +1 -1
- data/test/mdarray/test_operator.rb +31 -14
- data/test/mdarray/test_performance.rb +2 -1
- data/test/mdarray/test_printing.rb +1 -0
- data/test/mdarray/test_sections.rb +1 -0
- data/test/mdarray/test_shape.rb +1 -0
- data/test/mdarray/test_trigonometry.rb +1 -0
- data/test/mdarray/test_views.rb +1 -0
- data/vendor/mdarray.jar +0 -0
- data/vendor/{netcdfAll-4.5_0.jar → netcdfAll-4.6.jar} +0 -0
- data/vendor/slf4j-jdk14-1.7.12.jar +0 -0
- data/version.rb +1 -1
- metadata +247 -139
- data/lib/env.rb +0 -12
- data/lib/mdarray/lazy_mdarray.rb +0 -315
- data/lib/mdarray/lazy_operators.rb +0 -174
- data/test/env.rb +0 -8
- data/test/mdarray/test_lazy.rb +0 -306
data/test/env.rb
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
require_relative '../config.rb'
|
|
2
|
-
|
|
3
|
-
# Tmp directory for data storage
|
|
4
|
-
$TMP_TEST_DIR = MDArray.home_dir + "/test/tmp"
|
|
5
|
-
#Colt test directory
|
|
6
|
-
$COLT_TEST_DIR = MDArray.home_dir + "/test/colt"
|
|
7
|
-
# NetCDF test directory
|
|
8
|
-
$NETCDF_TEST_DIR = MDArray.home_dir + "/test/netcdf"
|
data/test/mdarray/test_lazy.rb
DELETED
|
@@ -1,306 +0,0 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
|
|
3
|
-
##########################################################################################
|
|
4
|
-
# Copyright © 2013 Rodrigo Botafogo. All Rights Reserved. Permission to use, copy, modify,
|
|
5
|
-
# and distribute this software and its documentation, without fee and without a signed
|
|
6
|
-
# licensing agreement, is hereby granted, provided that the above copyright notice, this
|
|
7
|
-
# paragraph and the following two paragraphs appear in all copies, modifications, and
|
|
8
|
-
# distributions.
|
|
9
|
-
#
|
|
10
|
-
# IN NO EVENT SHALL RODRIGO BOTAFOGO BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL,
|
|
11
|
-
# INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF
|
|
12
|
-
# THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF RODRIGO BOTAFOGO HAS BEEN ADVISED OF THE
|
|
13
|
-
# POSSIBILITY OF SUCH DAMAGE.
|
|
14
|
-
#
|
|
15
|
-
# RODRIGO BOTAFOGO SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
|
16
|
-
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
|
|
17
|
-
# SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED HEREUNDER IS PROVIDED "AS IS".
|
|
18
|
-
# RODRIGO BOTAFOGO HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS,
|
|
19
|
-
# OR MODIFICATIONS.
|
|
20
|
-
##########################################################################################
|
|
21
|
-
|
|
22
|
-
require 'rubygems'
|
|
23
|
-
require "test/unit"
|
|
24
|
-
require 'shoulda'
|
|
25
|
-
|
|
26
|
-
require 'mdarray'
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
class MDArrayTest < Test::Unit::TestCase
|
|
30
|
-
|
|
31
|
-
context "Lazy operations" do
|
|
32
|
-
|
|
33
|
-
setup do
|
|
34
|
-
|
|
35
|
-
@a = MDArray.int([2, 3], [1, 2, 3, 4, 5, 6])
|
|
36
|
-
@b = MDArray.int([2, 3], [10, 20, 30, 40, 50, 60])
|
|
37
|
-
@c = MDArray.double([2, 3], [100, 200, 300, 400, 500, 600])
|
|
38
|
-
@d = MDArray.init_with("int", [2, 3], 4)
|
|
39
|
-
@e = MDArray.init_with("int", [2, 3], 5)
|
|
40
|
-
@f = MDArray.init_with("int", [2, 3], 6)
|
|
41
|
-
@g = MDArray.init_with("int", [2, 3], 7)
|
|
42
|
-
|
|
43
|
-
@h = MDArray.init_with("int", [3, 3], 7)
|
|
44
|
-
@i = MDArray.init_with("int", [3, 3], 7)
|
|
45
|
-
|
|
46
|
-
@float = MDArray.init_with("float", [2, 3], 10.5)
|
|
47
|
-
@long = MDArray.init_with("long", [2, 3], 10)
|
|
48
|
-
@byte = MDArray.init_with("byte", [2, 3], 10)
|
|
49
|
-
|
|
50
|
-
MDArray.lazy = true
|
|
51
|
-
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
#-------------------------------------------------------------------------------------
|
|
56
|
-
#
|
|
57
|
-
#-------------------------------------------------------------------------------------
|
|
58
|
-
|
|
59
|
-
should "execute lazy operations" do
|
|
60
|
-
|
|
61
|
-
p "2 a"
|
|
62
|
-
a_2 = (@a + @a)[]
|
|
63
|
-
a_2.print
|
|
64
|
-
|
|
65
|
-
c = 2 * @a
|
|
66
|
-
|
|
67
|
-
lazy_c = @a + @b
|
|
68
|
-
# calculate the value of the lazy array with []
|
|
69
|
-
c = lazy_c[]
|
|
70
|
-
c.print
|
|
71
|
-
|
|
72
|
-
c = (@c + @a)[]
|
|
73
|
-
c = (@a + @c)[]
|
|
74
|
-
|
|
75
|
-
c = (@c + @byte)[]
|
|
76
|
-
c = (@byte + @c)[]
|
|
77
|
-
|
|
78
|
-
lazy_c = (@a * @d - @e) - (@b + @c)
|
|
79
|
-
lazy_c[].print
|
|
80
|
-
|
|
81
|
-
# evaluate the lazy expression with [] on the same line
|
|
82
|
-
d = ((@a * @d - @e) - (@b + @c))[]
|
|
83
|
-
d.print
|
|
84
|
-
|
|
85
|
-
# evaluate lazy expression with [] anywhere in the expression. (@a * @d - @e) is
|
|
86
|
-
# done lazyly then evaluated then operated with a lazy (@b + @c). The final
|
|
87
|
-
# result is lazy
|
|
88
|
-
d = ((@a * @d - @e)[] - (@b + @c))
|
|
89
|
-
d.print
|
|
90
|
-
|
|
91
|
-
MDArray.lazy = false
|
|
92
|
-
|
|
93
|
-
end
|
|
94
|
-
|
|
95
|
-
#-------------------------------------------------------------------------------------
|
|
96
|
-
#
|
|
97
|
-
#-------------------------------------------------------------------------------------
|
|
98
|
-
|
|
99
|
-
should "check that lazy is contagious" do
|
|
100
|
-
|
|
101
|
-
# this is done lazyly as we have "MDArray.lazy = true" defined in the setup
|
|
102
|
-
l_c = @a + @b
|
|
103
|
-
|
|
104
|
-
# now operations are done eagerly
|
|
105
|
-
MDArray.lazy = false
|
|
106
|
-
e_e = @c + @b
|
|
107
|
-
# note that we do not require [] before printing e_e
|
|
108
|
-
e_e.print
|
|
109
|
-
|
|
110
|
-
# now operating a lazy array with an eager array... should be lazy even when
|
|
111
|
-
# MDArray.lazy is false
|
|
112
|
-
l_f = l_c + e_e
|
|
113
|
-
l_f.print
|
|
114
|
-
# request the calculation and print
|
|
115
|
-
l_f[].print
|
|
116
|
-
|
|
117
|
-
MDArray.lazy = false
|
|
118
|
-
|
|
119
|
-
end
|
|
120
|
-
|
|
121
|
-
#-------------------------------------------------------------------------------------
|
|
122
|
-
#
|
|
123
|
-
#-------------------------------------------------------------------------------------
|
|
124
|
-
|
|
125
|
-
should "execute operations eagerly" do
|
|
126
|
-
|
|
127
|
-
MDArray.lazy = false
|
|
128
|
-
|
|
129
|
-
c = @a + @b
|
|
130
|
-
c.print
|
|
131
|
-
|
|
132
|
-
c = (@a * @d - @e) - (@b + @c)
|
|
133
|
-
c.print
|
|
134
|
-
|
|
135
|
-
MDArray.lazy = false
|
|
136
|
-
|
|
137
|
-
end
|
|
138
|
-
|
|
139
|
-
#-------------------------------------------------------------------------------------
|
|
140
|
-
#
|
|
141
|
-
#-------------------------------------------------------------------------------------
|
|
142
|
-
|
|
143
|
-
should "show that lazy is really lazy" do
|
|
144
|
-
|
|
145
|
-
# MDArray lazy operations are really lazy, i.e., there is not checking of any sort
|
|
146
|
-
# when parsing the expression. Validation is only done when values are required.
|
|
147
|
-
|
|
148
|
-
a = MDArray.int([2, 3], [1, 2, 3, 4, 5, 6])
|
|
149
|
-
b = MDArray.double([3, 1], [1, 2, 3])
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
# arrays a and b are of different shape and cannot work together. Yet, there will
|
|
153
|
-
# be no error while parsing
|
|
154
|
-
l_c = a + b
|
|
155
|
-
|
|
156
|
-
# now we get an error
|
|
157
|
-
assert_raise ( RuntimeError ) { l_c[].print }
|
|
158
|
-
|
|
159
|
-
# now lets add correctly
|
|
160
|
-
p "calculating lazy c"
|
|
161
|
-
l_c = @a + @b
|
|
162
|
-
l_c[].print
|
|
163
|
-
|
|
164
|
-
# now lets change @b
|
|
165
|
-
@b[0, 0] = 1000
|
|
166
|
-
# and calculate again lazy c
|
|
167
|
-
p "calculating lazy c again"
|
|
168
|
-
l_c[].print
|
|
169
|
-
|
|
170
|
-
p "calculating expression"
|
|
171
|
-
@b[1, 0] = 2000
|
|
172
|
-
p1 = (@a * @d - @e)[]
|
|
173
|
-
p2 = (@b + @c)[]
|
|
174
|
-
(p1 - p2)[].print
|
|
175
|
-
p "@b is"
|
|
176
|
-
@b.print
|
|
177
|
-
|
|
178
|
-
# evaluate lazy expression with [] anywhere in the expression. (@a * @d - @e) is
|
|
179
|
-
# done lazyly then evaluated then operated with a lazy (@b + @c). The final
|
|
180
|
-
# result is lazy
|
|
181
|
-
p "calculating lazy d"
|
|
182
|
-
d = ((@a * @d - @e)[] - (@b + @c))
|
|
183
|
-
d[].print
|
|
184
|
-
# lets now change the value of @a
|
|
185
|
-
@a[0, 0] = 1000
|
|
186
|
-
# no change in d... @a has being eagerly calculated
|
|
187
|
-
p "lazy d again after changing @a"
|
|
188
|
-
d[].print
|
|
189
|
-
# lets now change @b
|
|
190
|
-
@b[0, 0] = 1
|
|
191
|
-
@b[0, 1] = 150
|
|
192
|
-
@b[1, 1] = 1000
|
|
193
|
-
p "b is now:"
|
|
194
|
-
@b.print
|
|
195
|
-
# @b is still lazy on d calculation, so changing @b will change the value
|
|
196
|
-
# of d[].
|
|
197
|
-
p "lazy d again after changing @b"
|
|
198
|
-
d[].print
|
|
199
|
-
|
|
200
|
-
p "calculating new expression"
|
|
201
|
-
p3 = (@b + @c)
|
|
202
|
-
(p1 - p3)[].print
|
|
203
|
-
|
|
204
|
-
MDArray.lazy = false
|
|
205
|
-
|
|
206
|
-
end
|
|
207
|
-
|
|
208
|
-
#-------------------------------------------------------------------------------------
|
|
209
|
-
#
|
|
210
|
-
#-------------------------------------------------------------------------------------
|
|
211
|
-
|
|
212
|
-
should "work with Numeric" do
|
|
213
|
-
|
|
214
|
-
l_c = @a + 2
|
|
215
|
-
l_c[].print
|
|
216
|
-
|
|
217
|
-
l_c = 2 + @a
|
|
218
|
-
l_c[].print
|
|
219
|
-
|
|
220
|
-
l_c = 2 - @a
|
|
221
|
-
l_c[].print
|
|
222
|
-
|
|
223
|
-
MDArray.lazy = false
|
|
224
|
-
|
|
225
|
-
end
|
|
226
|
-
|
|
227
|
-
#-------------------------------------------------------------------------------------
|
|
228
|
-
#
|
|
229
|
-
#-------------------------------------------------------------------------------------
|
|
230
|
-
should "work with unary operators" do
|
|
231
|
-
|
|
232
|
-
# MDArray.lazy = false
|
|
233
|
-
|
|
234
|
-
arr = MDArray.linspace("double", 0, 1, 100)
|
|
235
|
-
l_a = arr.sin
|
|
236
|
-
l_a.print
|
|
237
|
-
|
|
238
|
-
b = l_a[]
|
|
239
|
-
b.print
|
|
240
|
-
|
|
241
|
-
((@a * @d - @e).sin - (@b + @c))[].print
|
|
242
|
-
|
|
243
|
-
sinh = (arr.sinh)[]
|
|
244
|
-
|
|
245
|
-
MDArray.lazy = false
|
|
246
|
-
|
|
247
|
-
end
|
|
248
|
-
|
|
249
|
-
#-------------------------------------------------------------------------------------
|
|
250
|
-
#
|
|
251
|
-
#-------------------------------------------------------------------------------------
|
|
252
|
-
|
|
253
|
-
=begin
|
|
254
|
-
should "convert expressions involving only arrays to RPN" do
|
|
255
|
-
|
|
256
|
-
lazy_c = @a + @b
|
|
257
|
-
assert_equal("int int add ", lazy_c.rpn)
|
|
258
|
-
|
|
259
|
-
lazy_d = @a * @b
|
|
260
|
-
assert_equal("int int mul ", lazy_d.rpn)
|
|
261
|
-
|
|
262
|
-
lazy_e = lazy_c / lazy_d
|
|
263
|
-
assert_equal("int int add int int mul div ", lazy_e.rpn)
|
|
264
|
-
|
|
265
|
-
lazy_c = @a - @b + (@c * @d / (@f + @g))
|
|
266
|
-
assert_equal("int int sub int int mul int int add div add ", lazy_c.rpn)
|
|
267
|
-
|
|
268
|
-
lazy_f = @a - @b + (@c * @d - @f / (@f + @g))
|
|
269
|
-
assert_equal("int int sub int int mul int int int add div sub add ", lazy_f.rpn)
|
|
270
|
-
|
|
271
|
-
end
|
|
272
|
-
|
|
273
|
-
#-------------------------------------------------------------------------------------
|
|
274
|
-
#
|
|
275
|
-
#-------------------------------------------------------------------------------------
|
|
276
|
-
|
|
277
|
-
should "validate operations" do
|
|
278
|
-
|
|
279
|
-
lazy_c = @a + @b
|
|
280
|
-
lazy_c.validate
|
|
281
|
-
|
|
282
|
-
# does not validate as shapes are different
|
|
283
|
-
lazy_e = @h + @a
|
|
284
|
-
assert_raise ( RuntimeError ) { lazy_e.validate }
|
|
285
|
-
|
|
286
|
-
lazy_f = @h + @i - @a + @b
|
|
287
|
-
assert_raise ( RuntimeError ) { lazy_f.validate }
|
|
288
|
-
|
|
289
|
-
lazy_g = @h + @i
|
|
290
|
-
|
|
291
|
-
lazy_k = lazy_g + lazy_c
|
|
292
|
-
assert_raise ( RuntimeError ) { lazy_k.validate }
|
|
293
|
-
|
|
294
|
-
end
|
|
295
|
-
|
|
296
|
-
#-------------------------------------------------------------------------------------
|
|
297
|
-
#
|
|
298
|
-
#-------------------------------------------------------------------------------------
|
|
299
|
-
|
|
300
|
-
should "convert expressions involving numeric to RPN" do
|
|
301
|
-
|
|
302
|
-
end
|
|
303
|
-
=end
|
|
304
|
-
end
|
|
305
|
-
|
|
306
|
-
end
|