Class SmoothStepFactory.FieldSmoothStepFunction<T extends CalculusFieldElement<T>>

  • Type Parameters:
    T - type of the field element
    All Implemented Interfaces:
    CalculusFieldUnivariateFunction<T>
    Enclosing class:
    SmoothStepFactory

    public static class SmoothStepFactory.FieldSmoothStepFunction<T extends CalculusFieldElement<T>>
    extends FieldPolynomialFunction<T>
    Smoothstep function as defined here.

    It is used to do a smooth transition between the "left edge" and the "right edge" with left edge assumed to be smaller than right edge.

    By definition, for order n greater than 1 and input x, a smoothstep function respects at least the following properties :

    • f(x <= leftEdge) = 0 and f(x >= rightEdge) = 1
    • f'(leftEdge) = f'(rightEdge) = 0
    If x is normalized between edges, we have at least :
    • f(x <= 0) = 0 and f(x >= 1) = 1
    • f'(0) = f'(1) = 0
    Smoothstep functions of higher order n will have their higher time derivatives also equal to zero at edges...
    • Method Detail

      • value

        public T value​(double xNormalized)
        Compute the value of the smoothstep for the given argument normalized between edges.
        Overrides:
        value in class FieldPolynomialFunction<T extends CalculusFieldElement<T>>
        Parameters:
        xNormalized - Normalized argument for which the function value should be computed. It is expected to be between [0:1] and will throw an exception otherwise.
        Returns:
        the value of the polynomial at the given point.
        See Also:
        UnivariateFunction.value(double)
      • value

        public T value​(double leftEdge,
                       double rightEdge,
                       T x)
                throws MathIllegalArgumentException
        Compute the value of the smoothstep function for the given edges and argument.

        Note that right edge is expected to be greater than left edge. It will throw an exception otherwise.

        Parameters:
        leftEdge - left edge
        rightEdge - right edge
        x - Argument for which the function value should be computed
        Returns:
        the value of the polynomial at the given point
        Throws:
        MathIllegalArgumentException - if right edge is greater than left edge
        See Also:
        UnivariateFunction.value(double)
      • checkInputEdges

        protected void checkInputEdges​(double leftEdge,
                                       double rightEdge)
        Check that left edge is lower than right edge. Otherwise, throw an exception.
        Parameters:
        leftEdge - left edge
        rightEdge - right edge
      • clampInput

        protected T clampInput​(double leftEdge,
                               double rightEdge,
                               T x)
        Clamp input between edges.
        Parameters:
        leftEdge - left edge
        rightEdge - right edge
        x - input to clamp
        Returns:
        clamped input
      • normalizeInput

        protected T normalizeInput​(double leftEdge,
                                   double rightEdge,
                                   T x)
        Normalize input between left and right edges.
        Parameters:
        leftEdge - left edge
        rightEdge - right edge
        x - input to normalize
        Returns:
        normalized input