T - the type of the field elementspublic interface FieldVector<T extends FieldElement<T>>
vector element indexing is 0-based -- e.g., getEntry(0)
returns the first element of the vector.
The various mapXxx and mapXxxToSelf methods operate
on vectors element-wise, i.e. they perform the same operation (adding a scalar,
applying a function ...) on each element in turn. The mapXxx
versions create a new vector to hold the result and do not change the instance.
The mapXxxToSelf versions use the instance itself to store the
results, so the instance is changed by these methods. In both cases, the result
vector is returned by the methods, this allows to use the fluent API
style, like this:
RealVector result = v.mapAddToSelf(3.0).mapTanToSelf().mapSquareToSelf();
Note that as almost all operations on FieldElement throw NullArgumentException when operating on a null element, it is the responsibility
of FieldVector implementations to make sure no null elements
are inserted into the vector. This must be done in all constructors and
all setters.
| Modifier and Type | Method and Description |
|---|---|
FieldVector<T> |
add(FieldVector<T> v)
Compute the sum of
this and v. |
FieldVector<T> |
append(FieldVector<T> v)
Construct a vector by appending a vector to this vector.
|
FieldVector<T> |
append(T d)
Construct a vector by appending a T to this vector.
|
FieldVector<T> |
copy()
Returns a (deep) copy of this.
|
T |
dotProduct(FieldVector<T> v)
Compute the dot product.
|
FieldVector<T> |
ebeDivide(FieldVector<T> v)
Element-by-element division.
|
FieldVector<T> |
ebeMultiply(FieldVector<T> v)
Element-by-element multiplication.
|
T[] |
getData()
Deprecated.
as of 3.1, to be removed in 4.0. Please use the
toArray() method instead. |
int |
getDimension()
Returns the size of the vector.
|
T |
getEntry(int index)
Returns the entry in the specified index.
|
Field<T> |
getField()
Get the type of field elements of the vector.
|
FieldVector<T> |
getSubVector(int index,
int n)
Get a subvector from consecutive elements.
|
FieldVector<T> |
mapAdd(T d)
Map an addition operation to each entry.
|
FieldVector<T> |
mapAddToSelf(T d)
Map an addition operation to each entry.
|
FieldVector<T> |
mapDivide(T d)
Map a division operation to each entry.
|
FieldVector<T> |
mapDivideToSelf(T d)
Map a division operation to each entry.
|
FieldVector<T> |
mapInv()
Map the 1/x function to each entry.
|
FieldVector<T> |
mapInvToSelf()
Map the 1/x function to each entry.
|
FieldVector<T> |
mapMultiply(T d)
Map a multiplication operation to each entry.
|
FieldVector<T> |
mapMultiplyToSelf(T d)
Map a multiplication operation to each entry.
|
FieldVector<T> |
mapSubtract(T d)
Map a subtraction operation to each entry.
|
FieldVector<T> |
mapSubtractToSelf(T d)
Map a subtraction operation to each entry.
|
FieldMatrix<T> |
outerProduct(FieldVector<T> v)
Compute the outer product.
|
FieldVector<T> |
projection(FieldVector<T> v)
Find the orthogonal projection of this vector onto another vector.
|
void |
set(T value)
Set all elements to a single value.
|
void |
setEntry(int index,
T value)
Set a single element.
|
void |
setSubVector(int index,
FieldVector<T> v)
Set a set of consecutive elements.
|
FieldVector<T> |
subtract(FieldVector<T> v)
Compute
this minus v. |
T[] |
toArray()
Convert the vector to a T array.
|
Field<T> getField()
FieldVector<T> copy()
FieldVector<T> add(FieldVector<T> v) throws DimensionMismatchException
this and v.v - vector to be addedthis + vDimensionMismatchException - if v is not the same size as thisFieldVector<T> subtract(FieldVector<T> v) throws DimensionMismatchException
this minus v.v - vector to be subtractedthis - vDimensionMismatchException - if v is not the same size as thisFieldVector<T> mapAdd(T d) throws NullArgumentException
d - value to be added to each entrythis + dNullArgumentException - if d is null.FieldVector<T> mapAddToSelf(T d) throws NullArgumentException
The instance is changed by this method.
d - value to be added to each entrythisNullArgumentException - if d is null.FieldVector<T> mapSubtract(T d) throws NullArgumentException
d - value to be subtracted to each entrythis - dNullArgumentException - if d is nullFieldVector<T> mapSubtractToSelf(T d) throws NullArgumentException
The instance is changed by this method.
d - value to be subtracted to each entrythisNullArgumentException - if d is nullFieldVector<T> mapMultiply(T d) throws NullArgumentException
d - value to multiply all entries bythis * dNullArgumentException - if d is null.FieldVector<T> mapMultiplyToSelf(T d) throws NullArgumentException
The instance is changed by this method.
d - value to multiply all entries bythisNullArgumentException - if d is null.FieldVector<T> mapDivide(T d) throws NullArgumentException, MathArithmeticException
d - value to divide all entries bythis / dNullArgumentException - if d is null.MathArithmeticException - if d is zero.FieldVector<T> mapDivideToSelf(T d) throws NullArgumentException, MathArithmeticException
The instance is changed by this method.
d - value to divide all entries bythisNullArgumentException - if d is null.MathArithmeticException - if d is zero.FieldVector<T> mapInv() throws MathArithmeticException
MathArithmeticException - if one of the entries is zero.FieldVector<T> mapInvToSelf() throws MathArithmeticException
The instance is changed by this method.
thisMathArithmeticException - if one of the entries is zero.FieldVector<T> ebeMultiply(FieldVector<T> v) throws DimensionMismatchException
v - vector by which instance elements must be multipliedthis[i] * v[i] for all iDimensionMismatchException - if v is not the same size as thisFieldVector<T> ebeDivide(FieldVector<T> v) throws DimensionMismatchException, MathArithmeticException
v - vector by which instance elements must be dividedthis[i] / v[i] for all iDimensionMismatchException - if v is not the same size as thisMathArithmeticException - if one entry of v is zero.@Deprecated T[] getData()
toArray() method instead.T dotProduct(FieldVector<T> v) throws DimensionMismatchException
v - vector with which dot product should be computedthis and vDimensionMismatchException - if v is not the same size as thisFieldVector<T> projection(FieldVector<T> v) throws DimensionMismatchException, MathArithmeticException
v - vector onto which this must be projectedthis onto vDimensionMismatchException - if v is not the same size as thisMathArithmeticException - if v is the null vector.FieldMatrix<T> outerProduct(FieldVector<T> v)
v - vector with which outer product should be computedT getEntry(int index) throws OutOfRangeException
index - Index location of entry to be fetched.index.OutOfRangeException - if the index is not valid.setEntry(int, FieldElement)void setEntry(int index, T value) throws OutOfRangeException
index - element index.value - new value for the element.OutOfRangeException - if the index is not valid.getEntry(int)int getDimension()
FieldVector<T> append(FieldVector<T> v)
v - vector to append to this one.FieldVector<T> append(T d)
d - T to append.FieldVector<T> getSubVector(int index, int n) throws OutOfRangeException, NotPositiveException
index - index of first element.n - number of elements to be retrieved.OutOfRangeException - if the index is not valid.NotPositiveException - if the number of elements if not positive.void setSubVector(int index, FieldVector<T> v) throws OutOfRangeException
index - index of first element to be set.v - vector containing the values to set.OutOfRangeException - if the index is not valid.void set(T value)
value - single value to set for all elementsCopyright © 2003–2016 The Apache Software Foundation. All rights reserved.