Examples of Groovey coding style and interface to UJMP

4.11K viewsScripting
0

I hope the attached may be of some interest to others.

It demonstrates some features of Groovey coding, such as closures – which avoid the need to write all those tedious loops when scanning the children of classes such as Matrices and Categories. Example:
[code:1wu8betl]def int matrixIndexFromName(String mName)
{
def listOfMatrices = []
matrices.each{listOfMatrices.add( it.name )}
// or [I]matrices.each{listOfMatrices << it.name }[/I]
int i = listOfMatrices.indexOf(mName)
}[/code:1wu8betl]

It uses Java Swing to get user input.

It also includes a primitive interface to Universal Java Matrix Package (UJMP), which enables a Quantrix matrix to be be imported and processed using matrix algebra operations. To use this capability you need to download the UJMP code ([url:1wu8betl]http://www.ujmp.org/[/url:1wu8betl]) and put in the ScriptingLibs directory per:
[quote="Ben G":1wu8betl]Dominik:

External JARs can be imported as of 4.0.42. For security reasons, we decided to use a single blessed location for external libraries rather than making the entire class path available to scripting. To install a library for use with scripting, follow these steps:

1) Open the folder on your hard drive where Quantrix is installed, and within that folder create a subfolder called “”ScriptingLibs””.

2) Place any JARs you need to use within the ScriptingLibs folder.

3) Restart Quantrix if necessary. In your script, import the classes you would like to use as you would in normal Groovy or Java source.
[/quote:1wu8betl]

Feedback, corrections, and further refinements much appreciated.

Simon

0

Hi Simon,

Thank you for your hints.

I could resolve my issues now and your model is working fine. The reason for the error message and the missing GUI window was the “jdmp-complete-0.1.1.jar” (a data mining java library from the UJMP developers) file I had previously added to the ScriptingLibs folder as well. You can’t have both libraries of them in the ScriptingLibs folder in Quantrix the same time.

The addition of the UJMP library to Quantrix scripting will allow us now to develop sophisticated applications using Linear Algebra.

Thanks again and have a nice weekend!

Dominik

You are viewing 1 out of 3 answers, click here to view all answers.

Latest Questions