Fixed wrong naming and typo.
Thanks to Gilles for spotting this! git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1536147 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
4b6b25d558
commit
a6be244e7f
|
@ -235,7 +235,7 @@ public class SparseGradient implements RealFieldElement<SparseGradient>, Seriali
|
|||
* </p>
|
||||
* @param a instance to multiply
|
||||
*/
|
||||
public void multInPlace(final SparseGradient a) {
|
||||
public void multiplyInPlace(final SparseGradient a) {
|
||||
// Derivatives.
|
||||
for (Map.Entry<Integer, Double> entry : derivatives.entrySet()) {
|
||||
derivatives.put(entry.getKey(), a.value * entry.getValue());
|
||||
|
@ -872,7 +872,7 @@ public class SparseGradient implements RealFieldElement<SparseGradient>, Seriali
|
|||
*/
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return 743 + 809 * + 233 * MathUtils.hash(value) + 167 * derivatives.hashCode();
|
||||
return 743 + 809 * MathUtils.hash(value) + 167 * derivatives.hashCode();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -126,7 +126,7 @@ public class SparseGradientTest extends ExtendedFieldElementAbstractTest<SparseG
|
|||
final SparseGradient var1 = SparseGradient.createVariable(id1, v1);
|
||||
final SparseGradient sum = var1.multiply(c1);
|
||||
final SparseGradient mult = SparseGradient.createVariable(id2, v2);
|
||||
mult.multInPlace(var1);
|
||||
mult.multiplyInPlace(var1);
|
||||
sum.addInPlace(mult);
|
||||
Assert.assertEquals(v1 * c1 + v2 * v1, sum.getValue(), 1.0e-15); // returns the value
|
||||
Assert.assertEquals(2, sum.numVars());
|
||||
|
|
Loading…
Reference in New Issue