You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by er...@apache.org on 2010/11/26 18:58:14 UTC
svn commit: r1039484 -
/commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/linear/RealVector.java
Author: erans
Date: Fri Nov 26 17:58:14 2010
New Revision: 1039484
URL: http://svn.apache.org/viewvc?rev=1039484&view=rev
Log:
MATH-430
Deprecation. Replacement available only in "trunk".
Modified:
commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/linear/RealVector.java
Modified: commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/linear/RealVector.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/linear/RealVector.java?rev=1039484&r1=1039483&r2=1039484&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/linear/RealVector.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/linear/RealVector.java Fri Nov 26 17:58:14 2010
@@ -46,208 +46,260 @@ import org.apache.commons.math.exception
* @since 2.0
*/
public interface RealVector {
-
/**
* Acts as if it is implemented as:
- * Entry e = null;
- * for(Iterator<Entry> it = iterator(); it.hasNext(); e = it.next()) {
- * e.setValue(function.value(e.getValue()));
- * }
- * @param function to apply to each successive entry
- * @return this vector
- * @throws MathUserException if function throws it on application to any entry
+ * <pre>
+ * Entry e = null;
+ * for(Iterator<Entry> it = iterator(); it.hasNext(); e = it.next()) {
+ * e.setValue(function.value(e.getValue()));
+ * }
+ * </pre>
+ *
+ * @param function Function to apply to each entry.
+ * @return this vector.
+ * @throws MathUserException if the function throws it.
*/
RealVector mapToSelf(UnivariateRealFunction function) throws MathUserException;
/**
* Acts as if implemented as:
- * return copy().map(function);
- * @param function to apply to each successive entry
- * @return a new vector
- * @throws MathUserException if function throws it on application to any entry
+ * <pre>
+ * return copy().map(function);
+ * </pre>
+ *
+ * @param function Functin to apply to each entry.
+ * @return a new vector.
+ * @throws MathUserException if the function throws it.
*/
RealVector map(UnivariateRealFunction function) throws MathUserException;
/** Class representing a modifiable entry in the vector. */
public abstract class Entry {
-
/** Index of the entry. */
private int index;
- /** Get the value of the entry.
- * @return value of the entry
+ /**
+ * Get the value of the entry.
+ *
+ * @return the value of the entry.
*/
public abstract double getValue();
-
- /** Set the value of the entry.
- * @param value new value for the entry
+ /**
+ * Set the value of the entry.
+ *
+ * @param value New value for the entry.
*/
public abstract void setValue(double value);
-
- /** Get the index of the entry.
- * @return index of the entry
+ /**
+ * Get the index of the entry.
+ *
+ * @return the index of the entry.
*/
public int getIndex() {
return index;
}
-
- /** Set the index of the entry.
- * @param index new index for the entry
+ /**
+ * Set the index of the entry.
+ *
+ * @param index New index for the entry.
*/
public void setIndex(int index) {
this.index = index;
}
-
}
/**
- * Generic dense iterator - starts with index == zero, and hasNext() == true until index == getDimension();
+ * Generic dense iterator.
+ * It iterates in increasing order of the vector index.
+ *
* @return a dense iterator
*/
Iterator<Entry> iterator();
/**
- * Specialized implementations may choose to not iterate over all dimensions, either because those values are
- * unset, or are equal to defaultValue(), or are small enough to be ignored for the purposes of iteration.
+ * Specialized implementations may choose to not iterate over all
+ * dimensions, either because those values are unset, or are equal
+ * to defaultValue(), or are small enough to be ignored for the
+ * purposes of iteration.
* No guarantees are made about order of iteration.
- * In dense implementations, this method will often delegate to {@link #iterator()}
+ * In dense implementations, this method will often delegate to
+ * {@link #iterator()}.
+ *
* @return a sparse iterator
*/
Iterator<Entry> sparseIterator();
/**
- * Returns a (deep) copy of this.
- * @return vector copy
+ * Returns a (deep) copy of this vector.
+ *
+ * @return a vector copy.
*/
RealVector copy();
/**
- * Compute the sum of this and v.
- * @param v vector to be added
- * @return this + v
- * @throws IllegalArgumentException if v is not the same size as this
+ * Compute the sum of this vector and {@code v}.
+ *
+ * @param v Vector to be added.
+ * @return {@code this} + {@code v}.
+ * @throws org.apache.commons.math.exception.DimensionMismatchException
+ * if {@code v} is not the same size as this vector.
*/
- RealVector add(RealVector v)
- throws IllegalArgumentException;
+ RealVector add(RealVector v);
/**
- * Compute the sum of this and v.
- * @param v vector to be added
- * @return this + v
- * @throws IllegalArgumentException if v is not the same size as this
+ * Compute the sum of this vector and {@code v}.
+ *
+ * @param v Vector to be added.
+ * @return {@code this} + {@code v}.
+ * @throws org.apache.commons.math.exception.DimensionMismatchException
+ * if {@code v} is not the same size as this vector.
*/
- RealVector add(double[] v)
- throws IllegalArgumentException;
+ RealVector add(double[] v);
+
/**
- * Compute this minus v.
- * @param v vector to be subtracted
- * @return this + v
- * @throws IllegalArgumentException if v is not the same size as this
+ * Subtract {@code v} from this vector.
+ *
+ * @param v Vector to be subtracted.
+ * @return {@code this} - {@code v}.
+ * @throws org.apache.commons.math.exception.DimensionMismatchException
+ * if {@code v} is not the same size as this vector.
*/
- RealVector subtract(RealVector v)
- throws IllegalArgumentException;
+ RealVector subtract(RealVector v);
/**
- * Compute this minus v.
- * @param v vector to be subtracted
- * @return this - v
- * @throws IllegalArgumentException if v is not the same size as this
+ * Subtract {@code v} from this vector.
+ *
+ * @param v Vector to be subtracted.
+ * @return {@code this} - {@code v}.
+ * @throws org.apache.commons.math.exception.DimensionMismatchException
+ * if {@code v} is not the same size as this vector.
*/
- RealVector subtract(double[] v)
- throws IllegalArgumentException;
+ RealVector subtract(double[] v);
/**
- * Map an addition operation to each entry.
- * @param d value to be added to each entry
- * @return this + d
+ * Add a value to each entry.
+ *
+ * @param d Value to be added to each entry.
+ * @return {@code this} + {@code d}.
*/
RealVector mapAdd(double d);
/**
- * Map an addition operation to each entry.
- * <p>The instance <strong>is</strong> changed by this method.</p>
- * @param d value to be added to each entry
- * @return for convenience, return this
+ * Add a value to each entry.
+ * The instance is changed in-place.
+ *
+ * @param d Value to be added to each entry.
+ * @return {@code this}.
*/
RealVector mapAddToSelf(double d);
/**
- * Map a subtraction operation to each entry.
- * @param d value to be subtracted to each entry
- * @return this - d
+ * Subtract a value from each entry.
+ *
+ * @param d Value to be subtracted.
+ * @return {@code this} - {@code d}.
*/
RealVector mapSubtract(double d);
/**
- * Map a subtraction operation to each entry.
- * <p>The instance <strong>is</strong> changed by this method.</p>
- * @param d value to be subtracted to each entry
- * @return for convenience, return this
+ * Subtract a value from each entry.
+ * The instance is changed in-place.
+ *
+ * @param d Value to be subtracted.
+ * @return {@code this}.
*/
RealVector mapSubtractToSelf(double d);
/**
- * Map a multiplication operation to each entry.
- * @param d value to multiply all entries by
- * @return this * d
+ * Multiply each entry.
+ *
+ * @param d Multiplication factor.
+ * @return {@code this} * {@code d}.
*/
RealVector mapMultiply(double d);
/**
- * Map a multiplication operation to each entry.
- * <p>The instance <strong>is</strong> changed by this method.</p>
- * @param d value to multiply all entries by
- * @return for convenience, return this
+ * Multiply each entry.
+ * The instance is changed in-place.
+ *
+ * @param d Multiplication factor.
+ * @return {@code this}.
*/
RealVector mapMultiplyToSelf(double d);
/**
- * Map a division operation to each entry.
- * @param d value to divide all entries by
- * @return this / d
+ * Divide each entry.
+ *
+ * @param d Value to divide by.
+ * @return {@code this} / {@code d}.
*/
RealVector mapDivide(double d);
/**
- * Map a division operation to each entry.
- * <p>The instance <strong>is</strong> changed by this method.</p>
- * @param d value to divide all entries by
- * @return for convenience, return this
+ * Divide each entry.
+ * The instance is changed in-place.
+ *
+ * @param d Value to divide by.
+ * @return {@code this}.
*/
RealVector mapDivideToSelf(double d);
/**
* Map a power operation to each entry.
- * @param d value to raise all entries to
- * @return this ^ d
+ *
+ * @param d Operator value.
+ * @return a mapped copy of the vector.
+ * @deprecated in 2.2 (to be removed in 3.0). Please use
+ * {@link #map(UnivariateRealFunction)} directly with
+ * the function classes in package
+ * {@link org.apache.commons.math.analysis.function}.
*/
RealVector mapPow(double d);
/**
* Map a power operation to each entry.
- * <p>The instance <strong>is</strong> changed by this method.</p>
- * @param d value to raise all entries to
- * @return for convenience, return this
+ * The instance is changed in-place.
+ *
+ * @param d Operator value.
+ * @return the mapped vector.
+ * @deprecated in 2.2 (to be removed in 3.0). Please use
+ * {@link #mapToSelf(UnivariateRealFunction)} directly with
+ * the function classes in package
+ * {@link org.apache.commons.math.analysis.function}.
*/
RealVector mapPowToSelf(double d);
/**
* Map the {@link Math#exp(double)} function to each entry.
- * @return a vector containing the result of applying the function to each entry
+ *
+ * @return a mapped copy of the vector.
+ * @deprecated in 2.2 (to be removed in 3.0). Please use
+ * {@link #map(UnivariateRealFunction)} directly with
+ * the function classes in package
+ * {@link org.apache.commons.math.analysis.function}.
*/
RealVector mapExp();
/**
- * Map the {@link Math#exp(double)} function to each entry.
- * <p>The instance <strong>is</strong> changed by this method.</p>
- * @return for convenience, return this
+ * Map {@link Math#exp(double)} operation to each entry.
+ * The instance is changed in-place.
+ *
+ * @return the mapped vector.
+ * @deprecated in 2.2 (to be removed in 3.0). Please use
+ * {@link #mapToSelf(UnivariateRealFunction)} directly with
+ * the function classes in package
+ * {@link org.apache.commons.math.analysis.function}.
*/
RealVector mapExpToSelf();
/**
* Map the {@link Math#expm1(double)} function to each entry.
* @return a vector containing the result of applying the function to each entry
+ * @deprecated in 2.2 (to be removed in 3.0). Please use
+ * {@link #map(UnivariateRealFunction)} directly with
+ * the function classes in package
+ * {@link org.apache.commons.math.analysis.function}.
*/
RealVector mapExpm1();
@@ -255,12 +307,20 @@ public interface RealVector {
* Map the {@link Math#expm1(double)} function to each entry.
* <p>The instance <strong>is</strong> changed by this method.</p>
* @return for convenience, return this
+ * @deprecated in 2.2 (to be removed in 3.0). Please use
+ * {@link #mapToSelf(UnivariateRealFunction)} directly with
+ * the function classes in package
+ * {@link org.apache.commons.math.analysis.function}.
*/
RealVector mapExpm1ToSelf();
/**
* Map the {@link Math#log(double)} function to each entry.
* @return a vector containing the result of applying the function to each entry
+ * @deprecated in 2.2 (to be removed in 3.0). Please use
+ * {@link #map(UnivariateRealFunction)} directly with
+ * the function classes in package
+ * {@link org.apache.commons.math.analysis.function}.
*/
RealVector mapLog();
@@ -268,12 +328,20 @@ public interface RealVector {
* Map the {@link Math#log(double)} function to each entry.
* <p>The instance <strong>is</strong> changed by this method.</p>
* @return for convenience, return this
+ * @deprecated in 2.2 (to be removed in 3.0). Please use
+ * {@link #mapToSelf(UnivariateRealFunction)} directly with
+ * the function classes in package
+ * {@link org.apache.commons.math.analysis.function}.
*/
RealVector mapLogToSelf();
/**
* Map the {@link Math#log10(double)} function to each entry.
* @return a vector containing the result of applying the function to each entry
+ * @deprecated in 2.2 (to be removed in 3.0). Please use
+ * {@link #map(UnivariateRealFunction)} directly with
+ * the function classes in package
+ * {@link org.apache.commons.math.analysis.function}.
*/
RealVector mapLog10();
@@ -281,12 +349,20 @@ public interface RealVector {
* Map the {@link Math#log10(double)} function to each entry.
* <p>The instance <strong>is</strong> changed by this method.</p>
* @return for convenience, return this
+ * @deprecated in 2.2 (to be removed in 3.0). Please use
+ * {@link #mapToSelf(UnivariateRealFunction)} directly with
+ * the function classes in package
+ * {@link org.apache.commons.math.analysis.function}.
*/
RealVector mapLog10ToSelf();
/**
* Map the {@link Math#log1p(double)} function to each entry.
* @return a vector containing the result of applying the function to each entry
+ * @deprecated in 2.2 (to be removed in 3.0). Please use
+ * {@link #map(UnivariateRealFunction)} directly with
+ * the function classes in package
+ * {@link org.apache.commons.math.analysis.function}.
*/
RealVector mapLog1p();
@@ -294,12 +370,20 @@ public interface RealVector {
* Map the {@link Math#log1p(double)} function to each entry.
* <p>The instance <strong>is</strong> changed by this method.</p>
* @return for convenience, return this
+ * @deprecated in 2.2 (to be removed in 3.0). Please use
+ * {@link #mapToSelf(UnivariateRealFunction)} directly with
+ * the function classes in package
+ * {@link org.apache.commons.math.analysis.function}.
*/
RealVector mapLog1pToSelf();
/**
* Map the {@link Math#cosh(double)} function to each entry.
* @return a vector containing the result of applying the function to each entry
+ * @deprecated in 2.2 (to be removed in 3.0). Please use
+ * {@link #map(UnivariateRealFunction)} directly with
+ * the function classes in package
+ * {@link org.apache.commons.math.analysis.function}.
*/
RealVector mapCosh();
@@ -307,12 +391,20 @@ public interface RealVector {
* Map the {@link Math#cosh(double)} function to each entry.
* <p>The instance <strong>is</strong> changed by this method.</p>
* @return for convenience, return this
+ * @deprecated in 2.2 (to be removed in 3.0). Please use
+ * {@link #mapToSelf(UnivariateRealFunction)} directly with
+ * the function classes in package
+ * {@link org.apache.commons.math.analysis.function}.
*/
RealVector mapCoshToSelf();
/**
* Map the {@link Math#sinh(double)} function to each entry.
* @return a vector containing the result of applying the function to each entry
+ * @deprecated in 2.2 (to be removed in 3.0). Please use
+ * {@link #map(UnivariateRealFunction)} directly with
+ * the function classes in package
+ * {@link org.apache.commons.math.analysis.function}.
*/
RealVector mapSinh();
@@ -320,12 +412,20 @@ public interface RealVector {
* Map the {@link Math#sinh(double)} function to each entry.
* <p>The instance <strong>is</strong> changed by this method.</p>
* @return for convenience, return this
+ * @deprecated in 2.2 (to be removed in 3.0). Please use
+ * {@link #mapToSelf(UnivariateRealFunction)} directly with
+ * the function classes in package
+ * {@link org.apache.commons.math.analysis.function}.
*/
RealVector mapSinhToSelf();
/**
* Map the {@link Math#tanh(double)} function to each entry.
* @return a vector containing the result of applying the function to each entry
+ * @deprecated in 2.2 (to be removed in 3.0). Please use
+ * {@link #map(UnivariateRealFunction)} directly with
+ * the function classes in package
+ * {@link org.apache.commons.math.analysis.function}.
*/
RealVector mapTanh();
@@ -333,12 +433,20 @@ public interface RealVector {
* Map the {@link Math#tanh(double)} function to each entry.
* <p>The instance <strong>is</strong> changed by this method.</p>
* @return for convenience, return this
+ * @deprecated in 2.2 (to be removed in 3.0). Please use
+ * {@link #mapToSelf(UnivariateRealFunction)} directly with
+ * the function classes in package
+ * {@link org.apache.commons.math.analysis.function}.
*/
RealVector mapTanhToSelf();
/**
* Map the {@link Math#cos(double)} function to each entry.
* @return a vector containing the result of applying the function to each entry
+ * @deprecated in 2.2 (to be removed in 3.0). Please use
+ * {@link #map(UnivariateRealFunction)} directly with
+ * the function classes in package
+ * {@link org.apache.commons.math.analysis.function}.
*/
RealVector mapCos();
@@ -346,12 +454,20 @@ public interface RealVector {
* Map the {@link Math#cos(double)} function to each entry.
* <p>The instance <strong>is</strong> changed by this method.</p>
* @return for convenience, return this
+ * @deprecated in 2.2 (to be removed in 3.0). Please use
+ * {@link #mapToSelf(UnivariateRealFunction)} directly with
+ * the function classes in package
+ * {@link org.apache.commons.math.analysis.function}.
*/
RealVector mapCosToSelf();
/**
* Map the {@link Math#sin(double)} function to each entry.
* @return a vector containing the result of applying the function to each entry
+ * @deprecated in 2.2 (to be removed in 3.0). Please use
+ * {@link #map(UnivariateRealFunction)} directly with
+ * the function classes in package
+ * {@link org.apache.commons.math.analysis.function}.
*/
RealVector mapSin();
@@ -359,12 +475,20 @@ public interface RealVector {
* Map the {@link Math#sin(double)} function to each entry.
* <p>The instance <strong>is</strong> changed by this method.</p>
* @return for convenience, return this
+ * @deprecated in 2.2 (to be removed in 3.0). Please use
+ * {@link #mapToSelf(UnivariateRealFunction)} directly with
+ * the function classes in package
+ * {@link org.apache.commons.math.analysis.function}.
*/
RealVector mapSinToSelf();
/**
* Map the {@link Math#tan(double)} function to each entry.
* @return a vector containing the result of applying the function to each entry
+ * @deprecated in 2.2 (to be removed in 3.0). Please use
+ * {@link #map(UnivariateRealFunction)} directly with
+ * the function classes in package
+ * {@link org.apache.commons.math.analysis.function}.
*/
RealVector mapTan();
@@ -372,12 +496,20 @@ public interface RealVector {
* Map the {@link Math#tan(double)} function to each entry.
* <p>The instance <strong>is</strong> changed by this method.</p>
* @return for convenience, return this
+ * @deprecated in 2.2 (to be removed in 3.0). Please use
+ * {@link #mapToSelf(UnivariateRealFunction)} directly with
+ * the function classes in package
+ * {@link org.apache.commons.math.analysis.function}.
*/
RealVector mapTanToSelf();
/**
* Map the {@link Math#acos(double)} function to each entry.
* @return a vector containing the result of applying the function to each entry
+ * @deprecated in 2.2 (to be removed in 3.0). Please use
+ * {@link #map(UnivariateRealFunction)} directly with
+ * the function classes in package
+ * {@link org.apache.commons.math.analysis.function}.
*/
RealVector mapAcos();
@@ -385,12 +517,20 @@ public interface RealVector {
* Map the {@link Math#acos(double)} function to each entry.
* <p>The instance <strong>is</strong> changed by this method.</p>
* @return for convenience, return this
+ * @deprecated in 2.2 (to be removed in 3.0). Please use
+ * {@link #mapToSelf(UnivariateRealFunction)} directly with
+ * the function classes in package
+ * {@link org.apache.commons.math.analysis.function}.
*/
RealVector mapAcosToSelf();
/**
* Map the {@link Math#asin(double)} function to each entry.
* @return a vector containing the result of applying the function to each entry
+ * @deprecated in 2.2 (to be removed in 3.0). Please use
+ * {@link #map(UnivariateRealFunction)} directly with
+ * the function classes in package
+ * {@link org.apache.commons.math.analysis.function}.
*/
RealVector mapAsin();
@@ -398,12 +538,20 @@ public interface RealVector {
* Map the {@link Math#asin(double)} function to each entry.
* <p>The instance <strong>is</strong> changed by this method.</p>
* @return for convenience, return this
+ * @deprecated in 2.2 (to be removed in 3.0). Please use
+ * {@link #mapToSelf(UnivariateRealFunction)} directly with
+ * the function classes in package
+ * {@link org.apache.commons.math.analysis.function}.
*/
RealVector mapAsinToSelf();
/**
* Map the {@link Math#atan(double)} function to each entry.
* @return a vector containing the result of applying the function to each entry
+ * @deprecated in 2.2 (to be removed in 3.0). Please use
+ * {@link #map(UnivariateRealFunction)} directly with
+ * the function classes in package
+ * {@link org.apache.commons.math.analysis.function}.
*/
RealVector mapAtan();
@@ -411,12 +559,20 @@ public interface RealVector {
* Map the {@link Math#atan(double)} function to each entry.
* <p>The instance <strong>is</strong> changed by this method.</p>
* @return for convenience, return this
+ * @deprecated in 2.2 (to be removed in 3.0). Please use
+ * {@link #mapToSelf(UnivariateRealFunction)} directly with
+ * the function classes in package
+ * {@link org.apache.commons.math.analysis.function}.
*/
RealVector mapAtanToSelf();
/**
* Map the 1/x function to each entry.
* @return a vector containing the result of applying the function to each entry
+ * @deprecated in 2.2 (to be removed in 3.0). Please use
+ * {@link #map(UnivariateRealFunction)} directly with
+ * the function classes in package
+ * {@link org.apache.commons.math.analysis.function}.
*/
RealVector mapInv();
@@ -424,12 +580,20 @@ public interface RealVector {
* Map the 1/x function to each entry.
* <p>The instance <strong>is</strong> changed by this method.</p>
* @return for convenience, return this
+ * @deprecated in 2.2 (to be removed in 3.0). Please use
+ * {@link #mapToSelf(UnivariateRealFunction)} directly with
+ * the function classes in package
+ * {@link org.apache.commons.math.analysis.function}.
*/
RealVector mapInvToSelf();
/**
* Map the {@link Math#abs(double)} function to each entry.
* @return a vector containing the result of applying the function to each entry
+ * @deprecated in 2.2 (to be removed in 3.0). Please use
+ * {@link #map(UnivariateRealFunction)} directly with
+ * the function classes in package
+ * {@link org.apache.commons.math.analysis.function}.
*/
RealVector mapAbs();
@@ -437,12 +601,20 @@ public interface RealVector {
* Map the {@link Math#abs(double)} function to each entry.
* <p>The instance <strong>is</strong> changed by this method.</p>
* @return for convenience, return this
+ * @deprecated in 2.2 (to be removed in 3.0). Please use
+ * {@link #mapToSelf(UnivariateRealFunction)} directly with
+ * the function classes in package
+ * {@link org.apache.commons.math.analysis.function}.
*/
RealVector mapAbsToSelf();
/**
* Map the {@link Math#sqrt(double)} function to each entry.
* @return a vector containing the result of applying the function to each entry
+ * @deprecated in 2.2 (to be removed in 3.0). Please use
+ * {@link #map(UnivariateRealFunction)} directly with
+ * the function classes in package
+ * {@link org.apache.commons.math.analysis.function}.
*/
RealVector mapSqrt();
@@ -450,12 +622,20 @@ public interface RealVector {
* Map the {@link Math#sqrt(double)} function to each entry.
* <p>The instance <strong>is</strong> changed by this method.</p>
* @return for convenience, return this
+ * @deprecated in 2.2 (to be removed in 3.0). Please use
+ * {@link #mapToSelf(UnivariateRealFunction)} directly with
+ * the function classes in package
+ * {@link org.apache.commons.math.analysis.function}.
*/
RealVector mapSqrtToSelf();
/**
* Map the {@link Math#cbrt(double)} function to each entry.
* @return a vector containing the result of applying the function to each entry
+ * @deprecated in 2.2 (to be removed in 3.0). Please use
+ * {@link #map(UnivariateRealFunction)} directly with
+ * the function classes in package
+ * {@link org.apache.commons.math.analysis.function}.
*/
RealVector mapCbrt();
@@ -463,12 +643,20 @@ public interface RealVector {
* Map the {@link Math#cbrt(double)} function to each entry.
* <p>The instance <strong>is</strong> changed by this method.</p>
* @return for convenience, return this
+ * @deprecated in 2.2 (to be removed in 3.0). Please use
+ * {@link #mapToSelf(UnivariateRealFunction)} directly with
+ * the function classes in package
+ * {@link org.apache.commons.math.analysis.function}.
*/
RealVector mapCbrtToSelf();
/**
* Map the {@link Math#ceil(double)} function to each entry.
* @return a vector containing the result of applying the function to each entry
+ * @deprecated in 2.2 (to be removed in 3.0). Please use
+ * {@link #map(UnivariateRealFunction)} directly with
+ * the function classes in package
+ * {@link org.apache.commons.math.analysis.function}.
*/
RealVector mapCeil();
@@ -476,12 +664,20 @@ public interface RealVector {
* Map the {@link Math#ceil(double)} function to each entry.
* <p>The instance <strong>is</strong> changed by this method.</p>
* @return for convenience, return this
+ * @deprecated in 2.2 (to be removed in 3.0). Please use
+ * {@link #mapToSelf(UnivariateRealFunction)} directly with
+ * the function classes in package
+ * {@link org.apache.commons.math.analysis.function}.
*/
RealVector mapCeilToSelf();
/**
* Map the {@link Math#floor(double)} function to each entry.
* @return a vector containing the result of applying the function to each entry
+ * @deprecated in 2.2 (to be removed in 3.0). Please use
+ * {@link #map(UnivariateRealFunction)} directly with
+ * the function classes in package
+ * {@link org.apache.commons.math.analysis.function}.
*/
RealVector mapFloor();
@@ -489,12 +685,20 @@ public interface RealVector {
* Map the {@link Math#floor(double)} function to each entry.
* <p>The instance <strong>is</strong> changed by this method.</p>
* @return for convenience, return this
+ * @deprecated in 2.2 (to be removed in 3.0). Please use
+ * {@link #mapToSelf(UnivariateRealFunction)} directly with
+ * the function classes in package
+ * {@link org.apache.commons.math.analysis.function}.
*/
RealVector mapFloorToSelf();
/**
* Map the {@link Math#rint(double)} function to each entry.
* @return a vector containing the result of applying the function to each entry
+ * @deprecated in 2.2 (to be removed in 3.0). Please use
+ * {@link #map(UnivariateRealFunction)} directly with
+ * the function classes in package
+ * {@link org.apache.commons.math.analysis.function}.
*/
RealVector mapRint();
@@ -502,12 +706,20 @@ public interface RealVector {
* Map the {@link Math#rint(double)} function to each entry.
* <p>The instance <strong>is</strong> changed by this method.</p>
* @return for convenience, return this
+ * @deprecated in 2.2 (to be removed in 3.0). Please use
+ * {@link #mapToSelf(UnivariateRealFunction)} directly with
+ * the function classes in package
+ * {@link org.apache.commons.math.analysis.function}.
*/
RealVector mapRintToSelf();
/**
* Map the {@link Math#signum(double)} function to each entry.
* @return a vector containing the result of applying the function to each entry
+ * @deprecated in 2.2 (to be removed in 3.0). Please use
+ * {@link #map(UnivariateRealFunction)} directly with
+ * the function classes in package
+ * {@link org.apache.commons.math.analysis.function}.
*/
RealVector mapSignum();
@@ -515,12 +727,20 @@ public interface RealVector {
* Map the {@link Math#signum(double)} function to each entry.
* <p>The instance <strong>is</strong> changed by this method.</p>
* @return for convenience, return this
+ * @deprecated in 2.2 (to be removed in 3.0). Please use
+ * {@link #mapToSelf(UnivariateRealFunction)} directly with
+ * the function classes in package
+ * {@link org.apache.commons.math.analysis.function}.
*/
RealVector mapSignumToSelf();
/**
* Map the {@link Math#ulp(double)} function to each entry.
* @return a vector containing the result of applying the function to each entry
+ * @deprecated in 2.2 (to be removed in 3.0). Please use
+ * {@link #map(UnivariateRealFunction)} directly with
+ * the function classes in package
+ * {@link org.apache.commons.math.analysis.function}.
*/
RealVector mapUlp();
@@ -528,6 +748,10 @@ public interface RealVector {
* Map the {@link Math#ulp(double)} function to each entry.
* <p>The instance <strong>is</strong> changed by this method.</p>
* @return for convenience, return this
+ * @deprecated in 2.2 (to be removed in 3.0). Please use
+ * {@link #mapToSelf(UnivariateRealFunction)} directly with
+ * the function classes in package
+ * {@link org.apache.commons.math.analysis.function}.
*/
RealVector mapUlpToSelf();
@@ -535,33 +759,37 @@ public interface RealVector {
* Element-by-element multiplication.
* @param v vector by which instance elements must be multiplied
* @return a vector containing this[i] * v[i] for all i
- * @throws IllegalArgumentException if v is not the same size as this
+ * @throws org.apache.commons.math.exception.DimensionMismatchException
+ * if {@code v} is not the same size as this vector.
*/
- RealVector ebeMultiply(RealVector v) throws IllegalArgumentException;
+ RealVector ebeMultiply(RealVector v);
/**
* Element-by-element multiplication.
* @param v vector by which instance elements must be multiplied
* @return a vector containing this[i] * v[i] for all i
- * @throws IllegalArgumentException if v is not the same size as this
+ * @throws org.apache.commons.math.exception.DimensionMismatchException
+ * if {@code v} is not the same size as this vector.
*/
- RealVector ebeMultiply(double[] v) throws IllegalArgumentException;
+ RealVector ebeMultiply(double[] v);
/**
* Element-by-element division.
* @param v vector by which instance elements must be divided
* @return a vector containing this[i] / v[i] for all i
- * @throws IllegalArgumentException if v is not the same size as this
+ * @throws org.apache.commons.math.exception.DimensionMismatchException
+ * if {@code v} is not the same size as this vector.
*/
- RealVector ebeDivide(RealVector v) throws IllegalArgumentException;
+ RealVector ebeDivide(RealVector v);
/**
* Element-by-element division.
* @param v vector by which instance elements must be divided
* @return a vector containing this[i] / v[i] for all i
- * @throws IllegalArgumentException if v is not the same size as this
+ * @throws org.apache.commons.math.exception.DimensionMismatchException
+ * if {@code v} is not the same size as this vector.
*/
- RealVector ebeDivide(double[] v) throws IllegalArgumentException;
+ RealVector ebeDivide(double[] v);
/**
* Returns vector entries as a double array.
@@ -573,19 +801,19 @@ public interface RealVector {
* Compute the dot product.
* @param v vector with which dot product should be computed
* @return the scalar dot product between instance and v
- * @exception IllegalArgumentException if v is not the same size as this
+ * @throws org.apache.commons.math.exception.DimensionMismatchException
+ * if {@code v} is not the same size as this vector.
*/
- double dotProduct(RealVector v)
- throws IllegalArgumentException;
+ double dotProduct(RealVector v);
/**
* Compute the dot product.
* @param v vector with which dot product should be computed
* @return the scalar dot product between instance and v
- * @exception IllegalArgumentException if v is not the same size as this
+ * @throws org.apache.commons.math.exception.DimensionMismatchException
+ * if {@code v} is not the same size as this vector.
*/
- double dotProduct(double[] v)
- throws IllegalArgumentException;
+ double dotProduct(double[] v);
/**
* Returns the L<sub>2</sub> norm of the vector.
@@ -627,13 +855,13 @@ public interface RealVector {
* elements differences, or euclidian distance.</p>
* @param v vector to which distance is requested
* @return distance between two vectors.
- * @exception IllegalArgumentException if v is not the same size as this
+ * @throws org.apache.commons.math.exception.DimensionMismatchException
+ * if {@code v} is not the same size as this vector.
* @see #getL1Distance(RealVector)
* @see #getLInfDistance(RealVector)
* @see #getNorm()
*/
- double getDistance(RealVector v)
- throws IllegalArgumentException;
+ double getDistance(RealVector v);
/**
* Distance between two vectors.
@@ -642,13 +870,13 @@ public interface RealVector {
* elements differences, or euclidian distance.</p>
* @param v vector to which distance is requested
* @return distance between two vectors.
- * @exception IllegalArgumentException if v is not the same size as this
+ * @throws org.apache.commons.math.exception.DimensionMismatchException
+ * if {@code v} is not the same size as this vector.
* @see #getL1Distance(double[])
* @see #getLInfDistance(double[])
* @see #getNorm()
*/
- double getDistance(double[] v)
- throws IllegalArgumentException;
+ double getDistance(double[] v);
/**
* Distance between two vectors.
@@ -657,13 +885,13 @@ public interface RealVector {
* elements differences.</p>
* @param v vector to which distance is requested
* @return distance between two vectors.
- * @exception IllegalArgumentException if v is not the same size as this
+ * @throws org.apache.commons.math.exception.DimensionMismatchException
+ * if {@code v} is not the same size as this vector.
* @see #getDistance(RealVector)
* @see #getLInfDistance(RealVector)
* @see #getL1Norm()
*/
- double getL1Distance(RealVector v)
- throws IllegalArgumentException;
+ double getL1Distance(RealVector v);
/**
* Distance between two vectors.
@@ -672,13 +900,13 @@ public interface RealVector {
* elements differences.</p>
* @param v vector to which distance is requested
* @return distance between two vectors.
- * @exception IllegalArgumentException if v is not the same size as this
+ * @throws org.apache.commons.math.exception.DimensionMismatchException
+ * if {@code v} is not the same size as this vector.
* @see #getDistance(double[])
* @see #getLInfDistance(double[])
* @see #getL1Norm()
*/
- double getL1Distance(double[] v)
- throws IllegalArgumentException;
+ double getL1Distance(double[] v);
/**
* Distance between two vectors.
@@ -687,13 +915,13 @@ public interface RealVector {
* elements differences.</p>
* @param v vector to which distance is requested
* @return distance between two vectors.
- * @exception IllegalArgumentException if v is not the same size as this
+ * @throws org.apache.commons.math.exception.DimensionMismatchException
+ * if {@code v} is not the same size as this vector.
* @see #getDistance(RealVector)
* @see #getL1Distance(RealVector)
* @see #getLInfNorm()
*/
- double getLInfDistance(RealVector v)
- throws IllegalArgumentException;
+ double getLInfDistance(RealVector v);
/**
* Distance between two vectors.
@@ -702,13 +930,13 @@ public interface RealVector {
* elements differences.</p>
* @param v vector to which distance is requested
* @return distance between two vectors.
- * @exception IllegalArgumentException if v is not the same size as this
+ * @throws org.apache.commons.math.exception.DimensionMismatchException
+ * if {@code v} is not the same size as this vector.
* @see #getDistance(double[])
* @see #getL1Distance(double[])
* @see #getLInfNorm()
*/
- double getLInfDistance(double[] v)
- throws IllegalArgumentException;
+ double getLInfDistance(double[] v);
/** Creates a unit vector pointing in the direction of this vector.
* <p>The instance is not changed by this method.</p>
@@ -719,68 +947,65 @@ public interface RealVector {
/** Converts this vector into a unit vector.
* <p>The instance itself is changed by this method.</p>
- * @exception ArithmeticException if the norm is null
+ * @throws org.apache.commons.math.exception.MathArithmeticException
+ * if the norm is zero.
*/
void unitize();
/** Find the orthogonal projection of this vector onto another vector.
* @param v vector onto which instance must be projected
* @return projection of the instance onto v
- * @throws IllegalArgumentException if v is not the same size as this
+ * @throws org.apache.commons.math.exception.DimensionMismatchException
+ * if {@code v} is not the same size as this vector.
*/
- RealVector projection(RealVector v)
- throws IllegalArgumentException;
+ RealVector projection(RealVector v);
/** Find the orthogonal projection of this vector onto another vector.
* @param v vector onto which instance must be projected
* @return projection of the instance onto v
- * @throws IllegalArgumentException if v is not the same size as this
+ * @throws org.apache.commons.math.exception.DimensionMismatchException
+ * if {@code v} is not the same size as this vector.
*/
- RealVector projection(double[] v)
- throws IllegalArgumentException;
+ RealVector projection(double[] v);
/**
* Compute the outer product.
* @param v vector with which outer product should be computed
* @return the square matrix outer product between instance and v
- * @exception IllegalArgumentException if v is not the same size as this
+ * @throws org.apache.commons.math.exception.DimensionMismatchException
+ * if {@code v} is not the same size as this vector.
*/
- RealMatrix outerProduct(RealVector v)
- throws IllegalArgumentException;
+ RealMatrix outerProduct(RealVector v);
/**
* Compute the outer product.
* @param v vector with which outer product should be computed
* @return the square matrix outer product between instance and v
- * @exception IllegalArgumentException if v is not the same size as this
+ * @throws org.apache.commons.math.exception.DimensionMismatchException
+ * if {@code v} is not the same size as this vector.
*/
- RealMatrix outerProduct(double[] v)
- throws IllegalArgumentException;
+ RealMatrix outerProduct(double[] v);
/**
* Returns the entry in the specified index.
- * <p>
- * The index start at 0 and must be lesser than the size,
- * otherwise a {@link MatrixIndexException} is thrown.
- * </p>
- * @param index index location of entry to be fetched
- * @return vector entry at index
- * @throws MatrixIndexException if the index is not valid
+ *
+ * @param index Index location of entry to be fetched.
+ * @return the vector entry at {@code index}.
+ * @throws org.apache.commons.math.exception.OutOfRangeException
+ * if the index is not valid.
* @see #setEntry(int, double)
*/
- double getEntry(int index)
- throws MatrixIndexException;
+ double getEntry(int index);
/**
* Set a single element.
* @param index element index.
* @param value new value for the element.
- * @exception MatrixIndexException if the index is
- * inconsistent with vector size
+ * @throws org.apache.commons.math.exception.OutOfRangeException
+ * if the index is not valid.
* @see #getEntry(int)
*/
- void setEntry(int index, double value)
- throws MatrixIndexException;
+ void setEntry(int index, double value);
/**
* Returns the size of the vector.
@@ -814,33 +1039,30 @@ public interface RealVector {
* @param index index of first element.
* @param n number of elements to be retrieved.
* @return a vector containing n elements.
- * @exception MatrixIndexException if the index is
- * inconsistent with vector size
+ * @throws org.apache.commons.math.exception.OutOfRangeException
+ * if the index is not valid.
*/
- RealVector getSubVector(int index, int n)
- throws MatrixIndexException;
+ RealVector getSubVector(int index, int n);
/**
* Set a set of consecutive elements.
* @param index index of first element to be set.
* @param v vector containing the values to set.
- * @exception MatrixIndexException if the index is
- * inconsistent with vector size
+ * @throws org.apache.commons.math.exception.OutOfRangeException
+ * if the index is not valid.
* @see #setSubVector(int, double[])
*/
- void setSubVector(int index, RealVector v)
- throws MatrixIndexException;
+ void setSubVector(int index, RealVector v);
/**
* Set a set of consecutive elements.
* @param index index of first element to be set.
* @param v vector containing the values to set.
- * @exception MatrixIndexException if the index is
- * inconsistent with vector size
+ * @throws org.apache.commons.math.exception.OutOfRangeException
+ * if the index is not valid.
* @see #setSubVector(int, RealVector)
*/
- void setSubVector(int index, double[] v)
- throws MatrixIndexException;
+ void setSubVector(int index, double[] v);
/**
* Set all elements to a single value.
@@ -857,17 +1079,17 @@ public interface RealVector {
double[] toArray();
/**
- * Returns true if any coordinate of this vector is NaN; false otherwise
- * @return true if any coordinate of this vector is NaN; false otherwise
+ * Check whether any coordinate of this vector is {@code NaN}.
+ * @return {@code true} if any coordinate of this vector is {@code NaN},
+ * {@code false} otherwise.
*/
boolean isNaN();
/**
- * Returns true if any coordinate of this vector is infinite and none are NaN;
- * false otherwise
- * @return true if any coordinate of this vector is infinite and none are NaN;
- * false otherwise
+ * Check whether any coordinate of this vector is infinite and none are {@code NaN}.
+ *
+ * @return {@code true} if any coordinate of this vector is infinite and
+ * none are {@code NaN}, {@code false} otherwise.
*/
boolean isInfinite();
-
}