public class DelegatingVector extends Object implements Vector
Vector.Element| Constructor and Description |
|---|
DelegatingVector() |
DelegatingVector(Vector dlg) |
| Modifier and Type | Method and Description |
|---|---|
Iterable<Vector.Element> |
all()
Gets iterator over all elements in this vector.
|
Spliterator<Double> |
allSpliterator()
Gets spliterator for all values in this vector.
|
Vector |
assign(double val)
Assigns given value to all elements of this vector.
|
Vector |
assign(double[] vals)
Assigns values from given array to this vector.
|
Vector |
assign(IntToDoubleFunction fun)
Assigns each vector element to the value generated by given function.
|
Vector |
assign(Vector vec)
Copies values from the argument vector to this one.
|
void |
compute(int i,
IgniteIntDoubleToDoubleBiFunction f)
Replace vector entry with value oldVal at i with result of computing f(i, oldVal).
|
Vector |
copy()
Creates new copy of this vector.
|
Vector |
copyOfRange(int from,
int to)
Copies the specified range of the vector into a new vector.
|
Matrix |
cross(Vector vec)
Gets the cross product of this vector and the other vector.
|
void |
destroy()
Destroys object if managed outside of JVM.
|
Vector |
divide(double x)
Creates new vector containing values from this vector divided by the argument.
|
double |
dot(Vector vec)
Gets dot product of two vectors.
|
boolean |
equals(Object o) |
<T> T |
foldMap(IgniteBiFunction<T,Double,T> foldFun,
IgniteDoubleFunction<Double> mapFun,
T zeroVal)
Folds this vector into a single value.
|
<T> T |
foldMap(Vector vec,
IgniteBiFunction<T,Double,T> foldFun,
IgniteBiFunction<Double,Double,Double> combFun,
T zeroVal)
Combines & maps two vector and folds them into a single value.
|
double |
get(int idx)
Gets the value at specified index.
|
double |
getDistanceSquared(Vector vec)
Get the square of the distance between this vector and the argument vector.
|
Vector.Element |
getElement(int idx)
Gets element at the given index.
|
double |
getLengthSquared()
Gets the sum of squares of all elements in this vector.
|
Map<String,Object> |
getMetaStorage()
Implementation should return an instance of the map to store meta attributes.
|
<T extends Serializable> |
getRaw(int idx)
Gets the value at specified index.
|
<T extends Serializable> |
getRawX(int idx)
Gets the value at specified index without checking for index boundaries.
|
VectorStorage |
getStorage()
Gets vector storage model.
|
Vector |
getVector()
Get the delegating vector
|
double |
getX(int idx)
Gets the value at specified index without checking for index boundaries.
|
IgniteUuid |
guid()
Auto-generated globally unique vector ID.
|
int |
hashCode() |
Vector |
increment(int idx,
double val)
Increments value at given index.
|
Vector |
incrementX(int idx,
double val)
Increments value at given index without checking for index boundaries.
|
boolean |
isArrayBased()
Checks if implementation is based on Java arrays.
|
boolean |
isDense()
Checks if this implementation should be considered dense so that it explicitly
represents every value.
|
boolean |
isDistributed()
Checks whether implementation is JVM-local or distributed (multi-JVM).
|
boolean |
isNumeric() |
double |
kNorm(double power)
Gets the k-norm of the vector.
|
Vector |
like(int crd)
Creates new empty vector of the same underlying class but of different cardinality.
|
Matrix |
likeMatrix(int rows,
int cols)
Creates new matrix of compatible flavor with given size.
|
Vector |
logNormalize()
Creates new vector containing the
log(1 + entry) / L_2 norm values of this vector. |
Vector |
logNormalize(double power)
Creates new vector with a normalized value calculated as
log_power(1 + entry) / L_power norm. |
Vector |
map(IgniteBiFunction<Double,Double,Double> fun,
double y)
Maps all elements of this vector by applying given function to each element with a constant
second parameter
y. |
Vector |
map(IgniteDoubleFunction<Double> fun)
Maps all values in this vector through a given function.
|
Vector |
map(Vector vec,
IgniteBiFunction<Double,Double,Double> fun)
Maps all values in this vector through a given function.
|
Vector.Element |
maxElement()
Gets maximum element in this vector.
|
double |
maxValue()
Gets maximum value in this vector.
|
Vector.Element |
minElement()
Gets minimal element in this vector.
|
Vector |
minus(Vector vec)
Creates new vector containing element by element difference between this vector and the argument one.
|
double |
minValue()
Gets minimal value in this vector.
|
int |
nonZeroElements()
Gets number of non-zero elements in this vector.
|
Iterable<Vector.Element> |
nonZeroes()
Iterates ove all non-zero elements in this vector.
|
Spliterator<Double> |
nonZeroSpliterator()
Gets spliterator for all non-zero values in this vector.
|
Vector |
normalize()
Creates new vector containing the normalized (L_2 norm) values of this vector.
|
Vector |
normalize(double power)
Creates new vector containing the normalized (L_power norm) values of this vector.
|
Vector |
plus(double x)
Creates new vector containing sum of each element in this vector and argument.
|
Vector |
plus(Vector vec)
Creates new vector containing element by element sum from both vectors.
|
void |
readExternal(ObjectInput in) |
Vector |
set(int idx,
double val)
Sets value.
|
Vector |
setRaw(int idx,
Serializable val)
Sets value.
|
Vector |
setRawX(int idx,
Serializable val)
Sets value without checking for index boundaries.
|
Vector |
setX(int idx,
double val)
Sets value without checking for index boundaries.
|
int |
size()
Gets cardinality of this vector (maximum number of the elements).
|
Vector |
sort()
Sorts this vector in ascending order.
|
double |
sum()
Gets the sum of all elements in this vector.
|
Vector |
times(double x)
Gets a new vector that contains product of each element and the argument.
|
Vector |
times(Vector vec)
Gets a new vector that is an element-wie product of this vector and the argument.
|
Matrix |
toMatrix(boolean rowLike)
Converts this vector into [N x 1] or [1 x N] matrix where N is this vector cardinality.
|
Matrix |
toMatrixPlusOne(boolean rowLike,
double zeroVal)
Converts this vector into [N+1 x 1] or [1 x N+1] matrix where N is this vector cardinality
|
Vector |
viewPart(int off,
int len) |
void |
writeExternal(ObjectOutput out) |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitasArray, labeledgetAttribute, hasAttribute, removeAttribute, setAttributepublic DelegatingVector()
public DelegatingVector(Vector dlg)
dlg - Parent vector.public Vector getVector()
public void writeExternal(ObjectOutput out) throws IOException
writeExternal in interface ExternalizableIOExceptionpublic void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal in interface ExternalizableIOExceptionClassNotFoundExceptionpublic Map<String,Object> getMetaStorage()
getMetaStorage in interface MetaAttributespublic Matrix likeMatrix(int rows, int cols)
likeMatrix in interface Vectorrows - Number of rows.cols - Number of columns.public Matrix toMatrix(boolean rowLike)
public Matrix toMatrixPlusOne(boolean rowLike, double zeroVal)
zeroVal parameter.toMatrixPlusOne in interface VectorrowLike - true for rowLike [N+1 x 1], or false for column [1 x N+1] matrix.public int size()
public boolean isDense()
isDense in interface StorageOpsMetricspublic double minValue()
public double maxValue()
public boolean isArrayBased()
isArrayBased in interface StorageOpsMetricspublic Vector copy()
public Iterable<Vector.Element> all()
Vector.Element instance so you need to copy it
if you want to retain it outside of iteration.public Iterable<Vector.Element> nonZeroes()
Vector.Element instance so you need to copy it
if you want to retain it outside of iteration.public Vector sort()
public Vector copyOfRange(int from, int to)
copyOfRange in interface Vectorfrom - the initial index of the range to be copied, inclusiveto - the final index of the range to be copied, exclusive.
(This index may lie outside the array.)public Spliterator<Double> allSpliterator()
allSpliterator in interface Vectorpublic Spliterator<Double> nonZeroSpliterator()
nonZeroSpliterator in interface Vectorpublic Vector.Element getElement(int idx)
Vector.Element instance so you need to copy it
if you want to retain it outside of iteration.getElement in interface Vectoridx - Element's index.public Vector assign(double val)
public Vector assign(double[] vals)
public Vector assign(IntToDoubleFunction fun)
public Vector map(IgniteDoubleFunction<Double> fun)
public Vector map(Vector vec, IgniteBiFunction<Double,Double,Double> fun)
A, argument vector B and the
function F this method maps every element x as:
A(x) = F(A(x), B(x))public Vector map(IgniteBiFunction<Double,Double,Double> fun, double y)
y.public Vector divide(double x)
public double dot(Vector vec)
public double get(int idx)
public double getX(int idx)
public <T extends Serializable> T getRaw(int idx)
public <T extends Serializable> T getRawX(int idx)
public Vector like(int crd)
public Vector minus(Vector vec)
public Vector normalize()
public Vector normalize(double power)
normalize in interface Vectorpower - The power to use. Must be >= 0. May also be Double.POSITIVE_INFINITY.x such that norm(x, power) == 1public Vector logNormalize()
log(1 + entry) / L_2 norm values of this vector.logNormalize in interface Vectorpublic Vector logNormalize(double power)
log_power(1 + entry) / L_power norm.logNormalize in interface Vectorpower - The power to use. Must be > 1. Cannot be Double.POSITIVE_INFINITY.public double kNorm(double power)
kNorm in interface Vectorpower - The power to use.Vector.normalize(double)public Vector.Element minElement()
minElement in interface Vectorpublic Vector.Element maxElement()
maxElement in interface Vectorpublic Vector plus(double x)
public Vector plus(Vector vec)
public Vector set(int idx, double val)
public Vector setX(int idx, double val)
public Vector setRaw(int idx, Serializable val)
public Vector setRawX(int idx, Serializable val)
public Vector incrementX(int idx, double val)
incrementX in interface Vectoridx - Vector index.val - Increment value.public Vector increment(int idx, double val)
public int nonZeroElements()
nonZeroElements in interface Vectorpublic Vector times(double x)
public Vector times(Vector vec)
public Vector viewPart(int off, int len)
public VectorStorage getStorage()
getStorage in interface Vectorpublic double sum()
public <T> T foldMap(IgniteBiFunction<T,Double,T> foldFun, IgniteDoubleFunction<Double> mapFun, T zeroVal)
foldMap in interface VectorT - Type of the folded value.foldFun - Folding function that takes two parameters: accumulator and the current value.mapFun - Mapping function that is called on each vector element before its passed to the accumulator (as its
second parameter).zeroVal - Zero value for fold operation.public <T> T foldMap(Vector vec, IgniteBiFunction<T,Double,T> foldFun, IgniteBiFunction<Double,Double,Double> combFun, T zeroVal)
public double getLengthSquared()
getLengthSquared in interface Vectorpublic double getDistanceSquared(Vector vec)
getDistanceSquared in interface Vectorvec - Another vector.public boolean isDistributed()
isDistributed in interface StorageOpsMetricspublic boolean isNumeric()
isNumeric in interface StorageOpsMetricspublic IgniteUuid guid()
public void compute(int i,
IgniteIntDoubleToDoubleBiFunction f)
public void destroy()
destroy in interface Destroyable
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 8.9.17-p1 Release Date : November 27 2025