Package jline.util

Class PrecomputedCDFunction

java.lang.Object
jline.util.PrecomputedTableFunction
jline.util.PrecomputedCDFunction
All Implemented Interfaces:
Serializable, Function<Matrix,Matrix>, SerializableFunction<Matrix,Matrix>

public class PrecomputedCDFunction extends PrecomputedTableFunction implements SerializableFunction<Matrix,Matrix>, Serializable
A pre-computed class dependence function beta_i(n) that stores function values for all possible state combinations.

This class is used to convert MATLAB class-dependence handles to Java by pre-computing all possible function values in MATLAB and storing them in a lookup table (see PrecomputedTableFunction). When the function is called in Java, it looks up the pre-computed value.

A chain-independent handle returns the dimensionless scaling as a scalar, which MATLAB broadcasts over the classes by elementwise multiplication in State.afterEventStation. Such a scalar is returned here as a 1x1 Matrix, which the JAR state machinery (AfterEventStation.cdScalar) broadcasts over the classes in the same way.

A chain-specific handle instead returns the length-R row vector [beta_1(n), ..., beta_R(n)] (Sauer's mu_{r,i}(n)), as the flow-equivalent-server aggregation produces; see FesBetaFunction. Such a state is tabulated whole via PrecomputedTableFunction.addValue(Matrix, double[]) and returned here as a 1xR Matrix. Collapsing it to a scalar would silently drop the per-class resolution and yield the unscaled network.

See Also:
  • Constructor Details

    • PrecomputedCDFunction

      public PrecomputedCDFunction(int numClasses, double defaultValue)
      Creates a new pre-computed class dependence function.
      Parameters:
      numClasses - the number of classes in the model
      defaultValue - the default value to return when a state is not found
    • PrecomputedCDFunction

      public PrecomputedCDFunction(int numClasses)
      Creates a new pre-computed class dependence function with default value of 1.0, i.e. the neutral scaling.
      Parameters:
      numClasses - the number of classes in the model
  • Method Details

    • apply

      public Matrix apply(Matrix ni)
      Applies the class dependence function to the given state.
      Specified by:
      apply in interface Function<Matrix,Matrix>
      Parameters:
      ni - the state vector as a Matrix (1 x numClasses or numClasses x 1)
      Returns:
      the pre-computed scaling: a 1xR Matrix when the state was tabulated per class, otherwise a 1x1 Matrix broadcast over the classes