Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
package eu.mihosoft.vrl.user;
@ComponentInfo(name="MatrixInput", category="ODE")
public class MatrixInput implements Serializable {
private static final long serialVersionUID = 1L;
private transient Script script;
@MethodInfo(name="", valueName="Matrix", valueStyle="default", valueOptions="serialization=false", hide=false)
public double[][] matrix(
@ParamInfo(name="<html><b>Matrix m</b></hmtl>", style="code", options="") String expression) {
GroovyShell shell = new GroovyShell();
script = shell.parse("import static java.lang.Math.*;"
+ "import eu.mihosoft.vrl.types.*;"
+ "m = [];"
+ expression);
script.run()
return script.getProperty("m")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment