Class MatrixEquation
-
- All Implemented Interfaces:
public class MatrixEquation
A wrapper class that extends EJML's Equation functionality to work seamlessly with jline.util.matrix.Matrix objects.
This class provides a bridge between the EJML equation parsing and evaluation system and the LINE matrix system. It automatically handles conversion between Matrix objects and EJML's internal representations, allowing for intuitive mathematical expressions to be evaluated using LINE matrices.
Usage example:
Matrix A = new Matrix(3, 3); Matrix B = new Matrix(3, 3); MatrixEquation eq = new MatrixEquation(); eq.alias("A", A, "B", B); MatrixEquation result = eq.process("C = A * B + I"); Matrix C = result.lookupSimple("C");
- Since:
1.0
QORE Lab, Imperial College London
-
-
Constructor Summary
Constructors Constructor Description MatrixEquation()
Creates a new MatrixEquation with an empty equation context. MatrixEquation(Equation e)
Creates a MatrixEquation wrapping an existing EJML Equation. MatrixEquation(Array<Object> args)
Creates a new MatrixEquation and immediately aliases the provided variables.
-
Method Summary
Modifier and Type Method Description void
alias(Array<Object> args)
Creates aliases for variables that can be used in matrix equations. Matrix
lookupSimple(String token)
Retrieves a matrix result from the equation context by variable name. MatrixEquation
process(String equation)
Processes a mathematical equation string and returns a new MatrixEquation containing the results. -
-
Method Detail
-
alias
void alias(Array<Object> args)
Creates aliases for variables that can be used in matrix equations. Arguments should be provided in pairs: variable name followed by variable value. Matrix objects are automatically converted to EJML's sparse matrix format.
- Parameters:
args
- variable name and value pairs (name1, value1, name2, value2, ...
-
lookupSimple
Matrix lookupSimple(String token)
Retrieves a matrix result from the equation context by variable name. The returned matrix is automatically converted from EJML's SimpleMatrix format to the LINE Matrix format.
- Parameters:
token
- the variable name to look up- Returns:
the matrix associated with the given variable name
-
process
MatrixEquation process(String equation)
Processes a mathematical equation string and returns a new MatrixEquation containing the results. The equation can reference any variables that have been aliased in this context.
- Parameters:
equation
- the mathematical equation to process (e.g.- Returns:
a new MatrixEquation containing the processed equation results
-
-
-
-