Dashboard > Groovy > ... > Modules > GroovyLab
GroovyLab Log In | Sign Up   View a printable version of the current page.

Added by Yann Richet , last edited by Yann Richet on Oct 10, 2007
Labels: 
(None)

Provides a domain specific language (DSL) for math engineering (matlab-like syntax).

Module Overview

GroovyLab is a set of Groovy classes and Java libraries. It provides common linear algebra and plot static methods easily usable in any groovy script or class.

GroovyLab is fully usable, but still in development status. It is based on JMathTools Java API (based on JAMA and RngPack).

Team Members

  • Yann Richet - Contributor to JMathTools Java project

GroovyLab is just provided to start a math engineering DSL sub-project of Groovy. If you need GroovyLab, GroovyLab also needs you...

Download

Distributions

Source release available at JMathTools website

Installing

Just extract the GroovyLab archive, and try to run examples cases using groovylab.bat or groovylab script: '

  • groovylab examples/simpleTest.gvl
  • groovylab examples/moreTest.gvl

Pre-requisites

GroovyLab is based on Groovy 1.1 and Java 1.5.

Documentation

The following example shows GroovyLab in action:

import static org.math.array.Matrix.*
import static org.math.plot.Plot.*

def A = rand(10,3)
println A
plot("A",A,"SCATTER")
import static org.math.array.Matrix.*
import static org.math.plot.Plot.*

def A = rand(10,3) 		// random Matrix of 10 rows and 3 columns
def B = fill(10,3,1.0) 	// one Matrix of 10 rows and 3 columns
def C = A + B 			// support for matrix addition with "+" or "-"
def D = A - 2.0			// support for number addition with "+" or "-"
def E = A * B			// support for matrix multiplication or division
def F = rand(3,3)
def G = F**(-1)			// support for matrix power (with integers only)

println A				// display Matrix content

plot("A",A,"SCATTER")	// plot Matrix values as ScatterPlot

def M = rand(5,5) + id(5) //Eigenvalues decomposition
println "M=\n" + M
println "V=\n" + V(M)
println "D=\n" + D(M)
println "M~\n" + (V(M) * D(M) * V(M)**(-1))
Site running on a free Atlassian Confluence Open Source Project License granted to The Codehaus. Evaluate Confluence today.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.6.2 Build:#919 Nov 26, 2007) - Bug/feature request - Contact Administrators