T
- the type of the field elementsArrayFieldVector
, SparseFieldVector
public 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 | 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.
|
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 MathIllegalArgumentException
this
and v
.v
- vector to be addedthis + v
MathIllegalArgumentException
- if v
is not the same size as this
FieldVector<T> subtract(FieldVector<T> v) throws MathIllegalArgumentException
this
minus v
.v
- vector to be subtractedthis - v
MathIllegalArgumentException
- if v
is not the same size as this
FieldVector<T> mapAdd(T d) throws NullArgumentException
d
- value to be added to each entrythis + d
NullArgumentException
- 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 entrythis
NullArgumentException
- if d
is null
.FieldVector<T> mapSubtract(T d) throws NullArgumentException
d
- value to be subtracted to each entrythis - d
NullArgumentException
- if d
is null
FieldVector<T> mapSubtractToSelf(T d) throws NullArgumentException
The instance is changed by this method.
d
- value to be subtracted to each entrythis
NullArgumentException
- if d
is null
FieldVector<T> mapMultiply(T d) throws NullArgumentException
d
- value to multiply all entries bythis * d
NullArgumentException
- if d
is null
.FieldVector<T> mapMultiplyToSelf(T d) throws NullArgumentException
The instance is changed by this method.
d
- value to multiply all entries bythis
NullArgumentException
- if d
is null
.FieldVector<T> mapDivide(T d) throws NullArgumentException, MathRuntimeException
d
- value to divide all entries bythis / d
NullArgumentException
- if d
is null
.MathRuntimeException
- if d
is zero.FieldVector<T> mapDivideToSelf(T d) throws NullArgumentException, MathRuntimeException
The instance is changed by this method.
d
- value to divide all entries bythis
NullArgumentException
- if d
is null
.MathRuntimeException
- if d
is zero.FieldVector<T> mapInv() throws MathRuntimeException
MathRuntimeException
- if one of the entries is zero.FieldVector<T> mapInvToSelf() throws MathRuntimeException
The instance is changed by this method.
this
MathRuntimeException
- if one of the entries is zero.FieldVector<T> ebeMultiply(FieldVector<T> v) throws MathIllegalArgumentException
v
- vector by which instance elements must be multipliedthis[i] * v[i]
for all i
MathIllegalArgumentException
- if v
is not the same size as this
FieldVector<T> ebeDivide(FieldVector<T> v) throws MathIllegalArgumentException, MathRuntimeException
v
- vector by which instance elements must be dividedthis[i] / v[i]
for all i
MathIllegalArgumentException
- if v
is not the same size as this
MathRuntimeException
- if one entry of v
is zero.T dotProduct(FieldVector<T> v) throws MathIllegalArgumentException
v
- vector with which dot product should be computedthis
and v
MathIllegalArgumentException
- if v
is not the same size as this
FieldVector<T> projection(FieldVector<T> v) throws MathIllegalArgumentException, MathRuntimeException
v
- vector onto which this
must be projectedthis
onto v
MathIllegalArgumentException
- if v
is not the same size as this
MathRuntimeException
- 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 MathIllegalArgumentException
index
- Index location of entry to be fetched.index
.MathIllegalArgumentException
- if the index is not valid.setEntry(int, FieldElement)
void setEntry(int index, T value) throws MathIllegalArgumentException
index
- element index.value
- new value for the element.MathIllegalArgumentException
- 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 MathIllegalArgumentException
index
- index of first element.n
- number of elements to be retrieved.MathIllegalArgumentException
- if the index is not valid.MathIllegalArgumentException
- if the number of elements if not positive.void setSubVector(int index, FieldVector<T> v) throws MathIllegalArgumentException
index
- index of first element to be set.v
- vector containing the values to set.MathIllegalArgumentException
- if the index is not valid.void set(T value)
value
- single value to set for all elementsT[] toArray()
The array is independent from vector data, it's elements are copied.
Copyright © 2016–2018 Hipparchus.org. All rights reserved.