MATH-854: in FieldVector and ArrayFieldVector, reverted to r1383770.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1384471 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sebastien Brisard 2012-09-13 19:00:51 +00:00
parent 406a6ae49d
commit aa0b1cc788
2 changed files with 115 additions and 248 deletions

View File

@ -97,7 +97,7 @@ public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<
* @see #ArrayFieldVector(Field, FieldElement[])
*/
public ArrayFieldVector(T[] d)
throws NullArgumentException, ZeroException {
throws NullArgumentException, ZeroException {
if (d == null) {
throw new NullArgumentException();
}
@ -118,7 +118,7 @@ public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<
* @see #ArrayFieldVector(FieldElement[])
*/
public ArrayFieldVector(Field<T> field, T[] d)
throws NullArgumentException {
throws NullArgumentException {
if (d == null) {
throw new NullArgumentException();
}
@ -148,7 +148,7 @@ public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<
* @see #ArrayFieldVector(Field, FieldElement[], boolean)
*/
public ArrayFieldVector(T[] d, boolean copyArray)
throws NullArgumentException, ZeroException {
throws NullArgumentException, ZeroException {
if (d == null) {
throw new NullArgumentException();
}
@ -175,7 +175,7 @@ public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<
* @see #ArrayFieldVector(FieldElement[], boolean)
*/
public ArrayFieldVector(Field<T> field, T[] d, boolean copyArray)
throws NullArgumentException {
throws NullArgumentException {
if (d == null) {
throw new NullArgumentException();
}
@ -194,7 +194,7 @@ public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<
* than {@code pos + size}.
*/
public ArrayFieldVector(T[] d, int pos, int size)
throws NullArgumentException, NumberIsTooLargeException {
throws NullArgumentException, NumberIsTooLargeException {
if (d == null) {
throw new NullArgumentException();
}
@ -218,7 +218,7 @@ public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<
* than {@code pos + size}.
*/
public ArrayFieldVector(Field<T> field, T[] d, int pos, int size)
throws NullArgumentException, NumberIsTooLargeException {
throws NullArgumentException, NumberIsTooLargeException {
if (d == null) {
throw new NullArgumentException();
}
@ -237,7 +237,7 @@ public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<
* @throws NullArgumentException if {@code v} is {@code null}.
*/
public ArrayFieldVector(FieldVector<T> v)
throws NullArgumentException {
throws NullArgumentException {
if (v == null) {
throw new NullArgumentException();
}
@ -255,7 +255,7 @@ public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<
* @throws NullArgumentException if {@code v} is {@code null}.
*/
public ArrayFieldVector(ArrayFieldVector<T> v)
throws NullArgumentException {
throws NullArgumentException {
if (v == null) {
throw new NullArgumentException();
}
@ -272,7 +272,7 @@ public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<
* @throws NullArgumentException if {@code v} is {@code null}.
*/
public ArrayFieldVector(ArrayFieldVector<T> v, boolean deep)
throws NullArgumentException {
throws NullArgumentException {
if (v == null) {
throw new NullArgumentException();
}
@ -289,7 +289,7 @@ public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<
* {@code null}.
*/
public ArrayFieldVector(ArrayFieldVector<T> v1, ArrayFieldVector<T> v2)
throws NullArgumentException {
throws NullArgumentException {
if (v1 == null || v2 == null) {
throw new NullArgumentException();
}
@ -308,7 +308,7 @@ public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<
* {@code null}.
*/
public ArrayFieldVector(ArrayFieldVector<T> v1, T[] v2)
throws NullArgumentException {
throws NullArgumentException {
if (v1 == null || v2 == null) {
throw new NullArgumentException();
}
@ -327,7 +327,7 @@ public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<
* {@code null}.
*/
public ArrayFieldVector(T[] v1, ArrayFieldVector<T> v2)
throws NullArgumentException {
throws NullArgumentException {
if (v1 == null || v2 == null) {
throw new NullArgumentException();
}
@ -353,7 +353,7 @@ public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<
* @see #ArrayFieldVector(Field, FieldElement[], FieldElement[])
*/
public ArrayFieldVector(T[] v1, T[] v2)
throws NullArgumentException, ZeroException {
throws NullArgumentException, ZeroException {
if (v1 == null || v2 == null) {
throw new NullArgumentException();
}
@ -378,7 +378,7 @@ public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<
* @see #ArrayFieldVector(FieldElement[], FieldElement[])
*/
public ArrayFieldVector(Field<T> field, T[] v1, T[] v2)
throws NullArgumentException, ZeroException {
throws NullArgumentException, ZeroException {
if (v1 == null || v2 == null) {
throw new NullArgumentException();
}
@ -412,12 +412,7 @@ public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<
return new ArrayFieldVector<T>(this, true);
}
/**
* {@inheritDoc}
*
* @throws DimensionMismatchException if {@code v} is not the same size as
* {@code this}.
*/
/** {@inheritDoc} */
public FieldVector<T> add(FieldVector<T> v)
throws DimensionMismatchException {
try {
@ -449,12 +444,7 @@ public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<
return new ArrayFieldVector<T>(field, out, false);
}
/**
* {@inheritDoc}
*
* @throws DimensionMismatchException if {@code v} is not the same size as
* {@code this}.
*/
/** {@inheritDoc} */
public FieldVector<T> subtract(FieldVector<T> v)
throws DimensionMismatchException {
try {
@ -486,12 +476,8 @@ public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<
return new ArrayFieldVector<T>(field, out, false);
}
/**
* {@inheritDoc}
*
* @throws NullArgumentException if {@code d} is {@code null}.
*/
public FieldVector<T> mapAdd(T d) throws NullArgumentException {
/** {@inheritDoc} */
public FieldVector<T> mapAdd(T d) {
T[] out = buildArray(data.length);
for (int i = 0; i < data.length; i++) {
out[i] = data[i].add(d);
@ -499,24 +485,16 @@ public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<
return new ArrayFieldVector<T>(field, out, false);
}
/**
* {@inheritDoc}
*
* @throws NullArgumentException if {@code d} is {@code null}.
*/
public FieldVector<T> mapAddToSelf(T d) throws NullArgumentException {
/** {@inheritDoc} */
public FieldVector<T> mapAddToSelf(T d) {
for (int i = 0; i < data.length; i++) {
data[i] = data[i].add(d);
}
return this;
}
/**
* {@inheritDoc}
*
* @throws NullArgumentException if {@code d} is {@code null}.
*/
public FieldVector<T> mapSubtract(T d) throws NullArgumentException {
/** {@inheritDoc} */
public FieldVector<T> mapSubtract(T d) {
T[] out = buildArray(data.length);
for (int i = 0; i < data.length; i++) {
out[i] = data[i].subtract(d);
@ -524,24 +502,16 @@ public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<
return new ArrayFieldVector<T>(field, out, false);
}
/**
* {@inheritDoc}
*
* @throws NullArgumentException if {@code d} is {@code null}.
*/
public FieldVector<T> mapSubtractToSelf(T d) throws NullArgumentException {
/** {@inheritDoc} */
public FieldVector<T> mapSubtractToSelf(T d) {
for (int i = 0; i < data.length; i++) {
data[i] = data[i].subtract(d);
}
return this;
}
/**
* {@inheritDoc}
*
* @throws NullArgumentException if {@code d} is {@code null}.
*/
public FieldVector<T> mapMultiply(T d) throws NullArgumentException {
/** {@inheritDoc} */
public FieldVector<T> mapMultiply(T d) {
T[] out = buildArray(data.length);
for (int i = 0; i < data.length; i++) {
out[i] = data[i].multiply(d);
@ -549,24 +519,15 @@ public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<
return new ArrayFieldVector<T>(field, out, false);
}
/**
* {@inheritDoc}
*
* @throws NullArgumentException if {@code d} is {@code null}.
*/
public FieldVector<T> mapMultiplyToSelf(T d) throws NullArgumentException {
/** {@inheritDoc} */
public FieldVector<T> mapMultiplyToSelf(T d) {
for (int i = 0; i < data.length; i++) {
data[i] = data[i].multiply(d);
}
return this;
}
/**
* {@inheritDoc}
*
* @throws NullArgumentException if {@code d} is {@code null}.
* @throws MathArithmeticException if {@code d} is zero.
*/
/** {@inheritDoc} */
public FieldVector<T> mapDivide(T d)
throws NullArgumentException, MathArithmeticException {
if (d == null) {
@ -579,12 +540,7 @@ public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<
return new ArrayFieldVector<T>(field, out, false);
}
/**
* {@inheritDoc}
*
* @throws NullArgumentException if {@code d} is {@code null}.
* @throws MathArithmeticException if {@code d} is zero.
*/
/** {@inheritDoc} */
public FieldVector<T> mapDivideToSelf(T d)
throws NullArgumentException, MathArithmeticException {
if (d == null) {
@ -596,11 +552,7 @@ public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<
return this;
}
/**
* {@inheritDoc}
*
* @throws MathArithmeticException if {@code d} is zero.
*/
/** {@inheritDoc} */
public FieldVector<T> mapInv() throws MathArithmeticException {
T[] out = buildArray(data.length);
final T one = field.getOne();
@ -614,11 +566,7 @@ public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<
return new ArrayFieldVector<T>(field, out, false);
}
/**
* {@inheritDoc}
*
* @throws MathArithmeticException if {@code d} is zero.
*/
/** {@inheritDoc} */
public FieldVector<T> mapInvToSelf() throws MathArithmeticException {
final T one = field.getOne();
for (int i = 0; i < data.length; i++) {
@ -631,12 +579,7 @@ public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<
return this;
}
/**
* {@inheritDoc}
*
* @throws DimensionMismatchException if {@code v} is not the same size as
* {@code this}.
*/
/** {@inheritDoc} */
public FieldVector<T> ebeMultiply(FieldVector<T> v)
throws DimensionMismatchException {
try {
@ -668,13 +611,7 @@ public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<
return new ArrayFieldVector<T>(field, out, false);
}
/**
* {@inheritDoc}
*
* @throws DimensionMismatchException if {@code v} is not the same size as
* {@code this}.
* @throws MathArithmeticException if one entry of {@code v} is zero.
*/
/** {@inheritDoc} */
public FieldVector<T> ebeDivide(FieldVector<T> v)
throws DimensionMismatchException, MathArithmeticException {
try {
@ -729,13 +666,9 @@ public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<
return data;
}
/**
* {@inheritDoc}
*
* @throws DimensionMismatchException if {@code v} is not the same size as
* {@code this}.
*/
public T dotProduct(FieldVector<T> v) throws DimensionMismatchException {
/** {@inheritDoc} */
public T dotProduct(FieldVector<T> v)
throws DimensionMismatchException {
try {
return dotProduct((ArrayFieldVector<T>) v);
} catch (ClassCastException cce) {
@ -765,13 +698,7 @@ public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<
return dot;
}
/**
* {@inheritDoc}
*
* @throws DimensionMismatchException if {@code v} is not the same size as
* {@code this}.
* @throws MathArithmeticException if {@code v} is the null vector.
*/
/** {@inheritDoc} */
public FieldVector<T> projection(FieldVector<T> v)
throws DimensionMismatchException, MathArithmeticException {
return v.mapMultiply(dotProduct(v).divide(v.dotProduct(v)));
@ -859,12 +786,7 @@ public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<
return new ArrayFieldVector<T>(field, out, false);
}
/**
* {@inheritDoc}
*
* @throws OutOfRangeException if the index is not valid.
* @throws NotPositiveException if the number of elements is not positive.
*/
/** {@inheritDoc} */
public FieldVector<T> getSubVector(int index, int n)
throws OutOfRangeException, NotPositiveException {
if (n < 0) {
@ -889,11 +811,7 @@ public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<
}
}
/**
* {@inheritDoc}
*
* @throws OutOfRangeException if the index is not valid.
*/
/** {@inheritDoc} */
public void setSubVector(int index, FieldVector<T> v) throws OutOfRangeException {
try {
try {

View File

@ -18,6 +18,11 @@ package org.apache.commons.math3.linear;
import org.apache.commons.math3.Field;
import org.apache.commons.math3.FieldElement;
import org.apache.commons.math3.exception.DimensionMismatchException;
import org.apache.commons.math3.exception.MathArithmeticException;
import org.apache.commons.math3.exception.NotPositiveException;
import org.apache.commons.math3.exception.NullArgumentException;
import org.apache.commons.math3.exception.OutOfRangeException;
/**
* Interface defining a field-valued vector with basic algebraic operations.
@ -58,161 +63,125 @@ public interface FieldVector<T extends FieldElement<T>> {
FieldVector<T> copy();
/**
* Compute the sum of {@code this} and {@code v}. Implementations should throw
* {@link org.apache.commons.math3.exception.DimensionMismatchException} if
* {@code v} is not the same size as {@code this}.
*
* Compute the sum of {@code this} and {@code v}.
* @param v vector to be added
* @return {@code this + v}
* @throws DimensionMismatchException if {@code v} is not the same size as
* {@code this}
*/
FieldVector<T> add(FieldVector<T> v);
FieldVector<T> add(FieldVector<T> v) throws DimensionMismatchException;
/**
* Compute {@code this} minus {@code v}. Implementations should throw
* {@link org.apache.commons.math3.exception.DimensionMismatchException} if
* {@code v} is not the same size as {@code this}
*
* Compute {@code this} minus {@code v}.
* @param v vector to be subtracted
* @return {@code this + v}
* @throws DimensionMismatchException if {@code v} is not the same size as
* {@code this}
*/
FieldVector<T> subtract(FieldVector<T> v);
FieldVector<T> subtract(FieldVector<T> v) throws DimensionMismatchException;
/**
* Map an addition operation to each entry. Implementations should throw
* {@link org.apache.commons.math3.exception.NullArgumentException} if
* {@code d} is {@code null}.
*
* Map an addition operation to each entry.
* @param d value to be added to each entry
* @return {@code this + d}
*/
FieldVector<T> mapAdd(T d);
/**
* Map an addition operation to each entry. The instance <strong>is</strong>
* changed by this method. Implementations should throw
* {@link org.apache.commons.math3.exception.NullArgumentException} if
* {@code d} is {@code null}.
*
* 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 {@code this}
*/
FieldVector<T> mapAddToSelf(T d);
/**
* Map a subtraction operation to each entry. Implementations should throw
* {@link org.apache.commons.math3.exception.NullArgumentException} if
* {@code d} is {@code null}.
*
* Map a subtraction operation to each entry.
* @param d value to be subtracted to each entry
* @return {@code this - d}
*/
FieldVector<T> mapSubtract(T d);
/**
* Map a subtraction operation to each entry. The instance
* <strong>is</strong> changed by this method. Implementations should throw
* {@link org.apache.commons.math3.exception.NullArgumentException} if
* {@code d} is {@code null}.
*
* 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 {@code this}
*/
FieldVector<T> mapSubtractToSelf(T d);
/**
* Map a multiplication operation to each entry. Implementations should throw
* {@link org.apache.commons.math3.exception.NullArgumentException} if
* {@code d} is {@code null}.
*
* Map a multiplication operation to each entry.
* @param d value to multiply all entries by
* @return {@code this * d}
*/
FieldVector<T> mapMultiply(T d);
/**
* Map a multiplication operation to each entry. The instance
* <strong>is</strong> changed by this method. Implementations should throw
* {@link org.apache.commons.math3.exception.NullArgumentException} if
* {@code d} is {@code null}.
*
* 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 {@code this}
*/
FieldVector<T> mapMultiplyToSelf(T d);
/**
* Map a division operation to each entry. Implementations should throw
* <ul>
* <li>{@link org.apache.commons.math3.exception.NullArgumentException} if
* {@code d} is {@code null},</li>
* <li>{@link org.apache.commons.math3.exception.MathArithmeticException} if
* {@code d} is zero.</li>
* </ul>
*
* Map a division operation to each entry.
* @param d value to divide all entries by
* @return {@code this / d}
* @throws NullArgumentException if {@code d} is {@code null}.
* @throws MathArithmeticException if {@code d} is zero.
*/
FieldVector<T> mapDivide(T d);
FieldVector<T> mapDivide(T d)
throws NullArgumentException, MathArithmeticException;
/**
* Map a division operation to each entry. The instance <strong>is</strong>
* changed by this method.
* <ul>
* <li>{@link org.apache.commons.math3.exception.NullArgumentException} if
* {@code d} is {@code null},</li>
* <li>{@link org.apache.commons.math3.exception.MathArithmeticException} if
* {@code d} is zero.</li>
* </ul>
*
* 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 {@code this}
* @throws NullArgumentException if {@code d} is {@code null}.
* @throws MathArithmeticException if {@code d} is zero.
*/
FieldVector<T> mapDivideToSelf(T d);
FieldVector<T> mapDivideToSelf(T d)
throws NullArgumentException, MathArithmeticException;
/**
* Map the 1/x function to each entry. Implementations should throw
* {@link org.apache.commons.math3.exception.MathArithmeticException} if
* one of the entries is zero.
*
* Map the 1/x function to each entry.
* @return a vector containing the result of applying the function to each
* entry.
* @throws MathArithmeticException if one of the entries is zero.
*/
FieldVector<T> mapInv();
FieldVector<T> mapInv() throws MathArithmeticException;
/**
* Map the 1/x function to each entry. The instance <strong>is</strong>
* changed by this method. Implementations should throw
* {@link org.apache.commons.math3.exception.MathArithmeticException} if
* one of the entries is zero.
*
* Map the 1/x function to each entry.
* <p>The instance <strong>is</strong> changed by this method.</p>
* @return for convenience, return {@code this}
* @throws MathArithmeticException if one of the entries is zero.
*/
FieldVector<T> mapInvToSelf();
FieldVector<T> mapInvToSelf() throws MathArithmeticException;
/**
* Element-by-element multiplication. Implementations should throw
* {@link org.apache.commons.math3.exception.DimensionMismatchException} if
* {@code v} is not the same size as {@code this}.
*
* Element-by-element multiplication.
* @param v vector by which instance elements must be multiplied
* @return a vector containing {@code this[i] * v[i]} for all {@code i}
* @throws DimensionMismatchException if {@code v} is not the same size as
* {@code this}
*/
FieldVector<T> ebeMultiply(FieldVector<T> v);
FieldVector<T> ebeMultiply(FieldVector<T> v)
throws DimensionMismatchException;
/**
* Element-by-element division. Implementations should throw
* <ul>
* <li>{@link org.apache.commons.math3.exception.DimensionMismatchException}
* if {@code v} is not the same size as {@code this},</li>
* <li>{@link org.apache.commons.math3.exception.MathArithmeticException}
* if one entry of {@code v} is zero.
* </li>
* </ul>
*
* Element-by-element division.
* @param v vector by which instance elements must be divided
* @return a vector containing {@code this[i] / v[i]} for all {@code i}
* @throws DimensionMismatchException if {@code v} is not the same size as
* {@code this}
* @throws MathArithmeticException if one entry of {@code v} is zero.
*/
FieldVector<T> ebeDivide(FieldVector<T> v);
FieldVector<T> ebeDivide(FieldVector<T> v)
throws DimensionMismatchException, MathArithmeticException;
/**
* Returns vector entries as a T array.
@ -221,30 +190,23 @@ public interface FieldVector<T extends FieldElement<T>> {
T[] getData();
/**
* Compute the dot product. Implementations should throw
* {@link org.apache.commons.math3.exception.DimensionMismatchException} if
* {@code v} is not the same size as {@code this}.
*
* Compute the dot product.
* @param v vector with which dot product should be computed
* @return the scalar dot product of {@code this} and {@code v}
* @throws DimensionMismatchException if {@code v} is not the same size as
* {@code this}
*/
T dotProduct(FieldVector<T> v);
T dotProduct(FieldVector<T> v) throws DimensionMismatchException;
/**
* Find the orthogonal projection of this vector onto another vector.
* Implementations should throw
* <ul>
* <li>{@link org.apache.commons.math3.exception.DimensionMismatchException}
* if {@code v} is not the same size as {@code this},</li>
* <li>{@link org.apache.commons.math3.exception.MathArithmeticException}
* if {@code v} is the null vector.
* </li>
* </ul>
*
/** Find the orthogonal projection of this vector onto another vector.
* @param v vector onto which {@code this} must be projected
* @return projection of {@code this} onto {@code v}
* @throws DimensionMismatchException if {@code v} is not the same size as
* {@code this}
* @throws MathArithmeticException if {@code v} is the null vector.
*/
FieldVector<T> projection(FieldVector<T> v);
FieldVector<T> projection(FieldVector<T> v)
throws DimensionMismatchException, MathArithmeticException;
/**
* Compute the outer product.
@ -254,30 +216,23 @@ public interface FieldVector<T extends FieldElement<T>> {
FieldMatrix<T> outerProduct(FieldVector<T> v);
/**
* Returns the entry in the specified index. Implementations should throw
* {@link org.apache.commons.math3.exception.OutOfRangeException} if the
* index is not valid.
* Returns the entry in the specified index.
*
* @param index Index location of entry to be fetched.
* @return the vector entry at {@code index}.
* @throws OutOfRangeException if the index is not valid.
* @see #setEntry(int, FieldElement)
*/
T getEntry(int index);
T getEntry(int index) throws OutOfRangeException;
/**
* Set a single element. Implementations should throw
* <ul>
* <li>{@link org.apache.commons.math3.exception.OutOfRangeException} if the
* index is not valid,</li>
* <li>{@link org.apache.commons.math3.exception.NullArgumentException} if
* the value is {@code null}.</li>
* </ul>
*
* Set a single element.
* @param index element index.
* @param value new value for the element.
* @throws OutOfRangeException if the index is not valid.
* @see #getEntry(int)
*/
void setEntry(int index, T value);
void setEntry(int index, T value) throws OutOfRangeException;
/**
* Returns the size of the vector.
@ -300,29 +255,23 @@ public interface FieldVector<T extends FieldElement<T>> {
FieldVector<T> append(T d);
/**
* Get a subvector from consecutive elements. Implementations should throw
* <ul>
* <li>{@link org.apache.commons.math3.exception.OutOfRangeException} if the
* index is not valid,</li>
* <li>{@link org.apache.commons.math3.exception.NotPositiveException} if
* the number of elements is not positive.</li>
* </ul>
*
* Get a subvector from consecutive elements.
* @param index index of first element.
* @param n number of elements to be retrieved.
* @return a vector containing n elements.
* @throws OutOfRangeException if the index is not valid.
* @throws NotPositiveException if the number of elements if not positive.
*/
FieldVector<T> getSubVector(int index, int n);
FieldVector<T> getSubVector(int index, int n)
throws OutOfRangeException, NotPositiveException;
/**
* Set a set of consecutive elements. Implementations should throw
* {@link org.apache.commons.math3.exception.OutOfRangeException} if the
* index is not valid.
*
* Set a set of consecutive elements.
* @param index index of first element to be set.
* @param v vector containing the values to set.
* @throws OutOfRangeException if the index is not valid.
*/
void setSubVector(int index, FieldVector<T> v);
void setSubVector(int index, FieldVector<T> v) throws OutOfRangeException;
/**
* Set all elements to a single value.