Class DSCompiler

java.lang.Object
org.hipparchus.analysis.differentiation.DSCompiler

public class DSCompiler extends Object
Class holding "compiled" computation rules for derivative structures.

This class implements the computation rules described in Dan Kalman's paper Doubly Recursive Multivariate Automatic Differentiation, Mathematics Magazine, vol. 75, no. 3, June 2002. However, in order to avoid performances bottlenecks, the recursive rules are "compiled" once in an unfold form. This class does this recursion unrolling and stores the computation rules as simple loops with pre-computed indirection arrays.

This class maps all derivative computation into single dimension arrays that hold the value and partial derivatives. The class does not hold these arrays, which remains under the responsibility of the caller. For each combination of number of free parameters and derivation order, only one compiler is necessary, and this compiler will be used to perform computations on all arrays provided to it, which can represent hundreds or thousands of different parameters kept together with all their partial derivatives.

The arrays on which compilers operate contain only the partial derivatives together with the 0th derivative, i.e. the value. The partial derivatives are stored in a compiler-specific order, which can be retrieved using methods getPartialDerivativeIndex and getPartialDerivativeOrders(int). The value is guaranteed to be stored as the first element (i.e. the getPartialDerivativeIndex method returns 0 when called with 0 for all derivation orders and getPartialDerivativeOrders returns an array filled with 0 when called with 0 as the index).

Note that the ordering changes with number of parameters and derivation order. For example given 2 parameters x and y, df/dy is stored at index 2 when derivation order is set to 1 (in this case the array has three elements: f, df/dx and df/dy). If derivation order is set to 2, then df/dy will be stored at index 3 (in this case the array has six elements: f, df/dx, d²f/dxdx, df/dy, d²f/dxdy and d²f/dydy).

Given this structure, users can perform some simple operations like adding, subtracting or multiplying constants and negating the elements by themselves, knowing if they want to mutate their array or create a new array. These simple operations are not provided by the compiler. The compiler provides only the more complex operations between several arrays.

This class is mainly used as the engine for scalar variable DerivativeStructure. It can also be used directly to hold several variables in arrays for more complex data structures. User can for example store a vector of n variables depending on three x, y and z free parameters in one array as follows:

   // parameter 0 is x, parameter 1 is y, parameter 2 is z
   int parameters = 3;
   DSCompiler compiler = DSCompiler.getCompiler(parameters, order);
   int size = compiler.getSize();

   // pack all elements in a single array
   double[] array = new double[n * size];
   for (int i = 0; i < n; ++i) {

     // we know value is guaranteed to be the first element
     array[i * size] = v[i];

     // we don't know where first derivatives are stored, so we ask the compiler
     array[i * size + compiler.getPartialDerivativeIndex(1, 0, 0) = dvOnDx[i][0];
     array[i * size + compiler.getPartialDerivativeIndex(0, 1, 0) = dvOnDy[i][0];
     array[i * size + compiler.getPartialDerivativeIndex(0, 0, 1) = dvOnDz[i][0];

     // we let all higher order derivatives set to 0

   }
 

Then in another function, user can perform some operations on all elements stored in the single array, such as a simple product of all variables:

   // compute the product of all elements
   double[] product = new double[size];
   prod[0] = 1.0;
   for (int i = 0; i < n; ++i) {
     double[] tmp = product.clone();
     compiler.multiply(tmp, 0, array, i * size, product, 0);
   }

   // value
   double p = product[0];

   // first derivatives
   double dPdX = product[compiler.getPartialDerivativeIndex(1, 0, 0)];
   double dPdY = product[compiler.getPartialDerivativeIndex(0, 1, 0)];
   double dPdZ = product[compiler.getPartialDerivativeIndex(0, 0, 1)];

   // cross derivatives (assuming order was at least 2)
   double dPdXdX = product[compiler.getPartialDerivativeIndex(2, 0, 0)];
   double dPdXdY = product[compiler.getPartialDerivativeIndex(1, 1, 0)];
   double dPdXdZ = product[compiler.getPartialDerivativeIndex(1, 0, 1)];
   double dPdYdY = product[compiler.getPartialDerivativeIndex(0, 2, 0)];
   double dPdYdZ = product[compiler.getPartialDerivativeIndex(0, 1, 1)];
   double dPdZdZ = product[compiler.getPartialDerivativeIndex(0, 0, 2)];
 
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    acos(double[] operand, int operandOffset, double[] result, int resultOffset)
    Compute arc cosine of a derivative structure.
    <T extends CalculusFieldElement<T>>
    void
    acos(T[] operand, int operandOffset, T[] result, int resultOffset)
    Compute arc cosine of a derivative structure.
    void
    acosh(double[] operand, int operandOffset, double[] result, int resultOffset)
    Compute inverse hyperbolic cosine of a derivative structure.
    <T extends CalculusFieldElement<T>>
    void
    acosh(T[] operand, int operandOffset, T[] result, int resultOffset)
    Compute inverse hyperbolic cosine of a derivative structure.
    void
    add(double[] lhs, int lhsOffset, double[] rhs, int rhsOffset, double[] result, int resultOffset)
    Perform addition of two derivative structures.
    <T extends CalculusFieldElement<T>>
    void
    add(T[] lhs, int lhsOffset, T[] rhs, int rhsOffset, T[] result, int resultOffset)
    Perform addition of two derivative structures.
    void
    asin(double[] operand, int operandOffset, double[] result, int resultOffset)
    Compute arc sine of a derivative structure.
    <T extends CalculusFieldElement<T>>
    void
    asin(T[] operand, int operandOffset, T[] result, int resultOffset)
    Compute arc sine of a derivative structure.
    void
    asinh(double[] operand, int operandOffset, double[] result, int resultOffset)
    Compute inverse hyperbolic sine of a derivative structure.
    <T extends CalculusFieldElement<T>>
    void
    asinh(T[] operand, int operandOffset, T[] result, int resultOffset)
    Compute inverse hyperbolic sine of a derivative structure.
    void
    atan(double[] operand, int operandOffset, double[] result, int resultOffset)
    Compute arc tangent of a derivative structure.
    <T extends CalculusFieldElement<T>>
    void
    atan(T[] operand, int operandOffset, T[] result, int resultOffset)
    Compute arc tangent of a derivative structure.
    void
    atan2(double[] y, int yOffset, double[] x, int xOffset, double[] result, int resultOffset)
    Compute two arguments arc tangent of a derivative structure.
    <T extends CalculusFieldElement<T>>
    void
    atan2(T[] y, int yOffset, T[] x, int xOffset, T[] result, int resultOffset)
    Compute two arguments arc tangent of a derivative structure.
    void
    atanh(double[] operand, int operandOffset, double[] result, int resultOffset)
    Compute inverse hyperbolic tangent of a derivative structure.
    <T extends CalculusFieldElement<T>>
    void
    atanh(T[] operand, int operandOffset, T[] result, int resultOffset)
    Compute inverse hyperbolic tangent of a derivative structure.
    void
    Check rules set compatibility.
    void
    compose(double[] operand, int operandOffset, double[] f, double[] result, int resultOffset)
    Compute composition of a derivative structure by a function.
    <T extends CalculusFieldElement<T>>
    void
    compose(T[] operand, int operandOffset, double[] f, T[] result, int resultOffset)
    Compute composition of a derivative structure by a function.
    <T extends CalculusFieldElement<T>>
    void
    compose(T[] operand, int operandOffset, T[] f, T[] result, int resultOffset)
    Compute composition of a derivative structure by a function.
    void
    cos(double[] operand, int operandOffset, double[] result, int resultOffset)
    Compute cosine of a derivative structure.
    <T extends CalculusFieldElement<T>>
    void
    cos(T[] operand, int operandOffset, T[] result, int resultOffset)
    Compute cosine of a derivative structure.
    void
    cosh(double[] operand, int operandOffset, double[] result, int resultOffset)
    Compute hyperbolic cosine of a derivative structure.
    <T extends CalculusFieldElement<T>>
    void
    cosh(T[] operand, int operandOffset, T[] result, int resultOffset)
    Compute hyperbolic cosine of a derivative structure.
    void
    divide(double[] lhs, int lhsOffset, double[] rhs, int rhsOffset, double[] result, int resultOffset)
    Perform division of two derivative structures.
    <T extends CalculusFieldElement<T>>
    void
    divide(T[] lhs, int lhsOffset, T[] rhs, int rhsOffset, T[] result, int resultOffset)
    Perform division of two derivative structures.
    void
    exp(double[] operand, int operandOffset, double[] result, int resultOffset)
    Compute exponential of a derivative structure.
    <T extends CalculusFieldElement<T>>
    void
    exp(T[] operand, int operandOffset, T[] result, int resultOffset)
    Compute exponential of a derivative structure.
    void
    expm1(double[] operand, int operandOffset, double[] result, int resultOffset)
    Compute exp(x) - 1 of a derivative structure.
    <T extends CalculusFieldElement<T>>
    void
    expm1(T[] operand, int operandOffset, T[] result, int resultOffset)
    Compute exp(x) - 1 of a derivative structure.
    static DSCompiler
    getCompiler(int parameters, int order)
    Get the compiler for number of free parameters and order.
    int
    Get the number of free parameters.
    int
    Get the derivation order.
    int
    Get the index of a partial derivative in the array.
    int[]
    Get the derivation orders for a specific index in the array.
    int
    Get the sum of derivation orders for a specific index in the array.
    int
    Get the array size required for holding partial derivatives data.
    void
    linearCombination(double a1, double[] c1, int offset1, double a2, double[] c2, int offset2, double[] result, int resultOffset)
    Compute linear combination.
    void
    linearCombination(double a1, double[] c1, int offset1, double a2, double[] c2, int offset2, double a3, double[] c3, int offset3, double[] result, int resultOffset)
    Compute linear combination.
    void
    linearCombination(double a1, double[] c1, int offset1, double a2, double[] c2, int offset2, double a3, double[] c3, int offset3, double a4, double[] c4, int offset4, double[] result, int resultOffset)
    Compute linear combination.
    <T extends CalculusFieldElement<T>>
    void
    linearCombination(double a1, T[] c1, int offset1, double a2, T[] c2, int offset2, double a3, T[] c3, int offset3, double a4, T[] c4, int offset4, T[] result, int resultOffset)
    Compute linear combination.
    <T extends CalculusFieldElement<T>>
    void
    linearCombination(double a1, T[] c1, int offset1, double a2, T[] c2, int offset2, double a3, T[] c3, int offset3, T[] result, int resultOffset)
    Compute linear combination.
    <T extends CalculusFieldElement<T>>
    void
    linearCombination(double a1, T[] c1, int offset1, double a2, T[] c2, int offset2, T[] result, int resultOffset)
    Compute linear combination.
    <T extends CalculusFieldElement<T>>
    void
    linearCombination(T a1, T[] c1, int offset1, T a2, T[] c2, int offset2, T[] result, int resultOffset)
    Compute linear combination.
    <T extends CalculusFieldElement<T>>
    void
    linearCombination(T a1, T[] c1, int offset1, T a2, T[] c2, int offset2, T a3, T[] c3, int offset3, T[] result, int resultOffset)
    Compute linear combination.
    <T extends CalculusFieldElement<T>>
    void
    linearCombination(T a1, T[] c1, int offset1, T a2, T[] c2, int offset2, T a3, T[] c3, int offset3, T a4, T[] c4, int offset4, T[] result, int resultOffset)
    Compute linear combination.
    void
    log(double[] operand, int operandOffset, double[] result, int resultOffset)
    Compute natural logarithm of a derivative structure.
    <T extends CalculusFieldElement<T>>
    void
    log(T[] operand, int operandOffset, T[] result, int resultOffset)
    Compute natural logarithm of a derivative structure.
    void
    log10(double[] operand, int operandOffset, double[] result, int resultOffset)
    Computes base 10 logarithm of a derivative structure.
    <T extends CalculusFieldElement<T>>
    void
    log10(T[] operand, int operandOffset, T[] result, int resultOffset)
    Computes base 10 logarithm of a derivative structure.
    void
    log1p(double[] operand, int operandOffset, double[] result, int resultOffset)
    Computes shifted logarithm of a derivative structure.
    <T extends CalculusFieldElement<T>>
    void
    log1p(T[] operand, int operandOffset, T[] result, int resultOffset)
    Computes shifted logarithm of a derivative structure.
    void
    multiply(double[] lhs, int lhsOffset, double[] rhs, int rhsOffset, double[] result, int resultOffset)
    Perform multiplication of two derivative structures.
    <T extends CalculusFieldElement<T>>
    void
    multiply(T[] lhs, int lhsOffset, T[] rhs, int rhsOffset, T[] result, int resultOffset)
    Perform multiplication of two derivative structures.
    void
    pow(double[] x, int xOffset, double[] y, int yOffset, double[] result, int resultOffset)
    Compute power of a derivative structure.
    void
    pow(double[] operand, int operandOffset, double p, double[] result, int resultOffset)
    Compute power of a derivative structure.
    void
    pow(double[] operand, int operandOffset, int n, double[] result, int resultOffset)
    Compute integer power of a derivative structure.
    void
    pow(double a, double[] operand, int operandOffset, double[] result, int resultOffset)
    Compute power of a double to a derivative structure.
    <T extends CalculusFieldElement<T>>
    void
    pow(double a, T[] operand, int operandOffset, T[] result, int resultOffset)
    Compute power of a double to a derivative structure.
    <T extends CalculusFieldElement<T>>
    void
    pow(T[] operand, int operandOffset, double p, T[] result, int resultOffset)
    Compute power of a derivative structure.
    <T extends CalculusFieldElement<T>>
    void
    pow(T[] operand, int operandOffset, int n, T[] result, int resultOffset)
    Compute integer power of a derivative structure.
    <T extends CalculusFieldElement<T>>
    void
    pow(T[] x, int xOffset, T[] y, int yOffset, T[] result, int resultOffset)
    Compute power of a derivative structure.
    void
    rebase(double[] ds, int dsOffset, DSCompiler baseCompiler, double[] p, double[] result, int resultOffset)
    Rebase derivative structure with respect to low level parameter functions.
    <T extends CalculusFieldElement<T>>
    void
    rebase(T[] ds, int dsOffset, DSCompiler baseCompiler, T[] p, T[] result, int resultOffset)
    Rebase derivative structure with respect to low level parameter functions.
    void
    reciprocal(double[] operand, int operandOffset, double[] result, int resultOffset)
    Compute reciprocal of derivative structure.
    <T extends CalculusFieldElement<T>>
    void
    reciprocal(T[] operand, int operandOffset, T[] result, int resultOffset)
    Compute reciprocal of derivative structure.
    void
    remainder(double[] lhs, int lhsOffset, double[] rhs, int rhsOffset, double[] result, int resultOffset)
    Perform remainder of two derivative structures.
    <T extends CalculusFieldElement<T>>
    void
    remainder(T[] lhs, int lhsOffset, T[] rhs, int rhsOffset, T[] result, int resultOffset)
    Perform remainder of two derivative structures.
    void
    rootN(double[] operand, int operandOffset, int n, double[] result, int resultOffset)
    Compute nth root of a derivative structure.
    <T extends CalculusFieldElement<T>>
    void
    rootN(T[] operand, int operandOffset, int n, T[] result, int resultOffset)
    Compute nth root of a derivative structure.
    void
    sin(double[] operand, int operandOffset, double[] result, int resultOffset)
    Compute sine of a derivative structure.
    <T extends CalculusFieldElement<T>>
    void
    sin(T[] operand, int operandOffset, T[] result, int resultOffset)
    Compute sine of a derivative structure.
    void
    sinCos(double[] operand, int operandOffset, double[] sin, int sinOffset, double[] cos, int cosOffset)
    Compute combined sine and cosine of a derivative structure.
    <T extends CalculusFieldElement<T>>
    void
    sinCos(T[] operand, int operandOffset, T[] sin, int sinOffset, T[] cos, int cosOffset)
    Compute combined sine and cosine of a derivative structure.
    void
    sinh(double[] operand, int operandOffset, double[] result, int resultOffset)
    Compute hyperbolic sine of a derivative structure.
    <T extends CalculusFieldElement<T>>
    void
    sinh(T[] operand, int operandOffset, T[] result, int resultOffset)
    Compute hyperbolic sine of a derivative structure.
    void
    sinhCosh(double[] operand, int operandOffset, double[] sinh, int sinhOffset, double[] cosh, int coshOffset)
    Compute combined hyperbolic sine and cosine of a derivative structure.
    <T extends CalculusFieldElement<T>>
    void
    sinhCosh(T[] operand, int operandOffset, T[] sinh, int sinhOffset, T[] cosh, int coshOffset)
    Compute combined hyperbolic sine and cosine of a derivative structure.
    void
    sqrt(double[] operand, int operandOffset, double[] result, int resultOffset)
    Compute square root of a derivative structure.
    <T extends CalculusFieldElement<T>>
    void
    sqrt(T[] operand, int operandOffset, T[] result, int resultOffset)
    Compute square root of a derivative structure.
    void
    subtract(double[] lhs, int lhsOffset, double[] rhs, int rhsOffset, double[] result, int resultOffset)
    Perform subtraction of two derivative structures.
    <T extends CalculusFieldElement<T>>
    void
    subtract(T[] lhs, int lhsOffset, T[] rhs, int rhsOffset, T[] result, int resultOffset)
    Perform subtraction of two derivative structures.
    void
    tan(double[] operand, int operandOffset, double[] result, int resultOffset)
    Compute tangent of a derivative structure.
    <T extends CalculusFieldElement<T>>
    void
    tan(T[] operand, int operandOffset, T[] result, int resultOffset)
    Compute tangent of a derivative structure.
    void
    tanh(double[] operand, int operandOffset, double[] result, int resultOffset)
    Compute hyperbolic tangent of a derivative structure.
    <T extends CalculusFieldElement<T>>
    void
    tanh(T[] operand, int operandOffset, T[] result, int resultOffset)
    Compute hyperbolic tangent of a derivative structure.
    double
    taylor(double[] ds, int dsOffset, double... delta)
    Evaluate Taylor expansion of a derivative structure.
    <T extends CalculusFieldElement<T>>
    T
    taylor(T[] ds, int dsOffset, double... delta)
    Evaluate Taylor expansion of a derivative structure.
    final <T extends CalculusFieldElement<T>>
    T
    taylor(T[] ds, int dsOffset, T... delta)
    Evaluate Taylor expansion of a derivative structure.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • getCompiler

      public static DSCompiler getCompiler(int parameters, int order) throws MathIllegalArgumentException
      Get the compiler for number of free parameters and order.
      Parameters:
      parameters - number of free parameters
      order - derivation order
      Returns:
      cached rules set
      Throws:
      MathIllegalArgumentException - if order is too large
    • getPartialDerivativeIndex

      public int getPartialDerivativeIndex(int... orders) throws MathIllegalArgumentException
      Get the index of a partial derivative in the array.

      If all orders are set to 0, then the 0th order derivative is returned, which is the value of the function.

      The indices of derivatives are between 0 and getSize() - 1. Their specific order is fixed for a given compiler, but otherwise not publicly specified. There are however some simple cases which have guaranteed indices:

      • the index of 0th order derivative is always 0
      • if there is only 1 free parameter, then the derivatives are sorted in increasing derivation order (i.e. f at index 0, df/dp at index 1, d2f/dp2 at index 2 ... dkf/dpk at index k),
      • if the derivation order is 1, then the derivatives are sorted in increasing free parameter order (i.e. f at index 0, df/dx1 at index 1, df/dx2 at index 2 ... df/dxk at index k),
      • all other cases are not publicly specified

      This method is the inverse of method getPartialDerivativeOrders(int)

      Parameters:
      orders - derivation orders with respect to each parameter
      Returns:
      index of the partial derivative
      Throws:
      MathIllegalArgumentException - if the numbers of parameters does not match the instance
      MathIllegalArgumentException - if sum of derivation orders is larger than the instance limits
      See Also:
    • getPartialDerivativeOrders

      public int[] getPartialDerivativeOrders(int index)
      Get the derivation orders for a specific index in the array.

      This method is the inverse of getPartialDerivativeIndex(int...).

      Parameters:
      index - of the partial derivative
      Returns:
      derivation orders with respect to each parameter
      See Also:
    • getPartialDerivativeOrdersSum

      public int getPartialDerivativeOrdersSum(int index)
      Get the sum of derivation orders for a specific index in the array.

      This method return the sum of the elements returned by getPartialDerivativeIndex(int...), using precomputed values

      Parameters:
      index - of the partial derivative
      Returns:
      sum of derivation orders with respect to each parameter
      Since:
      2.2
      See Also:
    • getFreeParameters

      public int getFreeParameters()
      Get the number of free parameters.
      Returns:
      number of free parameters
    • getOrder

      public int getOrder()
      Get the derivation order.
      Returns:
      derivation order
    • getSize

      public int getSize()
      Get the array size required for holding partial derivatives data.

      This number includes the single 0 order derivative element, which is guaranteed to be stored in the first element of the array.

      Returns:
      array size required for holding partial derivatives data
    • linearCombination

      public void linearCombination(double a1, double[] c1, int offset1, double a2, double[] c2, int offset2, double[] result, int resultOffset)
      Compute linear combination. The derivative structure built will be a1 * ds1 + a2 * ds2
      Parameters:
      a1 - first scale factor
      c1 - first base (unscaled) component
      offset1 - offset of first operand in its array
      a2 - second scale factor
      c2 - second base (unscaled) component
      offset2 - offset of second operand in its array
      result - array where result must be stored (it may be one of the input arrays)
      resultOffset - offset of the result in its array
    • linearCombination

      public <T extends CalculusFieldElement<T>> void linearCombination(T a1, T[] c1, int offset1, T a2, T[] c2, int offset2, T[] result, int resultOffset)
      Compute linear combination. The derivative structure built will be a1 * ds1 + a2 * ds2
      Type Parameters:
      T - the type of the function parameters and value
      Parameters:
      a1 - first scale factor
      c1 - first base (unscaled) component
      offset1 - offset of first operand in its array
      a2 - second scale factor
      c2 - second base (unscaled) component
      offset2 - offset of second operand in its array
      result - array where result must be stored (it may be one of the input arrays)
      resultOffset - offset of the result in its array
    • linearCombination

      public <T extends CalculusFieldElement<T>> void linearCombination(double a1, T[] c1, int offset1, double a2, T[] c2, int offset2, T[] result, int resultOffset)
      Compute linear combination. The derivative structure built will be a1 * ds1 + a2 * ds2
      Type Parameters:
      T - the type of the function parameters and value
      Parameters:
      a1 - first scale factor
      c1 - first base (unscaled) component
      offset1 - offset of first operand in its array
      a2 - second scale factor
      c2 - second base (unscaled) component
      offset2 - offset of second operand in its array
      result - array where result must be stored (it may be one of the input arrays)
      resultOffset - offset of the result in its array
    • linearCombination

      public void linearCombination(double a1, double[] c1, int offset1, double a2, double[] c2, int offset2, double a3, double[] c3, int offset3, double[] result, int resultOffset)
      Compute linear combination. The derivative structure built will be a1 * ds1 + a2 * ds2 + a3 * ds3 + a4 * ds4
      Parameters:
      a1 - first scale factor
      c1 - first base (unscaled) component
      offset1 - offset of first operand in its array
      a2 - second scale factor
      c2 - second base (unscaled) component
      offset2 - offset of second operand in its array
      a3 - third scale factor
      c3 - third base (unscaled) component
      offset3 - offset of third operand in its array
      result - array where result must be stored (it may be one of the input arrays)
      resultOffset - offset of the result in its array
    • linearCombination

      public <T extends CalculusFieldElement<T>> void linearCombination(T a1, T[] c1, int offset1, T a2, T[] c2, int offset2, T a3, T[] c3, int offset3, T[] result, int resultOffset)
      Compute linear combination. The derivative structure built will be a1 * ds1 + a2 * ds2 + a3 * ds3 + a4 * ds4
      Type Parameters:
      T - the type of the function parameters and value
      Parameters:
      a1 - first scale factor
      c1 - first base (unscaled) component
      offset1 - offset of first operand in its array
      a2 - second scale factor
      c2 - second base (unscaled) component
      offset2 - offset of second operand in its array
      a3 - third scale factor
      c3 - third base (unscaled) component
      offset3 - offset of third operand in its array
      result - array where result must be stored (it may be one of the input arrays)
      resultOffset - offset of the result in its array
    • linearCombination

      public <T extends CalculusFieldElement<T>> void linearCombination(double a1, T[] c1, int offset1, double a2, T[] c2, int offset2, double a3, T[] c3, int offset3, T[] result, int resultOffset)
      Compute linear combination. The derivative structure built will be a1 * ds1 + a2 * ds2 + a3 * ds3 + a4 * ds4
      Type Parameters:
      T - the type of the function parameters and value
      Parameters:
      a1 - first scale factor
      c1 - first base (unscaled) component
      offset1 - offset of first operand in its array
      a2 - second scale factor
      c2 - second base (unscaled) component
      offset2 - offset of second operand in its array
      a3 - third scale factor
      c3 - third base (unscaled) component
      offset3 - offset of third operand in its array
      result - array where result must be stored (it may be one of the input arrays)
      resultOffset - offset of the result in its array
    • linearCombination

      public void linearCombination(double a1, double[] c1, int offset1, double a2, double[] c2, int offset2, double a3, double[] c3, int offset3, double a4, double[] c4, int offset4, double[] result, int resultOffset)
      Compute linear combination. The derivative structure built will be a1 * ds1 + a2 * ds2 + a3 * ds3 + a4 * ds4
      Parameters:
      a1 - first scale factor
      c1 - first base (unscaled) component
      offset1 - offset of first operand in its array
      a2 - second scale factor
      c2 - second base (unscaled) component
      offset2 - offset of second operand in its array
      a3 - third scale factor
      c3 - third base (unscaled) component
      offset3 - offset of third operand in its array
      a4 - fourth scale factor
      c4 - fourth base (unscaled) component
      offset4 - offset of fourth operand in its array
      result - array where result must be stored (it may be one of the input arrays)
      resultOffset - offset of the result in its array
    • linearCombination

      public <T extends CalculusFieldElement<T>> void linearCombination(T a1, T[] c1, int offset1, T a2, T[] c2, int offset2, T a3, T[] c3, int offset3, T a4, T[] c4, int offset4, T[] result, int resultOffset)
      Compute linear combination. The derivative structure built will be a1 * ds1 + a2 * ds2 + a3 * ds3 + a4 * ds4
      Type Parameters:
      T - the type of the function parameters and value
      Parameters:
      a1 - first scale factor
      c1 - first base (unscaled) component
      offset1 - offset of first operand in its array
      a2 - second scale factor
      c2 - second base (unscaled) component
      offset2 - offset of second operand in its array
      a3 - third scale factor
      c3 - third base (unscaled) component
      offset3 - offset of third operand in its array
      a4 - fourth scale factor
      c4 - fourth base (unscaled) component
      offset4 - offset of fourth operand in its array
      result - array where result must be stored (it may be one of the input arrays)
      resultOffset - offset of the result in its array
    • linearCombination

      public <T extends CalculusFieldElement<T>> void linearCombination(double a1, T[] c1, int offset1, double a2, T[] c2, int offset2, double a3, T[] c3, int offset3, double a4, T[] c4, int offset4, T[] result, int resultOffset)
      Compute linear combination. The derivative structure built will be a1 * ds1 + a2 * ds2 + a3 * ds3 + a4 * ds4
      Type Parameters:
      T - the type of the function parameters and value
      Parameters:
      a1 - first scale factor
      c1 - first base (unscaled) component
      offset1 - offset of first operand in its array
      a2 - second scale factor
      c2 - second base (unscaled) component
      offset2 - offset of second operand in its array
      a3 - third scale factor
      c3 - third base (unscaled) component
      offset3 - offset of third operand in its array
      a4 - fourth scale factor
      c4 - fourth base (unscaled) component
      offset4 - offset of fourth operand in its array
      result - array where result must be stored (it may be one of the input arrays)
      resultOffset - offset of the result in its array
    • add

      public void add(double[] lhs, int lhsOffset, double[] rhs, int rhsOffset, double[] result, int resultOffset)
      Perform addition of two derivative structures.
      Parameters:
      lhs - array holding left hand side of addition
      lhsOffset - offset of the left hand side in its array
      rhs - array right hand side of addition
      rhsOffset - offset of the right hand side in its array
      result - array where result must be stored (it may be one of the input arrays)
      resultOffset - offset of the result in its array
    • add

      public <T extends CalculusFieldElement<T>> void add(T[] lhs, int lhsOffset, T[] rhs, int rhsOffset, T[] result, int resultOffset)
      Perform addition of two derivative structures.
      Type Parameters:
      T - the type of the function parameters and value
      Parameters:
      lhs - array holding left hand side of addition
      lhsOffset - offset of the left hand side in its array
      rhs - array right hand side of addition
      rhsOffset - offset of the right hand side in its array
      result - array where result must be stored (it may be one of the input arrays)
      resultOffset - offset of the result in its array
    • subtract

      public void subtract(double[] lhs, int lhsOffset, double[] rhs, int rhsOffset, double[] result, int resultOffset)
      Perform subtraction of two derivative structures.
      Parameters:
      lhs - array holding left hand side of subtraction
      lhsOffset - offset of the left hand side in its array
      rhs - array right hand side of subtraction
      rhsOffset - offset of the right hand side in its array
      result - array where result must be stored (it may be one of the input arrays)
      resultOffset - offset of the result in its array
    • subtract

      public <T extends CalculusFieldElement<T>> void subtract(T[] lhs, int lhsOffset, T[] rhs, int rhsOffset, T[] result, int resultOffset)
      Perform subtraction of two derivative structures.
      Type Parameters:
      T - the type of the function parameters and value
      Parameters:
      lhs - array holding left hand side of subtraction
      lhsOffset - offset of the left hand side in its array
      rhs - array right hand side of subtraction
      rhsOffset - offset of the right hand side in its array
      result - array where result must be stored (it may be one of the input arrays)
      resultOffset - offset of the result in its array
    • multiply

      public void multiply(double[] lhs, int lhsOffset, double[] rhs, int rhsOffset, double[] result, int resultOffset)
      Perform multiplication of two derivative structures.
      Parameters:
      lhs - array holding left hand side of multiplication
      lhsOffset - offset of the left hand side in its array
      rhs - array right hand side of multiplication
      rhsOffset - offset of the right hand side in its array
      result - array where result must be stored (for multiplication the result array cannot be one of the input arrays)
      resultOffset - offset of the result in its array
    • multiply

      public <T extends CalculusFieldElement<T>> void multiply(T[] lhs, int lhsOffset, T[] rhs, int rhsOffset, T[] result, int resultOffset)
      Perform multiplication of two derivative structures.
      Type Parameters:
      T - the type of the function parameters and value
      Parameters:
      lhs - array holding left hand side of multiplication
      lhsOffset - offset of the left hand side in its array
      rhs - array right hand side of multiplication
      rhsOffset - offset of the right hand side in its array
      result - array where result must be stored (for multiplication the result array cannot be one of the input arrays)
      resultOffset - offset of the result in its array
    • divide

      public void divide(double[] lhs, int lhsOffset, double[] rhs, int rhsOffset, double[] result, int resultOffset)
      Perform division of two derivative structures. Based on the multiplication operator.
      Parameters:
      lhs - array holding left hand side of division
      lhsOffset - offset of the left hand side in its array
      rhs - array right hand side of division
      rhsOffset - offset of the right hand side in its array
      result - array where result must be stored (for division the result array cannot be one of the input arrays)
      resultOffset - offset of the result in its array
    • divide

      public <T extends CalculusFieldElement<T>> void divide(T[] lhs, int lhsOffset, T[] rhs, int rhsOffset, T[] result, int resultOffset)
      Perform division of two derivative structures. Based on the multiplication operator.
      Type Parameters:
      T - the type of the function parameters and value
      Parameters:
      lhs - array holding left hand side of division
      lhsOffset - offset of the left hand side in its array
      rhs - array right hand side of division
      rhsOffset - offset of the right hand side in its array
      result - array where result must be stored (for division the result array cannot be one of the input arrays)
      resultOffset - offset of the result in its array
    • reciprocal

      public void reciprocal(double[] operand, int operandOffset, double[] result, int resultOffset)
      Compute reciprocal of derivative structure. Based on the multiplication operator.
      Parameters:
      operand - array holding the operand
      operandOffset - offset of the operand in its array
      result - array where result must be stored
      resultOffset - offset of the result in its array
    • reciprocal

      public <T extends CalculusFieldElement<T>> void reciprocal(T[] operand, int operandOffset, T[] result, int resultOffset)
      Compute reciprocal of derivative structure. Based on the multiplication operator.
      Type Parameters:
      T - the type of the function parameters and value
      Parameters:
      operand - array holding the operand
      operandOffset - offset of the operand in its array
      result - array where result must be stored
      resultOffset - offset of the result in its array
    • remainder

      public void remainder(double[] lhs, int lhsOffset, double[] rhs, int rhsOffset, double[] result, int resultOffset)
      Perform remainder of two derivative structures.
      Parameters:
      lhs - array holding left hand side of remainder
      lhsOffset - offset of the left hand side in its array
      rhs - array right hand side of remainder
      rhsOffset - offset of the right hand side in its array
      result - array where result must be stored (it may be one of the input arrays)
      resultOffset - offset of the result in its array
    • remainder

      public <T extends CalculusFieldElement<T>> void remainder(T[] lhs, int lhsOffset, T[] rhs, int rhsOffset, T[] result, int resultOffset)
      Perform remainder of two derivative structures.
      Type Parameters:
      T - the type of the function parameters and value
      Parameters:
      lhs - array holding left hand side of remainder
      lhsOffset - offset of the left hand side in its array
      rhs - array right hand side of remainder
      rhsOffset - offset of the right hand side in its array
      result - array where result must be stored (it may be one of the input arrays)
      resultOffset - offset of the result in its array
    • pow

      public void pow(double a, double[] operand, int operandOffset, double[] result, int resultOffset)
      Compute power of a double to a derivative structure.
      Parameters:
      a - number to exponentiate
      operand - array holding the power
      operandOffset - offset of the power in its array
      result - array where result must be stored (for power the result array cannot be the input array)
      resultOffset - offset of the result in its array
    • pow

      public <T extends CalculusFieldElement<T>> void pow(double a, T[] operand, int operandOffset, T[] result, int resultOffset)
      Compute power of a double to a derivative structure.
      Type Parameters:
      T - the type of the function parameters and value
      Parameters:
      a - number to exponentiate
      operand - array holding the power
      operandOffset - offset of the power in its array
      result - array where result must be stored (for power the result array cannot be the input array)
      resultOffset - offset of the result in its array
    • pow

      public void pow(double[] operand, int operandOffset, double p, double[] result, int resultOffset)
      Compute power of a derivative structure.
      Parameters:
      operand - array holding the operand
      operandOffset - offset of the operand in its array
      p - power to apply
      result - array where result must be stored (for power the result array cannot be the input array)
      resultOffset - offset of the result in its array
    • pow

      public <T extends CalculusFieldElement<T>> void pow(T[] operand, int operandOffset, double p, T[] result, int resultOffset)
      Compute power of a derivative structure.
      Type Parameters:
      T - the type of the function parameters and value
      Parameters:
      operand - array holding the operand
      operandOffset - offset of the operand in its array
      p - power to apply
      result - array where result must be stored (for power the result array cannot be the input array)
      resultOffset - offset of the result in its array
    • pow

      public void pow(double[] operand, int operandOffset, int n, double[] result, int resultOffset)
      Compute integer power of a derivative structure.
      Parameters:
      operand - array holding the operand
      operandOffset - offset of the operand in its array
      n - power to apply
      result - array where result must be stored (for power the result array cannot be the input array)
      resultOffset - offset of the result in its array
    • pow

      public <T extends CalculusFieldElement<T>> void pow(T[] operand, int operandOffset, int n, T[] result, int resultOffset)
      Compute integer power of a derivative structure.
      Type Parameters:
      T - the type of the function parameters and value
      Parameters:
      operand - array holding the operand
      operandOffset - offset of the operand in its array
      n - power to apply
      result - array where result must be stored (for power the result array cannot be the input array)
      resultOffset - offset of the result in its array
    • pow

      public void pow(double[] x, int xOffset, double[] y, int yOffset, double[] result, int resultOffset)
      Compute power of a derivative structure.
      Parameters:
      x - array holding the base
      xOffset - offset of the base in its array
      y - array holding the exponent
      yOffset - offset of the exponent in its array
      result - array where result must be stored (for power the result array cannot be the input array)
      resultOffset - offset of the result in its array
    • pow

      public <T extends CalculusFieldElement<T>> void pow(T[] x, int xOffset, T[] y, int yOffset, T[] result, int resultOffset)
      Compute power of a derivative structure.
      Type Parameters:
      T - the type of the function parameters and value
      Parameters:
      x - array holding the base
      xOffset - offset of the base in its array
      y - array holding the exponent
      yOffset - offset of the exponent in its array
      result - array where result must be stored (for power the result array cannot be the input array)
      resultOffset - offset of the result in its array
    • sqrt

      public void sqrt(double[] operand, int operandOffset, double[] result, int resultOffset)
      Compute square root of a derivative structure. Based on the multiplication operator.
      Parameters:
      operand - array holding the operand
      operandOffset - offset of the operand in its array
      result - array where result must be stored (for square root the result array cannot be the input array)
      resultOffset - offset of the result in its array
    • sqrt

      public <T extends CalculusFieldElement<T>> void sqrt(T[] operand, int operandOffset, T[] result, int resultOffset)
      Compute square root of a derivative structure. Based on the multiplication operator.
      Type Parameters:
      T - the type of the function parameters and value
      Parameters:
      operand - array holding the operand
      operandOffset - offset of the operand in its array
      result - array where result must be stored (for square root the result array cannot be the input array)
      resultOffset - offset of the result in its array
    • rootN

      public void rootN(double[] operand, int operandOffset, int n, double[] result, int resultOffset)
      Compute nth root of a derivative structure.
      Parameters:
      operand - array holding the operand
      operandOffset - offset of the operand in its array
      n - order of the root
      result - array where result must be stored (for nth root the result array cannot be the input array)
      resultOffset - offset of the result in its array
    • rootN

      public <T extends CalculusFieldElement<T>> void rootN(T[] operand, int operandOffset, int n, T[] result, int resultOffset)
      Compute nth root of a derivative structure.
      Type Parameters:
      T - the type of the function parameters and value
      Parameters:
      operand - array holding the operand
      operandOffset - offset of the operand in its array
      n - order of the root
      result - array where result must be stored (for nth root the result array cannot be the input array)
      resultOffset - offset of the result in its array
    • exp

      public void exp(double[] operand, int operandOffset, double[] result, int resultOffset)
      Compute exponential of a derivative structure.
      Parameters:
      operand - array holding the operand
      operandOffset - offset of the operand in its array
      result - array where result must be stored (for exponential the result array cannot be the input array)
      resultOffset - offset of the result in its array
    • exp

      public <T extends CalculusFieldElement<T>> void exp(T[] operand, int operandOffset, T[] result, int resultOffset)
      Compute exponential of a derivative structure.
      Type Parameters:
      T - the type of the function parameters and value
      Parameters:
      operand - array holding the operand
      operandOffset - offset of the operand in its array
      result - array where result must be stored (for exponential the result array cannot be the input array)
      resultOffset - offset of the result in its array
    • expm1

      public void expm1(double[] operand, int operandOffset, double[] result, int resultOffset)
      Compute exp(x) - 1 of a derivative structure.
      Parameters:
      operand - array holding the operand
      operandOffset - offset of the operand in its array
      result - array where result must be stored (for exponential the result array cannot be the input array)
      resultOffset - offset of the result in its array
    • expm1

      public <T extends CalculusFieldElement<T>> void expm1(T[] operand, int operandOffset, T[] result, int resultOffset)
      Compute exp(x) - 1 of a derivative structure.
      Type Parameters:
      T - the type of the function parameters and value
      Parameters:
      operand - array holding the operand
      operandOffset - offset of the operand in its array
      result - array where result must be stored (for exponential the result array cannot be the input array)
      resultOffset - offset of the result in its array
    • log

      public void log(double[] operand, int operandOffset, double[] result, int resultOffset)
      Compute natural logarithm of a derivative structure.
      Parameters:
      operand - array holding the operand
      operandOffset - offset of the operand in its array
      result - array where result must be stored (for logarithm the result array cannot be the input array)
      resultOffset - offset of the result in its array
    • log

      public <T extends CalculusFieldElement<T>> void log(T[] operand, int operandOffset, T[] result, int resultOffset)
      Compute natural logarithm of a derivative structure.
      Type Parameters:
      T - the type of the function parameters and value
      Parameters:
      operand - array holding the operand
      operandOffset - offset of the operand in its array
      result - array where result must be stored (for logarithm the result array cannot be the input array)
      resultOffset - offset of the result in its array
    • log1p

      public void log1p(double[] operand, int operandOffset, double[] result, int resultOffset)
      Computes shifted logarithm of a derivative structure.
      Parameters:
      operand - array holding the operand
      operandOffset - offset of the operand in its array
      result - array where result must be stored (for shifted logarithm the result array cannot be the input array)
      resultOffset - offset of the result in its array
    • log1p

      public <T extends CalculusFieldElement<T>> void log1p(T[] operand, int operandOffset, T[] result, int resultOffset)
      Computes shifted logarithm of a derivative structure.
      Type Parameters:
      T - the type of the function parameters and value
      Parameters:
      operand - array holding the operand
      operandOffset - offset of the operand in its array
      result - array where result must be stored (for shifted logarithm the result array cannot be the input array)
      resultOffset - offset of the result in its array
    • log10

      public void log10(double[] operand, int operandOffset, double[] result, int resultOffset)
      Computes base 10 logarithm of a derivative structure.
      Parameters:
      operand - array holding the operand
      operandOffset - offset of the operand in its array
      result - array where result must be stored (for base 10 logarithm the result array cannot be the input array)
      resultOffset - offset of the result in its array
    • log10

      public <T extends CalculusFieldElement<T>> void log10(T[] operand, int operandOffset, T[] result, int resultOffset)
      Computes base 10 logarithm of a derivative structure.
      Type Parameters:
      T - the type of the function parameters and value
      Parameters:
      operand - array holding the operand
      operandOffset - offset of the operand in its array
      result - array where result must be stored (for base 10 logarithm the result array cannot be the input array)
      resultOffset - offset of the result in its array
    • cos

      public void cos(double[] operand, int operandOffset, double[] result, int resultOffset)
      Compute cosine of a derivative structure.
      Parameters:
      operand - array holding the operand
      operandOffset - offset of the operand in its array
      result - array where result must be stored (for cosine the result array cannot be the input array)
      resultOffset - offset of the result in its array
    • cos

      public <T extends CalculusFieldElement<T>> void cos(T[] operand, int operandOffset, T[] result, int resultOffset)
      Compute cosine of a derivative structure.
      Type Parameters:
      T - the type of the function parameters and value
      Parameters:
      operand - array holding the operand
      operandOffset - offset of the operand in its array
      result - array where result must be stored (for cosine the result array cannot be the input array)
      resultOffset - offset of the result in its array
    • sin

      public void sin(double[] operand, int operandOffset, double[] result, int resultOffset)
      Compute sine of a derivative structure.
      Parameters:
      operand - array holding the operand
      operandOffset - offset of the operand in its array
      result - array where result must be stored (for sine the result array cannot be the input array)
      resultOffset - offset of the result in its array
    • sin

      public <T extends CalculusFieldElement<T>> void sin(T[] operand, int operandOffset, T[] result, int resultOffset)
      Compute sine of a derivative structure.
      Type Parameters:
      T - the type of the function parameters and value
      Parameters:
      operand - array holding the operand
      operandOffset - offset of the operand in its array
      result - array where result must be stored (for sine the result array cannot be the input array)
      resultOffset - offset of the result in its array
    • sinCos

      public void sinCos(double[] operand, int operandOffset, double[] sin, int sinOffset, double[] cos, int cosOffset)
      Compute combined sine and cosine of a derivative structure.
      Parameters:
      operand - array holding the operand
      operandOffset - offset of the operand in its array
      sin - array where sine must be stored (for sine the result array cannot be the input array)
      sinOffset - offset of the result in its array
      cos - array where cosine must be stored (for cosine the result array cannot be the input array)
      cosOffset - offset of the result in its array
      Since:
      1.4
    • sinCos

      public <T extends CalculusFieldElement<T>> void sinCos(T[] operand, int operandOffset, T[] sin, int sinOffset, T[] cos, int cosOffset)
      Compute combined sine and cosine of a derivative structure.
      Type Parameters:
      T - the type of the function parameters and value
      Parameters:
      operand - array holding the operand
      operandOffset - offset of the operand in its array
      sin - array where sine must be stored (for sine the result array cannot be the input array)
      sinOffset - offset of the result in its array
      cos - array where cosine must be stored (for cosine the result array cannot be the input array)
      cosOffset - offset of the result in its array
      Since:
      1.4
    • tan

      public void tan(double[] operand, int operandOffset, double[] result, int resultOffset)
      Compute tangent of a derivative structure.
      Parameters:
      operand - array holding the operand
      operandOffset - offset of the operand in its array
      result - array where result must be stored (for tangent the result array cannot be the input array)
      resultOffset - offset of the result in its array
    • tan

      public <T extends CalculusFieldElement<T>> void tan(T[] operand, int operandOffset, T[] result, int resultOffset)
      Compute tangent of a derivative structure.
      Type Parameters:
      T - the type of the function parameters and value
      Parameters:
      operand - array holding the operand
      operandOffset - offset of the operand in its array
      result - array where result must be stored (for tangent the result array cannot be the input array)
      resultOffset - offset of the result in its array
    • acos

      public void acos(double[] operand, int operandOffset, double[] result, int resultOffset)
      Compute arc cosine of a derivative structure.
      Parameters:
      operand - array holding the operand
      operandOffset - offset of the operand in its array
      result - array where result must be stored (for arc cosine the result array cannot be the input array)
      resultOffset - offset of the result in its array
    • acos

      public <T extends CalculusFieldElement<T>> void acos(T[] operand, int operandOffset, T[] result, int resultOffset)
      Compute arc cosine of a derivative structure.
      Type Parameters:
      T - the type of the function parameters and value
      Parameters:
      operand - array holding the operand
      operandOffset - offset of the operand in its array
      result - array where result must be stored (for arc cosine the result array cannot be the input array)
      resultOffset - offset of the result in its array
    • asin

      public void asin(double[] operand, int operandOffset, double[] result, int resultOffset)
      Compute arc sine of a derivative structure.
      Parameters:
      operand - array holding the operand
      operandOffset - offset of the operand in its array
      result - array where result must be stored (for arc sine the result array cannot be the input array)
      resultOffset - offset of the result in its array
    • asin

      public <T extends CalculusFieldElement<T>> void asin(T[] operand, int operandOffset, T[] result, int resultOffset)
      Compute arc sine of a derivative structure.
      Type Parameters:
      T - the type of the function parameters and value
      Parameters:
      operand - array holding the operand
      operandOffset - offset of the operand in its array
      result - array where result must be stored (for arc sine the result array cannot be the input array)
      resultOffset - offset of the result in its array
    • atan

      public void atan(double[] operand, int operandOffset, double[] result, int resultOffset)
      Compute arc tangent of a derivative structure.
      Parameters:
      operand - array holding the operand
      operandOffset - offset of the operand in its array
      result - array where result must be stored (for arc tangent the result array cannot be the input array)
      resultOffset - offset of the result in its array
    • atan

      public <T extends CalculusFieldElement<T>> void atan(T[] operand, int operandOffset, T[] result, int resultOffset)
      Compute arc tangent of a derivative structure.
      Type Parameters:
      T - the type of the function parameters and value
      Parameters:
      operand - array holding the operand
      operandOffset - offset of the operand in its array
      result - array where result must be stored (for arc tangent the result array cannot be the input array)
      resultOffset - offset of the result in its array
    • atan2

      public void atan2(double[] y, int yOffset, double[] x, int xOffset, double[] result, int resultOffset)
      Compute two arguments arc tangent of a derivative structure.
      Parameters:
      y - array holding the first operand
      yOffset - offset of the first operand in its array
      x - array holding the second operand
      xOffset - offset of the second operand in its array
      result - array where result must be stored (for two arguments arc tangent the result array cannot be the input array)
      resultOffset - offset of the result in its array
    • atan2

      public <T extends CalculusFieldElement<T>> void atan2(T[] y, int yOffset, T[] x, int xOffset, T[] result, int resultOffset)
      Compute two arguments arc tangent of a derivative structure.
      Type Parameters:
      T - the type of the function parameters and value
      Parameters:
      y - array holding the first operand
      yOffset - offset of the first operand in its array
      x - array holding the second operand
      xOffset - offset of the second operand in its array
      result - array where result must be stored (for two arguments arc tangent the result array cannot be the input array)
      resultOffset - offset of the result in its array
    • cosh

      public void cosh(double[] operand, int operandOffset, double[] result, int resultOffset)
      Compute hyperbolic cosine of a derivative structure.
      Parameters:
      operand - array holding the operand
      operandOffset - offset of the operand in its array
      result - array where result must be stored (for hyperbolic cosine the result array cannot be the input array)
      resultOffset - offset of the result in its array
    • cosh

      public <T extends CalculusFieldElement<T>> void cosh(T[] operand, int operandOffset, T[] result, int resultOffset)
      Compute hyperbolic cosine of a derivative structure.
      Type Parameters:
      T - the type of the function parameters and value
      Parameters:
      operand - array holding the operand
      operandOffset - offset of the operand in its array
      result - array where result must be stored (for hyperbolic cosine the result array cannot be the input array)
      resultOffset - offset of the result in its array
    • sinh

      public void sinh(double[] operand, int operandOffset, double[] result, int resultOffset)
      Compute hyperbolic sine of a derivative structure.
      Parameters:
      operand - array holding the operand
      operandOffset - offset of the operand in its array
      result - array where result must be stored (for hyperbolic sine the result array cannot be the input array)
      resultOffset - offset of the result in its array
    • sinh

      public <T extends CalculusFieldElement<T>> void sinh(T[] operand, int operandOffset, T[] result, int resultOffset)
      Compute hyperbolic sine of a derivative structure.
      Type Parameters:
      T - the type of the function parameters and value
      Parameters:
      operand - array holding the operand
      operandOffset - offset of the operand in its array
      result - array where result must be stored (for hyperbolic sine the result array cannot be the input array)
      resultOffset - offset of the result in its array
    • sinhCosh

      public void sinhCosh(double[] operand, int operandOffset, double[] sinh, int sinhOffset, double[] cosh, int coshOffset)
      Compute combined hyperbolic sine and cosine of a derivative structure.
      Parameters:
      operand - array holding the operand
      operandOffset - offset of the operand in its array
      sinh - array where hyperbolic sine must be stored (for sine the result array cannot be the input array)
      sinhOffset - offset of the result in its array
      cosh - array where hyperbolic cannot be the input array)
      coshOffset - offset of the result in its array
      Since:
      2.0
    • sinhCosh

      public <T extends CalculusFieldElement<T>> void sinhCosh(T[] operand, int operandOffset, T[] sinh, int sinhOffset, T[] cosh, int coshOffset)
      Compute combined hyperbolic sine and cosine of a derivative structure.
      Type Parameters:
      T - the type of the function parameters and value
      Parameters:
      operand - array holding the operand
      operandOffset - offset of the operand in its array
      sinh - array where hyperbolic sine must be stored (for sine the result array cannot be the input array)
      sinhOffset - offset of the result in its array
      cosh - array where hyperbolic cosine must be stored (for cosine the result array cannot be the input array)
      coshOffset - offset of the result in its array
      Since:
      1.4
    • tanh

      public void tanh(double[] operand, int operandOffset, double[] result, int resultOffset)
      Compute hyperbolic tangent of a derivative structure.
      Parameters:
      operand - array holding the operand
      operandOffset - offset of the operand in its array
      result - array where result must be stored (for hyperbolic tangent the result array cannot be the input array)
      resultOffset - offset of the result in its array
    • tanh

      public <T extends CalculusFieldElement<T>> void tanh(T[] operand, int operandOffset, T[] result, int resultOffset)
      Compute hyperbolic tangent of a derivative structure.
      Type Parameters:
      T - the type of the function parameters and value
      Parameters:
      operand - array holding the operand
      operandOffset - offset of the operand in its array
      result - array where result must be stored (for hyperbolic tangent the result array cannot be the input array)
      resultOffset - offset of the result in its array
    • acosh

      public void acosh(double[] operand, int operandOffset, double[] result, int resultOffset)
      Compute inverse hyperbolic cosine of a derivative structure.
      Parameters:
      operand - array holding the operand
      operandOffset - offset of the operand in its array
      result - array where result must be stored (for inverse hyperbolic cosine the result array cannot be the input array)
      resultOffset - offset of the result in its array
    • acosh

      public <T extends CalculusFieldElement<T>> void acosh(T[] operand, int operandOffset, T[] result, int resultOffset)
      Compute inverse hyperbolic cosine of a derivative structure.
      Type Parameters:
      T - the type of the function parameters and value
      Parameters:
      operand - array holding the operand
      operandOffset - offset of the operand in its array
      result - array where result must be stored (for inverse hyperbolic cosine the result array cannot be the input array)
      resultOffset - offset of the result in its array
    • asinh

      public void asinh(double[] operand, int operandOffset, double[] result, int resultOffset)
      Compute inverse hyperbolic sine of a derivative structure.
      Parameters:
      operand - array holding the operand
      operandOffset - offset of the operand in its array
      result - array where result must be stored (for inverse hyperbolic sine the result array cannot be the input array)
      resultOffset - offset of the result in its array
    • asinh

      public <T extends CalculusFieldElement<T>> void asinh(T[] operand, int operandOffset, T[] result, int resultOffset)
      Compute inverse hyperbolic sine of a derivative structure.
      Type Parameters:
      T - the type of the function parameters and value
      Parameters:
      operand - array holding the operand
      operandOffset - offset of the operand in its array
      result - array where result must be stored (for inverse hyperbolic sine the result array cannot be the input array)
      resultOffset - offset of the result in its array
    • atanh

      public void atanh(double[] operand, int operandOffset, double[] result, int resultOffset)
      Compute inverse hyperbolic tangent of a derivative structure.
      Parameters:
      operand - array holding the operand
      operandOffset - offset of the operand in its array
      result - array where result must be stored (for inverse hyperbolic tangent the result array cannot be the input array)
      resultOffset - offset of the result in its array
    • atanh

      public <T extends CalculusFieldElement<T>> void atanh(T[] operand, int operandOffset, T[] result, int resultOffset)
      Compute inverse hyperbolic tangent of a derivative structure.
      Type Parameters:
      T - the type of the function parameters and value
      Parameters:
      operand - array holding the operand
      operandOffset - offset of the operand in its array
      result - array where result must be stored (for inverse hyperbolic tangent the result array cannot be the input array)
      resultOffset - offset of the result in its array
    • compose

      public void compose(double[] operand, int operandOffset, double[] f, double[] result, int resultOffset)
      Compute composition of a derivative structure by a function.
      Parameters:
      operand - array holding the operand
      operandOffset - offset of the operand in its array
      f - array of value and derivatives of the function at the current point (i.e. at operand[operandOffset]).
      result - array where result must be stored (for composition the result array cannot be the input array)
      resultOffset - offset of the result in its array
    • compose

      public <T extends CalculusFieldElement<T>> void compose(T[] operand, int operandOffset, T[] f, T[] result, int resultOffset)
      Compute composition of a derivative structure by a function.
      Type Parameters:
      T - the type of the function parameters and value
      Parameters:
      operand - array holding the operand
      operandOffset - offset of the operand in its array
      f - array of value and derivatives of the function at the current point (i.e. at operand[operandOffset]).
      result - array where result must be stored (for composition the result array cannot be the input array)
      resultOffset - offset of the result in its array
    • compose

      public <T extends CalculusFieldElement<T>> void compose(T[] operand, int operandOffset, double[] f, T[] result, int resultOffset)
      Compute composition of a derivative structure by a function.
      Type Parameters:
      T - the type of the function parameters and value
      Parameters:
      operand - array holding the operand
      operandOffset - offset of the operand in its array
      f - array of value and derivatives of the function at the current point (i.e. at operand[operandOffset]).
      result - array where result must be stored (for composition the result array cannot be the input array)
      resultOffset - offset of the result in its array
    • taylor

      public double taylor(double[] ds, int dsOffset, double... delta) throws MathRuntimeException
      Evaluate Taylor expansion of a derivative structure.
      Parameters:
      ds - array holding the derivative structure
      dsOffset - offset of the derivative structure in its array
      delta - parameters offsets (Δx, Δy, ...)
      Returns:
      value of the Taylor expansion at x + Δx, y + Δy, ...
      Throws:
      MathRuntimeException - if factorials becomes too large
    • taylor

      @SafeVarargs public final <T extends CalculusFieldElement<T>> T taylor(T[] ds, int dsOffset, T... delta) throws MathRuntimeException
      Evaluate Taylor expansion of a derivative structure.
      Type Parameters:
      T - the type of the function parameters and value
      Parameters:
      ds - array holding the derivative structure
      dsOffset - offset of the derivative structure in its array
      delta - parameters offsets (Δx, Δy, ...)
      Returns:
      value of the Taylor expansion at x + Δx, y + Δy, ...
      Throws:
      MathRuntimeException - if factorials becomes too large
    • taylor

      public <T extends CalculusFieldElement<T>> T taylor(T[] ds, int dsOffset, double... delta) throws MathRuntimeException
      Evaluate Taylor expansion of a derivative structure.
      Type Parameters:
      T - the type of the function parameters and value
      Parameters:
      ds - array holding the derivative structure
      dsOffset - offset of the derivative structure in its array
      delta - parameters offsets (Δx, Δy, ...)
      Returns:
      value of the Taylor expansion at x + Δx, y + Δy, ...
      Throws:
      MathRuntimeException - if factorials becomes too large
    • rebase

      public void rebase(double[] ds, int dsOffset, DSCompiler baseCompiler, double[] p, double[] result, int resultOffset)
      Rebase derivative structure with respect to low level parameter functions.
      Parameters:
      ds - array holding the derivative structure
      dsOffset - offset of the derivative structure in its array
      baseCompiler - compiler associated with the low level parameter functions
      p - array holding the low level parameter functions (one flat array)
      result - array where result must be stored (for composition the result array cannot be the input
      resultOffset - offset of the result in its array
      Since:
      2.2
    • rebase

      public <T extends CalculusFieldElement<T>> void rebase(T[] ds, int dsOffset, DSCompiler baseCompiler, T[] p, T[] result, int resultOffset)
      Rebase derivative structure with respect to low level parameter functions.
      Type Parameters:
      T - type of the field elements
      Parameters:
      ds - array holding the derivative structure
      dsOffset - offset of the derivative structure in its array
      baseCompiler - compiler associated with the low level parameter functions
      p - array holding the low level parameter functions (one flat array)
      result - array where result must be stored (for composition the result array cannot be the input
      resultOffset - offset of the result in its array
      Since:
      2.2
    • checkCompatibility

      public void checkCompatibility(DSCompiler compiler) throws MathIllegalArgumentException
      Check rules set compatibility.
      Parameters:
      compiler - other compiler to check against instance
      Throws:
      MathIllegalArgumentException - if number of free parameters or orders are inconsistent