You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by lu...@apache.org on 2013/10/27 11:10:17 UTC
svn commit: r1536082 -
/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/differentiation/SparseGradient.java
Author: luc
Date: Sun Oct 27 10:10:16 2013
New Revision: 1536082
URL: http://svn.apache.org/r1536082
Log:
Removed Java6 @Override annotations.
@Override is needed in Java6 when implementing an interface, but is
allowed only when overriding a previous implementation in Java5. Apache
Commons Math currently targets Java5, so these annotations were
spurious.
Modified:
commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/differentiation/SparseGradient.java
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/differentiation/SparseGradient.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/differentiation/SparseGradient.java?rev=1536082&r1=1536081&r2=1536082&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/differentiation/SparseGradient.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/analysis/differentiation/SparseGradient.java Sun Oct 27 10:10:16 2013
@@ -34,7 +34,7 @@ import org.apache.commons.math3.util.Pre
* First derivative computation with large number of variables.
* <p>
* This class plays a similar role to {@link DerivativeStructure}, with
- * a focus on efficiency when dealing with large numer of independent variables
+ * 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
* {@link DerivativeStructure} and use less memory.
@@ -70,7 +70,7 @@ public class SparseGradient implements R
/** Internal constructor.
* @param value value of the function
- * @param scale scaling factor to apply to all deerivatives
+ * @param scale scaling factor to apply to all derivatives
* @param derivatives derivatives map, a deep copy will be performed,
* so the map given here will remain safe from changes in the new instance,
* may be null to create an empty derivatives map, i.e. a constant value
@@ -131,7 +131,6 @@ public class SparseGradient implements R
}
/** {@inheritDoc} */
- @Override
public double getReal() {
return value;
}
@@ -259,7 +258,6 @@ public class SparseGradient implements R
}
/** {@inheritDoc} */
- @Override
public SparseGradient multiply(final int n) {
return new SparseGradient(value * n, n, derivatives);
}
@@ -290,13 +288,11 @@ public class SparseGradient implements R
}
/** {@inheritDoc} */
- @Override
public SparseGradient negate() {
return new SparseGradient(-value, -1.0, derivatives);
}
/** {@inheritDoc} */
- @Override
public Field<SparseGradient> getField() {
return new Field<SparseGradient>() {
@@ -319,13 +315,11 @@ public class SparseGradient implements R
}
/** {@inheritDoc} */
- @Override
public SparseGradient remainder(final double a) {
return new SparseGradient(FastMath.IEEEremainder(value, a), derivatives);
}
/** {@inheritDoc} */
- @Override
public SparseGradient remainder(final SparseGradient a) {
// compute k such that lhs % rhs = lhs - k rhs
@@ -337,7 +331,6 @@ public class SparseGradient implements R
}
/** {@inheritDoc} */
- @Override
public SparseGradient abs() {
if (Double.doubleToLongBits(value) < 0) {
// we use the bits representation to also handle -0.0
@@ -348,37 +341,31 @@ public class SparseGradient implements R
}
/** {@inheritDoc} */
- @Override
public SparseGradient ceil() {
return createConstant(FastMath.ceil(value));
}
/** {@inheritDoc} */
- @Override
public SparseGradient floor() {
return createConstant(FastMath.floor(value));
}
/** {@inheritDoc} */
- @Override
public SparseGradient rint() {
return createConstant(FastMath.rint(value));
}
/** {@inheritDoc} */
- @Override
public long round() {
return FastMath.round(value);
}
/** {@inheritDoc} */
- @Override
public SparseGradient signum() {
return createConstant(FastMath.signum(value));
}
/** {@inheritDoc} */
- @Override
public SparseGradient copySign(final SparseGradient sign) {
final long m = Double.doubleToLongBits(value);
final long s = Double.doubleToLongBits(sign.value);
@@ -389,7 +376,6 @@ public class SparseGradient implements R
}
/** {@inheritDoc} */
- @Override
public SparseGradient copySign(final double sign) {
final long m = Double.doubleToLongBits(value);
final long s = Double.doubleToLongBits(sign);
@@ -400,7 +386,6 @@ public class SparseGradient implements R
}
/** {@inheritDoc} */
- @Override
public SparseGradient scalb(final int n) {
final SparseGradient out = new SparseGradient(FastMath.scalb(value, n), Collections.<Integer, Double> emptyMap());
for (Map.Entry<Integer, Double> entry : derivatives.entrySet()) {
@@ -410,7 +395,6 @@ public class SparseGradient implements R
}
/** {@inheritDoc} */
- @Override
public SparseGradient hypot(final SparseGradient y) {
if (Double.isInfinite(value) || Double.isInfinite(y.value)) {
return createConstant(Double.POSITIVE_INFINITY);
@@ -421,10 +405,10 @@ public class SparseGradient implements R
final int expX = FastMath.getExponent(value);
final int expY = FastMath.getExponent(y.value);
if (expX > expY + 27) {
- // y is neglectible with respect to x
+ // y is negligible with respect to x
return abs();
} else if (expY > expX + 27) {
- // x is neglectible with respect to y
+ // x is negligible with respect to y
return y.abs();
} else {
@@ -466,27 +450,23 @@ public class SparseGradient implements R
}
/** {@inheritDoc} */
- @Override
public SparseGradient reciprocal() {
return new SparseGradient(1.0 / value, -1.0 / (value * value), derivatives);
}
/** {@inheritDoc} */
- @Override
public SparseGradient sqrt() {
final double sqrt = FastMath.sqrt(value);
return new SparseGradient(sqrt, 0.5 / sqrt, derivatives);
}
/** {@inheritDoc} */
- @Override
public SparseGradient cbrt() {
final double cbrt = FastMath.cbrt(value);
return new SparseGradient(cbrt, 1.0 / (3 * cbrt * cbrt), derivatives);
}
/** {@inheritDoc} */
- @Override
public SparseGradient rootN(final int n) {
if (n == 2) {
return sqrt();
@@ -499,13 +479,11 @@ public class SparseGradient implements R
}
/** {@inheritDoc} */
- @Override
public SparseGradient pow(final double p) {
return new SparseGradient(FastMath.pow(value, p), p * FastMath.pow(value, p - 1), derivatives);
}
/** {@inheritDoc} */
- @Override
public SparseGradient pow(final int n) {
if (n == 0) {
return getField().getOne();
@@ -516,7 +494,6 @@ public class SparseGradient implements R
}
/** {@inheritDoc} */
- @Override
public SparseGradient pow(final SparseGradient e) {
return log().multiply(e).exp();
}
@@ -542,20 +519,17 @@ public class SparseGradient implements R
}
/** {@inheritDoc} */
- @Override
public SparseGradient exp() {
final double e = FastMath.exp(value);
return new SparseGradient(e, e, derivatives);
}
/** {@inheritDoc} */
- @Override
public SparseGradient expm1() {
return new SparseGradient(FastMath.expm1(value), FastMath.exp(value), derivatives);
}
/** {@inheritDoc} */
- @Override
public SparseGradient log() {
return new SparseGradient(FastMath.log(value), 1.0 / value, derivatives);
}
@@ -568,50 +542,42 @@ public class SparseGradient implements R
}
/** {@inheritDoc} */
- @Override
public SparseGradient log1p() {
return new SparseGradient(FastMath.log1p(value), 1.0 / (1.0 + value), derivatives);
}
/** {@inheritDoc} */
- @Override
public SparseGradient cos() {
return new SparseGradient(FastMath.cos(value), -FastMath.sin(value), derivatives);
}
/** {@inheritDoc} */
- @Override
public SparseGradient sin() {
return new SparseGradient(FastMath.sin(value), FastMath.cos(value), derivatives);
}
/** {@inheritDoc} */
- @Override
public SparseGradient tan() {
final double t = FastMath.tan(value);
return new SparseGradient(t, 1 + t * t, derivatives);
}
/** {@inheritDoc} */
- @Override
public SparseGradient acos() {
return new SparseGradient(FastMath.acos(value), -1.0 / FastMath.sqrt(1 - value * value), derivatives);
}
/** {@inheritDoc} */
- @Override
public SparseGradient asin() {
return new SparseGradient(FastMath.asin(value), 1.0 / FastMath.sqrt(1 - value * value), derivatives);
}
/** {@inheritDoc} */
- @Override
public SparseGradient atan() {
return new SparseGradient(FastMath.atan(value), 1.0 / (1 + value * value), derivatives);
}
/** {@inheritDoc} */
- @Override
public SparseGradient atan2(final SparseGradient x) {
// compute r = sqrt(x^2+y^2)
@@ -648,38 +614,32 @@ public class SparseGradient implements R
}
/** {@inheritDoc} */
- @Override
public SparseGradient cosh() {
return new SparseGradient(FastMath.cosh(value), FastMath.sinh(value), derivatives);
}
/** {@inheritDoc} */
- @Override
public SparseGradient sinh() {
return new SparseGradient(FastMath.sinh(value), FastMath.cosh(value), derivatives);
}
/** {@inheritDoc} */
- @Override
public SparseGradient tanh() {
final double t = FastMath.tanh(value);
return new SparseGradient(t, 1 - t * t, derivatives);
}
/** {@inheritDoc} */
- @Override
public SparseGradient acosh() {
return new SparseGradient(FastMath.acosh(value), 1.0 / FastMath.sqrt(value * value - 1.0), derivatives);
}
/** {@inheritDoc} */
- @Override
public SparseGradient asinh() {
return new SparseGradient(FastMath.asinh(value), 1.0 / FastMath.sqrt(value * value + 1.0), derivatives);
}
/** {@inheritDoc} */
- @Override
public SparseGradient atanh() {
return new SparseGradient(FastMath.atanh(value), 1.0 / (1.0 - value * value), derivatives);
}
@@ -721,7 +681,6 @@ public class SparseGradient implements R
}
/** {@inheritDoc} */
- @Override
public SparseGradient linearCombination(final SparseGradient[] a,
final SparseGradient[] b)
throws DimensionMismatchException {
@@ -748,7 +707,6 @@ public class SparseGradient implements R
}
/** {@inheritDoc} */
- @Override
public SparseGradient linearCombination(final double[] a, final SparseGradient[] b) {
// compute a simple value, with all partial derivatives
@@ -769,7 +727,6 @@ public class SparseGradient implements R
}
/** {@inheritDoc} */
- @Override
public SparseGradient linearCombination(final SparseGradient a1, final SparseGradient b1,
final SparseGradient a2, final SparseGradient b2) {
@@ -784,7 +741,6 @@ public class SparseGradient implements R
}
/** {@inheritDoc} */
- @Override
public SparseGradient linearCombination(final double a1, final SparseGradient b1,
final double a2, final SparseGradient b2) {
@@ -799,7 +755,6 @@ public class SparseGradient implements R
}
/** {@inheritDoc} */
- @Override
public SparseGradient linearCombination(final SparseGradient a1, final SparseGradient b1,
final SparseGradient a2, final SparseGradient b2,
final SparseGradient a3, final SparseGradient b3) {
@@ -817,7 +772,6 @@ public class SparseGradient implements R
}
/** {@inheritDoc} */
- @Override
public SparseGradient linearCombination(final double a1, final SparseGradient b1,
final double a2, final SparseGradient b2,
final double a3, final SparseGradient b3) {
@@ -835,7 +789,6 @@ public class SparseGradient implements R
}
/** {@inheritDoc} */
- @Override
public SparseGradient linearCombination(final SparseGradient a1, final SparseGradient b1,
final SparseGradient a2, final SparseGradient b2,
final SparseGradient a3, final SparseGradient b3,
@@ -855,7 +808,6 @@ public class SparseGradient implements R
}
/** {@inheritDoc} */
- @Override
public SparseGradient linearCombination(final double a1, final SparseGradient b1,
final double a2, final SparseGradient b2,
final double a3, final SparseGradient b3,