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 Type
    Method
    Description
    apply(double[] variables)
    Evaluate expression with given variable values.
    default Matrix
    applyMatrix(double[] variables)
    Convenience method for matrix extraction.
    double
    applyScalar(double[] variables)
    Convenience method for scalar extraction.
    default String
    applyString(double[] variables)
    Convenience method for string extraction.
    default double[]
    applyVector(double[] variables)
    Convenience method for vector extraction.
  • Method Details

    • apply

      MathExpression.EvalResult apply(double[] variables)
      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

      default Matrix applyMatrix(double[] variables)
      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

      default String applyString(double[] variables)
      Convenience method for string extraction. Throws ClassCastException if result is not a string.
      Parameters:
      variables - execution frame variables
      Returns:
      String result