My favorites | Sign in
Project Home Downloads Wiki Issues Source
Project Information
Members
Featured
Downloads

ScalaLab: Matlab-like scientific computing in Scala

Project Summary

The ScalaLab project aims to provide an efficient scientific programming environment for the Java Virtual Machine. The scripting language is based on the Scala programming language enhanced with high level scientific operators and with an integrated environment that provides a Matlab-like working style. Also, all the huge libraries of Java scientific code can be easily accessible. The main potential of the ScalaLab is speed and flexibility. The statically typed Scala language can provide speeds of scripting code similar to pure Java. Also, the environment can cooperate effectively with Java. A major design priority of ScalaLab is its user-friendly interface. We like the user to enjoy writing scientific code, and with this objective we design the whole framework.

ScalaLab provides the ScalaSci scripting engine, based on the new Scala programming language, that obtains scripting speed by resolving method calls at compile time ("statically typed"). The scripting code is extremely fast, close to Java (sometimes slower, sometimes faster), and usually faster from equivalent Matlab .m scripts!

Three versions of ScalaLab are provided: a. ScalaLab210 based on Scala 2.10 branch, b. ScalaLab292 based on Scala 2.9.2 final, c. ScalaLab282 based on Scala 2.8.2 final.

ATTENTION: ScalaLab is developed with JDK7, so make sure to have JDK7 installed. I run ScalaLab without problems with:

java version "1.7.0"

Java(TM) SE Runtime Environment (build 1.7.0-b147)

Java HotSpot(TM) 64-Bit Server VM (build 21.0-b17, mixed mode)

Perhaps useful to many users, is the following modification of the RunScalaLab.sh script, in order to run ScalaLab on an installed JDK7 next to JDK6 (/usr/java/jdk1.7.0 corresponds to your JDK7 installation directory):

JAVA_HOME=/usr/java/jdk1.7.0

$JAVA_HOME/bin/java -Xss10m -Xms200m -Xmx1000m -jar Scalalab291.jar

ScalaLab ScreenShot

ScalaLab is a simple to use environment that presents a rich Graphical User Interface to the user and a Matlab-like way of working. We present an illustrative snapshot where the FastICA toolbox has been used to separate a signal mixture by performing Independent Component Analysis (ICA).

Installation

To install and execute ScalaLab, download the executable featured downloads, either for the Scala 2.8.2 based version,or Scala 2.9.2 final, or the recent Scala 2.10 based and unzip them. Then execute the appropriate .bat script for Windows or the corresponding .sh script for UNIX users. The script initiates the appropriate Native BLAS libraries, and configures some JVM parameters.

Thus the disk configuration of ScalaLab should be:

  • ScalaLab282.jar or ScalaLab292.jar or ScalaLab210.jar // the executable
  • RunScalaLab.sh // the UNIX script for executing ScalaLab
  • RunScalaLabServerJVM.sh // the UNIX script for executing ScalaLab with server JVM (for large computations can be significantly faster)
  • RunScalaLabWin32.bat // the 32-bit Windows script for executing ScalaLab
  • RunScalaLabWin64.bat // the 64-bit Windows script for executing ScalaLab
  • RunScalaLabServerJVMWin32.bat // the 32-bit Windows script for executing ScalaLab with server JVM (for large computations can be significantly faster)
  • RunScalaLabServerJVMWin64.bat // the 64-bit Windows script for executing ScalaLab with server JVM (for large computations can be significantly faster)
  • /lib // should contain all the .jar library files of ScalaLab
  • /libBLAS // contains binaries for Native BLAS for Linux and Windows platforms

The most recent updates (26 -May -2012)

ParallelColt library of Piotr Wendykier is included with ScalaLab Libraries.

Some new DSP routines of Darwin Airola added in ScalaSci. Minor improvements

Routines inspired from Numerical Recipes implemented in Java/Scala

Redesign of FFT routines, Fast plot of large signals

ScalaLab Advantages

The main advantages of ScalaSci that equip it with great potential are:

  1. The flexibility and scalability of the wonderful and powerful Scala language, that offer many opportunities to implement convenient high-level scientific operators.
  2. The speed of Scala based scripting, that approaches the speed of native and optimized Java code, and thus is close to, or even better from C/C++ based scientific code!
  3. The vast Java based scientific libraries with excellent code for many application domains. These libraries are directly available from ScalaSci with the dynamic loading of the corresponding Java toolboxes.
  4. The user friendly Matlab-like environment of ScalaLab and the high quality scientific plotting support.

Documentation for ScalaLab

ScalaLab provides a lot of on-line help and demo examples. Also, there exist some material in the Downloads section in .pdf format that document some aspects of ScalaLab. The philosophy of ScalaLab is not to re-implement everything in Scala, but instead to exploit high quality Java scientific software either with Java, or preferably by wrapping the code with Scala classes. Although any Java scientific library can be utilized as toolbox, ScalaLab includes by default some excellent Java scientific libraries. Work is in progress to utilize more effectively these libraries by designing Scala based high level interfaces. These integrated libraries are:

  1. The NUMAL library described in the book: A Numerical Library in Java for Scientists & Engineers, Hang T. Lau, Chapman & Hall/CRC, 2004 (In my opinion, this is the best library to perform serious numerical work in ScalaLab. )
  2. The Efficient Matrix Java Library, http://code.google.com/p/efficient-java-matrix-library/
  3. The Matrix Toolkit for Java, http://code.google.com/p/matrix-toolkits-java/
  4. The Parallel Colt Library, http://sites.google.com/site/piotrwendykier/software/parallelcolt
  5. The JBLAS Library, http://jblas.org/
  6. The Apache Common Maths, http://commons.apache.org/math/
  7. Jsci - A Science API for Java, http://jsci.sourceforge.net/, provides mostly Wavelet Analysis Routines
  8. The JFreeChart plotting system, http://www.jfree.org/jfreechart/, provides plots, for some of which already exists Matlab-like interface
  9. The VisAD Java Scientific Visualization library, http://www.ssec.wisc.edu/~billh/visad.html, includes documentation about the design and utilization of this sophisticated package. Up to now the Java interface can be used from ScalaLab (of course can be coded in Scala). We plan to provide a Matlab-like simpler interface soon.

Useful Books to use with ScalaLab

ScalaLab can be utilized and as an educational tool for Numerical Analysis, Computational Intelligence and Engineering courses. Since the ScalaLab editor can execute directly Java code, many Java code chunks can be easily executed. Of course, Scala offers a much more effective programming framework. The following are some excellent scientific books that can be studied using ScalaLab for programming exercises:

  1. The NUMAL library described in the book: A Numerical Library in Java for scientists & Engineers, Hang T. Lau, Chapman & Hall/CRC, 2004
  2. Numerical Recipes in C++, Second (2002) and Third editions (2007), William H. Press, Saul A. Teukolsky, William T. Vetterling, Brian P. Flannery, Cambridge University Press, 2002, A classic book on numerical analysis and programming, inspires many ScalaLab routines, placed in package scalaSci.NR
  3. Numerical Analysis : Object-Oriented implementation of Numerical Methods: An Introduction with Java and Smalltalk, Didier H. Besset, Morgan Kauffmann, 2000, An excellent introductory book on numerical analysis methods, the routines of the book are available within the core of ScalaLab
  4. Expert Systems: Constructing Intelligent Agents with Java, J. Bigus et.al, John Wiley and Sons, 1997, A very good book on artificial intelligence techniques with Java on which the JFES ScalaLab toolbox is based
  5. Data Mining: Data Mining, Practical Machine Learning Tools and Techniques, Ian H. Witten, Eibe Frank, Mark A. Hall, Morgan Kauffman, 2011, An excellent book for developing data mining techniques using WEKA as a vehicle, WEKA is tested and provided as ScalaLab toolbox
  6. Neural Networks: Programming Neural Networks with ENCOG 2 in Java, Jeff Heaton, Heaton Research, 2011, An excellent book for practicing neural network techniques with the ENCOG system, that is tested and provided as ScalaLab toolbox

Also, some excellent Scala books can be used with ScalaLab, since ScalaLab builds upon the full Scala distribution. The classic book for Scala is the Odersky's book (listed first), but also the other ones are very good books and can complement the reader's skills:

  1. Martin Odersky, Lex Spoon, Bill Venners, Programming in Scala, Artima Second Edition, 2010
  2. Dean Wampler & Alex Payne, Programming Scala, O'Reily, 2009
  3. SCALA for the Impatient, Cay S. Horstmann, Addison-Wesley, 2012
  4. Venkat Subramaniam, Programming Scala – Tackle Multicore Complexity on the Java Virtual Machine, Pragmatic Bookself 2009
  5. David Pollak, Beginning Scala, APress 2009
  6. Christos Loverdos, Apostolos Syropoulos, Steps in Scala, Cambridge University Press, 2010

Attention

The default stack and heap size of the JVM are sometimes not adequate. Thus it is better to execute ScalaLab with something like:

java -Xss20m -Xms200m -Xmx1000m -jar scalalab.jar 

something that the RunScalaLab.bat and RunScalaLab.sh scripts perform.

Java 3D

In order the VisAD Scientific Data Visualization library to operate on 3-D plots, we recommend to install the Java 3D system from Oracle (http://www.oracle.com/technetwork/java/javase/tech/index-jsp-138252.html) for your platform.

ScalaLab Toolboxes

Any Java Library can be used as a ScalaLab Toolbox. However, for some of them work is in progress in order to provide better syntax with the superb facilities of the Scala language. You can find some of these toolboxes at the downloads section.

ScalaLab Development discussion group Mailing List

http://groups.google.com/group/scalalab-dev-group

ScalaLab Developer

    Stergios  Papadimitriou 
    Technology Education Institute of Kavala
    Department of Information Management
    Greece 
    email: sterg@teikav.edu.gr
Powered by Google Project Hosting