MATH-854: document all exceptions in ArrayFieldVector.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1384212 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
10af7e2b2f
commit
8469bc496c
|
@ -412,7 +412,12 @@ public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<
|
|||
return new ArrayFieldVector<T>(this, true);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @throws DimensionMismatchException if {@code v} is not the same size as
|
||||
* {@code this}.
|
||||
*/
|
||||
public FieldVector<T> add(FieldVector<T> v)
|
||||
throws DimensionMismatchException {
|
||||
try {
|
||||
|
@ -444,7 +449,12 @@ public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<
|
|||
return new ArrayFieldVector<T>(field, out, false);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @throws DimensionMismatchException if {@code v} is not the same size as
|
||||
* {@code this}.
|
||||
*/
|
||||
public FieldVector<T> subtract(FieldVector<T> v)
|
||||
throws DimensionMismatchException {
|
||||
try {
|
||||
|
@ -476,8 +486,12 @@ public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<
|
|||
return new ArrayFieldVector<T>(field, out, false);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public FieldVector<T> mapAdd(T d) {
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @throws NullArgumentException if {@code d} is {@code null}.
|
||||
*/
|
||||
public FieldVector<T> mapAdd(T d) throws NullArgumentException {
|
||||
T[] out = buildArray(data.length);
|
||||
for (int i = 0; i < data.length; i++) {
|
||||
out[i] = data[i].add(d);
|
||||
|
@ -485,16 +499,24 @@ public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<
|
|||
return new ArrayFieldVector<T>(field, out, false);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public FieldVector<T> mapAddToSelf(T d) {
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @throws NullArgumentException if {@code d} is {@code null}.
|
||||
*/
|
||||
public FieldVector<T> mapAddToSelf(T d) throws NullArgumentException {
|
||||
for (int i = 0; i < data.length; i++) {
|
||||
data[i] = data[i].add(d);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public FieldVector<T> mapSubtract(T d) {
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @throws NullArgumentException if {@code d} is {@code null}.
|
||||
*/
|
||||
public FieldVector<T> mapSubtract(T d) throws NullArgumentException {
|
||||
T[] out = buildArray(data.length);
|
||||
for (int i = 0; i < data.length; i++) {
|
||||
out[i] = data[i].subtract(d);
|
||||
|
@ -502,16 +524,24 @@ public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<
|
|||
return new ArrayFieldVector<T>(field, out, false);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public FieldVector<T> mapSubtractToSelf(T d) {
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @throws NullArgumentException if {@code d} is {@code null}.
|
||||
*/
|
||||
public FieldVector<T> mapSubtractToSelf(T d) throws NullArgumentException {
|
||||
for (int i = 0; i < data.length; i++) {
|
||||
data[i] = data[i].subtract(d);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public FieldVector<T> mapMultiply(T d) {
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @throws NullArgumentException if {@code d} is {@code null}.
|
||||
*/
|
||||
public FieldVector<T> mapMultiply(T d) throws NullArgumentException {
|
||||
T[] out = buildArray(data.length);
|
||||
for (int i = 0; i < data.length; i++) {
|
||||
out[i] = data[i].multiply(d);
|
||||
|
@ -519,15 +549,24 @@ public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<
|
|||
return new ArrayFieldVector<T>(field, out, false);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public FieldVector<T> mapMultiplyToSelf(T d) {
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @throws NullArgumentException if {@code d} is {@code null}.
|
||||
*/
|
||||
public FieldVector<T> mapMultiplyToSelf(T d) throws NullArgumentException {
|
||||
for (int i = 0; i < data.length; i++) {
|
||||
data[i] = data[i].multiply(d);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @throws NullArgumentException if {@code d} is {@code null}.
|
||||
* @throws MathArithmeticException if {@code d} is zero.
|
||||
*/
|
||||
public FieldVector<T> mapDivide(T d)
|
||||
throws NullArgumentException, MathArithmeticException {
|
||||
if (d == null) {
|
||||
|
@ -540,7 +579,12 @@ public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<
|
|||
return new ArrayFieldVector<T>(field, out, false);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @throws NullArgumentException if {@code d} is {@code null}.
|
||||
* @throws MathArithmeticException if {@code d} is zero.
|
||||
*/
|
||||
public FieldVector<T> mapDivideToSelf(T d)
|
||||
throws NullArgumentException, MathArithmeticException {
|
||||
if (d == null) {
|
||||
|
@ -552,7 +596,11 @@ public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<
|
|||
return this;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @throws MathArithmeticException if {@code d} is zero.
|
||||
*/
|
||||
public FieldVector<T> mapInv() throws MathArithmeticException {
|
||||
T[] out = buildArray(data.length);
|
||||
final T one = field.getOne();
|
||||
|
@ -566,7 +614,11 @@ public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<
|
|||
return new ArrayFieldVector<T>(field, out, false);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @throws MathArithmeticException if {@code d} is zero.
|
||||
*/
|
||||
public FieldVector<T> mapInvToSelf() throws MathArithmeticException {
|
||||
final T one = field.getOne();
|
||||
for (int i = 0; i < data.length; i++) {
|
||||
|
@ -579,7 +631,12 @@ public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<
|
|||
return this;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @throws DimensionMismatchException if {@code v} is not the same size as
|
||||
* {@code this}.
|
||||
*/
|
||||
public FieldVector<T> ebeMultiply(FieldVector<T> v)
|
||||
throws DimensionMismatchException {
|
||||
try {
|
||||
|
@ -611,7 +668,13 @@ public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<
|
|||
return new ArrayFieldVector<T>(field, out, false);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @throws DimensionMismatchException if {@code v} is not the same size as
|
||||
* {@code this}.
|
||||
* @throws MathArithmeticException if one entry of {@code v} is zero.
|
||||
*/
|
||||
public FieldVector<T> ebeDivide(FieldVector<T> v)
|
||||
throws DimensionMismatchException, MathArithmeticException {
|
||||
try {
|
||||
|
@ -666,9 +729,13 @@ public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<
|
|||
return data;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
public T dotProduct(FieldVector<T> v)
|
||||
throws DimensionMismatchException {
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @throws DimensionMismatchException if {@code v} is not the same size as
|
||||
* {@code this}.
|
||||
*/
|
||||
public T dotProduct(FieldVector<T> v) throws DimensionMismatchException {
|
||||
try {
|
||||
return dotProduct((ArrayFieldVector<T>) v);
|
||||
} catch (ClassCastException cce) {
|
||||
|
@ -698,7 +765,13 @@ public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<
|
|||
return dot;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @throws DimensionMismatchException if {@code v} is not the same size as
|
||||
* {@code this}.
|
||||
* @throws MathArithmeticException if {@code v} is the null vector.
|
||||
*/
|
||||
public FieldVector<T> projection(FieldVector<T> v)
|
||||
throws DimensionMismatchException, MathArithmeticException {
|
||||
return v.mapMultiply(dotProduct(v).divide(v.dotProduct(v)));
|
||||
|
@ -786,7 +859,12 @@ public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<
|
|||
return new ArrayFieldVector<T>(field, out, false);
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @throws OutOfRangeException if the index is not valid.
|
||||
* @throws NotPositiveException if the number of elements is not positive.
|
||||
*/
|
||||
public FieldVector<T> getSubVector(int index, int n)
|
||||
throws OutOfRangeException, NotPositiveException {
|
||||
if (n < 0) {
|
||||
|
@ -811,7 +889,11 @@ public class ArrayFieldVector<T extends FieldElement<T>> implements FieldVector<
|
|||
}
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @throws OutOfRangeException if the index is not valid.
|
||||
*/
|
||||
public void setSubVector(int index, FieldVector<T> v) throws OutOfRangeException {
|
||||
try {
|
||||
try {
|
||||
|
|
Loading…
Reference in New Issue