commons-math3-3.6.1-类-DerivativeStructure-中英对照文档及源码赏析

commons-math3-3.6.1-类-DerivativeStructure-中英对照文档及源码赏析

摘要:中英对照文档、源码赏析、org.apache.commons.math3.analysis.differentiation.DerivativeStructure、DerivativeStructure、commons-math3、3.6.1、commons-math3-3.6.1、java

完整中文文档、中英对照文档下载请移步:commons-math3-中文文档、中英对照文档-CSDN下载

1. 开源组件说明

commonsmath.gif

commonslogo.png

jar包名称:commons-math3-3.6.1.jar

Maven 依赖:

<dependency>
    <groupId>org.apache.commons</groupId>
    <artifactId>commons-math3</artifactId>
    <version>3.6.1</version>
</dependency>

完整中文文档、中英对照文档下载请移步:commons-math3-中文文档、中英对照文档-CSDN下载

2. 类:org.apache.commons.math3.analysis.differentiation.DerivativeStructure

2.1. DerivativeStructure 中英对照文档

org.apache.commons.math3.analysis.differentiation
类 DerivativeStructure
  • java.lang.Object
    • org.apache.commons.math3.analysis.differentiation.DerivativeStructure
  • All Implemented Interfaces:
    Serializable, FieldElement< DerivativeStructure>, RealFieldElement< DerivativeStructure>

    Serializable,FieldElement ,RealFieldElement



    public class DerivativeStructure
    extends Object
    implements RealFieldElement<DerivativeStructure>, Serializable
    Class representing both the value and the differentials of a function.

    This class is the workhorse of the differentiation package.

    This class is an implementation of the extension to Rall's numbers described in Dan Kalman's paper Doubly Recursive Multivariate Automatic Differentiation, Mathematics Magazine, vol. 75, no. 3, June 2002. Rall's numbers are an extension to the real numbers used throughout mathematical expressions; they hold the derivative together with the value of a function. Dan Kalman's derivative structures hold all partial derivatives up to any specified order, with respect to any number of free parameters. Rall's numbers therefore can be seen as derivative structures for order one derivative and one free parameter, and real numbers can be seen as derivative structures with zero order derivative and no free parameters.

    DerivativeStructure instances can be used directly thanks to the arithmetic operators to the mathematical functions provided as methods by this class (+, -, *, /, %, sin, cos ...).

    Implementing complex expressions by hand using these classes is a tedious and error-prone task but has the advantage of having no limitation on the derivation order despite no requiring users to compute the derivatives by themselves. Implementing complex expression can also be done by developing computation code using standard primitive double values and to use differentiators to create the DerivativeStructure-based instances. This method is simpler but may be limited in the accuracy and derivation orders and may be computationally intensive (this is typically the case for finite differences differentiator.

    Instances of this class are guaranteed to be immutable.


    类表示函数的值和差异。此类是差异化包的主主页。该课程是在丹卡尔曼纸上描述的俱乐部纸张中描述的扩展延伸的延伸,数量递归多变量自动化,Mathematics Magazine,Vol。 75,没有。 3,2002年6月。洛尔的数字是在数学表达式中使用的实际数字的延伸;它们将衍生品与函数的值保持在一起。 Dan Kalman的衍生结构将所有部分导数保持在任何指定的订单,以及任何数量的免费参数。因此,Rall的数字可以被视为订购一个衍生物和一个自由参数的衍生结构,并且实数可以被视为具有零阶衍生的衍生结构,没有自由参数。衍生结构实例可以直接使用算术运算符来使用作为该类的方法提供的数学函数(+, - ,*,/,%,sin,cos ...)。使用这些类使用这些类实现复杂的表达式是一种繁琐且出错的任务,而是具有在派生顺序上没有限制的优势,尽管不需要用户自己计算衍生物。也可以通过使用标准基本双倍值开发计算代码来完成复杂表达式,并使用差分来创建基于衍生体属性的实例来完成。该方法更简单,但可以在准确度和推导阶数中受到限制,并且可以计算密集型(通常是有限差异化器的情况。该类的实例保证是不可变的。

    从以下版本开始:
    3.1

    3.1

    另请参阅:
    DSCompiler, Serialized Form

    dscompiler,序列化形式

    • 构造器详细说明
      • DerivativeStructure
        public DerivativeStructure(int parameters,
                           int order)
                            throws NumberIsTooLargeException
        Build an instance with all values and derivatives set to 0.

        构建一个具有设置为0的所有值和派生的实例。

        参数:
        parameters - number of free parameters

        参数 - 免费参数数

        order - derivation order

        订单 - 衍生顺序

        抛出:
        NumberIsTooLargeException - if order is too large

        NumberStoolarGeexception - 如果订单太大

      • DerivativeStructure
        public DerivativeStructure(int parameters,
                           int order,
                           double value)
                            throws NumberIsTooLargeException
        Build an instance representing a constant value.

        构建表示常量值的实例。

        参数:
        parameters - number of free parameters

        参数 - 免费参数数

        order - derivation order

        订单 - 衍生顺序

        value - value of the constant

        价值 - 常数的值

        抛出:
        NumberIsTooLargeException - if order is too large

        NumberStoolarGeexception - 如果订单太大

        另请参阅:
        DerivativeStructure(int, int, int, double)

        衍生设计(int,int,int,double)

      • DerivativeStructure
        public DerivativeStructure(int parameters,
                           int order,
                           int index,
                           double value)
                            throws NumberIsTooLargeException
        Build an instance representing a variable.

        Instances built using this constructor are considered to be the free variables with respect to which differentials are computed. As such, their differential with respect to themselves is +1.


        构建表示变量的实例。使用该构造函数构建的实例被认为是相对于计算差异的自由变量。因此,它们对自己的差异是+1。

        参数:
        parameters - number of free parameters

        参数 - 免费参数数

        order - derivation order

        订单 - 衍生顺序

        index - index of the variable (from 0 to parameters - 1)

        索引 - 变量的索引(从0到参数 - 1)

        value - value of the variable

        值 - 变量的值

        抛出:
        NumberIsTooLargeException - if index >= parameters.

        NumberStoolarGeexception - 如果索引> =参数。

        另请参阅:
        DerivativeStructure(int, int, double)

        衍生设计(int,int,double)

      • DerivativeStructure
        public DerivativeStructure(double a1,
                           DerivativeStructure ds1,
                           double a2,
                           DerivativeStructure ds2)
                            throws DimensionMismatchException
        Linear combination constructor. The derivative structure built will be a1 * ds1 + a2 * ds2

        线性组合构造函数。构建的衍生结构将是A1 * DS1 + A2 * DS2

        参数:
        a1 - first scale factor

        A1 - 第一规模因子

        ds1 - first base (unscaled) derivative structure

        DS1 - 第一基础(未坐标)衍生结构

        a2 - second scale factor

        A2 - 二级规模因子

        ds2 - second base (unscaled) derivative structure

        DS2 - 第二基础(未坐标)衍生结构

        抛出:
        DimensionMismatchException - if number of free parameters or orders are inconsistent

        DimensionMismatchException - 如果免费参数或订单的数量不一致

      • DerivativeStructure
        public DerivativeStructure(double a1,
                           DerivativeStructure ds1,
                           double a2,
                           DerivativeStructure ds2,
                           double a3,
                           DerivativeStructure ds3)
                            throws DimensionMismatchException
        Linear combination constructor. The derivative structure built will be a1 * ds1 + a2 * ds2 + a3 * ds3

        线性组合构造函数。构建的衍生结构将是A1 * DS1 + A2 * DS2 + A3 * DS3

        参数:
        a1 - first scale factor

        A1 - 第一规模因子

        ds1 - first base (unscaled) derivative structure

        DS1 - 第一基础(未坐标)衍生结构

        a2 - second scale factor

        A2 - 二级规模因子

        ds2 - second base (unscaled) derivative structure

        DS2 - 第二基础(未坐标)衍生结构

        a3 - third scale factor

        A3 - 第三比例因子

        ds3 - third base (unscaled) derivative structure

        DS3 - 第三基础(未坐标)衍生结构

        抛出:
        DimensionMismatchException - if number of free parameters or orders are inconsistent

        DimensionMismatchException - 如果免费参数或订单的数量不一致

      • DerivativeStructure
        public DerivativeStructure(double a1,
                           DerivativeStructure ds1,
                           double a2,
                           DerivativeStructure ds2,
                           double a3,
                           DerivativeStructure ds3,
                           double a4,
                           DerivativeStructure ds4)
                            throws DimensionMismatchException
        Linear combination constructor. The derivative structure built will be a1 * ds1 + a2 * ds2 + a3 * ds3 + a4 * ds4

        线性组合构造函数。构建的衍生结构将是A1 * DS1 + A2 * DS2 + A3 * DS3 + A4 * DS4

        参数:
        a1 - first scale factor

        A1 - 第一规模因子

        ds1 - first base (unscaled) derivative structure

        DS1 - 第一基础(未坐标)衍生结构

        a2 - second scale factor

        A2 - 二级规模因子

        ds2 - second base (unscaled) derivative structure

        DS2 - 第二基础(未坐标)衍生结构

        a3 - third scale factor

        A3 - 第三比例因子

        ds3 - third base (unscaled) derivative structure

        DS3 - 第三基础(未坐标)衍生结构

        a4 - fourth scale factor

        A4 - 第四比例因子

        ds4 - fourth base (unscaled) derivative structure

        DS4 - 第四个基础(未划算)衍生结构

        抛出:
        DimensionMismatchException - if number of free parameters or orders are inconsistent

        DimensionMismatchException - 如果免费参数或订单的数量不一致

      • DerivativeStructure
        public DerivativeStructure(int parameters,
                           int order,
                           double... derivatives)
                            throws DimensionMismatchException,
                                   NumberIsTooLargeException
        Build an instance from all its derivatives.

        从所有衍生品构建一个实例。

        参数:
        parameters - number of free parameters

        参数 - 免费参数数

        order - derivation order

        订单 - 衍生顺序

        derivatives - derivatives sorted according to DSCompiler.getPartialDerivativeIndex(int...)

        衍生品 - 衍生品根据dscompiler.getpartialderivativeIndIndInd(int ...)进行排序

        抛出:
        DimensionMismatchException - if derivatives array does not match the size expected by the compiler

        DimensionMismatchException - 如果导数阵列与编译器预期的大小不匹配

        NumberIsTooLargeException - if order is too large

        NumberStoolarGeexception - 如果订单太大

        另请参阅:
        getAllDerivatives()

        GetAllderivatives()

    • 方法详细说明
      • getFreeParameters
        public int getFreeParameters()
        Get the number of free parameters.

        获取免费参数的数量。

        返回:
        number of free parameters

        自由参数数量

      • getOrder
        public int getOrder()
        Get the derivation order.

        获取派生顺序。

        返回:
        derivation order

        推导令

      • createConstant
        public DerivativeStructure createConstant(double c)
        Create a constant compatible with instance order and number of parameters.

        This method is a convenience factory method, it simply calls new DerivativeStructure(getFreeParameters(), getOrder(), c)


        创建与实例顺序和参数数兼容的常量。此方法是便利厂方法,它只是呼叫新衍生体(GetFreeparameters(),getOrder(),c)

        参数:
        c - value of the constant

        C - 常数的值

        返回:
        a constant compatible with instance order and number of parameters

        常量兼容实例顺序和参数数

        从以下版本开始:
        3.3

        3.3

        另请参阅:
        DerivativeStructure(int, int, double)

        衍生设计(int,int,double)

      • getReal
        public double getReal()
        Get the real value of the number.

        获得数字的实际值。

        指定者:
        getReal in interface  RealFieldElement<DerivativeStructure>

        接口中的气息真实的弹性<衍生事件>

        返回:
        real value

        实际价值

        从以下版本开始:
        3.2

        3.2

      • getValue
        public double getValue()
        Get the value part of the derivative structure.

        获取衍生结构的值部分。

        返回:
        value part of the derivative structure

        衍生结构的价值部分

        另请参阅:
        getPartialDerivative(int...)

        getPartialDerivative(Int ...)

      • getPartialDerivative
        public double getPartialDerivative(int... orders)
                                    throws DimensionMismatchException,
                                           NumberIsTooLargeException
        Get a partial derivative.

        获得部分衍生物。

        参数:
        orders - derivation orders with respect to each variable (if all orders are 0, the value is returned)

        订单 - 派生关于每个变量的命令(如果所有订单为0,则返回该值)

        返回:
        partial derivative

        偏导数

        抛出:
        DimensionMismatchException - if the numbers of variables does not match the instance

        DimensionMismatchException - 如果变量的数量不匹配实例

        NumberIsTooLargeException - if sum of derivation orders is larger than the instance limits

        NumberStoolarGeexception - 如果派生订单的总和大于实例限制

        另请参阅:
        getValue()

        getValue()

      • getAllDerivatives
        public double[] getAllDerivatives()
        Get all partial derivatives.

        获得所有部分衍生品。

        返回:
        a fresh copy of partial derivatives, in an array sorted according to DSCompiler.getPartialDerivativeIndex(int...)

        根据DSCompiler.getPartialDerivativeIndIndIndIndInativeDind(int ...),在阵列中排序的阵列中的一个新鲜副本。

      • add
        public DerivativeStructure add(double a)
        '+' operator.

        '+'运营商。

        指定者:
        add in interface  RealFieldElement<DerivativeStructure>

        添加接口RealFieldElement

        参数:
        a - right hand side parameter of the operator

        操作员的右手侧参数

        返回:
        this+a

        这个+ A.

        从以下版本开始:
        3.2

        3.2

      • subtract
        public DerivativeStructure subtract(double a)
        '-' operator.

        '-' 操作员。

        指定者:
        subtract in interface  RealFieldElement<DerivativeStructure>

        在界面中减去InterfieldElement <衍生事件>

        参数:
        a - right hand side parameter of the operator

        操作员的右手侧参数

        返回:
        this-a

        这是

        从以下版本开始:
        3.2

        3.2

      • multiply
        public DerivativeStructure multiply(int n)
        Compute n × this. Multiplication by an integer number is defined as the following sum
        n × this = ∑ i=1 n this.

        计算n×它。通过整数数乘法定义为以下和n×这个=Σi= 1n。

        指定者:
        multiply in interface  FieldElement<DerivativeStructure>

        乘法在界面FieldElement

        参数:
        n - Number of times this must be added to itself.

        n - 必须添加到自身的次数。

        返回:
        A new element representing n × this.

        一个表示n×的新元素。

      • multiply
        public DerivativeStructure multiply(double a)
        '×' operator.

        '×'算子。

        指定者:
        multiply in interface  RealFieldElement<DerivativeStructure>

        乘法在界面中真实位置<衍生事件>

        参数:
        a - right hand side parameter of the operator

        操作员的右手侧参数

        返回:
        this×a

        这个×A.

        从以下版本开始:
        3.2

        3.2

      • divide
        public DerivativeStructure divide(double a)
        '÷' operator.

        '÷'运营商。

        指定者:
        divide in interface  RealFieldElement<DerivativeStructure>

        划分界面RealFieldElement

        参数:
        a - right hand side parameter of the operator

        操作员的右手侧参数

        返回:
        this÷a

        这个÷啊

        从以下版本开始:
        3.2

        3.2

      • remainder
        public DerivativeStructure remainder(double a)
        IEEE remainder operator.

        IEEE剩余的运营商。

        指定者:
        remainder in interface  RealFieldElement<DerivativeStructure>

        interface中的剩余部分RealFieldElement

        参数:
        a - right hand side parameter of the operator

        操作员的右手侧参数

        返回:
        this - n × a where n is the closest integer to this/a (the even integer is chosen for n if this/a is halfway between two integers)

        这个 - n×a其中n是最接近的整数/ a(如果这个/ a在两个整数之间是半途的,则选择偶数整数)

      • remainder
        public DerivativeStructure remainder(DerivativeStructure a)
                                      throws DimensionMismatchException
        IEEE remainder operator.

        IEEE剩余的运营商。

        指定者:
        remainder in interface  RealFieldElement<DerivativeStructure>

        interface中的剩余部分RealFieldElement

        参数:
        a - right hand side parameter of the operator

        操作员的右手侧参数

        返回:
        this - n × a where n is the closest integer to this/a (the even integer is chosen for n if this/a is halfway between two integers)

        这个 - n×a其中n是最接近的整数/ a(如果这个/ a在两个整数之间是半途的,则选择偶数整数)

        抛出:
        DimensionMismatchException - if number of free parameters or orders do not match

        DimensionMismatchException - 如果免费参数或订单的数量不匹配

        从以下版本开始:
        3.2

        3.2

      • negate
        public DerivativeStructure negate()
        Returns the additive inverse of this element.

        返回此元素的附加逆。

        指定者:
        negate in interface  FieldElement<DerivativeStructure>

        inface fieldelement

        返回:
        the opposite of this.

        与此相反。

      • ceil
        public DerivativeStructure ceil()
        Get the smallest whole number larger than instance.

        获得比实例大的最小整数。

        指定者:
        ceil in interface  RealFieldElement<DerivativeStructure>

        接口中的CEIL REALFIELDELEMENT

        返回:
        ceil(this)

        CEIL(这)

        从以下版本开始:
        3.2

        3.2

      • floor
        public DerivativeStructure floor()
        Get the largest whole number smaller than instance.

        获得比实例小的最大数量。

        指定者:
        floor in interface  RealFieldElement<DerivativeStructure>

        界面底部RealFieldElement <衍生事件>

        返回:
        floor(this)

        地板(这)

        从以下版本开始:
        3.2

        3.2

      • rint
        public DerivativeStructure rint()
        Get the whole number that is the nearest to the instance, or the even one if x is exactly half way between two integers.

        获取最接近实例的整个数字,或者如果x在两个整数之间正好一半。

        指定者:
        rint in interface  RealFieldElement<DerivativeStructure>

        接口中的rint sealfieldelement

        返回:
        a double number r such that r is an integer r - 0.5 ≤ this ≤ r + 0.5

        双数R,使R是整数R - 0.5≤这≤R+ 0.5

        从以下版本开始:
        3.2

        3.2

      • round
        public long round()
        Get the closest long to instance value.

        获得最接近的时间达实例值。

        指定者:
        round in interface  RealFieldElement<DerivativeStructure>

        界面中的圆形RealFieldElement

        返回:
        closest long to RealFieldElement.getReal()

        最接近realfieldelement.getReal()

      • signum
        public DerivativeStructure signum()
        Compute the signum of the instance. The signum is -1 for negative numbers, +1 for positive numbers and 0 otherwise

        计算实例的Signum。Signum为-1用于负数,+1为正数,否则为0

        指定者:
        signum in interface  RealFieldElement<DerivativeStructure>

        界面中的Signum RealFieldElement <衍生事件>

        返回:
        -1.0, -0.0, +0.0, +1.0 or NaN depending on sign of a

        -1.0,-0.0,+0.0,+1.0或NaN取决于a的标志

        从以下版本开始:
        3.2

        3.2

      • copySign
        public DerivativeStructure copySign(DerivativeStructure sign)
        Returns the instance with the sign of the argument. A NaN sign argument is treated as positive.

        使用参数的符号返回实例。NAN标志论证被视为积极。

        指定者:
        copySign in interface  RealFieldElement<DerivativeStructure>

        界面中的CopySign RealFieldElement

        参数:
        sign - the sign for the returned value

        签署 - 返回值的标志

        返回:
        the instance with the same sign as the sign argument

        具有与标志参数相同的符号的实例

        从以下版本开始:
        3.2

        3.2

      • copySign
        public DerivativeStructure copySign(double sign)
        Returns the instance with the sign of the argument. A NaN sign argument is treated as positive.

        使用参数的符号返回实例。NAN标志论证被视为积极。

        指定者:
        copySign in interface  RealFieldElement<DerivativeStructure>

        界面中的CopySign RealFieldElement

        参数:
        sign - the sign for the returned value

        签署 - 返回值的标志

        返回:
        the instance with the same sign as the sign argument

        具有与标志参数相同的符号的实例

        从以下版本开始:
        3.2

        3.2

      • getExponent
        public int getExponent()
        Return the exponent of the instance value, removing the bias.

        For double numbers of the form 2x, the unbiased exponent is exactly x.


        返回实例值的指数,删除偏差。对于2x的双数,非偏见的指数正好x。

        返回:
        exponent for instance in IEEE754 representation, without bias

        例如在IEEE754表示中,没有偏见

      • scalb
        public DerivativeStructure scalb(int n)
        Multiply the instance by a power of 2.

        将实例乘以2的功率。

        指定者:
        scalb in interface  RealFieldElement<DerivativeStructure>

        Scarb在界面中真实的灵感<衍生纲要>

        参数:
        n - power of 2

        n - 力量为2

        返回:
        this × 2 n

        这个×2n.

        从以下版本开始:
        3.2

        3.2

      • hypot
        public DerivativeStructure hypot(DerivativeStructure y)
                                  throws DimensionMismatchException
        Returns the hypotenuse of a triangle with sides this and y - sqrt( this 2 + y 2) avoiding intermediate overflow or underflow.
        • If either argument is infinite, then the result is positive infinity.
        • else, if either argument is NaN then the result is NaN.

        返回三角形的斜边,与侧面和Y - SQRT(This2 + Y2)避免中间溢出或下溢。如果任一参数是无限的,那么结果是正无穷大。否则,如果任一参数是NaN,那么结果是NaN。

        指定者:
        hypot in interface  RealFieldElement<DerivativeStructure>

        接口中的斜面真实位置

        参数:
        y - a value

        y - 一个值

        返回:
        sqrt( this 2 + y 2)

        SQRT(this2 + y2)

        抛出:
        DimensionMismatchException - if number of free parameters or orders do not match

        DimensionMismatchException - 如果免费参数或订单的数量不匹配

        从以下版本开始:
        3.2

        3.2

      • hypot
        public static DerivativeStructure hypot(DerivativeStructure x,
                                DerivativeStructure y)
                                         throws DimensionMismatchException
        Returns the hypotenuse of a triangle with sides x and y - sqrt( x 2 + y 2) avoiding intermediate overflow or underflow.
        • If either argument is infinite, then the result is positive infinity.
        • else, if either argument is NaN then the result is NaN.

        返回三角形的斜边X和Y - SQRT(X2 + Y2)避免中间溢出或下溢。如果任一参数是无限的,那么结果是正无穷大。否则,如果任一参数是NaN,那么结果是NaN。

        参数:
        x - a value

        X - 一个值

        y - a value

        y - 一个值

        返回:
        sqrt( x 2 + y 2)

        sqrt(x2 + y2)

        抛出:
        DimensionMismatchException - if number of free parameters or orders do not match

        DimensionMismatchException - 如果免费参数或订单的数量不匹配

        从以下版本开始:
        3.2

        3.2

      • compose
        public DerivativeStructure compose(double... f)
                                    throws DimensionMismatchException
        Compute composition of the instance by a univariate function.

        通过单变量函数计算实例的组成。

        参数:
        f - array of value and derivatives of the function at the current point (i.e. [f( getValue()), f'( getValue()), f''( getValue())...]).

        F - 当前点处的函数的值和衍生物(即[f(getValue()),f'(getValue()),f''(getValue())......)。

        返回:
        f(this)

        F(这)

        抛出:
        DimensionMismatchException - if the number of derivatives in the array is not equal to order + 1

        DimensionMismatchException - 如果阵列中的衍生物数量不等于Order + 1

      • sqrt
        public DerivativeStructure sqrt()
        Square root.

        平方根。

        指定者:
        sqrt in interface  RealFieldElement<DerivativeStructure>

        SQRT在接口中真实的灵感<衍生纲要>

        返回:
        square root of the instance

        实例的平方根

        从以下版本开始:
        3.2

        3.2

      • cbrt
        public DerivativeStructure cbrt()
        Cubic root.

        立方根。

        指定者:
        cbrt in interface  RealFieldElement<DerivativeStructure>

        接口中的CBRT RealFieldElement <衍生事件>

        返回:
        cubic root of the instance

        实例的立方根

        从以下版本开始:
        3.2

        3.2

      • rootN
        public DerivativeStructure rootN(int n)
        N th root.

        第n根。

        指定者:
        rootN in interface  RealFieldElement<DerivativeStructure>

        rootn in interface realfieldelement

        参数:
        n - order of the root

        n - root的顺序

        返回:
        n th root of the instance

        实例的第n个根

        从以下版本开始:
        3.2

        3.2

      • pow
        public static DerivativeStructure pow(double a,
                              DerivativeStructure x)
        Compute a x where a is a double and x a DerivativeStructure

        计算AX,其中A是双倍和X衍生体

        参数:
        a - number to exponentiate

        a - 代表的号码

        x - power to apply

        X - 申请权力

        返回:
        a x

        斧头

        从以下版本开始:
        3.3

        3.3

      • pow
        public DerivativeStructure pow(double p)
        Power operation.

        电源操作。

        指定者:
        pow in interface  RealFieldElement<DerivativeStructure>

        界面中的POW REALFIELDELEMENT

        参数:
        p - power to apply

        P - 申请权力

        返回:
        this p

        这个

        从以下版本开始:
        3.2

        3.2

      • pow
        public DerivativeStructure pow(int n)
        Integer power operation.

        整数电源操作。

        指定者:
        pow in interface  RealFieldElement<DerivativeStructure>

        界面中的POW REALFIELDELEMENT

        参数:
        n - power to apply

        n - 申请的力量

        返回:
        this n

        本来

        从以下版本开始:
        3.2

        3.2

      • expm1
        public DerivativeStructure expm1()
        Exponential minus 1.

        指数减去1。

        指定者:
        expm1 in interface  RealFieldElement<DerivativeStructure>

        expm1在界面中真实的灵感<衍生事件>

        返回:
        exponential minus one of the instance

        指数减去其中一个实例

        从以下版本开始:
        3.2

        3.2

      • log1p
        public DerivativeStructure log1p()
        Shifted natural logarithm.

        移动自然对数。

        指定者:
        log1p in interface  RealFieldElement<DerivativeStructure>

        log1p在interfile中真实的弹性

        返回:
        logarithm of one plus the instance

        一个加上实例的对数

        从以下版本开始:
        3.2

        3.2

      • log10
        public DerivativeStructure log10()
        Base 10 logarithm.

        基数10对数。

        返回:
        base 10 logarithm of the instance

        基础10实例的对数

      • atan2
        public static DerivativeStructure atan2(DerivativeStructure y,
                                DerivativeStructure x)
                                         throws DimensionMismatchException
        Two arguments arc tangent operation.

        两个参数arc切线操作。

        参数:
        y - first argument of the arc tangent

        Y - 弧形切线的第一个论点

        x - second argument of the arc tangent

        X - 弧形切线的第二个论点

        返回:
        atan2(y, x)

        atan2(y,x)

        抛出:
        DimensionMismatchException - if number of free parameters or orders do not match

        DimensionMismatchException - 如果免费参数或订单的数量不匹配

        从以下版本开始:
        3.2

        3.2

      • cosh
        public DerivativeStructure cosh()
        Hyperbolic cosine operation.

        双曲线余弦操作。

        指定者:
        cosh in interface  RealFieldElement<DerivativeStructure>

        COSH在界面中真实的弹性<衍生事件>

        返回:
        cosh(this)

        Cosh(这个)

        从以下版本开始:
        3.2

        3.2

      • sinh
        public DerivativeStructure sinh()
        Hyperbolic sine operation.

        双曲正弦操作。

        指定者:
        sinh in interface  RealFieldElement<DerivativeStructure>

        SINH在界面中真实的弹性<衍生事件>

        返回:
        sinh(this)

        sinh(这)

        从以下版本开始:
        3.2

        3.2

      • tanh
        public DerivativeStructure tanh()
        Hyperbolic tangent operation.

        双曲线切线操作。

        指定者:
        tanh in interface  RealFieldElement<DerivativeStructure>

        Tanh在界面中真实的弹性<衍生事件>

        返回:
        tanh(this)

        Tanh(这个)

        从以下版本开始:
        3.2

        3.2

      • acosh
        public DerivativeStructure acosh()
        Inverse hyperbolic cosine operation.

        反向双曲余弦操作。

        指定者:
        acosh in interface  RealFieldElement<DerivativeStructure>

        Acosh在界面中真实的弹性<衍生体系>

        返回:
        acosh(this)

        Acosh(这个)

        从以下版本开始:
        3.2

        3.2

      • asinh
        public DerivativeStructure asinh()
        Inverse hyperbolic sine operation.

        反转双曲正弦操作。

        指定者:
        asinh in interface  RealFieldElement<DerivativeStructure>

        Asinh在界面中真实的弹性<衍生体系>

        返回:
        asin(this)

        asin(这)

        从以下版本开始:
        3.2

        3.2

      • atanh
        public DerivativeStructure atanh()
        Inverse hyperbolic tangent operation.

        反向双曲线切线操作。

        指定者:
        atanh in interface  RealFieldElement<DerivativeStructure>

        atanh在界面中真实的灵感<衍生纲要>

        返回:
        atanh(this)

        atanh(这)

        从以下版本开始:
        3.2

        3.2

      • toDegrees
        public DerivativeStructure toDegrees()
        Convert radians to degrees, with error of less than 0.5 ULP

        将弧度转换为度数,误差小于0.5 ulp

        返回:
        instance converted into degrees

        实例转换为度数

      • toRadians
        public DerivativeStructure toRadians()
        Convert degrees to radians, with error of less than 0.5 ULP

        将度数转换为弧度,误差小于0.5 ulp

        返回:
        instance converted into radians

        实例转换为弧度

      • taylor
        public double taylor(double... delta)
                      throws MathArithmeticException
        Evaluate Taylor expansion a derivative structure.

        评估泰勒膨胀衍生物结构。

        参数:
        delta - parameters offsets (Δx, Δy, ...)

        Delta - 参数偏移(ΔX,ΔY,......)

        返回:
        value of the Taylor expansion at x + Δx, y + Δy, ...

        X +ΔX,Y +ΔY的泰勒膨胀的值,......

        抛出:
        MathArithmeticException - if factorials becomes too large

        matharithmeticexception - 如果阶乘变得太大

      • linearCombination
        public DerivativeStructure linearCombination(DerivativeStructure a1,
                                            DerivativeStructure b1,
                                            DerivativeStructure a2,
                                            DerivativeStructure b2)
                                              throws DimensionMismatchException
        Compute a linear combination.

        计算线性组合。

        指定者:
        linearCombination in interface  RealFieldElement<DerivativeStructure>

        界面中的线性过程RealFieldElement <衍生事件>

        参数:
        a1 - first factor of the first term

        A1 - 第一项的第一因素

        b1 - second factor of the first term

        B1 - 第一个术语的第二个因素

        a2 - first factor of the second term

        A2 - 第二项的第一因素

        b2 - second factor of the second term

        B2 - 第二项的第二个因素

        返回:
        a 1×b 1 + a 2×b 2

        A1×B1 + A2×B2

        抛出:
        DimensionMismatchException - if number of free parameters or orders do not match

        DimensionMismatchException - 如果免费参数或订单的数量不匹配

        从以下版本开始:
        3.2

        3.2

        另请参阅:
        RealFieldElement.linearCombination(Object, Object, Object, Object, Object, Object), RealFieldElement.linearCombination(Object, Object, Object, Object, Object, Object, Object, Object)

        RealFieldElement.LinearCombination(对象,对象,对象,对象,对象),RealFieldElement.LinearCombination(对象,对象,对象,对象,对象,对象,对象,对象)

      • linearCombination
        public DerivativeStructure linearCombination(double a1,
                                            DerivativeStructure b1,
                                            double a2,
                                            DerivativeStructure b2)
                                              throws DimensionMismatchException
        Compute a linear combination.

        计算线性组合。

        指定者:
        linearCombination in interface  RealFieldElement<DerivativeStructure>

        界面中的线性过程RealFieldElement <衍生事件>

        参数:
        a1 - first factor of the first term

        A1 - 第一项的第一因素

        b1 - second factor of the first term

        B1 - 第一个术语的第二个因素

        a2 - first factor of the second term

        A2 - 第二项的第一因素

        b2 - second factor of the second term

        B2 - 第二项的第二个因素

        返回:
        a 1×b 1 + a 2×b 2

        A1×B1 + A2×B2

        抛出:
        DimensionMismatchException - if number of free parameters or orders do not match

        DimensionMismatchException - 如果免费参数或订单的数量不匹配

        从以下版本开始:
        3.2

        3.2

        另请参阅:
        RealFieldElement.linearCombination(double, Object, double, Object, double, Object), RealFieldElement.linearCombination(double, Object, double, Object, double, Object, double, Object)

        RealFieldElement.LinearCombination(双重,对象,双,对象,双,对象),RealFieldElement.LinearCombination(双重,对象,双,对象,双,对象,双,对象)

      • linearCombination
        public DerivativeStructure linearCombination(DerivativeStructure a1,
                                            DerivativeStructure b1,
                                            DerivativeStructure a2,
                                            DerivativeStructure b2,
                                            DerivativeStructure a3,
                                            DerivativeStructure b3)
                                              throws DimensionMismatchException
        Compute a linear combination.

        计算线性组合。

        指定者:
        linearCombination in interface  RealFieldElement<DerivativeStructure>

        界面中的线性过程RealFieldElement <衍生事件>

        参数:
        a1 - first factor of the first term

        A1 - 第一项的第一因素

        b1 - second factor of the first term

        B1 - 第一个术语的第二个因素

        a2 - first factor of the second term

        A2 - 第二项的第一因素

        b2 - second factor of the second term

        B2 - 第二项的第二个因素

        a3 - first factor of the third term

        A3 - 第三个术语的第一因素

        b3 - second factor of the third term

        B3 - 第三个术语的第二个因素

        返回:
        a 1×b 1 + a 2×b 2 + a 3×b 3

        A1×B1 + A2×B2 + A3×B3

        抛出:
        DimensionMismatchException - if number of free parameters or orders do not match

        DimensionMismatchException - 如果免费参数或订单的数量不匹配

        从以下版本开始:
        3.2

        3.2

        另请参阅:
        RealFieldElement.linearCombination(Object, Object, Object, Object), RealFieldElement.linearCombination(Object, Object, Object, Object, Object, Object, Object, Object)

        RealFieldElement.LinearCombination(对象,对象,对象,对象),RealFieldElement.LinearCombination(对象,对象,对象,对象,对象,对象,对象,对象)

      • linearCombination
        public DerivativeStructure linearCombination(double a1,
                                            DerivativeStructure b1,
                                            double a2,
                                            DerivativeStructure b2,
                                            double a3,
                                            DerivativeStructure b3)
                                              throws DimensionMismatchException
        Compute a linear combination.

        计算线性组合。

        指定者:
        linearCombination in interface  RealFieldElement<DerivativeStructure>

        界面中的线性过程RealFieldElement <衍生事件>

        参数:
        a1 - first factor of the first term

        A1 - 第一项的第一因素

        b1 - second factor of the first term

        B1 - 第一个术语的第二个因素

        a2 - first factor of the second term

        A2 - 第二项的第一因素

        b2 - second factor of the second term

        B2 - 第二项的第二个因素

        a3 - first factor of the third term

        A3 - 第三个术语的第一因素

        b3 - second factor of the third term

        B3 - 第三个术语的第二个因素

        返回:
        a 1×b 1 + a 2×b 2 + a 3×b 3

        A1×B1 + A2×B2 + A3×B3

        抛出:
        DimensionMismatchException - if number of free parameters or orders do not match

        DimensionMismatchException - 如果免费参数或订单的数量不匹配

        从以下版本开始:
        3.2

        3.2

        另请参阅:
        RealFieldElement.linearCombination(double, Object, double, Object), RealFieldElement.linearCombination(double, Object, double, Object, double, Object, double, Object)

        RealFieldElement.Linearcombination(Double,Object,Double,Object),RealFieldElement.Linearcombination(双重,对象,双,对象,双重,对象,双,对象)

      • linearCombination
        public DerivativeStructure linearCombination(DerivativeStructure a1,
                                            DerivativeStructure b1,
                                            DerivativeStructure a2,
                                            DerivativeStructure b2,
                                            DerivativeStructure a3,
                                            DerivativeStructure b3,
                                            DerivativeStructure a4,
                                            DerivativeStructure b4)
                                              throws DimensionMismatchException
        Compute a linear combination.

        计算线性组合。

        指定者:
        linearCombination in interface  RealFieldElement<DerivativeStructure>

        界面中的线性过程RealFieldElement <衍生事件>

        参数:
        a1 - first factor of the first term

        A1 - 第一项的第一因素

        b1 - second factor of the first term

        B1 - 第一个术语的第二个因素

        a2 - first factor of the second term

        A2 - 第二项的第一因素

        b2 - second factor of the second term

        B2 - 第二项的第二个因素

        a3 - first factor of the third term

        A3 - 第三个术语的第一因素

        b3 - second factor of the third term

        B3 - 第三个术语的第二个因素

        a4 - first factor of the third term

        A4 - 第三个术语的第一因素

        b4 - second factor of the third term

        B4 - 第三个任期的第二个因素

        返回:
        a 1×b 1 + a 2×b 2 + a 3×b 3 + a 4×b 4

        A1×B1 + A2×B2 + A3×B3 + A4×B4

        抛出:
        DimensionMismatchException - if number of free parameters or orders do not match

        DimensionMismatchException - 如果免费参数或订单的数量不匹配

        从以下版本开始:
        3.2

        3.2

        另请参阅:
        RealFieldElement.linearCombination(Object, Object, Object, Object), RealFieldElement.linearCombination(Object, Object, Object, Object, Object, Object)

        RealFieldElement.LinearCombination(对象,对象,对象,对象),RealFieldElement.LinearCombination(对象,对象,对象,对象,对象,对象)

      • linearCombination
        public DerivativeStructure linearCombination(double a1,
                                            DerivativeStructure b1,
                                            double a2,
                                            DerivativeStructure b2,
                                            double a3,
                                            DerivativeStructure b3,
                                            double a4,
                                            DerivativeStructure b4)
                                              throws DimensionMismatchException
        Compute a linear combination.

        计算线性组合。

        指定者:
        linearCombination in interface  RealFieldElement<DerivativeStructure>

        界面中的线性过程RealFieldElement <衍生事件>

        参数:
        a1 - first factor of the first term

        A1 - 第一项的第一因素

        b1 - second factor of the first term

        B1 - 第一个术语的第二个因素

        a2 - first factor of the second term

        A2 - 第二项的第一因素

        b2 - second factor of the second term

        B2 - 第二项的第二个因素

        a3 - first factor of the third term

        A3 - 第三个术语的第一因素

        b3 - second factor of the third term

        B3 - 第三个术语的第二个因素

        a4 - first factor of the third term

        A4 - 第三个术语的第一因素

        b4 - second factor of the third term

        B4 - 第三个任期的第二个因素

        返回:
        a 1×b 1 + a 2×b 2 + a 3×b 3 + a 4×b 4

        A1×B1 + A2×B2 + A3×B3 + A4×B4

        抛出:
        DimensionMismatchException - if number of free parameters or orders do not match

        DimensionMismatchException - 如果免费参数或订单的数量不匹配

        从以下版本开始:
        3.2

        3.2

        另请参阅:
        RealFieldElement.linearCombination(double, Object, double, Object), RealFieldElement.linearCombination(double, Object, double, Object, double, Object)

        RealFieldElement.linearcombination(双重,对象,双,对象),RealFieldElement.Linearcombination(双重,对象,双,对象,双,对象)

      • equals
        public boolean equals(Object other)
        Test for the equality of two derivative structures.

        Derivative structures are considered equal if they have the same number of free parameters, the same derivation order, and the same derivatives.


        测试两个衍生物结构的平等。如果它们具有相同数量的自由参数,相同的推导顺序和相同的衍生物,则认为衍生结构是相等的。

        重写:
        equals in class  Object

        等于类对象

        参数:
        other - Object to test for equality to this

        其他 - 用于测试平等的对象

        返回:
        true if two derivative structures are equal

        如果两个衍生结构相等,则为真

        从以下版本开始:
        3.2

        3.2

      • hashCode
        public int hashCode()
        Get a hashCode for the derivative structure.

        获取衍生结构结构的哈希码。

        重写:
        hashCode in class  Object

        类对象中的哈希码

        返回:
        a hash code value for this object

        此对象的哈希码值

        从以下版本开始:
        3.2

        3.2

2.2. DerivativeStructure 源码赏析

/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.apache.commons.math3.analysis.differentiation;

import java.io.Serializable;

import org.apache.commons.math3.Field;
import org.apache.commons.math3.FieldElement;
import org.apache.commons.math3.RealFieldElement;
import org.apache.commons.math3.exception.DimensionMismatchException;
import org.apache.commons.math3.exception.MathArithmeticException;
import org.apache.commons.math3.exception.NumberIsTooLargeException;
import org.apache.commons.math3.util.FastMath;
import org.apache.commons.math3.util.MathArrays;
import org.apache.commons.math3.util.MathUtils;

/** Class representing both the value and the differentials of a function.
 * <p>This class is the workhorse of the differentiation package.</p>
 * <p>This class is an implementation of the extension to Rall's
 * numbers described in Dan Kalman's paper <a
 * href="http://www1.american.edu/cas/mathstat/People/kalman/pdffiles/mmgautodiff.pdf">Doubly
 * Recursive Multivariate Automatic Differentiation</a>, Mathematics Magazine, vol. 75,
 * no. 3, June 2002. Rall's numbers are an extension to the real numbers used
 * throughout mathematical expressions; they hold the derivative together with the
 * value of a function. Dan Kalman's derivative structures hold all partial derivatives
 * up to any specified order, with respect to any number of free parameters. Rall's
 * numbers therefore can be seen as derivative structures for order one derivative and
 * one free parameter, and real numbers can be seen as derivative structures with zero
 * order derivative and no free parameters.</p>
 * <p>{@link DerivativeStructure} instances can be used directly thanks to
 * the arithmetic operators to the mathematical functions provided as
 * methods by this class (+, -, *, /, %, sin, cos ...).</p>
 * <p>Implementing complex expressions by hand using these classes is
 * a tedious and error-prone task but has the advantage of having no limitation
 * on the derivation order despite no requiring users to compute the derivatives by
 * themselves. Implementing complex expression can also be done by developing computation
 * code using standard primitive double values and to use {@link
 * UnivariateFunctionDifferentiator differentiators} to create the {@link
 * DerivativeStructure}-based instances. This method is simpler but may be limited in
 * the accuracy and derivation orders and may be computationally intensive (this is
 * typically the case for {@link FiniteDifferencesDifferentiator finite differences
 * differentiator}.</p>
 * <p>Instances of this class are guaranteed to be immutable.</p>
 * @see DSCompiler
 * @since 3.1
 */
public class DerivativeStructure implements RealFieldElement<DerivativeStructure>, Serializable {

    /** Serializable UID. */
    private static final long serialVersionUID = 20120730L;

    /** Compiler for the current dimensions. */
    private transient DSCompiler compiler;

    /** Combined array holding all values. */
    private final double[] data;

    /** Build an instance with all values and derivatives set to 0.
     * @param compiler compiler to use for computation
     */
    private DerivativeStructure(final DSCompiler compiler) {
        this.compiler = compiler;
        this.data     = new double[compiler.getSize()];
    }

    /** Build an instance with all values and derivatives set to 0.
     * @param parameters number of free parameters
     * @param order derivation order
     * @throws NumberIsTooLargeException if order is too large
     */
    public DerivativeStructure(final int parameters, final int order)
        throws NumberIsTooLargeException {
        this(DSCompiler.getCompiler(parameters, order));
    }

    /** Build an instance representing a constant value.
     * @param parameters number of free parameters
     * @param order derivation order
     * @param value value of the constant
     * @throws NumberIsTooLargeException if order is too large
     * @see #DerivativeStructure(int, int, int, double)
     */
    public DerivativeStructure(final int parameters, final int order, final double value)
        throws NumberIsTooLargeException {
        this(parameters, order);
        this.data[0] = value;
    }

    /** Build an instance representing a variable.
     * <p>Instances built using this constructor are considered
     * to be the free variables with respect to which differentials
     * are computed. As such, their differential with respect to
     * themselves is +1.</p>
     * @param parameters number of free parameters
     * @param order derivation order
     * @param index index of the variable (from 0 to {@code parameters - 1})
     * @param value value of the variable
     * @exception NumberIsTooLargeException if {@code index >= parameters}.
     * @see #DerivativeStructure(int, int, double)
     */
    public DerivativeStructure(final int parameters, final int order,
                               final int index, final double value)
        throws NumberIsTooLargeException {
        this(parameters, order, value);

        if (index >= parameters) {
            throw new NumberIsTooLargeException(index, parameters, false);
        }

        if (order > 0) {
            // the derivative of the variable with respect to itself is 1.
            data[DSCompiler.getCompiler(index, order).getSize()] = 1.0;
        }

    }

    /** Linear combination constructor.
     * The derivative structure built will be a1 * ds1 + a2 * ds2
     * @param a1 first scale factor
     * @param ds1 first base (unscaled) derivative structure
     * @param a2 second scale factor
     * @param ds2 second base (unscaled) derivative structure
     * @exception DimensionMismatchException if number of free parameters or orders are inconsistent
     */
    public DerivativeStructure(final double a1, final DerivativeStructure ds1,
                               final double a2, final DerivativeStructure ds2)
        throws DimensionMismatchException {
        this(ds1.compiler);
        compiler.checkCompatibility(ds2.compiler);
        compiler.linearCombination(a1, ds1.data, 0, a2, ds2.data, 0, data, 0);
    }

    /** Linear combination constructor.
     * The derivative structure built will be a1 * ds1 + a2 * ds2 + a3 * ds3
     * @param a1 first scale factor
     * @param ds1 first base (unscaled) derivative structure
     * @param a2 second scale factor
     * @param ds2 second base (unscaled) derivative structure
     * @param a3 third scale factor
     * @param ds3 third base (unscaled) derivative structure
     * @exception DimensionMismatchException if number of free parameters or orders are inconsistent
     */
    public DerivativeStructure(final double a1, final DerivativeStructure ds1,
                               final double a2, final DerivativeStructure ds2,
                               final double a3, final DerivativeStructure ds3)
        throws DimensionMismatchException {
        this(ds1.compiler);
        compiler.checkCompatibility(ds2.compiler);
        compiler.checkCompatibility(ds3.compiler);
        compiler.linearCombination(a1, ds1.data, 0, a2, ds2.data, 0, a3, ds3.data, 0, data, 0);
    }

    /** Linear combination constructor.
     * The derivative structure built will be a1 * ds1 + a2 * ds2 + a3 * ds3 + a4 * ds4
     * @param a1 first scale factor
     * @param ds1 first base (unscaled) derivative structure
     * @param a2 second scale factor
     * @param ds2 second base (unscaled) derivative structure
     * @param a3 third scale factor
     * @param ds3 third base (unscaled) derivative structure
     * @param a4 fourth scale factor
     * @param ds4 fourth base (unscaled) derivative structure
     * @exception DimensionMismatchException if number of free parameters or orders are inconsistent
     */
    public DerivativeStructure(final double a1, final DerivativeStructure ds1,
                               final double a2, final DerivativeStructure ds2,
                               final double a3, final DerivativeStructure ds3,
                               final double a4, final DerivativeStructure ds4)
        throws DimensionMismatchException {
        this(ds1.compiler);
        compiler.checkCompatibility(ds2.compiler);
        compiler.checkCompatibility(ds3.compiler);
        compiler.checkCompatibility(ds4.compiler);
        compiler.linearCombination(a1, ds1.data, 0, a2, ds2.data, 0,
                                   a3, ds3.data, 0, a4, ds4.data, 0,
                                   data, 0);
    }

    /** Build an instance from all its derivatives.
     * @param parameters number of free parameters
     * @param order derivation order
     * @param derivatives derivatives sorted according to
     * {@link DSCompiler#getPartialDerivativeIndex(int...)}
     * @exception DimensionMismatchException if derivatives array does not match the
     * {@link DSCompiler#getSize() size} expected by the compiler
     * @throws NumberIsTooLargeException if order is too large
     * @see #getAllDerivatives()
     */
    public DerivativeStructure(final int parameters, final int order, final double ... derivatives)
        throws DimensionMismatchException, NumberIsTooLargeException {
        this(parameters, order);
        if (derivatives.length != data.length) {
            throw new DimensionMismatchException(derivatives.length, data.length);
        }
        System.arraycopy(derivatives, 0, data, 0, data.length);
    }

    /** Copy constructor.
     * @param ds instance to copy
     */
    private DerivativeStructure(final DerivativeStructure ds) {
        this.compiler = ds.compiler;
        this.data     = ds.data.clone();
    }

    /** Get the number of free parameters.
     * @return number of free parameters
     */
    public int getFreeParameters() {
        return compiler.getFreeParameters();
    }

    /** Get the derivation order.
     * @return derivation order
     */
    public int getOrder() {
        return compiler.getOrder();
    }

    /** Create a constant compatible with instance order and number of parameters.
     * <p>
     * This method is a convenience factory method, it simply calls
     * {@code new DerivativeStructure(getFreeParameters(), getOrder(), c)}
     * </p>
     * @param c value of the constant
     * @return a constant compatible with instance order and number of parameters
     * @see #DerivativeStructure(int, int, double)
     * @since 3.3
     */
    public DerivativeStructure createConstant(final double c) {
        return new DerivativeStructure(getFreeParameters(), getOrder(), c);
    }

    /** {@inheritDoc}
     * @since 3.2
     */
    public double getReal() {
        return data[0];
    }

    /** Get the value part of the derivative structure.
     * @return value part of the derivative structure
     * @see #getPartialDerivative(int...)
     */
    public double getValue() {
        return data[0];
    }

    /** Get a partial derivative.
     * @param orders derivation orders with respect to each variable (if all orders are 0,
     * the value is returned)
     * @return partial derivative
     * @see #getValue()
     * @exception DimensionMismatchException if the numbers of variables does not
     * match the instance
     * @exception NumberIsTooLargeException if sum of derivation orders is larger
     * than the instance limits
     */
    public double getPartialDerivative(final int ... orders)
        throws DimensionMismatchException, NumberIsTooLargeException {
        return data[compiler.getPartialDerivativeIndex(orders)];
    }

    /** Get all partial derivatives.
     * @return a fresh copy of partial derivatives, in an array sorted according to
     * {@link DSCompiler#getPartialDerivativeIndex(int...)}
     */
    public double[] getAllDerivatives() {
        return data.clone();
    }

    /** {@inheritDoc}
     * @since 3.2
     */
    public DerivativeStructure add(final double a) {
        final DerivativeStructure ds = new DerivativeStructure(this);
        ds.data[0] += a;
        return ds;
    }

    /** {@inheritDoc}
     * @exception DimensionMismatchException if number of free parameters
     * or orders do not match
     */
    public DerivativeStructure add(final DerivativeStructure a)
        throws DimensionMismatchException {
        compiler.checkCompatibility(a.compiler);
        final DerivativeStructure ds = new DerivativeStructure(this);
        compiler.add(data, 0, a.data, 0, ds.data, 0);
        return ds;
    }

    /** {@inheritDoc}
     * @since 3.2
     */
    public DerivativeStructure subtract(final double a) {
        return add(-a);
    }

    /** {@inheritDoc}
     * @exception DimensionMismatchException if number of free parameters
     * or orders do not match
     */
    public DerivativeStructure subtract(final DerivativeStructure a)
        throws DimensionMismatchException {
        compiler.checkCompatibility(a.compiler);
        final DerivativeStructure ds = new DerivativeStructure(this);
        compiler.subtract(data, 0, a.data, 0, ds.data, 0);
        return ds;
    }

    /** {@inheritDoc} */
    public DerivativeStructure multiply(final int n) {
        return multiply((double) n);
    }

    /** {@inheritDoc}
     * @since 3.2
     */
    public DerivativeStructure multiply(final double a) {
        final DerivativeStructure ds = new DerivativeStructure(this);
        for (int i = 0; i < ds.data.length; ++i) {
            ds.data[i] *= a;
        }
        return ds;
    }

    /** {@inheritDoc}
     * @exception DimensionMismatchException if number of free parameters
     * or orders do not match
     */
    public DerivativeStructure multiply(final DerivativeStructure a)
        throws DimensionMismatchException {
        compiler.checkCompatibility(a.compiler);
        final DerivativeStructure result = new DerivativeStructure(compiler);
        compiler.multiply(data, 0, a.data, 0, result.data, 0);
        return result;
    }

    /** {@inheritDoc}
     * @since 3.2
     */
    public DerivativeStructure divide(final double a) {
        final DerivativeStructure ds = new DerivativeStructure(this);
        for (int i = 0; i < ds.data.length; ++i) {
            ds.data[i] /= a;
        }
        return ds;
    }

    /** {@inheritDoc}
     * @exception DimensionMismatchException if number of free parameters
     * or orders do not match
     */
    public DerivativeStructure divide(final DerivativeStructure a)
        throws DimensionMismatchException {
        compiler.checkCompatibility(a.compiler);
        final DerivativeStructure result = new DerivativeStructure(compiler);
        compiler.divide(data, 0, a.data, 0, result.data, 0);
        return result;
    }

    /** {@inheritDoc} */
    public DerivativeStructure remainder(final double a) {
        final DerivativeStructure ds = new DerivativeStructure(this);
        ds.data[0] = FastMath.IEEEremainder(ds.data[0], a);
        return ds;
    }

    /** {@inheritDoc}
     * @exception DimensionMismatchException if number of free parameters
     * or orders do not match
     * @since 3.2
     */
    public DerivativeStructure remainder(final DerivativeStructure a)
        throws DimensionMismatchException {
        compiler.checkCompatibility(a.compiler);
        final DerivativeStructure result = new DerivativeStructure(compiler);
        compiler.remainder(data, 0, a.data, 0, result.data, 0);
        return result;
    }

    /** {@inheritDoc} */
    public DerivativeStructure negate() {
        final DerivativeStructure ds = new DerivativeStructure(compiler);
        for (int i = 0; i < ds.data.length; ++i) {
            ds.data[i] = -data[i];
        }
        return ds;
    }

    /** {@inheritDoc}
     * @since 3.2
     */
    public DerivativeStructure abs() {
        if (Double.doubleToLongBits(data[0]) < 0) {
            // we use the bits representation to also handle -0.0
            return negate();
        } else {
            return this;
        }
    }

    /** {@inheritDoc}
     * @since 3.2
     */
    public DerivativeStructure ceil() {
        return new DerivativeStructure(compiler.getFreeParameters(),
                                       compiler.getOrder(),
                                       FastMath.ceil(data[0]));
    }

    /** {@inheritDoc}
     * @since 3.2
     */
    public DerivativeStructure floor() {
        return new DerivativeStructure(compiler.getFreeParameters(),
                                       compiler.getOrder(),
                                       FastMath.floor(data[0]));
    }

    /** {@inheritDoc}
     * @since 3.2
     */
    public DerivativeStructure rint() {
        return new DerivativeStructure(compiler.getFreeParameters(),
                                       compiler.getOrder(),
                                       FastMath.rint(data[0]));
    }

    /** {@inheritDoc} */
    public long round() {
        return FastMath.round(data[0]);
    }

    /** {@inheritDoc}
     * @since 3.2
     */
    public DerivativeStructure signum() {
        return new DerivativeStructure(compiler.getFreeParameters(),
                                       compiler.getOrder(),
                                       FastMath.signum(data[0]));
    }

    /** {@inheritDoc}
     * @since 3.2
     */
    public DerivativeStructure copySign(final DerivativeStructure sign){
        long m = Double.doubleToLongBits(data[0]);
        long s = Double.doubleToLongBits(sign.data[0]);
        if ((m >= 0 && s >= 0) || (m < 0 && s < 0)) { // Sign is currently OK
            return this;
        }
        return negate(); // flip sign
    }

    /** {@inheritDoc}
     * @since 3.2
     */
    public DerivativeStructure copySign(final double sign) {
        long m = Double.doubleToLongBits(data[0]);
        long s = Double.doubleToLongBits(sign);
        if ((m >= 0 && s >= 0) || (m < 0 && s < 0)) { // Sign is currently OK
            return this;
        }
        return negate(); // flip sign
    }

    /**
     * Return the exponent of the instance value, removing the bias.
     * <p>
     * For double numbers of the form 2<sup>x</sup>, the unbiased
     * exponent is exactly x.
     * </p>
     * @return exponent for instance in IEEE754 representation, without bias
     */
    public int getExponent() {
        return FastMath.getExponent(data[0]);
    }

    /** {@inheritDoc}
     * @since 3.2
     */
    public DerivativeStructure scalb(final int n) {
        final DerivativeStructure ds = new DerivativeStructure(compiler);
        for (int i = 0; i < ds.data.length; ++i) {
            ds.data[i] = FastMath.scalb(data[i], n);
        }
        return ds;
    }

    /** {@inheritDoc}
     * @exception DimensionMismatchException if number of free parameters
     * or orders do not match
     * @since 3.2
     */
    public DerivativeStructure hypot(final DerivativeStructure y)
        throws DimensionMismatchException {

        compiler.checkCompatibility(y.compiler);

        if (Double.isInfinite(data[0]) || Double.isInfinite(y.data[0])) {
            return new DerivativeStructure(compiler.getFreeParameters(),
                                           compiler.getFreeParameters(),
                                           Double.POSITIVE_INFINITY);
        } else if (Double.isNaN(data[0]) || Double.isNaN(y.data[0])) {
            return new DerivativeStructure(compiler.getFreeParameters(),
                                           compiler.getFreeParameters(),
                                           Double.NaN);
        } else {

            final int expX = getExponent();
            final int expY = y.getExponent();
            if (expX > expY + 27) {
                // y is neglectible with respect to x
                return abs();
            } else if (expY > expX + 27) {
                // x is neglectible with respect to y
                return y.abs();
            } else {

                // find an intermediate scale to avoid both overflow and underflow
                final int middleExp = (expX + expY) / 2;

                // scale parameters without losing precision
                final DerivativeStructure scaledX = scalb(-middleExp);
                final DerivativeStructure scaledY = y.scalb(-middleExp);

                // compute scaled hypotenuse
                final DerivativeStructure scaledH =
                        scaledX.multiply(scaledX).add(scaledY.multiply(scaledY)).sqrt();

                // remove scaling
                return scaledH.scalb(middleExp);

            }

        }
    }

    /**
     * Returns the hypotenuse of a triangle with sides {@code x} and {@code y}
     * - sqrt(<i>x</i><sup>2</sup>&nbsp;+<i>y</i><sup>2</sup>)
     * avoiding intermediate overflow or underflow.
     *
     * <ul>
     * <li> If either argument is infinite, then the result is positive infinity.</li>
     * <li> else, if either argument is NaN then the result is NaN.</li>
     * </ul>
     *
     * @param x a value
     * @param y a value
     * @return sqrt(<i>x</i><sup>2</sup>&nbsp;+<i>y</i><sup>2</sup>)
     * @exception DimensionMismatchException if number of free parameters
     * or orders do not match
     * @since 3.2
     */
    public static DerivativeStructure hypot(final DerivativeStructure x, final DerivativeStructure y)
        throws DimensionMismatchException {
        return x.hypot(y);
    }

    /** Compute composition of the instance by a univariate function.
     * @param f array of value and derivatives of the function at
     * the current point (i.e. [f({@link #getValue()}),
     * f'({@link #getValue()}), f''({@link #getValue()})...]).
     * @return f(this)
     * @exception DimensionMismatchException if the number of derivatives
     * in the array is not equal to {@link #getOrder() order} + 1
     */
    public DerivativeStructure compose(final double ... f)
        throws DimensionMismatchException {
        if (f.length != getOrder() + 1) {
            throw new DimensionMismatchException(f.length, getOrder() + 1);
        }
        final DerivativeStructure result = new DerivativeStructure(compiler);
        compiler.compose(data, 0, f, result.data, 0);
        return result;
    }

    /** {@inheritDoc} */
    public DerivativeStructure reciprocal() {
        final DerivativeStructure result = new DerivativeStructure(compiler);
        compiler.pow(data, 0, -1, result.data, 0);
        return result;
    }

    /** {@inheritDoc}
     * @since 3.2
     */
    public DerivativeStructure sqrt() {
        return rootN(2);
    }

    /** {@inheritDoc}
     * @since 3.2
     */
    public DerivativeStructure cbrt() {
        return rootN(3);
    }

    /** {@inheritDoc}
     * @since 3.2
     */
    public DerivativeStructure rootN(final int n) {
        final DerivativeStructure result = new DerivativeStructure(compiler);
        compiler.rootN(data, 0, n, result.data, 0);
        return result;
    }

    /** {@inheritDoc} */
    public Field<DerivativeStructure> getField() {
        return new Field<DerivativeStructure>() {

            /** {@inheritDoc} */
            public DerivativeStructure getZero() {
                return new DerivativeStructure(compiler.getFreeParameters(), compiler.getOrder(), 0.0);
            }

            /** {@inheritDoc} */
            public DerivativeStructure getOne() {
                return new DerivativeStructure(compiler.getFreeParameters(), compiler.getOrder(), 1.0);
            }

            /** {@inheritDoc} */
            public Class<? extends FieldElement<DerivativeStructure>> getRuntimeClass() {
                return DerivativeStructure.class;
            }

        };
    }

    /** Compute a<sup>x</sup> where a is a double and x a {@link DerivativeStructure}
     * @param a number to exponentiate
     * @param x power to apply
     * @return a<sup>x</sup>
     * @since 3.3
     */
    public static DerivativeStructure pow(final double a, final DerivativeStructure x) {
        final DerivativeStructure result = new DerivativeStructure(x.compiler);
        x.compiler.pow(a, x.data, 0, result.data, 0);
        return result;
    }

    /** {@inheritDoc}
     * @since 3.2
     */
    public DerivativeStructure pow(final double p) {
        final DerivativeStructure result = new DerivativeStructure(compiler);
        compiler.pow(data, 0, p, result.data, 0);
        return result;
    }

    /** {@inheritDoc}
     * @since 3.2
     */
    public DerivativeStructure pow(final int n) {
        final DerivativeStructure result = new DerivativeStructure(compiler);
        compiler.pow(data, 0, n, result.data, 0);
        return result;
    }

    /** {@inheritDoc}
     * @exception DimensionMismatchException if number of free parameters
     * or orders do not match
     * @since 3.2
     */
    public DerivativeStructure pow(final DerivativeStructure e)
        throws DimensionMismatchException {
        compiler.checkCompatibility(e.compiler);
        final DerivativeStructure result = new DerivativeStructure(compiler);
        compiler.pow(data, 0, e.data, 0, result.data, 0);
        return result;
    }

    /** {@inheritDoc}
     * @since 3.2
     */
    public DerivativeStructure exp() {
        final DerivativeStructure result = new DerivativeStructure(compiler);
        compiler.exp(data, 0, result.data, 0);
        return result;
    }

    /** {@inheritDoc}
     * @since 3.2
     */
    public DerivativeStructure expm1() {
        final DerivativeStructure result = new DerivativeStructure(compiler);
        compiler.expm1(data, 0, result.data, 0);
        return result;
    }

    /** {@inheritDoc}
     * @since 3.2
     */
    public DerivativeStructure log() {
        final DerivativeStructure result = new DerivativeStructure(compiler);
        compiler.log(data, 0, result.data, 0);
        return result;
    }

    /** {@inheritDoc}
     * @since 3.2
     */
    public DerivativeStructure log1p() {
        final DerivativeStructure result = new DerivativeStructure(compiler);
        compiler.log1p(data, 0, result.data, 0);
        return result;
    }

    /** Base 10 logarithm.
     * @return base 10 logarithm of the instance
     */
    public DerivativeStructure log10() {
        final DerivativeStructure result = new DerivativeStructure(compiler);
        compiler.log10(data, 0, result.data, 0);
        return result;
    }

    /** {@inheritDoc}
     * @since 3.2
     */
    public DerivativeStructure cos() {
        final DerivativeStructure result = new DerivativeStructure(compiler);
        compiler.cos(data, 0, result.data, 0);
        return result;
    }

    /** {@inheritDoc}
     * @since 3.2
     */
    public DerivativeStructure sin() {
        final DerivativeStructure result = new DerivativeStructure(compiler);
        compiler.sin(data, 0, result.data, 0);
        return result;
    }

    /** {@inheritDoc}
     * @since 3.2
     */
    public DerivativeStructure tan() {
        final DerivativeStructure result = new DerivativeStructure(compiler);
        compiler.tan(data, 0, result.data, 0);
        return result;
    }

    /** {@inheritDoc}
     * @since 3.2
     */
    public DerivativeStructure acos() {
        final DerivativeStructure result = new DerivativeStructure(compiler);
        compiler.acos(data, 0, result.data, 0);
        return result;
    }

    /** {@inheritDoc}
     * @since 3.2
     */
    public DerivativeStructure asin() {
        final DerivativeStructure result = new DerivativeStructure(compiler);
        compiler.asin(data, 0, result.data, 0);
        return result;
    }

    /** {@inheritDoc}
     * @since 3.2
     */
    public DerivativeStructure atan() {
        final DerivativeStructure result = new DerivativeStructure(compiler);
        compiler.atan(data, 0, result.data, 0);
        return result;
    }

    /** {@inheritDoc}
     * @since 3.2
     */
    public DerivativeStructure atan2(final DerivativeStructure x)
        throws DimensionMismatchException {
        compiler.checkCompatibility(x.compiler);
        final DerivativeStructure result = new DerivativeStructure(compiler);
        compiler.atan2(data, 0, x.data, 0, result.data, 0);
        return result;
    }

    /** Two arguments arc tangent operation.
     * @param y first argument of the arc tangent
     * @param x second argument of the arc tangent
     * @return atan2(y, x)
     * @exception DimensionMismatchException if number of free parameters
     * or orders do not match
     * @since 3.2
     */
    public static DerivativeStructure atan2(final DerivativeStructure y, final DerivativeStructure x)
        throws DimensionMismatchException {
        return y.atan2(x);
    }

    /** {@inheritDoc}
     * @since 3.2
     */
    public DerivativeStructure cosh() {
        final DerivativeStructure result = new DerivativeStructure(compiler);
        compiler.cosh(data, 0, result.data, 0);
        return result;
    }

    /** {@inheritDoc}
     * @since 3.2
     */
    public DerivativeStructure sinh() {
        final DerivativeStructure result = new DerivativeStructure(compiler);
        compiler.sinh(data, 0, result.data, 0);
        return result;
    }

    /** {@inheritDoc}
     * @since 3.2
     */
    public DerivativeStructure tanh() {
        final DerivativeStructure result = new DerivativeStructure(compiler);
        compiler.tanh(data, 0, result.data, 0);
        return result;
    }

    /** {@inheritDoc}
     * @since 3.2
     */
    public DerivativeStructure acosh() {
        final DerivativeStructure result = new DerivativeStructure(compiler);
        compiler.acosh(data, 0, result.data, 0);
        return result;
    }

    /** {@inheritDoc}
     * @since 3.2
     */
    public DerivativeStructure asinh() {
        final DerivativeStructure result = new DerivativeStructure(compiler);
        compiler.asinh(data, 0, result.data, 0);
        return result;
    }

    /** {@inheritDoc}
     * @since 3.2
     */
    public DerivativeStructure atanh() {
        final DerivativeStructure result = new DerivativeStructure(compiler);
        compiler.atanh(data, 0, result.data, 0);
        return result;
    }

    /** Convert radians to degrees, with error of less than 0.5 ULP
     *  @return instance converted into degrees
     */
    public DerivativeStructure toDegrees() {
        final DerivativeStructure ds = new DerivativeStructure(compiler);
        for (int i = 0; i < ds.data.length; ++i) {
            ds.data[i] = FastMath.toDegrees(data[i]);
        }
        return ds;
    }

    /** Convert degrees to radians, with error of less than 0.5 ULP
     *  @return instance converted into radians
     */
    public DerivativeStructure toRadians() {
        final DerivativeStructure ds = new DerivativeStructure(compiler);
        for (int i = 0; i < ds.data.length; ++i) {
            ds.data[i] = FastMath.toRadians(data[i]);
        }
        return ds;
    }

    /** Evaluate Taylor expansion a derivative structure.
     * @param delta parameters offsets (&Delta;x, &Delta;y, ...)
     * @return value of the Taylor expansion at x + &Delta;x, y + &Delta;y, ...
     * @throws MathArithmeticException if factorials becomes too large
     */
    public double taylor(final double ... delta) throws MathArithmeticException {
        return compiler.taylor(data, 0, delta);
    }

    /** {@inheritDoc}
     * @exception DimensionMismatchException if number of free parameters
     * or orders do not match
     * @since 3.2
     */
    public DerivativeStructure linearCombination(final DerivativeStructure[] a, final DerivativeStructure[] b)
        throws DimensionMismatchException {

        // compute an accurate value, taking care of cancellations
        final double[] aDouble = new double[a.length];
        for (int i = 0; i < a.length; ++i) {
            aDouble[i] = a[i].getValue();
        }
        final double[] bDouble = new double[b.length];
        for (int i = 0; i < b.length; ++i) {
            bDouble[i] = b[i].getValue();
        }
        final double accurateValue = MathArrays.linearCombination(aDouble, bDouble);

        // compute a simple value, with all partial derivatives
        DerivativeStructure simpleValue = a[0].getField().getZero();
        for (int i = 0; i < a.length; ++i) {
            simpleValue = simpleValue.add(a[i].multiply(b[i]));
        }

        // create a result with accurate value and all derivatives (not necessarily as accurate as the value)
        final double[] all = simpleValue.getAllDerivatives();
        all[0] = accurateValue;
        return new DerivativeStructure(simpleValue.getFreeParameters(), simpleValue.getOrder(), all);

    }

    /** {@inheritDoc}
     * @exception DimensionMismatchException if number of free parameters
     * or orders do not match
     * @since 3.2
     */
    public DerivativeStructure linearCombination(final double[] a, final DerivativeStructure[] b)
        throws DimensionMismatchException {

        // compute an accurate value, taking care of cancellations
        final double[] bDouble = new double[b.length];
        for (int i = 0; i < b.length; ++i) {
            bDouble[i] = b[i].getValue();
        }
        final double accurateValue = MathArrays.linearCombination(a, bDouble);

        // compute a simple value, with all partial derivatives
        DerivativeStructure simpleValue = b[0].getField().getZero();
        for (int i = 0; i < a.length; ++i) {
            simpleValue = simpleValue.add(b[i].multiply(a[i]));
        }

        // create a result with accurate value and all derivatives (not necessarily as accurate as the value)
        final double[] all = simpleValue.getAllDerivatives();
        all[0] = accurateValue;
        return new DerivativeStructure(simpleValue.getFreeParameters(), simpleValue.getOrder(), all);

    }

    /** {@inheritDoc}
     * @exception DimensionMismatchException if number of free parameters
     * or orders do not match
     * @since 3.2
     */
    public DerivativeStructure linearCombination(final DerivativeStructure a1, final DerivativeStructure b1,
                                                 final DerivativeStructure a2, final DerivativeStructure b2)
        throws DimensionMismatchException {

        // compute an accurate value, taking care of cancellations
        final double accurateValue = MathArrays.linearCombination(a1.getValue(), b1.getValue(),
                                                                  a2.getValue(), b2.getValue());

        // compute a simple value, with all partial derivatives
        final DerivativeStructure simpleValue = a1.multiply(b1).add(a2.multiply(b2));

        // create a result with accurate value and all derivatives (not necessarily as accurate as the value)
        final double[] all = simpleValue.getAllDerivatives();
        all[0] = accurateValue;
        return new DerivativeStructure(getFreeParameters(), getOrder(), all);

    }

    /** {@inheritDoc}
     * @exception DimensionMismatchException if number of free parameters
     * or orders do not match
     * @since 3.2
     */
    public DerivativeStructure linearCombination(final double a1, final DerivativeStructure b1,
                                                 final double a2, final DerivativeStructure b2)
        throws DimensionMismatchException {

        // compute an accurate value, taking care of cancellations
        final double accurateValue = MathArrays.linearCombination(a1, b1.getValue(),
                                                                  a2, b2.getValue());

        // compute a simple value, with all partial derivatives
        final DerivativeStructure simpleValue = b1.multiply(a1).add(b2.multiply(a2));

        // create a result with accurate value and all derivatives (not necessarily as accurate as the value)
        final double[] all = simpleValue.getAllDerivatives();
        all[0] = accurateValue;
        return new DerivativeStructure(getFreeParameters(), getOrder(), all);

    }

    /** {@inheritDoc}
     * @exception DimensionMismatchException if number of free parameters
     * or orders do not match
     * @since 3.2
     */
    public DerivativeStructure linearCombination(final DerivativeStructure a1, final DerivativeStructure b1,
                                                 final DerivativeStructure a2, final DerivativeStructure b2,
                                                 final DerivativeStructure a3, final DerivativeStructure b3)
        throws DimensionMismatchException {

        // compute an accurate value, taking care of cancellations
        final double accurateValue = MathArrays.linearCombination(a1.getValue(), b1.getValue(),
                                                                  a2.getValue(), b2.getValue(),
                                                                  a3.getValue(), b3.getValue());

        // compute a simple value, with all partial derivatives
        final DerivativeStructure simpleValue = a1.multiply(b1).add(a2.multiply(b2)).add(a3.multiply(b3));

        // create a result with accurate value and all derivatives (not necessarily as accurate as the value)
        final double[] all = simpleValue.getAllDerivatives();
        all[0] = accurateValue;
        return new DerivativeStructure(getFreeParameters(), getOrder(), all);

    }

    /** {@inheritDoc}
     * @exception DimensionMismatchException if number of free parameters
     * or orders do not match
     * @since 3.2
     */
    public DerivativeStructure linearCombination(final double a1, final DerivativeStructure b1,
                                                 final double a2, final DerivativeStructure b2,
                                                 final double a3, final DerivativeStructure b3)
        throws DimensionMismatchException {

        // compute an accurate value, taking care of cancellations
        final double accurateValue = MathArrays.linearCombination(a1, b1.getValue(),
                                                                  a2, b2.getValue(),
                                                                  a3, b3.getValue());

        // compute a simple value, with all partial derivatives
        final DerivativeStructure simpleValue = b1.multiply(a1).add(b2.multiply(a2)).add(b3.multiply(a3));

        // create a result with accurate value and all derivatives (not necessarily as accurate as the value)
        final double[] all = simpleValue.getAllDerivatives();
        all[0] = accurateValue;
        return new DerivativeStructure(getFreeParameters(), getOrder(), all);

    }

    /** {@inheritDoc}
     * @exception DimensionMismatchException if number of free parameters
     * or orders do not match
     * @since 3.2
     */
    public DerivativeStructure linearCombination(final DerivativeStructure a1, final DerivativeStructure b1,
                                                 final DerivativeStructure a2, final DerivativeStructure b2,
                                                 final DerivativeStructure a3, final DerivativeStructure b3,
                                                 final DerivativeStructure a4, final DerivativeStructure b4)
        throws DimensionMismatchException {

        // compute an accurate value, taking care of cancellations
        final double accurateValue = MathArrays.linearCombination(a1.getValue(), b1.getValue(),
                                                                  a2.getValue(), b2.getValue(),
                                                                  a3.getValue(), b3.getValue(),
                                                                  a4.getValue(), b4.getValue());

        // compute a simple value, with all partial derivatives
        final DerivativeStructure simpleValue = a1.multiply(b1).add(a2.multiply(b2)).add(a3.multiply(b3)).add(a4.multiply(b4));

        // create a result with accurate value and all derivatives (not necessarily as accurate as the value)
        final double[] all = simpleValue.getAllDerivatives();
        all[0] = accurateValue;
        return new DerivativeStructure(getFreeParameters(), getOrder(), all);

    }

    /** {@inheritDoc}
     * @exception DimensionMismatchException if number of free parameters
     * or orders do not match
     * @since 3.2
     */
    public DerivativeStructure linearCombination(final double a1, final DerivativeStructure b1,
                                                 final double a2, final DerivativeStructure b2,
                                                 final double a3, final DerivativeStructure b3,
                                                 final double a4, final DerivativeStructure b4)
        throws DimensionMismatchException {

        // compute an accurate value, taking care of cancellations
        final double accurateValue = MathArrays.linearCombination(a1, b1.getValue(),
                                                                  a2, b2.getValue(),
                                                                  a3, b3.getValue(),
                                                                  a4, b4.getValue());

        // compute a simple value, with all partial derivatives
        final DerivativeStructure simpleValue = b1.multiply(a1).add(b2.multiply(a2)).add(b3.multiply(a3)).add(b4.multiply(a4));

        // create a result with accurate value and all derivatives (not necessarily as accurate as the value)
        final double[] all = simpleValue.getAllDerivatives();
        all[0] = accurateValue;
        return new DerivativeStructure(getFreeParameters(), getOrder(), all);

    }

    /**
     * Test for the equality of two derivative structures.
     * <p>
     * Derivative structures are considered equal if they have the same number
     * of free parameters, the same derivation order, and the same derivatives.
     * </p>
     * @param other Object to test for equality to this
     * @return true if two derivative structures are equal
     * @since 3.2
     */
    @Override
    public boolean equals(Object other) {

        if (this == other) {
            return true;
        }

        if (other instanceof DerivativeStructure) {
            final DerivativeStructure rhs = (DerivativeStructure)other;
            return (getFreeParameters() == rhs.getFreeParameters()) &&
                   (getOrder() == rhs.getOrder()) &&
                   MathArrays.equals(data, rhs.data);
        }

        return false;

    }

    /**
     * Get a hashCode for the derivative structure.
     * @return a hash code value for this object
     * @since 3.2
     */
    @Override
    public int hashCode() {
        return 227 + 229 * getFreeParameters() + 233 * getOrder() + 239 * MathUtils.hash(data);
    }

    /**
     * Replace the instance with a data transfer object for serialization.
     * @return data transfer object that will be serialized
     */
    private Object writeReplace() {
        return new DataTransferObject(compiler.getFreeParameters(), compiler.getOrder(), data);
    }

    /** Internal class used only for serialization. */
    private static class DataTransferObject implements Serializable {

        /** Serializable UID. */
        private static final long serialVersionUID = 20120730L;

        /** Number of variables.
         * @serial
         */
        private final int variables;

        /** Derivation order.
         * @serial
         */
        private final int order;

        /** Partial derivatives.
         * @serial
         */
        private final double[] data;

        /** Simple constructor.
         * @param variables number of variables
         * @param order derivation order
         * @param data partial derivatives
         */
        DataTransferObject(final int variables, final int order, final double[] data) {
            this.variables = variables;
            this.order     = order;
            this.data      = data;
        }

        /** Replace the deserialized data transfer object with a {@link DerivativeStructure}.
         * @return replacement {@link DerivativeStructure}
         */
        private Object readResolve() {
            return new DerivativeStructure(variables, order, data);
        }

    }

}
  • 2
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
### 回答1: commons-math3-3.6.1-api文档-中英对照版.zip是一个包含Commons Math3.6.1版本的API文档的压缩文件。Commons Math是一个Java库,提供了许多数学功能和算法的实现。 API文档是帮助开发人员理解库中可用的、方法和属性的官方文档。它提供了关于每个的详细说明,包括的用途、方法的功能、参数和返回值的说明等。通过阅读API文档开发人员可以很容易地了解如何正确地使用库的各个部分。 这个特定的API文档版本是中英对照版,这意味着文档提供了中文和英文的对照版本。这将有助于使用英文不太熟练的开发人员更好地理解文档的内容。无论是母语为中文的开发者还是母语为英文的开发者,都可以从这个中英对照的API文档中受益。 要使用这个API文档,你可以下载并解压缩这个.zip文件。解压后,你将获得一个文件夹,里面包含了所有的API文档文件。你可以打开文档并浏览其中的和方法,查找你需要的信息。 总之,commons-math3-3.6.1-api文档-中英对照版.zip是一个包含了Commons Math3.6.1版本的API文档的压缩文件。它是中英对照的,可以帮助开发人员更好地理解和使用这个库的功能和算法。 ### 回答2: commons-math3-3.6.1-api文档-中英对照版.zip是Apache Commons Math库的文档。这个文档提供了Apache Commons Math库中各个和方法的详细说明,包括参数、返回值、异常等方面的信息。它是以中英对照的方式呈现,方便中英文用户理解和使用该库。 Apache Commons Math是一个开源的数学库,提供了一系列的数学算法和工具,旨在帮助开发人员解决各种数学问题。这个库包括了统计、线性代数、函数优化、随机数生成等方面的功能。其中,统计模块可以用于计算均值、方差、相关系数等统计量;线性代数模块提供了矩阵运算、线性方程组求解等功能;函数优化模块可以用来寻找函数的最小值或最大值;随机数模块可以生成各种概率分布的随机数。 通过使用Apache Commons Math库,开发人员可以避免自己实现复杂的数学算法,提高开发效率。而文档则是帮助开发人员理解和使用该库的重要工具。commons-math3-3.6.1-api文档-中英对照版.zip提供了方便用户查找和阅读的中英文对照版本,使得使用该库的过程更加顺畅。 ### 回答3: commons-math3-3.6.1-api文档-中英对照版.zip是一个压缩文件,其中包含了Apache Commons Math库版本3.6.1的API文档。这个库是一个开源的Java数学库,提供了许多数学函数和算法,用于解决常见的数学问题。 这个API文档提供了针对每个和方法的详细说明,包括参数、返回值、异常以及使用示例等。中英对照版意味着文档中同时提供了中文和英文的说明,方便开发人员根据自己的语言习惯进行阅读和理解。 通过查阅这个API文档开发人员可以了解到Apache Commons Math库中每个和方法的功能和用法,从而可以更加高效地利用这个数学库来完成自己的项目开发任务。此外,API文档还提供了丰富的示例代码,帮助开发人员更快地掌握如何正确地使用这些数学函数和算法。 总之,commons-math3-3.6.1-api文档-中英对照版.zip是一个非常实用的文件,提供了Apache Commons Math库版本3.6.1的API文档,方便开发人员学习和使用这个功能强大的数学库。它对于进行数学计算和处理的项目开发者来说是一个宝贵的资源。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

寒水馨

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值