<div dir="ltr"><p class="" align="center" style="text-align:center"><b><span lang="EN-US" style="font-size:20pt;line-height:31px">Announcement</span></b></p><p class="" style="text-align:justify"><span lang="EN-US">MDArray version 0.5.3 has Just been released. MDArray is a multi dimensional array implemented for JRuby inspired by NumPy (</span><a href="http://www.numpy.org/"><span lang="EN-US">www.numpy.org</span></a><span lang="EN-US">) and Masahiro Tanaka´s Narray (<a href="http://narray.rubyforge.org">narray.rubyforge.org</a>).  MDArray stands on the shoulders of Java-NetCDF and Parallel Colt.  At this point MDArray has libraries for mathematical, trigonometric and descriptive statistics methods.</span></p>

<p class="" style="text-align:justify"><span lang="EN-US">NetCDF-Java Library is a Java interface to </span><a href="http://www.unidata.ucar.edu/software/netcdf/index.html"><span lang="EN-US" style="color:windowtext;text-decoration:none">NetCDF files</span></a><span lang="EN-US">, as well as to many other types of scientific data formats.</span><span lang="EN-US" style="font-size:10pt;line-height:14px;font-family:Verdana,sans-serif;color:black"> </span><span lang="EN-US"> It is developed and distributed by Unidata (</span><a href="http://www.unidata.ucar.edu/"><span lang="EN-US">http://www.unidata.ucar.edu</span></a><span lang="EN-US">).</span></p>

<p class=""><span lang="EN-US">Parallel Colt (</span><a href="http://grepcode.com/snapshot/repo1.maven.org/maven2/net.sourceforge.parallelcolt/parallelcolt/0.10.0/"><span lang="EN-US">http://grepcode.com/snapshot/repo1.maven.org/maven2/net.sourceforge.parallelcolt/parallelcolt/0.10.0/</span></a><span lang="EN-US">) is a </span><a href="http://en.wikipedia.org/wiki/Thread_%28computer_science%29"><span lang="EN-US" style="color:windowtext;text-decoration:none">multithreaded</span></a><span lang="EN-US"> version of </span><a href="http://dsd.lbl.gov/~hoschek/colt/"><span lang="EN-US" style="color:windowtext;text-decoration:none">Colt</span></a><span lang="EN-US"> (</span><a href="http://acs.lbl.gov/software/colt/"><span lang="EN-US">http://acs.lbl.gov/software/colt/</span></a><span lang="EN-US">).  Colt provides a set of Open Source Libraries for High Performance Scientific and Technical Computing in Java. Scientific and technical computing is characterized by demanding problem sizes and a need for high performance at reasonably small memory footprint.</span></p>

<p class=""><b><span lang="EN-US" style="font-size:14pt;line-height:21px">What´s new</span></b><b><span lang="EN-US">:</span></b></p><p class=""><b><span lang="EN-US">Performance Improvement</span></b></p><p class="" style="text-align:justify">

<span lang="EN-US">On previous versions, array operations were done by passing a Ruby Proc to a loop for all elements of the given arrays.  For instance, adding two MDArrays was done by passing Proc.new { |a, b| a + b } and looping through all elements of the arrays.  Procs are very flexible in Ruby; however, from my experience with MDArray, also very slow.</span></p>

<p class="" style="text-align:justify"><span lang="EN-US">On this version, when available, instead of passing a Proc to the loop, we pass a native Java method.  Available Java methods are those extracted from Parallel Colt and listed below.  Note that Parallel Colt has native methods for the following types only: “double”, “float”, “long” and “int”. With this change, there was a performance improvement of over 90%, and using MDArray operations is close to native Java operations.  We expect (but have not yet benchmarking data) that this brings MDArray performance close to similar solutions such as NArray, NMatrix and NumPy (please try it, and if this assertion is false, I´ll be glad to change it in future announcements).</span></p>

<p class="" style="text-align:justify"><span lang="EN-US">Methods not available in Parallel Colt but supported by Ruby, such as “sinh”, “tanh”, and “add” for “byte” type, etc. are still supported by MDArray.  Again, to improve performance, instead of passing a Proc we now create a class as follows</span></p>

<p class="" style="margin:0cm 0cm 0.0001pt 35.4pt;text-align:justify"><span lang="EN-US"> class Add</span></p><p class="" style="margin-bottom:0.0001pt"><b><span lang="EN-US">                        </span></b><span lang="EN-US">def self.apply(a, b)</span></p>

<p class="" style="margin-bottom:0.0001pt"><span lang="EN-US">                                a + b</span></p><p class="" style="margin-bottom:0.0001pt"><span lang="EN-US">                         end</span></p><p class="" style="margin-bottom:0.0001pt">

<span lang="EN-US">               end</span></p><p class="" style="margin-bottom:0.0001pt"><span lang="EN-US"> </span></p><p class="" style="margin-bottom:0.0001pt"><span lang="EN-US">This change brought performance improvement of over 60% for MDArray operations with Ruby methods.</span></p>

<p class="" style="margin-bottom:0.0001pt"><b><span lang="EN-US">Experimental Lazy Evaluation</span></b></p><p class="" style="margin-bottom:0.0001pt"><span lang="EN-US">Usual MDArray operations are done eagerly, i.e., if @a, @b, @c are three MDArrays then the following:</span></p>

<p class="" style="margin-bottom:0.0001pt"><span lang="EN-US">                @d = @a + @b + @c</span></p><p class="" style="margin-bottom:0.0001pt;text-align:justify"><span lang="EN-US">will be evaluated as follows: first @a + @b is performed and stored in a temporary variable, then this temporary variable is added to @c.  For large expressions, temporary variables can have significant performance impact.</span></p>

<p class="" style="margin-bottom:0.0001pt;text-align:justify"><span lang="EN-US">This version of MDArray introduces lazy evaluation of expressions.  Thus, when in lazy mode:</span></p><p class="" style="margin-bottom:0.0001pt;text-align:justify">

<span lang="EN-US">                @lazy_d = @a + @b + @c</span></p><p class="" style="margin-bottom:0.0001pt;text-align:justify"><span lang="EN-US">will not evaluate immediately.  Rather, the expression is preprocessed and only executed when required.  Since at execution time the whole expression is known, there is no need for temporary variables as the whole expression is executed at once.  To put MDArray in lazy mode we only need to set its mode to lazy with the following command “MDArray.lazy = true”.  All expressions after that are by default lazy.  In lazy mode, MDArray resembles Numexpr, however, there is no need to write the expression as a string, and there is no compilation involved.</span></p>

<p class="" style="margin-bottom:0.0001pt;text-align:justify"><span lang="EN-US">MDArray does not implement broadcasting rules as NumPy.  As a result, trying to operate on arrays of different shape raises an exception.  On lazy mode, this exception is raise only at evaluation time, so it is possible to have an invalid lazy array.  To evaluate a lazy array one should use the “[]” method as follows:</span></p>

<p class="" style="margin-bottom:0.0001pt;text-align:justify"><span lang="EN-US">                @d = lazy_d[]</span></p><p class="" style="margin-bottom:0.0001pt;text-align:justify"><span lang="EN-US">@d is now a normal MDArray. </span></p>

<p class="" style="margin-bottom:0.0001pt;text-align:justify"><span lang="EN-US">Lazy MDArrays are really lazy, so let’s assume that @a = [1, 2, 3, 4] and @b = [5, 6, 7, 8].  Lets also have @l_c = @a + @b.  Now doing @c = @l_c[], will evaluate @c to [6, 8, 10, 12].  Now, let´s do @a[1] = 20 and then @d = @l_c[].  Now @d evaluates to [25, 8, 10, 12] as the new value of @a is used.</span></p>

<p class="" style="margin-bottom:0.0001pt;text-align:justify"><span lang="EN-US">Lazy arrays can be evaluated inside expressions:</span></p><p class="" style="margin-bottom:0.0001pt;text-align:justify"><span lang="EN-US">                @l_c = (@a + @b)[] + @c</span></p>

<p class="" style="margin-bottom:0.0001pt;text-align:justify"><span lang="EN-US">In this example, @l_c is a lazy array, but (@a + @b) is evaluated when the “[]” method is called and then added to @c.  If now the value of @a or @b is changed, the evaluation of @l_c will not be changed as in the previous example.</span></p>

<p class="" style="margin-bottom:0.0001pt;text-align:justify"><span lang="EN-US">Finally, laziness is contagious.  So, let´s assume that we have @l_c as above, a lazy array and we do MDArray.lazy = false.  From this point on in the code, operations will be done eagerly.  Now doing: @e = @d + @l_c, @e is a lazy array as its construction involves a lazy array.  One should be careful when in eager mode mixing lazy and eager arrays: </span></p>

<p class="" style="margin-bottom:0.0001pt;text-align:justify"><span lang="EN-US">                @c = @l_a + (@b + @c)</span></p><p class="" style="margin-bottom:0.0001pt;text-align:justify"><span lang="EN-US">then, with parenthesis, first (@b + @c) is evaluated eagerly and then added lazily to @l_a, giving a lazy array.</span></p>

<p class="" style="margin-bottom:0.0001pt;text-align:justify"><span lang="EN-US">In this version, Lazy evaluation is around 40% <b>less</b> efficient in one machine I tested up to approximately the same performance in another equipment than eager evaluation when only native Java methods (Parallel Colt methods described below) are used in the expression. If expression involves any Ruby method, evaluation of lazy expressions becomes much slower than eager evaluation.  In order to improve performance, I believe that compilation of expression will be necessary.</span></p>

<p class=""><b><span lang="EN-US" style="font-size:14pt;line-height:21px">MDArray and SciRuby</span></b><b><span lang="EN-US">:</span></b></p><p class=""><span lang="EN-US">MDArray subscribes fully to the SciRuby Manifesto (</span><a href="http://sciruby.com/"><span lang="EN-US">http://sciruby.com/</span></a><span lang="EN-US">). </span></p>

<p style="margin:0cm 0cm 0.0001pt 35.4pt;text-align:justify;line-height:20.7pt;background-color:rgb(248,248,248);vertical-align:baseline"><i><span lang="EN-US" style="font-size:11pt;font-family:Calibri,sans-serif">“</span></i><a href="http://www.ruby-lang.org/"><i><span lang="EN-US" style="font-size:11pt;font-family:Calibri,sans-serif;color:windowtext;text-decoration:none">Ruby</span></i></a><i><span lang="EN-US" style="font-size:11pt;font-family:Calibri,sans-serif"> has for some time had no equivalent to the beautifully constructed </span></i><a href="http://numpy.scipy.org/"><i><span lang="EN-US" style="font-size:11pt;font-family:Calibri,sans-serif;color:windowtext;text-decoration:none">NumPy</span></i></a><i><span lang="EN-US" style="font-size:11pt;font-family:Calibri,sans-serif">, <a href="http://www.scipy.org/"><span style="color:windowtext;text-decoration:none">SciPy</span></a>, and </span></i><a href="http://matplotlib.sourceforge.net/"><i><span lang="EN-US" style="font-size:11pt;font-family:Calibri,sans-serif;color:windowtext;text-decoration:none">matplotlib</span></i></a><i><span lang="EN-US" style="font-size:11pt;font-family:Calibri,sans-serif"> libraries for </span></i><i><span lang="EN-US" style="font-size:11pt;font-family:Calibri,sans-serif;color:windowtext"><a href="http://www.python.org/">Pytho</a>n.</span></i></p>

<p style="margin:0cm 0cm 0.0001pt 35.4pt;text-align:justify;line-height:20.7pt;background-color:rgb(248,248,248);vertical-align:baseline"><i><span lang="EN-US" style="font-size:11pt;font-family:Calibri,sans-serif">We believe that the time for a Ruby science and visualization package has come. Sometimes when a solution of sugar and water becomes super-saturated, from it precipitates a pure, delicious, and diabetes-inducing crystal of sweetness, induced by no more than the tap of a finger. So is occurring now, we believe, with numeric and visualization libraries for Ruby.”</span></i></p>

<p class=""><span lang="EN-US"> </span></p><p class=""><b><span lang="EN-US" style="font-size:14pt;line-height:21px">MDArray main properties are</span></b><b><span lang="EN-US">:</span></b></p><p class="" style><span lang="EN-US" style="font-family:Symbol">·<span style="font-size:7pt;font-family:'Times New Roman'">         </span></span><span lang="EN-US">Homogeneous multidimensional array, a table of elements (usually numbers), all of the same type, indexed by a tuple of positive integers;</span></p>

<p class="" style><span lang="EN-US" style="font-family:Symbol">·<span style="font-size:7pt;font-family:'Times New Roman'">         </span></span><span lang="EN-US">Easy calculation for large numerical multi dimensional arrays;</span></p>

<p class="" style><span lang="EN-US" style="font-family:Symbol">·<span style="font-size:7pt;font-family:'Times New Roman'">         </span></span><span lang="EN-US">Basic types are: boolean, byte, short, int, long, float, double, string, structure;</span></p>

<p class="" style><span lang="EN-US" style="font-family:Symbol">·<span style="font-size:7pt;font-family:'Times New Roman'">         </span></span><span lang="EN-US">Based on JRuby, which allows importing Java libraries;</span></p>

<p class="" style><span lang="EN-US" style="font-family:Symbol">·<span style="font-size:7pt;font-family:'Times New Roman'">         </span></span><span lang="EN-US">Operator: +,-,*,/,%,**, >, >=, etc.;</span></p>

<p class="" style><span lang="EN-US" style="font-family:Symbol">·<span style="font-size:7pt;font-family:'Times New Roman'">         </span></span><span lang="EN-US">Functions: abs, ceil, floor, truncate, is_zero, square, cube, fourth;</span></p>

<p class="" style><span lang="EN-US" style="font-family:Symbol">·<span style="font-size:7pt;font-family:'Times New Roman'">         </span></span><span lang="EN-US">Binary Operators: &, |, ^, ~ (binary_ones_complement), <<, >>;</span></p>

<p class="" style><span lang="EN-US" style="font-family:Symbol">·<span style="font-size:7pt;font-family:'Times New Roman'">         </span></span><span lang="EN-US">Ruby Math functions: acos, acosh, asin, asinh, atan, atan2, atanh, cbrt, cos, erf, exp, gamma, hypot, ldexp, log, log10, log2, sin, sinh, sqrt, tan, tanh, neg;</span></p>

<p class="" style><span lang="EN-US" style="font-family:Symbol">·<span style="font-size:7pt;font-family:'Times New Roman'">         </span></span><span lang="EN-US"> Boolean operations on boolean arrays: and, or, not;</span></p>

<p class="" style><span lang="EN-US" style="font-family:Symbol">·<span style="font-size:7pt;font-family:'Times New Roman'">         </span></span><span lang="EN-US"> Fast descriptive statistics from Parallel Colt (complete list found bellow);</span></p>

<p class="" style><span lang="EN-US" style="font-family:Symbol">·<span style="font-size:7pt;font-family:'Times New Roman'">         </span></span><span lang="EN-US"> Easy manipulation of arrays: reshape, reduce dimension, permute, section, slice, etc.;</span></p>

<p class="" style><span lang="EN-US" style="font-family:Symbol">·<span style="font-size:7pt;font-family:'Times New Roman'">         </span></span><span lang="EN-US">Reading of two dimensional arrays from CSV files (mainly for debugging and simple testing purposes);</span></p>

<p class="" style><span lang="EN-US" style="font-family:Symbol">·<span style="font-size:7pt;font-family:'Times New Roman'">         </span></span><span lang="EN-US">StatList: a list that can grow/shrink and that can compute Parallel Colt descriptive statistics;</span></p>

<p class="" style><span lang="EN-US" style="font-family:Symbol">·<span style="font-size:7pt;font-family:'Times New Roman'">         </span></span><span lang="EN-US">Experimental lazy evaluation (still slower than eager evaluation).</span></p>

<p class=""><b><span lang="EN-US" style="font-size:14pt;line-height:21px">Descriptive statistics methods imported from Parallel Colt</span></b><b><span lang="EN-US">:</span></b></p><p class="" style="text-align:justify">
<span lang="EN-US">auto_correlation, correlation, covariance, durbin_watson, frequencies, geometric_mean, harmonic_mean, kurtosis, lag1, max, mean, mean_deviation, median, min, moment, moment3, moment4, pooled_mean, pooled_variance, product, quantile, quantile_inverse, rank_interpolated, rms, sample_covariance, sample_kurtosis, sample_kurtosis_standard_error, sample_skew, sample_skew_standard_error, sample_standard_deviation, sample_variance, sample_weighted_variance, skew, split,  standard_deviation, standard_error, sum, sum_of_inversions, sum_of_logarithms, sum_of_powers, sum_of_power_deviations, sum_of_squares, sum_of_squared_deviations, trimmed_mean, variance, weighted_mean, weighted_rms, weighted_sums, winsorized_mean.</span></p>

<p class="" style="text-align:justify"><b><span lang="EN-US" style="font-size:14pt;line-height:21px">Double and Float methods from Parallel Colt</span></b><span lang="EN-US">:</span></p><p class="" style="text-align:justify">

<span lang="EN-US">acos, asin, atan, atan2, ceil, cos, exp, floor, greater, IEEEremainder, inv, less, lg, log, log2, rint, sin, sqrt, tan.</span></p><p class="" style="text-align:justify"><b><span lang="EN-US" style="font-size:14pt;line-height:21px">Double, Float, Long and Int methods from Parallel Colt</span></b><span lang="EN-US">:</span></p>

<p class="" style="text-align:justify"><span lang="EN-US">abs, compare, div, divNeg, equals, isEqual (is_equal), isGreater (is_greater), isles (is_less), max, min, minus, mod, mult, multNeg (mult_neg), multSquare (mult_square), neg, plus (add), plusAbs (plus_abs), pow (power), sign, square.</span></p>

<p class="" style="text-align:justify"><b><span lang="EN-US" style="font-size:14pt;line-height:21px">Long and Int methods from Parallel Colt</span></b></p><p class="" style="text-align:justify"><span lang="EN-US">and, dec, factorial, inc, not, or, shiftLeft (shift_left), shiftRightSigned (shift_right_signed), shiftRightUnsigned (shift_right_unsigned), xor.</span></p>

<p class="" style="text-align:justify"><b><span lang="EN-US" style="font-size:14pt;line-height:21px">MDArray installation and download</span></b><b><span lang="EN-US">:</span></b></p><p class="" style="text-align:justify">

<span lang="EN-US" style="font-family:Symbol">·<span style="font-size:7pt;font-family:'Times New Roman'">         </span></span><span lang="EN-US">Install Jruby</span></p><p class="" style="text-align:justify"><span lang="EN-US" style="font-family:Symbol">·<span style="font-size:7pt;font-family:'Times New Roman'">         </span></span><span lang="EN-US">jruby –S gem install mdarray</span></p>

<p class="" style="text-align:justify"><b><span lang="EN-US" style="font-size:14pt;line-height:21px">MDArray Homepages</span></b><b><span lang="EN-US">:</span></b></p><p class="" style="text-align:justify"><span lang="EN-US" style="font-family:Symbol">·<span style="font-size:7pt;font-family:'Times New Roman'">         </span></span><a href="http://rubygems.org/gems/mdarray">http://rubygems.org/gems/mdarray</a><span lang="EN-US"></span></p>

<p class="" style="text-align:justify"><span lang="EN-US" style="font-family:Symbol">·<span style="font-size:7pt;font-family:'Times New Roman'">         </span></span><a href="https://github.com/rbotafogo/mdarray/wiki"><span lang="EN-US">https://github.com/rbotafogo/mdarray/wiki</span></a><span lang="EN-US"></span></p>

<p class="" style="text-align:justify"><b><span lang="EN-US" style="font-size:14pt;line-height:21px">Contributors</span></b><b><span lang="EN-US">:</span></b></p><p class="" style="text-align:justify"><span lang="EN-US">Contributors are welcome.</span></p>

<p class="" style="text-align:justify"><b><span lang="EN-US" style="font-size:14pt;line-height:21px">MDArray History</span></b><b><span lang="EN-US">:</span></b></p><p class="" style="text-align:justify"><span lang="EN-US" style="font-family:Symbol">·<span style="font-size:7pt;font-family:'Times New Roman'">    </span></span><span lang="EN-US">24/05/2013: Version 0.5.0 – Over 90% Performance improvements for methods imported from Parallel Colt and over 40% performance improvements for all other methods (implemented in Ruby);</span></p>

<p class="" style="text-align:justify"><span lang="EN-US" style="font-family:Symbol">·<span style="font-size:7pt;font-family:'Times New Roman'">     </span></span><span lang="EN-US">16/05/2013: Version 0.5.0 - All loops transferred to Java with over 50% performance improvements.  Descriptive statistics from Parallel Colt;</span></p>

<p class="" style="text-align:justify"><span lang="EN-US" style="font-family:Symbol">·<span style="font-size:7pt;font-family:'Times New Roman'">         </span></span><span lang="EN-US">19/04/2013: Version 0.4.3 - Fixes a simple, but fatal bug in 0.4.2.  No new features;</span></p>

<p class="" style="text-align:justify"><span lang="EN-US" style="font-family:Symbol">·<span style="font-size:7pt;font-family:'Times New Roman'">         </span></span><span lang="EN-US">17/04/2013: Version 0.4.2 - Adds simple statistics and boolean operators;</span></p>

<p class="" style="text-align:justify"><span lang="EN-US" style="font-family:Symbol">·<span style="font-size:7pt;font-family:'Times New Roman'">         </span></span><span lang="EN-US">05/04/2013: Version 0.4.0 – Initial release.</span></p>

<div><br></div>-- <br>Rodrigo Botafogo<div>Integrando TI ao seu negócio<br><br><div><br></div></div>
</div>