Skip to content
Rodrigo Botafogo edited this page May 20, 2013 · 45 revisions

Welcome to the MDArray wiki!

MDArray is a multi dimensional array implemented for JRuby inspired by NumPy (www.numpy.org) and Masahiro Tanaka´s Narray (narray.rubyforge.org). MDArray stands on the shoulders of Java-NetCDF and Parallel Colt.

NetCDF-Java Library is a Java interface to NetCDF files, as well as to many other types of scientific data formats. It is developed and distributed by Unidata (http://www.unidata.ucar.edu).

Parallel Colt (http://grepcode.com/snapshot/repo1.maven.org/maven2/net.sourceforge.parallelcolt/parallelcolt/0.10.0/) is a multithreaded version of Colt (http://acs.lbl.gov/software/colt/). 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.

##MDArray and SciRuby

MDArray subscribes fully to the SciRuby Manifesto (http://sciruby.com/).

“Ruby has for some time had no equivalent to the beautifully constructed NumPy, SciPy, and matplotlib libraries for Python.

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.”

##MDArray Main Properties

  • Easy calculation for large numerical multi dimensional arrays;
  • Basic types are: boolean, byte, short, int, long, float, double, string, structure;
  • Based on JRuby, which allows importing Java libraries. Version 0.4.0 only imports Java-NetCDF;
  • Operator: +,-,*,/,%,**, >, >=, etc.
  • Functions: abs, ceil, floor, truncate, is_zero, square, cube, fourth;
  • Binary Operators: &, |, ^, ~ (binary_ones_complement), <<, >>;
  • 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;
  • Boolean operations on boolean arrays: and, or, not;
  • Fast descriptive statistics from Parallel Colt (complete list found bellow);
  • Easy manipulation of arrays: reshape, reduce dimension, permute, section, slice, etc.;
  • Reading of two dimensional arrays from CSV files (mainly for debugging and simple testing purposes);
  • StatList: a list that can grow/shrink and that can compute Parallel Colt descriptive statistics.
  • Descriptive statistics methods provided by MDArray:

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.

  • MDArray is similar to:

    • Ruby/NArray, Python/NumPy, Perl/PDL, Yorick, IDL
  • MDArray is far from completed!

    • Experimental! Specification may be changed;
    • Far from completed;
    • Bugs may be included;
    • No documentation;
    • Performance needs improvement.
  • Tested Platform

    • JRuby 1.7.3
    • Java 7
  • Installation

    • Needs JRuby installed
    • jruby -S gem install mdarray
  • Author

    Rodrigo Botafogo: [email protected]

Introduction

In MDArray dimensions are called axes. The number of axes is its rank. For example, the coordinates of a point in 3D space [1, 2, 1] is an array of rank 1, because it has one axis. That axis has a length of 3. In the example pictured below, the array has rank 2 (it is 2-dimensional). The first dimension (axis) has a length of 2, the second dimension has a length of 3.

[ [1, 2, 3], [4, 5, 6] ]

Using MDArray

Clone this wiki locally