Interface Function<D,C>

All Superinterfaces:
Function<D,C>, Relation<D,C>
All Known Subinterfaces:
Bijection<D,C>, ContinuousFunction<D,C>, ConvergentSequence<T>, DifferentiableFunction<D,C>, DiscreteMap<T>, IntegerSequence, IntegrableFunction<D,C>, MultivariateFunction, MultivariateRealFunction, ParametricCurve, ParametricSurface, ProbabilityDistribution, RealFunction, ScalarField<V>, ScalarFunction<D>, Sequence<T>, Transform<D,C>, UnivariateFunction, VectorField<V>, VectorFunction<F>
All Known Implementing Classes:
ArnoldCatMap, BellSequence, BetaDistribution, BezierCurve, BinomialDistribution, CatalanSequence, CauchyDistribution, ChiSquareDistribution, Circle, Cone, ContinuousDistribution, Cylinder, DiscreteDistribution, DiscreteFourierTransform, Ellipse, Ellipsoid, ExponentialDistribution, FactorialSequence, FibonacciSequence, GammaDistribution, GeometricDistribution, GingerbreadManMap, Helix, HenonMap, LogisticMap, LogNormalDistribution, NormalDistribution, Paraboloid, PoissonDistribution, PolynomialFunction, PrimePiSequence, PrimeSequence, RecursiveSequence, Sphere, SquareSequence, StandardMap, StudentTDistribution, Torus, TriangularSequence, UniformDistribution, WeibullDistribution

public interface Function<D,C> extends Relation<D,C>, Function<D,C>
Represents a mathematical function from a domain D to a codomain C.

A function is a relation where for every x ∈ D, there is exactly one y ∈ C such that (x, y) is in the relation.

Since:
1.0
Author:
Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
  • Method Summary

    Modifier and Type
    Method
    Description
    default <V> Function<D,V>
    andThen(Function<? super C, ? extends V> after)
    Composes this function with another (from java.util.function.Function).
    default C
    apply(D x)
    Java Function interface implementation - delegates to evaluate().
    default <V> Function<V,C>
    compose(Function<V,D> inner)
    Returns the composition of this function with another function.
    default boolean
    contains(D input, C output)
    Checks if the relation contains the pair (input, output).
    Evaluates this function at the given point.
    default List<C>
    Evaluates the function for a batch of input values.
    Returns the currently set compute backend.
    default boolean
    Indicates if this function is continuous.
    default boolean
    Indicates if this function is differentiable.
    default void
    Sets the compute backend for this function (e.g., enable GPU).

    Methods inherited from interface Function

    compose

    Methods inherited from interface Relation

    getCodomain, getDomain
  • Method Details

    • evaluate

      C evaluate(D x)
      Evaluates this function at the given point.
      Parameters:
      x - the input point
      Returns:
      the value of the function at x
    • apply

      default C apply(D x)
      Java Function interface implementation - delegates to evaluate().
      Specified by:
      apply in interface Function<D,C>
      Parameters:
      x - input value
      Returns:
      f(x)
    • contains

      default boolean contains(D input, C output)
      Checks if the relation contains the pair (input, output). For a function, this checks if f(input) == output.
      Specified by:
      contains in interface Relation<D,C>
      Parameters:
      input - the input element from the domain
      output - the output element from the codomain
      Returns:
      true if (input, output) is in the relation
    • compose

      default <V> Function<V,C> compose(Function<V,D> inner)
      Returns the composition of this function with another function. (f o g)(x) = f(g(x))
      Type Parameters:
      V - the domain of the inner function
      Parameters:
      inner - the inner function g
      Returns:
      the composite function f o g
    • andThen

      default <V> Function<D,V> andThen(Function<? super C, ? extends V> after)
      Composes this function with another (from java.util.function.Function).
      Specified by:
      andThen in interface Function<D,C>
      Type Parameters:
      V - result type
      Parameters:
      after - function to apply after this
      Returns:
      composed function
    • setBackend

      default void setBackend(ComputeBackend backend)
      Sets the compute backend for this function (e.g., enable GPU).
      Parameters:
      backend - the compute backend
    • getBackend

      default ComputeBackend getBackend()
      Returns the currently set compute backend.
      Returns:
      the compute backend, or null if none is explicitly set or supported.
    • evaluate

      default List<C> evaluate(Collection<D> inputs)
      Evaluates the function for a batch of input values.
      Parameters:
      inputs - a collection of input values
      Returns:
      a list of corresponding output values
    • isContinuous

      default boolean isContinuous()
      Indicates if this function is continuous.
      Returns:
      true if continuous, false otherwise
    • isDifferentiable

      default boolean isDifferentiable()
      Indicates if this function is differentiable.
      Returns:
      true if differentiable, false otherwise