Research Article

ScalaLab and GroovyLab: Comparing Scala and Groovy for Scientific Computing

Algorithm 4

//define the operation: Number + double ,
// at the MetaClass of the Numbers class
Number.metaClass.plus  =
  {
//the double m array denotes the input parameter
double m  ->
// call a Java routine for the operation
  res  =
groovySci.math.LinearAlgebra.LinearAlgebra.plus(delegate,  m)// calls Java code
    res
}