Interface FastCompositeExpression
public interface FastCompositeExpression
- Author:
- GBEMIRO Compiled expression that returns any type of EvalResult (scalar, matrix, vector, etc.). Performance characteristics: - Scalar expressions: 5-10 ns - Small matrices: 50-200 ns - Large matrices: linear to problem size (excellent cache locality)
-
Method Summary
Modifier and TypeMethodDescriptionapply(double[] variables) Evaluate expression with given variable values.default MatrixapplyMatrix(double[] variables) Convenience method for matrix extraction.doubleapplyScalar(double[] variables) Convenience method for scalar extraction.default StringapplyString(double[] variables) Convenience method for string extraction.default double[]applyVector(double[] variables) Convenience method for vector extraction.
-
Method Details
-
apply
Evaluate expression with given variable values. Returns EvalResult to support all types (scalar, matrix, vector, etc.).- Parameters:
variables- array of variable values indexed by registry slots- Returns:
- EvalResult of any type (scalar, matrix, vector, string, error)
-
applyScalar
double applyScalar(double[] variables) Convenience method for scalar extraction. Throws ClassCastException if result is not scalar.- Parameters:
variables- execution frame variables- Returns:
- scalar value
-
applyMatrix
Convenience method for matrix extraction. Throws ClassCastException if result is not a matrix.- Parameters:
variables- execution frame variables- Returns:
- Matrix result
-
applyVector
default double[] applyVector(double[] variables) Convenience method for vector extraction. Throws ClassCastException if result is not a vector.- Parameters:
variables- execution frame variables- Returns:
- double[] vector
-
applyString
Convenience method for string extraction. Throws ClassCastException if result is not a string.- Parameters:
variables- execution frame variables- Returns:
- String result
-