public class SparseGradient extends Object implements RealFieldElement<SparseGradient>, Serializable
 This class plays a similar role to DerivativeStructure, with
 a focus on efficiency when dealing with large number of independent variables
 and most computation depend only on a few of them, and when only first derivative
 is desired. When these conditions are met, this class should be much faster than
 DerivativeStructure and use less memory.
 
DEG_TO_RAD, RAD_TO_DEG| Modifier and Type | Method and Description | 
|---|---|
| SparseGradient | abs()absolute value. | 
| SparseGradient | acos()Arc cosine operation. | 
| SparseGradient | acosh()Inverse hyperbolic cosine operation. | 
| SparseGradient | add(double c)'+' operator. | 
| SparseGradient | add(SparseGradient a)Compute this + a. | 
| void | addInPlace(SparseGradient a)Add in place. | 
| SparseGradient | asin()Arc sine operation. | 
| SparseGradient | asinh()Inverse hyperbolic sine operation. | 
| SparseGradient | atan()Arc tangent operation. | 
| SparseGradient | atan2(SparseGradient x)Two arguments arc tangent operation. | 
| static SparseGradient | atan2(SparseGradient y,
     SparseGradient x)Two arguments arc tangent operation. | 
| SparseGradient | atanh()Inverse hyperbolic  tangent operation. | 
| SparseGradient | cbrt()Cubic root. | 
| SparseGradient | ceil()Get the smallest whole number larger than instance. | 
| SparseGradient | compose(double f0,
       double f1)Compute composition of the instance by a univariate function. | 
| SparseGradient | copySign(double sign)Returns the instance with the sign of the argument. | 
| SparseGradient | copySign(SparseGradient sign)Returns the instance with the sign of the argument. | 
| SparseGradient | cos()Cosine operation. | 
| SparseGradient | cosh()Hyperbolic cosine operation. | 
| static SparseGradient | createConstant(double value)Factory method creating a constant. | 
| static SparseGradient | createVariable(int idx,
              double value)Factory method creating an independent variable. | 
| SparseGradient | divide(double c)'÷' operator. | 
| SparseGradient | divide(SparseGradient a)Compute this ÷ a. | 
| boolean | equals(Object other)Test for the equality of two sparse gradients. | 
| SparseGradient | exp()Exponential. | 
| SparseGradient | expm1()Exponential minus 1. | 
| SparseGradient | floor()Get the largest whole number smaller than instance. | 
| double | getDerivative(int index)Get the derivative with respect to a particular index variable. | 
| Field<SparseGradient> | getField()Get the  Fieldto which the instance belongs. | 
| double | getReal()Get the real value of the number. | 
| double | getValue()Get the value of the function. | 
| int | hashCode()Get a hashCode for the derivative structure. | 
| SparseGradient | hypot(SparseGradient y)Returns the hypotenuse of a triangle with sides  thisandy- sqrt(this2 +y2)
 avoiding intermediate overflow or underflow. | 
| static SparseGradient | hypot(SparseGradient x,
     SparseGradient y)Returns the hypotenuse of a triangle with sides  xandy- sqrt(x2 +y2)
 avoiding intermediate overflow or underflow. | 
| SparseGradient | linearCombination(double[] a,
                 SparseGradient[] b)Compute a linear combination. | 
| SparseGradient | linearCombination(double a1,
                 SparseGradient b1,
                 double a2,
                 SparseGradient b2)Compute a linear combination. | 
| SparseGradient | linearCombination(double a1,
                 SparseGradient b1,
                 double a2,
                 SparseGradient b2,
                 double a3,
                 SparseGradient b3)Compute a linear combination. | 
| SparseGradient | linearCombination(double a1,
                 SparseGradient b1,
                 double a2,
                 SparseGradient b2,
                 double a3,
                 SparseGradient b3,
                 double a4,
                 SparseGradient b4)Compute a linear combination. | 
| SparseGradient | linearCombination(SparseGradient[] a,
                 SparseGradient[] b)Compute a linear combination. | 
| SparseGradient | linearCombination(SparseGradient a1,
                 SparseGradient b1,
                 SparseGradient a2,
                 SparseGradient b2)Compute a linear combination. | 
| SparseGradient | linearCombination(SparseGradient a1,
                 SparseGradient b1,
                 SparseGradient a2,
                 SparseGradient b2,
                 SparseGradient a3,
                 SparseGradient b3)Compute a linear combination. | 
| SparseGradient | linearCombination(SparseGradient a1,
                 SparseGradient b1,
                 SparseGradient a2,
                 SparseGradient b2,
                 SparseGradient a3,
                 SparseGradient b3,
                 SparseGradient a4,
                 SparseGradient b4)Compute a linear combination. | 
| SparseGradient | log()Natural logarithm. | 
| SparseGradient | log10()Base 10 logarithm. | 
| SparseGradient | log1p()Shifted natural logarithm. | 
| SparseGradient | multiply(double c)'×' operator. | 
| SparseGradient | multiply(int n)Compute n × this. | 
| SparseGradient | multiply(SparseGradient a)Compute this × a. | 
| void | multiplyInPlace(SparseGradient a)Multiply in place. | 
| SparseGradient | negate()Returns the additive inverse of  thiselement. | 
| SparseGradient | newInstance(double v)Create an instance corresponding to a constant real value. | 
| int | numVars()Find the number of variables. | 
| SparseGradient | pow(double p)Power operation. | 
| static SparseGradient | pow(double a,
   SparseGradient x)Compute ax where a is a double and x a  SparseGradient | 
| SparseGradient | pow(int n)Integer power operation. | 
| SparseGradient | pow(SparseGradient e)Power operation. | 
| SparseGradient | reciprocal()Returns the multiplicative inverse of  thiselement. | 
| SparseGradient | remainder(double a)IEEE remainder operator. | 
| SparseGradient | remainder(SparseGradient a)IEEE remainder operator. | 
| SparseGradient | 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. | 
| SparseGradient | rootN(int n)Nth root. | 
| SparseGradient | scalb(int n)Multiply the instance by a power of 2. | 
| SparseGradient | signum()Compute the signum of the instance. | 
| SparseGradient | sin()Sine operation. | 
| FieldSinCos<SparseGradient> | sinCos()Combined Sine and Cosine operation. | 
| SparseGradient | sinh()Hyperbolic sine operation. | 
| SparseGradient | sqrt()Square root. | 
| SparseGradient | subtract(double c)'-' operator. | 
| SparseGradient | subtract(SparseGradient a)Compute this - a. | 
| SparseGradient | tan()Tangent operation. | 
| SparseGradient | tanh()Hyperbolic tangent operation. | 
| double | taylor(double... delta)Evaluate Taylor expansion of a sparse gradient. | 
| SparseGradient | toDegrees()Convert radians to degrees, with error of less than 0.5 ULP | 
| SparseGradient | toRadians()Convert degrees to radians, with error of less than 0.5 ULP | 
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitroundgetExponent, isInfinite, isNaNpublic SparseGradient newInstance(double v)
 The default implementation creates the instance by adding
 the value to getField().getZero(). This is not optimal
 and does not work when called with a negative zero as the
 sign of zero is lost with the addition. The default implementation
 should therefore be overridden in concrete classes. The default
 implementation will be removed at the next major version.
 
newInstance in interface CalculusFieldElement<SparseGradient>v - constant real valuepublic static SparseGradient createConstant(double value)
value - value of the constantpublic static SparseGradient createVariable(int idx, double value)
idx - index of the variablevalue - value of the variablepublic int numVars()
public double getDerivative(int index)
index - index to differentiate with.public double getValue()
public double getReal()
getReal in interface CalculusFieldElement<SparseGradient>public SparseGradient add(SparseGradient a)
add in interface FieldElement<SparseGradient>a - element to addpublic void addInPlace(SparseGradient a)
This method is designed to be faster when used multiple times in a loop.
 The instance is changed here, in order to not change the
 instance the add(SparseGradient) method should
 be used.
 
a - instance to addpublic SparseGradient add(double c)
add in interface CalculusFieldElement<SparseGradient>c - right hand side parameter of the operatorpublic SparseGradient subtract(SparseGradient a)
subtract in interface FieldElement<SparseGradient>a - element to subtractpublic SparseGradient subtract(double c)
subtract in interface CalculusFieldElement<SparseGradient>c - right hand side parameter of the operatorpublic SparseGradient multiply(SparseGradient a)
multiply in interface FieldElement<SparseGradient>a - element to multiplypublic void multiplyInPlace(SparseGradient a)
This method is designed to be faster when used multiple times in a loop.
 The instance is changed here, in order to not change the
 instance the add(SparseGradient) method should
 be used.
 
a - instance to multiplypublic SparseGradient multiply(double c)
multiply in interface CalculusFieldElement<SparseGradient>c - right hand side parameter of the operatorpublic SparseGradient multiply(int n)
multiply in interface FieldElement<SparseGradient>n - Number of times this must be added to itself.public SparseGradient divide(SparseGradient a)
divide in interface FieldElement<SparseGradient>a - element to divide bypublic SparseGradient divide(double c)
divide in interface CalculusFieldElement<SparseGradient>c - right hand side parameter of the operatorpublic SparseGradient negate()
this element.negate in interface FieldElement<SparseGradient>this.public Field<SparseGradient> getField()
Field to which the instance belongs.getField in interface FieldElement<SparseGradient>Field to which the instance belongspublic SparseGradient remainder(double a)
remainder in interface CalculusFieldElement<SparseGradient>a - right hand side parameter of the operatorpublic SparseGradient remainder(SparseGradient a)
remainder in interface CalculusFieldElement<SparseGradient>a - right hand side parameter of the operatorpublic SparseGradient abs()
abs in interface RealFieldElement<SparseGradient>public SparseGradient ceil()
ceil in interface CalculusFieldElement<SparseGradient>public SparseGradient floor()
floor in interface CalculusFieldElement<SparseGradient>public SparseGradient rint()
rint in interface CalculusFieldElement<SparseGradient>public SparseGradient signum()
signum in interface CalculusFieldElement<SparseGradient>public SparseGradient copySign(SparseGradient sign)
sign argument is treated as positive.copySign in interface CalculusFieldElement<SparseGradient>sign - the sign for the returned valuesign argumentpublic SparseGradient copySign(double sign)
sign argument is treated as positive.copySign in interface CalculusFieldElement<SparseGradient>sign - the sign for the returned valuesign argumentpublic SparseGradient scalb(int n)
scalb in interface CalculusFieldElement<SparseGradient>n - power of 2public SparseGradient hypot(SparseGradient y)
this and y
 - sqrt(this2 +y2)
 avoiding intermediate overflow or underflow.
 hypot in interface CalculusFieldElement<SparseGradient>y - a valuepublic static SparseGradient hypot(SparseGradient x, SparseGradient y)
x and y
 - sqrt(x2 +y2)
 avoiding intermediate overflow or underflow.
 x - a valuey - a valuepublic SparseGradient reciprocal()
this element.reciprocal in interface CalculusFieldElement<SparseGradient>reciprocal in interface FieldElement<SparseGradient>this.public SparseGradient sqrt()
sqrt in interface CalculusFieldElement<SparseGradient>public SparseGradient cbrt()
cbrt in interface CalculusFieldElement<SparseGradient>public SparseGradient rootN(int n)
rootN in interface CalculusFieldElement<SparseGradient>n - order of the rootpublic SparseGradient pow(double p)
pow in interface CalculusFieldElement<SparseGradient>p - power to applypublic SparseGradient pow(int n)
pow in interface CalculusFieldElement<SparseGradient>n - power to applypublic SparseGradient pow(SparseGradient e)
pow in interface CalculusFieldElement<SparseGradient>e - exponentpublic static SparseGradient pow(double a, SparseGradient x)
SparseGradienta - number to exponentiatex - power to applypublic SparseGradient exp()
exp in interface CalculusFieldElement<SparseGradient>public SparseGradient expm1()
expm1 in interface CalculusFieldElement<SparseGradient>public SparseGradient log()
log in interface CalculusFieldElement<SparseGradient>public SparseGradient log10()
log10 in interface CalculusFieldElement<SparseGradient>public SparseGradient log1p()
log1p in interface CalculusFieldElement<SparseGradient>public SparseGradient cos()
cos in interface CalculusFieldElement<SparseGradient>public SparseGradient sin()
sin in interface CalculusFieldElement<SparseGradient>public FieldSinCos<SparseGradient> sinCos()
sinCos in interface CalculusFieldElement<SparseGradient>public SparseGradient tan()
tan in interface CalculusFieldElement<SparseGradient>public SparseGradient acos()
acos in interface CalculusFieldElement<SparseGradient>public SparseGradient asin()
asin in interface CalculusFieldElement<SparseGradient>public SparseGradient atan()
atan in interface CalculusFieldElement<SparseGradient>public SparseGradient atan2(SparseGradient x)
atan2 in interface CalculusFieldElement<SparseGradient>x - second argument of the arc tangentpublic static SparseGradient atan2(SparseGradient y, SparseGradient x)
y - first argument of the arc tangentx - second argument of the arc tangentpublic SparseGradient cosh()
cosh in interface CalculusFieldElement<SparseGradient>public SparseGradient sinh()
sinh in interface CalculusFieldElement<SparseGradient>public SparseGradient tanh()
tanh in interface CalculusFieldElement<SparseGradient>public SparseGradient acosh()
acosh in interface CalculusFieldElement<SparseGradient>public SparseGradient asinh()
asinh in interface CalculusFieldElement<SparseGradient>public SparseGradient atanh()
atanh in interface CalculusFieldElement<SparseGradient>public SparseGradient toDegrees()
toDegrees in interface CalculusFieldElement<SparseGradient>public SparseGradient toRadians()
toRadians in interface CalculusFieldElement<SparseGradient>public double taylor(double... delta)
delta - parameters offsets (Δx, Δy, ...)public SparseGradient compose(double f0, double f1)
f0 - value of the function at (i.e. f(getValue()))f1 - first derivative of the function at
 the current point (i.e. f'(getValue()))public SparseGradient linearCombination(SparseGradient[] a, SparseGradient[] b) throws MathIllegalArgumentException
linearCombination in interface CalculusFieldElement<SparseGradient>a - Factors.b - Factors.Σi ai bi.MathIllegalArgumentException - if arrays dimensions don't matchpublic SparseGradient linearCombination(double[] a, SparseGradient[] b)
linearCombination in interface CalculusFieldElement<SparseGradient>a - Factors.b - Factors.Σi ai bi.public SparseGradient linearCombination(SparseGradient a1, SparseGradient b1, SparseGradient a2, SparseGradient b2)
linearCombination in interface CalculusFieldElement<SparseGradient>a1 - first factor of the first termb1 - second factor of the first terma2 - first factor of the second termb2 - second factor of the second termCalculusFieldElement.linearCombination(Object, Object, Object, Object, Object, Object), 
CalculusFieldElement.linearCombination(Object, Object, Object, Object, Object, Object, Object, Object)public SparseGradient linearCombination(double a1, SparseGradient b1, double a2, SparseGradient b2)
linearCombination in interface CalculusFieldElement<SparseGradient>a1 - first factor of the first termb1 - second factor of the first terma2 - first factor of the second termb2 - second factor of the second termCalculusFieldElement.linearCombination(double, Object, double, Object, double, Object), 
CalculusFieldElement.linearCombination(double, Object, double, Object, double, Object, double, Object)public SparseGradient linearCombination(SparseGradient a1, SparseGradient b1, SparseGradient a2, SparseGradient b2, SparseGradient a3, SparseGradient b3)
linearCombination in interface CalculusFieldElement<SparseGradient>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 termCalculusFieldElement.linearCombination(Object, Object, Object, Object), 
CalculusFieldElement.linearCombination(Object, Object, Object, Object, Object, Object, Object, Object)public SparseGradient linearCombination(double a1, SparseGradient b1, double a2, SparseGradient b2, double a3, SparseGradient b3)
linearCombination in interface CalculusFieldElement<SparseGradient>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 termCalculusFieldElement.linearCombination(double, Object, double, Object), 
CalculusFieldElement.linearCombination(double, Object, double, Object, double, Object, double, Object)public SparseGradient linearCombination(SparseGradient a1, SparseGradient b1, SparseGradient a2, SparseGradient b2, SparseGradient a3, SparseGradient b3, SparseGradient a4, SparseGradient b4)
linearCombination in interface CalculusFieldElement<SparseGradient>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 fourth termb4 - second factor of the fourth termCalculusFieldElement.linearCombination(Object, Object, Object, Object), 
CalculusFieldElement.linearCombination(Object, Object, Object, Object, Object, Object)public SparseGradient linearCombination(double a1, SparseGradient b1, double a2, SparseGradient b2, double a3, SparseGradient b3, double a4, SparseGradient b4)
linearCombination in interface CalculusFieldElement<SparseGradient>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 fourth termb4 - second factor of the fourth termCalculusFieldElement.linearCombination(double, Object, double, Object), 
CalculusFieldElement.linearCombination(double, Object, double, Object, double, Object)public boolean equals(Object other)
Sparse gradients are considered equal if they have the same value and the same derivatives.
Copyright © 2016–2020 Hipparchus.org. All rights reserved.