SparseGradient (Apache Commons Math 3.3 API)

org.apache.commons.math3.analysis.differentiation

## Class SparseGradient

- java.lang.Object
- - org.apache.commons.math3.analysis.differentiation.SparseGradient

- All Implemented Interfaces:
    Serializable, FieldElement<SparseGradient>, RealFieldElement<SparseGradient>

      public class SparseGradient
      extends Object
      implements RealFieldElement<SparseGradient>, Serializable

  First derivative computation with large number of variables.

  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.

  Since:
    3.3
  Version:
    $Id: SparseGradient.java 1536147 2013-10-27 14:39:16Z luc $
  See Also:
    Serialized Form

- - ### Method Summary

    Methods
    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 `Field` to 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 `this` and `y` - sqrt(this2 +y2) avoiding intermediate overflow or underflow.
    `static SparseGradient` | `hypot(SparseGradient x, SparseGradient y)` Returns the hypotenuse of a triangle with sides `x` and `y` - 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 `this` element.
    `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 `this` element.
    `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.
    `long` | `round()` Get the closest long to instance value.
    `SparseGradient` | `scalb(int n)` Multiply the instance by a power of 2.
    `SparseGradient` | `signum()` Compute the signum of the instance.
    `SparseGradient` | `sin()` Sine 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

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### createConstant

          public static SparseGradient createConstant(double value)

      Factory method creating a constant.
      Parameters:
        `value` - value of the constant
      Returns:
        a new instance

    - #### createVariable

          public static SparseGradient createVariable(int idx,
                                      double value)

      Factory method creating an independent variable.
      Parameters:
        `idx` - index of the variable
        `value` - value of the variable
      Returns:
        a new instance

    - #### numVars

          public int numVars()

      Find the number of variables.
      Returns:
        number of variables

    - #### getDerivative

          public double getDerivative(int index)

      Get the derivative with respect to a particular index variable.
      Parameters:
        `index` - index to differentiate with.
      Returns:
        derivative with respect to a particular index variable

    - #### getValue

          public double getValue()

      Get the value of the function.
      Returns:
        value of the function.

    - #### getReal

          public double getReal()

      Get the real value of the number.
      Specified by:
        `getReal` in interface `RealFieldElement<SparseGradient>`
      Returns:
        real value

    - #### add

          public SparseGradient add(SparseGradient a)

      Compute this + a.
      Specified by:
        `add` in interface `FieldElement<SparseGradient>`
      Parameters:
        `a` - element to add
      Returns:
        a new element representing this + a

    - #### addInPlace

          public void addInPlace(SparseGradient a)

      Add in place.

      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.

      Parameters:
        `a` - instance to add

    - #### add

          public SparseGradient add(double c)

      '+' operator.
      Specified by:
        `add` in interface `RealFieldElement<SparseGradient>`
      Parameters:
        `c` - right hand side parameter of the operator
      Returns:
        this+a

    - #### subtract

          public SparseGradient subtract(SparseGradient a)

      Compute this - a.
      Specified by:
        `subtract` in interface `FieldElement<SparseGradient>`
      Parameters:
        `a` - element to subtract
      Returns:
        a new element representing this - a

    - #### subtract

          public SparseGradient subtract(double c)

      '-' operator.
      Specified by:
        `subtract` in interface `RealFieldElement<SparseGradient>`
      Parameters:
        `c` - right hand side parameter of the operator
      Returns:
        this-a

    - #### multiply

          public SparseGradient multiply(SparseGradient a)

      Compute this × a.
      Specified by:
        `multiply` in interface `FieldElement<SparseGradient>`
      Parameters:
        `a` - element to multiply
      Returns:
        a new element representing this × a

    - #### multiplyInPlace

          public void multiplyInPlace(SparseGradient a)

      Multiply in place.

      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.

      Parameters:
        `a` - instance to multiply

    - #### multiply

          public SparseGradient multiply(double c)

      '×' operator.
      Specified by:
        `multiply` in interface `RealFieldElement<SparseGradient>`
      Parameters:
        `c` - right hand side parameter of the operator
      Returns:
        this×a

    - #### multiply

          public SparseGradient multiply(int n)

      Compute n × this. Multiplication by an integer number is defined as the following sum
      n × this = ∑i=1n this.
      Specified by:
        `multiply` in interface `FieldElement<SparseGradient>`
      Parameters:
        `n` - Number of times `this` must be added to itself.
      Returns:
        A new element representing n × this.

    - #### divide

          public SparseGradient divide(SparseGradient a)

      Compute this ÷ a.
      Specified by:
        `divide` in interface `FieldElement<SparseGradient>`
      Parameters:
        `a` - element to add
      Returns:
        a new element representing this ÷ a

    - #### divide

          public SparseGradient divide(double c)

      '÷' operator.
      Specified by:
        `divide` in interface `RealFieldElement<SparseGradient>`
      Parameters:
        `c` - right hand side parameter of the operator
      Returns:
        this÷s;a

    - #### negate

          public SparseGradient negate()

      Returns the additive inverse of `this` element.
      Specified by:
        `negate` in interface `FieldElement<SparseGradient>`
      Returns:
        the opposite of `this`.

    - #### getField

          public Field<SparseGradient> getField()

      Get the `Field` to which the instance belongs.
      Specified by:
        `getField` in interface `FieldElement<SparseGradient>`
      Returns:
        `Field` to which the instance belongs

    - #### remainder

          public SparseGradient remainder(double a)

      IEEE remainder operator.
      Specified by:
        `remainder` in interface `RealFieldElement<SparseGradient>`
      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

          public SparseGradient remainder(SparseGradient a)

      IEEE remainder operator.
      Specified by:
        `remainder` in interface `RealFieldElement<SparseGradient>`
      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)

    - #### abs

          public SparseGradient abs()

      absolute value.
      Specified by:
        `abs` in interface `RealFieldElement<SparseGradient>`
      Returns:
        abs(this)

    - #### ceil

          public SparseGradient ceil()

      Get the smallest whole number larger than instance.
      Specified by:
        `ceil` in interface `RealFieldElement<SparseGradient>`
      Returns:
        ceil(this)

    - #### floor

          public SparseGradient floor()

      Get the largest whole number smaller than instance.
      Specified by:
        `floor` in interface `RealFieldElement<SparseGradient>`
      Returns:
        floor(this)

    - #### rint

          public 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.
      Specified by:
        `rint` in interface `RealFieldElement<SparseGradient>`
      Returns:
        a double number r such that r is an integer r - 0.5 <= this <= r + 0.5

    - #### round

          public long round()

      Get the closest long to instance value.
      Specified by:
        `round` in interface `RealFieldElement<SparseGradient>`
      Returns:
        closest long to `RealFieldElement.getReal()`

    - #### signum

          public SparseGradient 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 interface `RealFieldElement<SparseGradient>`
      Returns:
        -1.0, -0.0, +0.0, +1.0 or NaN depending on sign of a

    - #### copySign

          public SparseGradient copySign(SparseGradient sign)

      Returns the instance with the sign of the argument. A NaN `sign` argument is treated as positive.
      Specified by:
        `copySign` in interface `RealFieldElement<SparseGradient>`
      Parameters:
        `sign` - the sign for the returned value
      Returns:
        the instance with the same sign as the `sign` argument

    - #### copySign

          public SparseGradient copySign(double sign)

      Returns the instance with the sign of the argument. A NaN `sign` argument is treated as positive.
      Specified by:
        `copySign` in interface `RealFieldElement<SparseGradient>`
      Parameters:
        `sign` - the sign for the returned value
      Returns:
        the instance with the same sign as the `sign` argument

    - #### scalb

          public SparseGradient scalb(int n)

      Multiply the instance by a power of 2.
      Specified by:
        `scalb` in interface `RealFieldElement<SparseGradient>`
      Parameters:
        `n` - power of 2
      Returns:
        this × 2n

    - #### hypot

          public SparseGradient hypot(SparseGradient y)

      Returns the hypotenuse of a triangle with sides `this` and `y` - 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 interface `RealFieldElement<SparseGradient>`
      Parameters:
        `y` - a value
      Returns:
        sqrt(this2 +y2)

    - #### hypot

          public static SparseGradient hypot(SparseGradient x,
                             SparseGradient y)

      Returns the hypotenuse of a triangle with sides `x` and `y` - 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 value
        `y` - a value
      Returns:
        sqrt(x2 +y2)

    - #### reciprocal

          public SparseGradient reciprocal()

      Returns the multiplicative inverse of `this` element.
      Specified by:
        `reciprocal` in interface `FieldElement<SparseGradient>`
      Specified by:
        `reciprocal` in interface `RealFieldElement<SparseGradient>`
      Returns:
        the inverse of `this`.

    - #### sqrt

          public SparseGradient sqrt()

      Square root.
      Specified by:
        `sqrt` in interface `RealFieldElement<SparseGradient>`
      Returns:
        square root of the instance

    - #### cbrt

          public SparseGradient cbrt()

      Cubic root.
      Specified by:
        `cbrt` in interface `RealFieldElement<SparseGradient>`
      Returns:
        cubic root of the instance

    - #### rootN

          public SparseGradient rootN(int n)

      Nth root.
      Specified by:
        `rootN` in interface `RealFieldElement<SparseGradient>`
      Parameters:
        `n` - order of the root
      Returns:
        nth root of the instance

    - #### pow

          public SparseGradient pow(double p)

      Power operation.
      Specified by:
        `pow` in interface `RealFieldElement<SparseGradient>`
      Parameters:
        `p` - power to apply
      Returns:
        thisp

    - #### pow

          public SparseGradient pow(int n)

      Integer power operation.
      Specified by:
        `pow` in interface `RealFieldElement<SparseGradient>`
      Parameters:
        `n` - power to apply
      Returns:
        thisn

    - #### pow

          public SparseGradient pow(SparseGradient e)

      Power operation.
      Specified by:
        `pow` in interface `RealFieldElement<SparseGradient>`
      Parameters:
        `e` - exponent
      Returns:
        thise

    - #### pow

          public static SparseGradient pow(double a,
                           SparseGradient x)

      Compute ax where a is a double and x a `SparseGradient`
      Parameters:
        `a` - number to exponentiate
        `x` - power to apply
      Returns:
        ax

    - #### exp

          public SparseGradient exp()

      Exponential.
      Specified by:
        `exp` in interface `RealFieldElement<SparseGradient>`
      Returns:
        exponential of the instance

    - #### expm1

          public SparseGradient expm1()

      Exponential minus 1.
      Specified by:
        `expm1` in interface `RealFieldElement<SparseGradient>`
      Returns:
        exponential minus one of the instance

    - #### log

          public SparseGradient log()

      Natural logarithm.
      Specified by:
        `log` in interface `RealFieldElement<SparseGradient>`
      Returns:
        logarithm of the instance

    - #### log10

          public SparseGradient log10()

      Base 10 logarithm.
      Returns:
        base 10 logarithm of the instance

    - #### log1p

          public SparseGradient log1p()

      Shifted natural logarithm.
      Specified by:
        `log1p` in interface `RealFieldElement<SparseGradient>`
      Returns:
        logarithm of one plus the instance

    - #### cos

          public SparseGradient cos()

      Cosine operation.
      Specified by:
        `cos` in interface `RealFieldElement<SparseGradient>`
      Returns:
        cos(this)

    - #### sin

          public SparseGradient sin()

      Sine operation.
      Specified by:
        `sin` in interface `RealFieldElement<SparseGradient>`
      Returns:
        sin(this)

    - #### tan

          public SparseGradient tan()

      Tangent operation.
      Specified by:
        `tan` in interface `RealFieldElement<SparseGradient>`
      Returns:
        tan(this)

    - #### acos

          public SparseGradient acos()

      Arc cosine operation.
      Specified by:
        `acos` in interface `RealFieldElement<SparseGradient>`
      Returns:
        acos(this)

    - #### asin

          public SparseGradient asin()

      Arc sine operation.
      Specified by:
        `asin` in interface `RealFieldElement<SparseGradient>`
      Returns:
        asin(this)

    - #### atan

          public SparseGradient atan()

      Arc tangent operation.
      Specified by:
        `atan` in interface `RealFieldElement<SparseGradient>`
      Returns:
        atan(this)

    - #### atan2

          public SparseGradient atan2(SparseGradient x)

      Two arguments arc tangent operation.
      Specified by:
        `atan2` in interface `RealFieldElement<SparseGradient>`
      Parameters:
        `x` - second argument of the arc tangent
      Returns:
        atan2(this, x)

    - #### atan2

          public static SparseGradient atan2(SparseGradient y,
                             SparseGradient x)

      Two arguments arc tangent operation.
      Parameters:
        `y` - first argument of the arc tangent
        `x` - second argument of the arc tangent
      Returns:
        atan2(y, x)

    - #### cosh

          public SparseGradient cosh()

      Hyperbolic cosine operation.
      Specified by:
        `cosh` in interface `RealFieldElement<SparseGradient>`
      Returns:
        cosh(this)

    - #### sinh

          public SparseGradient sinh()

      Hyperbolic sine operation.
      Specified by:
        `sinh` in interface `RealFieldElement<SparseGradient>`
      Returns:
        sinh(this)

    - #### tanh

          public SparseGradient tanh()

      Hyperbolic tangent operation.
      Specified by:
        `tanh` in interface `RealFieldElement<SparseGradient>`
      Returns:
        tanh(this)

    - #### acosh

          public SparseGradient acosh()

      Inverse hyperbolic cosine operation.
      Specified by:
        `acosh` in interface `RealFieldElement<SparseGradient>`
      Returns:
        acosh(this)

    - #### asinh

          public SparseGradient asinh()

      Inverse hyperbolic sine operation.
      Specified by:
        `asinh` in interface `RealFieldElement<SparseGradient>`
      Returns:
        asin(this)

    - #### atanh

          public SparseGradient atanh()

      Inverse hyperbolic tangent operation.
      Specified by:
        `atanh` in interface `RealFieldElement<SparseGradient>`
      Returns:
        atanh(this)

    - #### toDegrees

          public SparseGradient toDegrees()

      Convert radians to degrees, with error of less than 0.5 ULP
      Returns:
        instance converted into degrees

    - #### toRadians

          public SparseGradient toRadians()

      Convert degrees to radians, with error of less than 0.5 ULP
      Returns:
        instance converted into radians

    - #### taylor

          public double taylor(double... delta)

      Evaluate Taylor expansion of a sparse gradient.
      Parameters:
        `delta` - parameters offsets (Δx, Δy, ...)
      Returns:
        value of the Taylor expansion at x + Δx, y + Δy, ...

    - #### compose

          public SparseGradient compose(double f0,
                               double f1)

      Compute composition of the instance by a univariate function.
      Parameters:
        `f0` - value of the function at (i.e. f(`getValue()`))
        `f1` - first derivative of the function at the current point (i.e. f'(`getValue()`))
      Returns:
        f(this)

    - #### linearCombination

          public SparseGradient linearCombination(SparseGradient[] a,
                                         SparseGradient[] b)
                                           throws DimensionMismatchException

      Compute a linear combination.
      Specified by:
        `linearCombination` in interface `RealFieldElement<SparseGradient>`
      Parameters:
        `a` - Factors.
        `b` - Factors.
      Returns:
        `Σi ai bi`.
      Throws:
        `DimensionMismatchException` - if arrays dimensions don't match

    - #### linearCombination

          public SparseGradient linearCombination(double[] a,
                                         SparseGradient[] b)

      Compute a linear combination.
      Specified by:
        `linearCombination` in interface `RealFieldElement<SparseGradient>`
      Parameters:
        `a` - Factors.
        `b` - Factors.
      Returns:
        `Σi ai bi`.

    - #### linearCombination

          public SparseGradient linearCombination(SparseGradient a1,
                                         SparseGradient b1,
                                         SparseGradient a2,
                                         SparseGradient b2)

      Compute a linear combination.
      Specified by:
        `linearCombination` in interface `RealFieldElement<SparseGradient>`
      Parameters:
        `a1` - first factor of the first term
        `b1` - second factor of the first term
        `a2` - first factor of the second term
        `b2` - second factor of the second term
      Returns:
        a1×b1 + a2×b2
      See Also:
        `RealFieldElement.linearCombination(Object, Object, Object, Object, Object, Object)`, `RealFieldElement.linearCombination(Object, Object, Object, Object, Object, Object, Object, Object)`

    - #### linearCombination

          public SparseGradient linearCombination(double a1,
                                         SparseGradient b1,
                                         double a2,
                                         SparseGradient b2)

      Compute a linear combination.
      Specified by:
        `linearCombination` in interface `RealFieldElement<SparseGradient>`
      Parameters:
        `a1` - first factor of the first term
        `b1` - second factor of the first term
        `a2` - first factor of the second term
        `b2` - second factor of the second term
      Returns:
        a1×b1 + a2×b2
      See Also:
        `RealFieldElement.linearCombination(double, Object, double, Object, double, Object)`, `RealFieldElement.linearCombination(double, Object, double, Object, double, Object, double, Object)`

    - #### linearCombination

          public SparseGradient linearCombination(SparseGradient a1,
                                         SparseGradient b1,
                                         SparseGradient a2,
                                         SparseGradient b2,
                                         SparseGradient a3,
                                         SparseGradient b3)

      Compute a linear combination.
      Specified by:
        `linearCombination` in interface `RealFieldElement<SparseGradient>`
      Parameters:
        `a1` - first factor of the first term
        `b1` - second factor of the first term
        `a2` - first factor of the second term
        `b2` - second factor of the second term
        `a3` - first factor of the third term
        `b3` - second factor of the third term
      Returns:
        a1×b1 + a2×b2 + a3×b3
      See Also:
        `RealFieldElement.linearCombination(Object, Object, Object, Object)`, `RealFieldElement.linearCombination(Object, Object, Object, Object, Object, Object, Object, Object)`

    - #### linearCombination

          public SparseGradient linearCombination(double a1,
                                         SparseGradient b1,
                                         double a2,
                                         SparseGradient b2,
                                         double a3,
                                         SparseGradient b3)

      Compute a linear combination.
      Specified by:
        `linearCombination` in interface `RealFieldElement<SparseGradient>`
      Parameters:
        `a1` - first factor of the first term
        `b1` - second factor of the first term
        `a2` - first factor of the second term
        `b2` - second factor of the second term
        `a3` - first factor of the third term
        `b3` - second factor of the third term
      Returns:
        a1×b1 + a2×b2 + a3×b3
      See Also:
        `RealFieldElement.linearCombination(double, Object, double, Object)`, `RealFieldElement.linearCombination(double, Object, double, Object, double, Object, double, Object)`

    - #### linearCombination

          public SparseGradient linearCombination(SparseGradient a1,
                                         SparseGradient b1,
                                         SparseGradient a2,
                                         SparseGradient b2,
                                         SparseGradient a3,
                                         SparseGradient b3,
                                         SparseGradient a4,
                                         SparseGradient b4)

      Compute a linear combination.
      Specified by:
        `linearCombination` in interface `RealFieldElement<SparseGradient>`
      Parameters:
        `a1` - first factor of the first term
        `b1` - second factor of the first term
        `a2` - first factor of the second term
        `b2` - second factor of the second term
        `a3` - first factor of the third term
        `b3` - second factor of the third term
        `a4` - first factor of the third term
        `b4` - second factor of the third term
      Returns:
        a1×b1 + a2×b2 + a3×b3 + a4×b4
      See Also:
        `RealFieldElement.linearCombination(Object, Object, Object, Object)`, `RealFieldElement.linearCombination(Object, Object, Object, Object, Object, Object)`

    - #### linearCombination

          public SparseGradient linearCombination(double a1,
                                         SparseGradient b1,
                                         double a2,
                                         SparseGradient b2,
                                         double a3,
                                         SparseGradient b3,
                                         double a4,
                                         SparseGradient b4)

      Compute a linear combination.
      Specified by:
        `linearCombination` in interface `RealFieldElement<SparseGradient>`
      Parameters:
        `a1` - first factor of the first term
        `b1` - second factor of the first term
        `a2` - first factor of the second term
        `b2` - second factor of the second term
        `a3` - first factor of the third term
        `b3` - second factor of the third term
        `a4` - first factor of the third term
        `b4` - second factor of the third term
      Returns:
        a1×b1 + a2×b2 + a3×b3 + a4×b4
      See Also:
        `RealFieldElement.linearCombination(double, Object, double, Object)`, `RealFieldElement.linearCombination(double, Object, double, Object, double, Object)`

    - #### equals

          public boolean equals(Object other)

      Test for the equality of two sparse gradients.

      Sparse gradients are considered equal if they have the same value and the same derivatives.

      Overrides:
        `equals` in class `Object`
      Parameters:
        `other` - Object to test for equality to this
      Returns:
        true if two sparse gradients are equal

    - #### hashCode

          public int hashCode()

      Get a hashCode for the derivative structure.
      Overrides:
        `hashCode` in class `Object`
      Returns:
        a hash code value for this object
      Since:
        3.2

Copyright © 2003–2014 The Apache Software Foundation. All rights reserved.