|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.commons.math3.linear.SparseFieldVector<T>
T
- the type of the field elements
@Deprecated public class SparseFieldVector<T extends FieldElement<T>>
This class implements the FieldVector
interface with a OpenIntToFieldHashMap
backing store.
Constructor Summary | |
---|---|
|
SparseFieldVector(Field<T> field)
Deprecated. Build a 0-length vector. |
|
SparseFieldVector(Field<T> field,
int dimension)
Deprecated. Construct a vector of zeroes. |
|
SparseFieldVector(Field<T> field,
int dimension,
int expectedSize)
Deprecated. Build a vector with known the sparseness (for advanced use only). |
|
SparseFieldVector(Field<T> field,
T[] values)
Deprecated. Create from a Field array. |
|
SparseFieldVector(SparseFieldVector<T> v)
Deprecated. Copy constructor. |
protected |
SparseFieldVector(SparseFieldVector<T> v,
int resize)
Deprecated. Build a resized vector, for use with append. |
Method Summary | |
---|---|
FieldVector<T> |
add(FieldVector<T> v)
Deprecated. Compute the sum of this and v . |
FieldVector<T> |
add(SparseFieldVector<T> v)
Deprecated. Optimized method to add sparse vectors. |
FieldVector<T> |
append(FieldVector<T> v)
Deprecated. Construct a vector by appending a vector to this vector. |
FieldVector<T> |
append(SparseFieldVector<T> v)
Deprecated. Construct a vector by appending a vector to this vector. |
FieldVector<T> |
append(T d)
Deprecated. Construct a vector by appending a T to this vector. |
protected void |
checkVectorDimensions(int n)
Deprecated. Check if instance dimension is equal to some expected value. |
FieldVector<T> |
copy()
Deprecated. Returns a (deep) copy of this. |
T |
dotProduct(FieldVector<T> v)
Deprecated. Compute the dot product. |
FieldVector<T> |
ebeDivide(FieldVector<T> v)
Deprecated. Element-by-element division. |
FieldVector<T> |
ebeMultiply(FieldVector<T> v)
Deprecated. Element-by-element multiplication. |
boolean |
equals(Object obj)
Deprecated. |
T[] |
getData()
Deprecated. as of 3.1, to be removed in 4.0. Please use the toArray() method instead. |
int |
getDimension()
Deprecated. Returns the size of the vector. |
T |
getEntry(int index)
Deprecated. Returns the entry in the specified index. |
Field<T> |
getField()
Deprecated. Get the type of field elements of the vector. |
FieldVector<T> |
getSubVector(int index,
int n)
Deprecated. Get a subvector from consecutive elements. |
int |
hashCode()
Deprecated. |
FieldVector<T> |
mapAdd(T d)
Deprecated. Map an addition operation to each entry. |
FieldVector<T> |
mapAddToSelf(T d)
Deprecated. Map an addition operation to each entry. |
FieldVector<T> |
mapDivide(T d)
Deprecated. Map a division operation to each entry. |
FieldVector<T> |
mapDivideToSelf(T d)
Deprecated. Map a division operation to each entry. |
FieldVector<T> |
mapInv()
Deprecated. Map the 1/x function to each entry. |
FieldVector<T> |
mapInvToSelf()
Deprecated. Map the 1/x function to each entry. |
FieldVector<T> |
mapMultiply(T d)
Deprecated. Map a multiplication operation to each entry. |
FieldVector<T> |
mapMultiplyToSelf(T d)
Deprecated. Map a multiplication operation to each entry. |
FieldVector<T> |
mapSubtract(T d)
Deprecated. Map a subtraction operation to each entry. |
FieldVector<T> |
mapSubtractToSelf(T d)
Deprecated. Map a subtraction operation to each entry. |
FieldMatrix<T> |
outerProduct(FieldVector<T> v)
Deprecated. Compute the outer product. |
FieldMatrix<T> |
outerProduct(SparseFieldVector<T> v)
Deprecated. Optimized method to compute outer product when both vectors are sparse. |
FieldVector<T> |
projection(FieldVector<T> v)
Deprecated. Find the orthogonal projection of this vector onto another vector. |
void |
set(T value)
Deprecated. Set all elements to a single value. |
void |
setEntry(int index,
T value)
Deprecated. Set a single element. |
void |
setSubVector(int index,
FieldVector<T> v)
Deprecated. Set a set of consecutive elements. |
FieldVector<T> |
subtract(FieldVector<T> v)
Deprecated. Compute this minus v . |
SparseFieldVector<T> |
subtract(SparseFieldVector<T> v)
Deprecated. Optimized method to compute this minus v . |
T[] |
toArray()
Deprecated. Convert the vector to a T array. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SparseFieldVector(Field<T> field)
SparseFieldVector(SparseFieldVector, int)
constructor
or one of the append
method (append(FieldVector)
or
append(SparseFieldVector)
) to gather data into this vector.
field
- Field to which the elements belong.public SparseFieldVector(Field<T> field, int dimension)
field
- Field to which the elements belong.dimension
- Size of the vector.protected SparseFieldVector(SparseFieldVector<T> v, int resize)
v
- Original vectorresize
- Amount to add.public SparseFieldVector(Field<T> field, int dimension, int expectedSize)
field
- Field to which the elements belong.dimension
- Size of the vector.expectedSize
- Expected number of non-zero entries.public SparseFieldVector(Field<T> field, T[] values)
field
- Field to which the elements belong.values
- Set of values to create from.public SparseFieldVector(SparseFieldVector<T> v)
v
- Instance to copy.Method Detail |
---|
public FieldVector<T> add(SparseFieldVector<T> v) throws DimensionMismatchException
v
- Vector to add.
this + v
.
DimensionMismatchException
- if v
is not the same size as
this
.public FieldVector<T> append(SparseFieldVector<T> v)
v
- Vector to append to this one.
public FieldVector<T> append(FieldVector<T> v)
append
in interface FieldVector<T extends FieldElement<T>>
v
- vector to append to this one.
public FieldVector<T> append(T d)
append
in interface FieldVector<T extends FieldElement<T>>
d
- T to append.
public FieldVector<T> copy()
copy
in interface FieldVector<T extends FieldElement<T>>
public T dotProduct(FieldVector<T> v) throws DimensionMismatchException
dotProduct
in interface FieldVector<T extends FieldElement<T>>
v
- vector with which dot product should be computed
this
and v
DimensionMismatchException
- if v
is not the same size as this
public FieldVector<T> ebeDivide(FieldVector<T> v) throws DimensionMismatchException, MathArithmeticException
ebeDivide
in interface FieldVector<T extends FieldElement<T>>
v
- vector by which instance elements must be divided
this[i] / v[i]
for all i
DimensionMismatchException
- if v
is not the same size as this
MathArithmeticException
- if one entry of v
is zero.public FieldVector<T> ebeMultiply(FieldVector<T> v) throws DimensionMismatchException
ebeMultiply
in interface FieldVector<T extends FieldElement<T>>
v
- vector by which instance elements must be multiplied
this[i] * v[i]
for all i
DimensionMismatchException
- if v
is not the same size as this
@Deprecated public T[] getData()
toArray()
method instead.
getData
in interface FieldVector<T extends FieldElement<T>>
public int getDimension()
getDimension
in interface FieldVector<T extends FieldElement<T>>
public T getEntry(int index) throws OutOfRangeException
getEntry
in interface FieldVector<T extends FieldElement<T>>
index
- Index location of entry to be fetched.
index
.
OutOfRangeException
- if the index is not valid.FieldVector.setEntry(int, FieldElement)
public Field<T> getField()
getField
in interface FieldVector<T extends FieldElement<T>>
public FieldVector<T> getSubVector(int index, int n) throws OutOfRangeException, NotPositiveException
getSubVector
in interface FieldVector<T extends FieldElement<T>>
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.public FieldVector<T> mapAdd(T d) throws NullArgumentException
mapAdd
in interface FieldVector<T extends FieldElement<T>>
d
- value to be added to each entry
this + d
NullArgumentException
- if d
is null
.public FieldVector<T> mapAddToSelf(T d) throws NullArgumentException
The instance is changed by this method.
mapAddToSelf
in interface FieldVector<T extends FieldElement<T>>
d
- value to be added to each entry
this
NullArgumentException
- if d
is null
.public FieldVector<T> mapDivide(T d) throws NullArgumentException, MathArithmeticException
mapDivide
in interface FieldVector<T extends FieldElement<T>>
d
- value to divide all entries by
this / d
NullArgumentException
- if d
is null
.
MathArithmeticException
- if d
is zero.public FieldVector<T> mapDivideToSelf(T d) throws NullArgumentException, MathArithmeticException
The instance is changed by this method.
mapDivideToSelf
in interface FieldVector<T extends FieldElement<T>>
d
- value to divide all entries by
this
NullArgumentException
- if d
is null
.
MathArithmeticException
- if d
is zero.public FieldVector<T> mapInv() throws MathArithmeticException
mapInv
in interface FieldVector<T extends FieldElement<T>>
MathArithmeticException
- if one of the entries is zero.public FieldVector<T> mapInvToSelf() throws MathArithmeticException
The instance is changed by this method.
mapInvToSelf
in interface FieldVector<T extends FieldElement<T>>
this
MathArithmeticException
- if one of the entries is zero.public FieldVector<T> mapMultiply(T d) throws NullArgumentException
mapMultiply
in interface FieldVector<T extends FieldElement<T>>
d
- value to multiply all entries by
this * d
NullArgumentException
- if d
is null
.public FieldVector<T> mapMultiplyToSelf(T d) throws NullArgumentException
The instance is changed by this method.
mapMultiplyToSelf
in interface FieldVector<T extends FieldElement<T>>
d
- value to multiply all entries by
this
NullArgumentException
- if d
is null
.public FieldVector<T> mapSubtract(T d) throws NullArgumentException
mapSubtract
in interface FieldVector<T extends FieldElement<T>>
d
- value to be subtracted to each entry
this - d
NullArgumentException
- if d
is null
public FieldVector<T> mapSubtractToSelf(T d) throws NullArgumentException
The instance is changed by this method.
mapSubtractToSelf
in interface FieldVector<T extends FieldElement<T>>
d
- value to be subtracted to each entry
this
NullArgumentException
- if d
is null
public FieldMatrix<T> outerProduct(SparseFieldVector<T> v)
v
- vector with which outer product should be computed
public FieldMatrix<T> outerProduct(FieldVector<T> v)
outerProduct
in interface FieldVector<T extends FieldElement<T>>
v
- vector with which outer product should be computed
public FieldVector<T> projection(FieldVector<T> v) throws DimensionMismatchException, MathArithmeticException
projection
in interface FieldVector<T extends FieldElement<T>>
v
- vector onto which this
must be projected
this
onto v
DimensionMismatchException
- if v
is not the same size as this
MathArithmeticException
- if v
is the null vector.public void set(T value)
set
in interface FieldVector<T extends FieldElement<T>>
value
- single value to set for all elementspublic void setEntry(int index, T value) throws OutOfRangeException
setEntry
in interface FieldVector<T extends FieldElement<T>>
index
- element index.value
- new value for the element.
OutOfRangeException
- if the index is not valid.FieldVector.getEntry(int)
public void setSubVector(int index, FieldVector<T> v) throws OutOfRangeException
setSubVector
in interface FieldVector<T extends FieldElement<T>>
index
- index of first element to be set.v
- vector containing the values to set.
OutOfRangeException
- if the index is not valid.public SparseFieldVector<T> subtract(SparseFieldVector<T> v) throws DimensionMismatchException
this
minus v
.
v
- vector to be subtracted
this - v
DimensionMismatchException
- if v
is not the same size as
this
.public FieldVector<T> subtract(FieldVector<T> v) throws DimensionMismatchException
this
minus v
.
subtract
in interface FieldVector<T extends FieldElement<T>>
v
- vector to be subtracted
this - v
DimensionMismatchException
- if v
is not the same size as this
public T[] toArray()
The array is independent from vector data, it's elements are copied.
toArray
in interface FieldVector<T extends FieldElement<T>>
protected void checkVectorDimensions(int n) throws DimensionMismatchException
n
- Expected dimension.
DimensionMismatchException
- if the dimensions do not match.public FieldVector<T> add(FieldVector<T> v) throws DimensionMismatchException
this
and v
.
add
in interface FieldVector<T extends FieldElement<T>>
v
- vector to be added
this + v
DimensionMismatchException
- if v
is not the same size as this
public int hashCode()
hashCode
in class Object
public boolean equals(Object obj)
equals
in class Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |