mdarray 0.4.3.pre-java → 0.5.0-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.
Files changed (111) hide show
  1. data/README.md +82 -14
  2. data/Rakefile +8 -2
  3. data/doc/BinaryOperator.html +227 -0
  4. data/doc/BitwiseOperators.html +135 -0
  5. data/doc/BooleanFunctions.html +135 -0
  6. data/doc/BooleanMDArray.html +193 -0
  7. data/doc/ByteMDArray.html +271 -0
  8. data/doc/Colt.html +269 -0
  9. data/doc/ComparisonOperators.html +135 -0
  10. data/doc/Const.html +490 -0
  11. data/doc/Csv.html +589 -0
  12. data/doc/DDescriptive.html +4373 -0
  13. data/doc/DoubleMDArray.html +555 -0
  14. data/doc/DoubleStatList.html +256 -0
  15. data/doc/FastBinaryOperator.html +743 -0
  16. data/doc/FastBoolean.html +512 -0
  17. data/doc/FastUnaryOperator.html +583 -0
  18. data/doc/FloatMDArray.html +237 -0
  19. data/doc/FunctionCreation.html +520 -0
  20. data/doc/FunctionMap.html +813 -0
  21. data/doc/GenericFunctions.html +135 -0
  22. data/doc/IntMDArray.html +259 -0
  23. data/doc/LongMDArray.html +257 -0
  24. data/doc/MDArray.html +9639 -0
  25. data/doc/MDArray/Counter.html +2767 -0
  26. data/doc/MDArray/IteratorFast.html +872 -0
  27. data/doc/MDArray/IteratorFastBoolean.html +384 -0
  28. data/doc/MDArray/IteratorFastByte.html +373 -0
  29. data/doc/MDArray/IteratorFastChar.html +384 -0
  30. data/doc/MDArray/IteratorFastDouble.html +384 -0
  31. data/doc/MDArray/IteratorFastFloat.html +384 -0
  32. data/doc/MDArray/IteratorFastInt.html +384 -0
  33. data/doc/MDArray/IteratorFastLong.html +384 -0
  34. data/doc/MDArray/IteratorFastShort.html +384 -0
  35. data/doc/MDArrayTest.html +125 -0
  36. data/doc/NonNumericalMDArray.html +177 -0
  37. data/doc/NumericFunctions.html +297 -0
  38. data/doc/NumericalMDArray.html +278 -0
  39. data/doc/Operator.html +826 -0
  40. data/doc/Proc.html +1097 -0
  41. data/doc/RubyBinaryOperator.html +526 -0
  42. data/doc/RubyFunctions.html +232 -0
  43. data/doc/RubyMath.html +135 -0
  44. data/doc/RubyStats.html +135 -0
  45. data/doc/RubyUnaryOperator.html +510 -0
  46. data/doc/ShortMDArray.html +267 -0
  47. data/doc/StatList.html +1176 -0
  48. data/doc/StringMDArray.html +181 -0
  49. data/doc/StructureMDArray.html +181 -0
  50. data/doc/UnaryOperator.html +227 -0
  51. data/doc/UserFunction.html +297 -0
  52. data/doc/_index.html +467 -0
  53. data/doc/class_list.html +53 -0
  54. data/doc/css/common.css +1 -0
  55. data/doc/css/full_list.css +57 -0
  56. data/doc/css/style.css +338 -0
  57. data/doc/file.README.html +173 -0
  58. data/doc/file_list.html +55 -0
  59. data/doc/frames.html +28 -0
  60. data/doc/index.html +173 -0
  61. data/doc/js/app.js +214 -0
  62. data/doc/js/full_list.js +173 -0
  63. data/doc/js/jquery.js +4 -0
  64. data/doc/method_list.html +2524 -0
  65. data/doc/top-level-namespace.html +114 -0
  66. data/lib/colt/colt.rb +56 -0
  67. data/lib/colt/colt_mdarray.rb +95 -0
  68. data/lib/colt/double_descriptive.rb +636 -0
  69. data/lib/colt/probability.rb +12 -0
  70. data/lib/colt/stat_list.rb +192 -0
  71. data/lib/env.rb +5 -1
  72. data/lib/mdarray.rb +5 -0
  73. data/lib/mdarray/access.rb +2 -2
  74. data/lib/mdarray/creation.rb +34 -19
  75. data/lib/mdarray/csv.rb +61 -0
  76. data/lib/mdarray/fast_operators.rb +241 -0
  77. data/lib/mdarray/operators.rb +18 -0
  78. data/lib/mdarray/ruby_operators.rb +2 -18
  79. data/lib/mdarray/ruby_stats.rb +1 -1
  80. data/lib/mdarray/views.rb +8 -8
  81. data/target/helper.jar +0 -0
  82. data/test/colt/VALE3.csv +3437 -0
  83. data/test/colt/VALE3.xlsx +0 -0
  84. data/test/colt/VALE3_short-err.csv +20 -0
  85. data/test/colt/VALE3_short.csv +20 -0
  86. data/test/colt/VALE3_short.xlsx +0 -0
  87. data/test/colt/test_complete.rb +25 -0
  88. data/test/colt/test_stat_list.rb +128 -0
  89. data/test/colt/test_statistics.rb +114 -0
  90. data/test/complete.rb +25 -0
  91. data/test/env.rb +54 -30
  92. data/test/{arithmetic_casting.rb → mdarray/arithmetic_casting.rb} +0 -0
  93. data/test/{test_access.rb → mdarray/test_access.rb} +0 -0
  94. data/test/{test_boolean.rb → mdarray/test_boolean.rb} +0 -2
  95. data/test/{test_comparison.rb → mdarray/test_comparison.rb} +0 -0
  96. data/test/{test_complete.rb → mdarray/test_complete.rb} +3 -14
  97. data/test/{test_counter.rb → mdarray/test_counter.rb} +0 -0
  98. data/test/{test_creation.rb → mdarray/test_creation.rb} +0 -0
  99. data/test/{test_error.rb → mdarray/test_error.rb} +8 -5
  100. data/test/{test_operator.rb → mdarray/test_operator.rb} +6 -2
  101. data/test/{test_speed.rb → mdarray/test_performance.rb} +74 -39
  102. data/test/{test_printing.rb → mdarray/test_printing.rb} +0 -1
  103. data/test/{test_shape.rb → mdarray/test_shape.rb} +0 -0
  104. data/test/mdarray/test_statistics.rb +80 -0
  105. data/test/{test_trigonometry.rb → mdarray/test_trigonometry.rb} +0 -0
  106. data/test/{test_views.rb → mdarray/test_views.rb} +0 -0
  107. data/vendor/parallelcolt-0.10.0.jar +0 -0
  108. data/version.rb +1 -1
  109. metadata +122 -39
  110. data/test/test_lazy.rb +0 -52
  111. data/test/test_statistics.rb +0 -38
Binary file
@@ -0,0 +1,20 @@
1
+ Date,Open,High,Low,Close,Volume,Adj Close
2
+ 2013-04-24,33.58,34.37,33.42,33.58,7022800,33.58
3
+ 2013-04-23,32.53,33.54,32.07,33.40,3379500,33.40
4
+ 2013-04-22,32.14,32.56,31.80,32.39,2287100,32.39
5
+ 2013-04-19,32.34,32.54,31.54,32.10,4675200,32.10
6
+ 2013-04-18,32.45,32.78,31.72,31.90,4258300,31.90
7
+ 2013-04-17,31.70,32.50,31.07,32.46,9355000,32.46
8
+ 2013-04-16,33.05,33.31,32.69,32.33,5677000,32.33
9
+ 2013-04-15,33.55,33.86,32.05,32.46,4378700,32.46
10
+ 2013-04-12,34.12,35.86,33.34,34.58,6132200,34.58
11
+ 2013-04-11,35.15,35.29,33.89,34.14,5182600,34.14
12
+ 2013-04-10,36.43,36.81,34.85,35.00,8489500,35.00
13
+ 2013-04-09,35.00,36.60,35.00,36.19,7892300,36.19
14
+ 2013-04-08,34.69,34.88,34.08,34.70,6448600,34.70
15
+ 2013-04-05,33.74,34.83,33.44,34.56,4539600,34.56
16
+ 2013-04-04,34.95,35.20,34.09,34.19,4226900,34.19
17
+ 2013-04-03,33.18,35.35,33.06,35.16,6258100,35.16
18
+ 2013-04-02,34.81,34.92,33.18,33.25,5340900,33.25
19
+ 2013-04-01,34.81,34.92,33.94,34.00,1962600
20
+ 2013-03-29,35.13,35.13,35.13,35.13,000,35.13
@@ -0,0 +1,20 @@
1
+ Date,Open,High,Low,Close,Volume,Adj Close
2
+ 2013-04-24,33.58,34.37,33.42,33.58,7022800,33.58
3
+ 2013-04-23,32.53,33.54,32.07,33.40,3379500,33.40
4
+ 2013-04-22,32.14,32.56,31.80,32.39,2287100,32.39
5
+ 2013-04-19,32.34,32.54,31.54,32.10,4675200,32.10
6
+ 2013-04-18,32.45,32.78,31.72,31.90,4258300,31.90
7
+ 2013-04-17,31.70,32.50,31.07,32.46,9355000,32.46
8
+ 2013-04-16,33.05,33.31,32.69,32.33,5677000,32.33
9
+ 2013-04-15,33.55,33.86,32.05,32.46,4378700,32.46
10
+ 2013-04-12,34.12,35.86,33.34,34.58,6132200,34.58
11
+ 2013-04-11,35.15,35.29,33.89,34.14,5182600,34.14
12
+ 2013-04-10,36.43,36.81,34.85,35.00,8489500,35.00
13
+ 2013-04-09,35.00,36.60,35.00,36.19,7892300,36.19
14
+ 2013-04-08,34.69,34.88,34.08,34.70,6448600,34.70
15
+ 2013-04-05,33.74,34.83,33.44,34.56,4539600,34.56
16
+ 2013-04-04,34.95,35.20,34.09,34.19,4226900,34.19
17
+ 2013-04-03,33.18,35.35,33.06,35.16,6258100,35.16
18
+ 2013-04-02,34.81,34.92,33.18,33.25,5340900,33.25
19
+ 2013-04-01,34.81,34.92,33.94,34.00,1962600,34.00
20
+ 2013-03-29,35.13,35.13,35.13,35.13,000,35.13
@@ -0,0 +1,25 @@
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
+ #=begin
23
+ require_relative 'test_statistics'
24
+ require_relative 'test_stat_list'
25
+ #=end
@@ -0,0 +1,128 @@
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
+ class MDArrayTest < Test::Unit::TestCase
29
+
30
+ context "Parrallel Colt Integration" do
31
+
32
+ setup do
33
+
34
+ end # setup
35
+
36
+ #-------------------------------------------------------------------------------------
37
+ #
38
+ #-------------------------------------------------------------------------------------
39
+
40
+ should "work with stat_lists" do
41
+
42
+ # Creates a DoubleStatList of capacity 10
43
+ @list = DoubleStatList.new(10)
44
+
45
+ @list.add(2.25)
46
+ @list.add(5.0)
47
+
48
+ assert_equal(2.25, @list[0])
49
+ assert_equal(5.0, @list[1])
50
+ assert_equal(3.625, @list.mean)
51
+
52
+ # Search for element in the list
53
+ assert_equal(1, @list.binary_search(5))
54
+ assert_equal(1, @list.index_of(5.0))
55
+
56
+ @list.add(3.0)
57
+ @list.add(5.0)
58
+
59
+ assert_equal(3, @list.last_index_of(5.0))
60
+
61
+ list2 = @list.copy
62
+ # changing the value of @list
63
+ @list[0] = 10
64
+ assert_equal(10, @list[0])
65
+ # list2 is unchanged
66
+ assert_equal(2.25, list2[0])
67
+
68
+ @list.shuffle
69
+ @list.print
70
+
71
+ # mean is now wrong... we've added/changed elements in @list, but we still get the
72
+ assert_equal(3.625, @list.mean)
73
+
74
+ # to make it right we need to reset_statistics. Whenever an element on the
75
+ # list is changed it is required to call reset_statistics
76
+ @list.reset_statistics
77
+ assert_equal(5.75, @list.mean)
78
+
79
+ end
80
+
81
+ #-------------------------------------------------------------------------------------
82
+ #
83
+ #-------------------------------------------------------------------------------------
84
+
85
+ should "be memory efficient when possible" do
86
+
87
+ # read file VALE3. This file has a header that we need to discard. VALE3
88
+ # contains quote values from brazilian company VALE as obtained from Yahoo finance
89
+ # (quote vale3.SA)
90
+ vale3 = MDArray.double("#{$COLT_TEST_DIR}/VALE3_short.csv", true)
91
+
92
+ # calling reset_statistics on vale3, creates a stat_list for vale3
93
+ vale3.reset_statistics
94
+
95
+ # get vale3 stat_list. This should not copy any data... let's check it
96
+ list = vale3.stat_list
97
+
98
+ # let's change a value in list
99
+ list[0] = 10
100
+ assert_equal(10, list[0])
101
+ assert_equal(10, vale3[0, 0])
102
+
103
+ # Getting the open value
104
+ open = vale3.slice(1, 1)
105
+
106
+ # open and vale3 should use the same backing store
107
+ open[0] = 5
108
+ assert_equal(5, open[0])
109
+ assert_equal(5, vale3[0,1])
110
+
111
+ # now... doing reset_statistics on open will not use the same backing store
112
+ # as open is not contigous in memory and copying is necessary. This is the
113
+ # cost integrating NetCDF and Parallel Colt. It might actually be a good
114
+ # idea in some cases to make a copy and operate on contigous memory than using
115
+ # indexing to move over the array.
116
+ open.reset_statistics
117
+ open_list = open.stat_list
118
+ open_list[0] = 1000
119
+ assert_equal(1000, open_list[0])
120
+ assert_equal(5, open[0])
121
+
122
+
123
+
124
+ end
125
+
126
+ end
127
+
128
+ end
@@ -0,0 +1,114 @@
1
+ require 'rubygems'
2
+ require "test/unit"
3
+ require 'shoulda'
4
+
5
+ require 'mdarray'
6
+
7
+ class MDArrayTest < Test::Unit::TestCase
8
+
9
+ context "Statistics Tests" do
10
+
11
+ setup do
12
+
13
+ end
14
+
15
+ #-------------------------------------------------------------------------------------
16
+ #
17
+ #-------------------------------------------------------------------------------------
18
+
19
+ should "do stats operations" do
20
+
21
+ # read file VALE3. This file has a header that we need to discard. VALE3
22
+ # contains quote values from brazilian company VALE as obtained from Yahoo finance
23
+ # (quote vale3.SA)
24
+ vale3 = MDArray.double("#{$COLT_TEST_DIR}/VALE3_short.csv", true)
25
+
26
+ # in order to use statistics we need to reset_statistics on array vale3. This
27
+ # breaks version 0.4.3 statistics that did not require a call to reset_statistics.
28
+ # In future version we will keep both methods with reset_statistics and without
29
+ # reset_statistics being required.
30
+ vale3.reset_statistics
31
+
32
+ # sum all values of vale3. This does not make sense from a financial point of view.
33
+ # suming all values including dates... Not doing anything with the value, just
34
+ # checking that it does not crash.
35
+ vale3.sum
36
+
37
+ # lets get only the open price for the whole period. We slice the vale3 on the
38
+ # second dimension and get the second column.
39
+ open = vale3.slice(1,1)
40
+
41
+ # lets also get the high value.
42
+ high = vale3.slice(1,2)
43
+
44
+ # weights to be used for weighted operations
45
+ weights = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14.0, 15, 16, 17, 18, 19]
46
+
47
+ # splitters to be used to split the list
48
+ splitters = [34.0, 36.0]
49
+
50
+ # quantiles to be used to split the list
51
+ percs = [0.20, 0.40, 0.60, 0.80, 1]
52
+
53
+ # getting descriptive statistics for the open value. open is a new MDArray, so
54
+ # we need to reset_statistics for open as well.
55
+ open.reset_statistics
56
+
57
+ assert_equal(-0.30204751376121775, open.auto_correlation(10))
58
+ assert_equal(0.8854362245369992, open.correlation(high))
59
+ assert_equal(1.4367963988919659, open.covariance(high))
60
+ assert_equal(0.00079607686762408, open.durbin_watson)
61
+ assert_equal(33.837262944797345, open.geometric_mean)
62
+ assert_equal(33.81400448777291, open.harmonic_mean)
63
+ assert_equal(-0.925644222523478, open.kurtosis)
64
+ assert_equal(0.681656774667894, open.lag1)
65
+ assert_equal(36.43, open.max)
66
+ assert_equal(33.86052631578948,open.mean)
67
+ assert_equal(1.0889750692520779,open.mean_deviation)
68
+ assert_equal(33.74,open.median)
69
+ assert_equal(31.7,open.min)
70
+ assert_equal(0.07736522466830013,open.moment3)
71
+ assert_equal(5.147382269264963,open.moment4)
72
+ assert_equal(34.17368421052632,open.pooled_mean(high))
73
+ assert_equal(1.623413296398882,open.pooled_variance(high))
74
+ assert_equal(1.1442193777839571e+29,open.product)
75
+ assert_equal(32.498000000000005,open.quantile(0.2))
76
+ assert_equal(0.8421052631578947,open.quantile_inverse(35.0))
77
+ assert_equal(5.903846153846159,open.rank_interpolated(33.0))
78
+ assert_equal(33.88377930514836,open.rms)
79
+ assert_equal(-0.8280585298104861,open.sample_kurtosis)
80
+ assert_equal(1.5166184210526306,open.sample_covariance(high))
81
+ assert_equal(1.0142698435367294,open.sample_kurtosis_standard_error)
82
+ assert_equal(0.042567930807996486,open.sample_skew)
83
+ assert_equal(0.5237666950104207,open.sample_skew_standard_error)
84
+ assert_equal(1.3075102994156926,open.sample_standard_deviation)
85
+ assert_equal(1.6627719298244807,open.sample_variance)
86
+ assert_equal(1.2035654385963137,open.sample_weighted_variance(weights))
87
+ assert_equal(0.039130771304858564,open.skew)
88
+ assert_equal(1.255092672964214,open.standard_deviation)
89
+ assert_equal(0.28793800664365016,open.standard_error)
90
+ assert_equal(643.35,open.sum)
91
+ assert_equal(0.561897364355954,open.sum_of_inversions)
92
+ assert_equal(66.90969033519778,open.sum_of_logarithms)
93
+ assert_equal(29.92989473684211,open.sum_of_power_deviations(2, open.mean))
94
+ assert_equal(740665.2440910001,open.sum_of_powers(3))
95
+ assert_equal(21814.099500000004,open.sum_of_squares)
96
+ assert_equal(28.354637119112198,open.sum_of_squared_deviations)
97
+ assert_equal(33.862, open.trimmed_mean(2, 2))
98
+ assert_equal(1.5752576177284554,open.variance)
99
+ assert_equal(34.31689473684211,open.weighted_mean(weights))
100
+ assert_equal(0.029110571117388302,open.weighted_rms(weights))
101
+ assert_equal(33.816315789473684,open.winsorized_mean(1, 1))
102
+
103
+ p "Distinct values: #{open.frequencies[:distinct_values]}"
104
+ p "Frequencies: #{open.frequencies[:frequencies]}"
105
+ p "Split: #{open.split(splitters)}"
106
+ p "Quantiles: #{open.quantiles(percs)}"
107
+ p "Sorted elements: #{open.sort}"
108
+ p "Standardized elements: #{open.standardize}"
109
+
110
+ end
111
+
112
+ end
113
+
114
+ end
@@ -0,0 +1,25 @@
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 'env.rb'
23
+
24
+ require 'mdarray/test_complete'
25
+ require 'colt/test_complete'
@@ -1,50 +1,74 @@
1
1
  require 'rbconfig'
2
2
 
3
- # Config::CONFIG['host_os'] # returns mswin32 on Windows, for example
4
- # p Config::CONFIG
3
+ # Home directory for MDArray
4
+ $MDARRAY_HOME_DIR = ".."
5
5
 
6
- # Fix environment variable for MultiCell
7
- # Prepare environment to work inside Cygwin
6
+ # MDArray Test directory
7
+ $MDARRAY_TEST_DIR = "./mdarray"
8
8
 
9
- # Return the cygpath of a path
10
- def cygpath(path)
11
- `cygpath -p -m #{path}`.tr("\n", "")
12
- end
9
+ # Colt Test directory
10
+ $COLT_TEST_DIR = "./colt"
13
11
 
14
- # Add path to load path
15
- def mklib(path, home_path = true)
12
+ ##########################################################################################
13
+ # If we need to test for coverage
14
+ ##########################################################################################
16
15
 
17
- if (home_path)
18
- lib = path + "/lib"
19
- else
20
- lib = path
21
- end
16
+ if ENV['COVERAGE'] == 'true'
22
17
 
23
- $LOAD_PATH << `cygpath -p -m #{lib}`.tr("\n", "")
18
+ require 'simplecov'
19
+
20
+ SimpleCov.start do
21
+ @filters = []
22
+ add_group "MDArray", "lib/mdarray"
23
+ add_group "Colt", "lib/colt"
24
+ end
24
25
 
25
26
  end
26
27
 
27
- # Home directory for MDArray
28
- $MDARRAY_HOME_DIR = "/home/zxb3/Desenv/MDArray"
29
- mklib($MDARRAY_HOME_DIR)
28
+ ##########################################################################################
29
+ # Prepare environment to work inside Cygwin
30
+ ##########################################################################################
30
31
 
31
- # Home directory for MultiCell
32
- $MC_HOME_DIR = "/home/zxb3/Desenv/MultiCell"
33
- mklib($MC_HOME_DIR)
32
+ if ENV['MDARRAY_ENV'] == 'cygwin'
34
33
 
35
- # Home directory for NcInterface
36
- $NCI_HOME_DIR = "/home/zxb3/Desenv/NcInterface"
37
- mklib($NCI_HOME_DIR)
34
+ # RbConfig::CONFIG['host_os'] # returns mswin32 on Windows, for example
35
+ # p Config::CONFIG
36
+
37
+ #---------------------------------------------------------------------------------------
38
+ # Return the cygpath of a path
39
+ #---------------------------------------------------------------------------------------
38
40
 
39
- # Home directory for BM&F Bovespa files
40
- $BMF_BOVESPA_DIR = "/home/zxb3/Investimentos/SeriesHistoricas/BMF_BOVESPA/"
41
+ def cygpath(path)
42
+ `cygpath -a -p -m #{path}`.tr("\n", "")
43
+ end
44
+
45
+ #---------------------------------------------------------------------------------------
46
+ # Add path to load path
47
+ #---------------------------------------------------------------------------------------
48
+
49
+ def mklib(path, home_path = true)
50
+
51
+ if (home_path)
52
+ lib = path + "/lib"
53
+ else
54
+ lib = path
55
+ end
56
+
57
+ $LOAD_PATH << `cygpath -p -m #{lib}`.tr("\n", "")
58
+
59
+ end
60
+
61
+ mklib($MDARRAY_HOME_DIR)
41
62
 
42
- # Home directory for results
43
- $RESULT_HOME_DIR = $MC_HOME_DIR + "/results/"
63
+ $MDARRAY_TEST_DIR = cygpath($MDARRAY_TEST_DIR)
64
+ $COLT_TEST_DIR = cygpath($COLT_TEST_DIR)
65
+
66
+ end
44
67
 
45
68
  =begin
46
69
  # Build Jruby classpath from environment classpath
47
70
  ENV['WCLASSPATH'].split(';').each do |path|
48
- $CLASSPATH << cygpath(path)
71
+ $CLASSPATH << cygpath(path)
49
72
  end
50
73
  =end
74
+