Class DerivativeStructure
- All Implemented Interfaces:
Serializable
,FieldElement<DerivativeStructure>
,RealFieldElement<DerivativeStructure>
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.
- Since:
- 3.1
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionDerivativeStructure
(double a1, DerivativeStructure ds1, double a2, DerivativeStructure ds2) Linear combination constructor.DerivativeStructure
(double a1, DerivativeStructure ds1, double a2, DerivativeStructure ds2, double a3, DerivativeStructure ds3) Linear combination constructor.DerivativeStructure
(double a1, DerivativeStructure ds1, double a2, DerivativeStructure ds2, double a3, DerivativeStructure ds3, double a4, DerivativeStructure ds4) Linear combination constructor.DerivativeStructure
(int parameters, int order) Build an instance with all values and derivatives set to 0.DerivativeStructure
(int parameters, int order, double value) Build an instance representing a constant value.DerivativeStructure
(int parameters, int order, double... derivatives) Build an instance from all its derivatives.DerivativeStructure
(int parameters, int order, int index, double value) Build an instance representing a variable. -
Method Summary
Modifier and TypeMethodDescriptionabs()
absolute value.acos()
Arc cosine operation.acosh()
Inverse hyperbolic cosine operation.add
(double a) '+' operator.Compute this + a.asin()
Arc sine operation.asinh()
Inverse hyperbolic sine operation.atan()
Arc tangent operation.Two arguments arc tangent operation.static DerivativeStructure
Two arguments arc tangent operation.atanh()
Inverse hyperbolic tangent operation.cbrt()
Cubic root.ceil()
Get the smallest whole number larger than instance.compose
(double... f) Compute composition of the instance by a univariate function.copySign
(double sign) Returns the instance with the sign of the argument.copySign
(DerivativeStructure sign) Returns the instance with the sign of the argument.cos()
Cosine operation.cosh()
Hyperbolic cosine operation.createConstant
(double c) Create a constant compatible with instance order and number of parameters.divide
(double a) '÷' operator.Compute this ÷ a.boolean
Test for the equality of two derivative structures.exp()
Exponential.expm1()
Exponential minus 1.floor()
Get the largest whole number smaller than instance.double[]
Get all partial derivatives.int
Return the exponent of the instance value, removing the bias.getField()
Get theField
to which the instance belongs.int
Get the number of free parameters.int
getOrder()
Get the derivation order.double
getPartialDerivative
(int... orders) Get a partial derivative.double
getReal()
Get the real value of the number.double
getValue()
Get the value part of the derivative structure.int
hashCode()
Get a hashCode for the derivative structure.Returns the hypotenuse of a triangle with sidesthis
andy
- sqrt(this2 +y2) avoiding intermediate overflow or underflow.static DerivativeStructure
Returns the hypotenuse of a triangle with sidesx
andy
- sqrt(x2 +y2) avoiding intermediate overflow or underflow.linearCombination
(double[] a, DerivativeStructure[] b) Compute a linear combination.linearCombination
(double a1, DerivativeStructure b1, double a2, DerivativeStructure b2) Compute a linear combination.linearCombination
(double a1, DerivativeStructure b1, double a2, DerivativeStructure b2, double a3, DerivativeStructure b3) Compute a linear combination.linearCombination
(double a1, DerivativeStructure b1, double a2, DerivativeStructure b2, double a3, DerivativeStructure b3, double a4, DerivativeStructure b4) Compute a linear combination.Compute a linear combination.linearCombination
(DerivativeStructure a1, DerivativeStructure b1, DerivativeStructure a2, DerivativeStructure b2) Compute a linear combination.linearCombination
(DerivativeStructure a1, DerivativeStructure b1, DerivativeStructure a2, DerivativeStructure b2, DerivativeStructure a3, DerivativeStructure b3) Compute a linear combination.linearCombination
(DerivativeStructure a1, DerivativeStructure b1, DerivativeStructure a2, DerivativeStructure b2, DerivativeStructure a3, DerivativeStructure b3, DerivativeStructure a4, DerivativeStructure b4) Compute a linear combination.log()
Natural logarithm.log10()
Base 10 logarithm.log1p()
Shifted natural logarithm.multiply
(double a) '×' operator.multiply
(int n) Compute n × this.Compute this × a.negate()
Returns the additive inverse ofthis
element.pow
(double p) Power operation.static DerivativeStructure
pow
(double a, DerivativeStructure x) Compute ax where a is a double and x aDerivativeStructure
pow
(int n) Integer power operation.Power operation.Returns the multiplicative inverse ofthis
element.remainder
(double a) IEEE remainder operator.IEEE remainder operator.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.rootN
(int n) Nth root.long
round()
Get the closest long to instance value.scalb
(int n) Multiply the instance by a power of 2.signum()
Compute the signum of the instance.sin()
Sine operation.sinh()
Hyperbolic sine operation.sqrt()
Square root.subtract
(double a) '-' operator.Compute this - a.tan()
Tangent operation.tanh()
Hyperbolic tangent operation.double
taylor
(double... delta) Evaluate Taylor expansion a derivative structure.Convert radians to degrees, with error of less than 0.5 ULPConvert degrees to radians, with error of less than 0.5 ULP
-
Constructor Details
-
DerivativeStructure
Build an instance with all values and derivatives set to 0.- Parameters:
parameters
- number of free parametersorder
- derivation order- Throws:
NumberIsTooLargeException
- if order is too large
-
DerivativeStructure
public DerivativeStructure(int parameters, int order, double value) throws NumberIsTooLargeException Build an instance representing a constant value.- Parameters:
parameters
- number of free parametersorder
- derivation ordervalue
- value of the constant- Throws:
NumberIsTooLargeException
- if order is too large- See Also:
-
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.
- Parameters:
parameters
- number of free parametersorder
- derivation orderindex
- index of the variable (from 0 toparameters - 1
)value
- value of the variable- Throws:
NumberIsTooLargeException
- ifindex >= parameters
.- See Also:
-
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- Parameters:
a1
- first scale factords1
- first base (unscaled) derivative structurea2
- second scale factords2
- second base (unscaled) derivative structure- Throws:
DimensionMismatchException
- if number of free parameters or orders are inconsistent
-
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- Parameters:
a1
- first scale factords1
- first base (unscaled) derivative structurea2
- second scale factords2
- second base (unscaled) derivative structurea3
- third scale factords3
- third base (unscaled) derivative structure- Throws:
DimensionMismatchException
- if number of free parameters or orders are inconsistent
-
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- Parameters:
a1
- first scale factords1
- first base (unscaled) derivative structurea2
- second scale factords2
- second base (unscaled) derivative structurea3
- third scale factords3
- third base (unscaled) derivative structurea4
- fourth scale factords4
- fourth base (unscaled) derivative structure- Throws:
DimensionMismatchException
- if number of free parameters or orders are inconsistent
-
DerivativeStructure
public DerivativeStructure(int parameters, int order, double... derivatives) throws DimensionMismatchException, NumberIsTooLargeException Build an instance from all its derivatives.- Parameters:
parameters
- number of free parametersorder
- derivation orderderivatives
- derivatives sorted according toDSCompiler.getPartialDerivativeIndex(int...)
- Throws:
DimensionMismatchException
- if derivatives array does not match thesize
expected by the compilerNumberIsTooLargeException
- if order is too large- See Also:
-
-
Method Details
-
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
-
createConstant
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)
- Parameters:
c
- value of the constant- Returns:
- a constant compatible with instance order and number of parameters
- Since:
- 3.3
- See Also:
-
getReal
public double getReal()Get the real value of the number.- Specified by:
getReal
in interfaceRealFieldElement<DerivativeStructure>
- Returns:
- real value
- Since:
- 3.2
-
getValue
public double getValue()Get the value part of the derivative structure.- Returns:
- value part of the derivative structure
- See Also:
-
getPartialDerivative
public double getPartialDerivative(int... orders) throws DimensionMismatchException, NumberIsTooLargeException Get a partial derivative.- Parameters:
orders
- derivation orders with respect to each variable (if all orders are 0, the value is returned)- Returns:
- partial derivative
- Throws:
DimensionMismatchException
- if the numbers of variables does not match the instanceNumberIsTooLargeException
- if sum of derivation orders is larger than the instance limits- See Also:
-
getAllDerivatives
public double[] getAllDerivatives()Get all partial derivatives.- Returns:
- a fresh copy of partial derivatives, in an array sorted according to
DSCompiler.getPartialDerivativeIndex(int...)
-
add
'+' operator.- Specified by:
add
in interfaceRealFieldElement<DerivativeStructure>
- Parameters:
a
- right hand side parameter of the operator- Returns:
- this+a
- Since:
- 3.2
-
add
Compute this + a.- Specified by:
add
in interfaceFieldElement<DerivativeStructure>
- Parameters:
a
- element to add- Returns:
- a new element representing this + a
- Throws:
DimensionMismatchException
- if number of free parameters or orders do not match
-
subtract
'-' operator.- Specified by:
subtract
in interfaceRealFieldElement<DerivativeStructure>
- Parameters:
a
- right hand side parameter of the operator- Returns:
- this-a
- Since:
- 3.2
-
subtract
Compute this - a.- Specified by:
subtract
in interfaceFieldElement<DerivativeStructure>
- Parameters:
a
- element to subtract- Returns:
- a new element representing this - a
- Throws:
DimensionMismatchException
- if number of free parameters or orders do not match
-
multiply
Compute n × this. Multiplication by an integer number is defined as the following sumn × this = ∑i=1n this. - Specified by:
multiply
in interfaceFieldElement<DerivativeStructure>
- Parameters:
n
- Number of timesthis
must be added to itself.- Returns:
- A new element representing n × this.
-
multiply
'×' operator.- Specified by:
multiply
in interfaceRealFieldElement<DerivativeStructure>
- Parameters:
a
- right hand side parameter of the operator- Returns:
- this×a
- Since:
- 3.2
-
multiply
Compute this × a.- Specified by:
multiply
in interfaceFieldElement<DerivativeStructure>
- Parameters:
a
- element to multiply- Returns:
- a new element representing this × a
- Throws:
DimensionMismatchException
- if number of free parameters or orders do not match
-
divide
'÷' operator.- Specified by:
divide
in interfaceRealFieldElement<DerivativeStructure>
- Parameters:
a
- right hand side parameter of the operator- Returns:
- this÷a
- Since:
- 3.2
-
divide
Compute this ÷ a.- Specified by:
divide
in interfaceFieldElement<DerivativeStructure>
- Parameters:
a
- element to divide by- Returns:
- a new element representing this ÷ a
- Throws:
DimensionMismatchException
- if number of free parameters or orders do not match
-
remainder
IEEE remainder operator.- Specified by:
remainder
in interfaceRealFieldElement<DerivativeStructure>
- Parameters:
a
- right hand side parameter of the operator- Returns:
- 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)
-
remainder
IEEE remainder operator.- Specified by:
remainder
in interfaceRealFieldElement<DerivativeStructure>
- Parameters:
a
- right hand side parameter of the operator- Returns:
- 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)
- Throws:
DimensionMismatchException
- if number of free parameters or orders do not match- Since:
- 3.2
-
negate
Returns the additive inverse ofthis
element.- Specified by:
negate
in interfaceFieldElement<DerivativeStructure>
- Returns:
- the opposite of
this
.
-
abs
absolute value.- Specified by:
abs
in interfaceRealFieldElement<DerivativeStructure>
- Returns:
- abs(this)
- Since:
- 3.2
-
ceil
Get the smallest whole number larger than instance.- Specified by:
ceil
in interfaceRealFieldElement<DerivativeStructure>
- Returns:
- ceil(this)
- Since:
- 3.2
-
floor
Get the largest whole number smaller than instance.- Specified by:
floor
in interfaceRealFieldElement<DerivativeStructure>
- Returns:
- floor(this)
- Since:
- 3.2
-
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.- Specified by:
rint
in interfaceRealFieldElement<DerivativeStructure>
- Returns:
- a double number r such that r is an integer r - 0.5 ≤ this ≤ r + 0.5
- Since:
- 3.2
-
round
public long round()Get the closest long to instance value.- Specified by:
round
in interfaceRealFieldElement<DerivativeStructure>
- Returns:
- closest long to
RealFieldElement.getReal()
-
signum
Compute the signum of the instance. The signum is -1 for negative numbers, +1 for positive numbers and 0 otherwise- Specified by:
signum
in interfaceRealFieldElement<DerivativeStructure>
- Returns:
- -1.0, -0.0, +0.0, +1.0 or NaN depending on sign of a
- Since:
- 3.2
-
copySign
Returns the instance with the sign of the argument. A NaNsign
argument is treated as positive.- Specified by:
copySign
in interfaceRealFieldElement<DerivativeStructure>
- Parameters:
sign
- the sign for the returned value- Returns:
- the instance with the same sign as the
sign
argument - Since:
- 3.2
-
copySign
Returns the instance with the sign of the argument. A NaNsign
argument is treated as positive.- Specified by:
copySign
in interfaceRealFieldElement<DerivativeStructure>
- Parameters:
sign
- the sign for the returned value- Returns:
- the instance with the same sign as the
sign
argument - Since:
- 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.
- Returns:
- exponent for instance in IEEE754 representation, without bias
-
scalb
Multiply the instance by a power of 2.- Specified by:
scalb
in interfaceRealFieldElement<DerivativeStructure>
- Parameters:
n
- power of 2- Returns:
- this × 2n
- Since:
- 3.2
-
hypot
Returns the hypotenuse of a triangle with sidesthis
andy
- sqrt(this2 +y2) 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.
- Specified by:
hypot
in interfaceRealFieldElement<DerivativeStructure>
- Parameters:
y
- a value- Returns:
- sqrt(this2 +y2)
- Throws:
DimensionMismatchException
- if number of free parameters or orders do not match- Since:
- 3.2
-
hypot
public static DerivativeStructure hypot(DerivativeStructure x, DerivativeStructure y) throws DimensionMismatchException Returns the hypotenuse of a triangle with sidesx
andy
- sqrt(x2 +y2) 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.
- Parameters:
x
- a valuey
- a value- Returns:
- sqrt(x2 +y2)
- Throws:
DimensionMismatchException
- if number of free parameters or orders do not match- Since:
- 3.2
-
compose
Compute composition of the instance by a univariate function.- Parameters:
f
- array of value and derivatives of the function at the current point (i.e. [f(getValue()
), f'(getValue()
), f''(getValue()
)...]).- Returns:
- f(this)
- Throws:
DimensionMismatchException
- if the number of derivatives in the array is not equal toorder
+ 1
-
reciprocal
Returns the multiplicative inverse ofthis
element.- Specified by:
reciprocal
in interfaceFieldElement<DerivativeStructure>
- Specified by:
reciprocal
in interfaceRealFieldElement<DerivativeStructure>
- Returns:
- the inverse of
this
.
-
sqrt
Square root.- Specified by:
sqrt
in interfaceRealFieldElement<DerivativeStructure>
- Returns:
- square root of the instance
- Since:
- 3.2
-
cbrt
Cubic root.- Specified by:
cbrt
in interfaceRealFieldElement<DerivativeStructure>
- Returns:
- cubic root of the instance
- Since:
- 3.2
-
rootN
Nth root.- Specified by:
rootN
in interfaceRealFieldElement<DerivativeStructure>
- Parameters:
n
- order of the root- Returns:
- nth root of the instance
- Since:
- 3.2
-
getField
Get theField
to which the instance belongs.- Specified by:
getField
in interfaceFieldElement<DerivativeStructure>
- Returns:
Field
to which the instance belongs
-
pow
Compute ax where a is a double and x aDerivativeStructure
- Parameters:
a
- number to exponentiatex
- power to apply- Returns:
- ax
- Since:
- 3.3
-
pow
Power operation.- Specified by:
pow
in interfaceRealFieldElement<DerivativeStructure>
- Parameters:
p
- power to apply- Returns:
- thisp
- Since:
- 3.2
-
pow
Integer power operation.- Specified by:
pow
in interfaceRealFieldElement<DerivativeStructure>
- Parameters:
n
- power to apply- Returns:
- thisn
- Since:
- 3.2
-
pow
Power operation.- Specified by:
pow
in interfaceRealFieldElement<DerivativeStructure>
- Parameters:
e
- exponent- Returns:
- thise
- Throws:
DimensionMismatchException
- if number of free parameters or orders do not match- Since:
- 3.2
-
exp
Exponential.- Specified by:
exp
in interfaceRealFieldElement<DerivativeStructure>
- Returns:
- exponential of the instance
- Since:
- 3.2
-
expm1
Exponential minus 1.- Specified by:
expm1
in interfaceRealFieldElement<DerivativeStructure>
- Returns:
- exponential minus one of the instance
- Since:
- 3.2
-
log
Natural logarithm.- Specified by:
log
in interfaceRealFieldElement<DerivativeStructure>
- Returns:
- logarithm of the instance
- Since:
- 3.2
-
log1p
Shifted natural logarithm.- Specified by:
log1p
in interfaceRealFieldElement<DerivativeStructure>
- Returns:
- logarithm of one plus the instance
- Since:
- 3.2
-
log10
Base 10 logarithm.- Returns:
- base 10 logarithm of the instance
-
cos
Cosine operation.- Specified by:
cos
in interfaceRealFieldElement<DerivativeStructure>
- Returns:
- cos(this)
- Since:
- 3.2
-
sin
Sine operation.- Specified by:
sin
in interfaceRealFieldElement<DerivativeStructure>
- Returns:
- sin(this)
- Since:
- 3.2
-
tan
Tangent operation.- Specified by:
tan
in interfaceRealFieldElement<DerivativeStructure>
- Returns:
- tan(this)
- Since:
- 3.2
-
acos
Arc cosine operation.- Specified by:
acos
in interfaceRealFieldElement<DerivativeStructure>
- Returns:
- acos(this)
- Since:
- 3.2
-
asin
Arc sine operation.- Specified by:
asin
in interfaceRealFieldElement<DerivativeStructure>
- Returns:
- asin(this)
- Since:
- 3.2
-
atan
Arc tangent operation.- Specified by:
atan
in interfaceRealFieldElement<DerivativeStructure>
- Returns:
- atan(this)
- Since:
- 3.2
-
atan2
Two arguments arc tangent operation.- Specified by:
atan2
in interfaceRealFieldElement<DerivativeStructure>
- Parameters:
x
- second argument of the arc tangent- Returns:
- atan2(this, x)
- Throws:
DimensionMismatchException
- if number of free parameters or orders are inconsistent- Since:
- 3.2
-
atan2
public static DerivativeStructure atan2(DerivativeStructure y, DerivativeStructure x) throws DimensionMismatchException Two arguments arc tangent operation.- Parameters:
y
- first argument of the arc tangentx
- second argument of the arc tangent- Returns:
- atan2(y, x)
- Throws:
DimensionMismatchException
- if number of free parameters or orders do not match- Since:
- 3.2
-
cosh
Hyperbolic cosine operation.- Specified by:
cosh
in interfaceRealFieldElement<DerivativeStructure>
- Returns:
- cosh(this)
- Since:
- 3.2
-
sinh
Hyperbolic sine operation.- Specified by:
sinh
in interfaceRealFieldElement<DerivativeStructure>
- Returns:
- sinh(this)
- Since:
- 3.2
-
tanh
Hyperbolic tangent operation.- Specified by:
tanh
in interfaceRealFieldElement<DerivativeStructure>
- Returns:
- tanh(this)
- Since:
- 3.2
-
acosh
Inverse hyperbolic cosine operation.- Specified by:
acosh
in interfaceRealFieldElement<DerivativeStructure>
- Returns:
- acosh(this)
- Since:
- 3.2
-
asinh
Inverse hyperbolic sine operation.- Specified by:
asinh
in interfaceRealFieldElement<DerivativeStructure>
- Returns:
- asin(this)
- Since:
- 3.2
-
atanh
Inverse hyperbolic tangent operation.- Specified by:
atanh
in interfaceRealFieldElement<DerivativeStructure>
- Returns:
- atanh(this)
- Since:
- 3.2
-
toDegrees
Convert radians to degrees, with error of less than 0.5 ULP- Returns:
- instance converted into degrees
-
toRadians
Convert degrees to radians, with error of less than 0.5 ULP- Returns:
- instance converted into radians
-
taylor
Evaluate Taylor expansion a derivative structure.- Parameters:
delta
- parameters offsets (Δx, Δy, ...)- Returns:
- value of the Taylor expansion at x + Δx, y + Δy, ...
- Throws:
MathArithmeticException
- if factorials becomes too large
-
linearCombination
public DerivativeStructure linearCombination(DerivativeStructure[] a, DerivativeStructure[] b) throws DimensionMismatchException Compute a linear combination.- Specified by:
linearCombination
in interfaceRealFieldElement<DerivativeStructure>
- Parameters:
a
- Factors.b
- Factors.- Returns:
Σi ai bi
.- Throws:
DimensionMismatchException
- if number of free parameters or orders do not match- Since:
- 3.2
-
linearCombination
public DerivativeStructure linearCombination(double[] a, DerivativeStructure[] b) throws DimensionMismatchException Compute a linear combination.- Specified by:
linearCombination
in interfaceRealFieldElement<DerivativeStructure>
- Parameters:
a
- Factors.b
- Factors.- Returns:
Σi ai bi
.- Throws:
DimensionMismatchException
- if number of free parameters or orders do not match- Since:
- 3.2
-
linearCombination
public DerivativeStructure linearCombination(DerivativeStructure a1, DerivativeStructure b1, DerivativeStructure a2, DerivativeStructure b2) throws DimensionMismatchException Compute a linear combination.- Specified by:
linearCombination
in interfaceRealFieldElement<DerivativeStructure>
- Parameters:
a1
- first factor of the first termb1
- second factor of the first terma2
- first factor of the second termb2
- second factor of the second term- Returns:
- a1×b1 + a2×b2
- Throws:
DimensionMismatchException
- if number of free parameters or orders do not match- Since:
- 3.2
- See Also:
-
linearCombination
public DerivativeStructure linearCombination(double a1, DerivativeStructure b1, double a2, DerivativeStructure b2) throws DimensionMismatchException Compute a linear combination.- Specified by:
linearCombination
in interfaceRealFieldElement<DerivativeStructure>
- Parameters:
a1
- first factor of the first termb1
- second factor of the first terma2
- first factor of the second termb2
- second factor of the second term- Returns:
- a1×b1 + a2×b2
- Throws:
DimensionMismatchException
- if number of free parameters or orders do not match- Since:
- 3.2
- See Also:
-
linearCombination
public DerivativeStructure linearCombination(DerivativeStructure a1, DerivativeStructure b1, DerivativeStructure a2, DerivativeStructure b2, DerivativeStructure a3, DerivativeStructure b3) throws DimensionMismatchException Compute a linear combination.- Specified by:
linearCombination
in interfaceRealFieldElement<DerivativeStructure>
- Parameters:
a1
- first factor of the first termb1
- second factor of the first terma2
- first factor of the second termb2
- second factor of the second terma3
- first factor of the third termb3
- second factor of the third term- Returns:
- a1×b1 + a2×b2 + a3×b3
- Throws:
DimensionMismatchException
- if number of free parameters or orders do not match- Since:
- 3.2
- See Also:
-
linearCombination
public DerivativeStructure linearCombination(double a1, DerivativeStructure b1, double a2, DerivativeStructure b2, double a3, DerivativeStructure b3) throws DimensionMismatchException Compute a linear combination.- Specified by:
linearCombination
in interfaceRealFieldElement<DerivativeStructure>
- Parameters:
a1
- first factor of the first termb1
- second factor of the first terma2
- first factor of the second termb2
- second factor of the second terma3
- first factor of the third termb3
- second factor of the third term- Returns:
- a1×b1 + a2×b2 + a3×b3
- Throws:
DimensionMismatchException
- if number of free parameters or orders do not match- Since:
- 3.2
- See Also:
-
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.- Specified by:
linearCombination
in interfaceRealFieldElement<DerivativeStructure>
- Parameters:
a1
- first factor of the first termb1
- second factor of the first terma2
- first factor of the second termb2
- second factor of the second terma3
- first factor of the third termb3
- second factor of the third terma4
- first factor of the third termb4
- second factor of the third term- Returns:
- a1×b1 + a2×b2 + a3×b3 + a4×b4
- Throws:
DimensionMismatchException
- if number of free parameters or orders do not match- Since:
- 3.2
- See Also:
-
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.- Specified by:
linearCombination
in interfaceRealFieldElement<DerivativeStructure>
- Parameters:
a1
- first factor of the first termb1
- second factor of the first terma2
- first factor of the second termb2
- second factor of the second terma3
- first factor of the third termb3
- second factor of the third terma4
- first factor of the third termb4
- second factor of the third term- Returns:
- a1×b1 + a2×b2 + a3×b3 + a4×b4
- Throws:
DimensionMismatchException
- if number of free parameters or orders do not match- Since:
- 3.2
- See Also:
-
equals
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.
-
hashCode
public int hashCode()Get a hashCode for the derivative structure.
-