public class VectorView extends AbstractVector
| Modifier and Type | Class and Description |
|---|---|
class |
VectorView.AllIterator |
class |
VectorView.NonZeroIterator |
AbstractVector.LocalElementVector.Element| Modifier and Type | Field and Description |
|---|---|
protected int |
offset |
protected Vector |
vector |
lengthSquared| Constructor and Description |
|---|
VectorView()
For serialization purposes only
|
VectorView(Vector vector,
int offset,
int cardinality) |
| Modifier and Type | Method and Description |
|---|---|
Vector |
clone()
Return a copy of the recipient
|
double |
getDistanceSquared(Vector v)
Get the square of the distance between this vector and the other vector.
|
double |
getIteratorAdvanceCost()
Gets an estimate of the cost (in number of operations) it takes to advance an iterator through the nonzero
elements of this vector.
|
double |
getLengthSquared()
Return the sum of squares of all elements in the vector.
|
double |
getLookupCost()
Gets an estimate of the cost (in number of operations) it takes to lookup a random element in this vector.
|
int |
getNumNondefaultElements()
Return the number of values in the recipient which are not the default value.
|
double |
getQuick(int index)
Return the value at the given index, without checking bounds
|
boolean |
isAddConstantTime()
Return true iff adding a new (nonzero) element takes constant time for this vector.
|
boolean |
isDense() |
boolean |
isSequentialAccess() |
Iterator<Vector.Element> |
iterateNonZero()
Iterates over all non-zero elements.
|
Iterator<Vector.Element> |
iterator()
Iterates over all elements * NOTE: Implementations may choose to reuse the Element returned for performance
reasons, so if you need a copy of it, you should call
AbstractVector.getElement(int) for the given index |
VectorView |
like()
Return an empty vector of the same underlying class as the receiver
|
Vector |
like(int cardinality)
Return a new empty vector of the same underlying class as the receiver with given cardinality
|
protected Matrix |
matrixLike(int rows,
int columns)
Subclasses must override to return an appropriately sparse or dense result
|
void |
mergeUpdates(OrderedIntDoubleMapping updates)
Used internally by assign() to update multiple indices and values at once.
|
void |
setQuick(int index,
double value)
Set the value at the given index, without checking bounds
|
Vector |
viewPart(int offset,
int length)
Return a new vector containing the subset of the recipient
|
aggregate, aggregate, all, asFormatString, assign, assign, assign, assign, assign, assign, createOptimizedCopy, cross, divide, dot, dotSelf, equals, get, getElement, getNumNonZeroElements, hashCode, incrementQuick, invalidateCachedLength, logNormalize, logNormalize, logNormalize, maxValue, maxValueIndex, minus, minValue, minValueIndex, nonZeroes, norm, normalize, normalize, plus, plus, set, size, sparseVectorToString, times, times, toString, toString, zSumprotected Vector vector
protected int offset
public VectorView()
public VectorView(Vector vector, int offset, int cardinality)
protected Matrix matrixLike(int rows, int columns)
AbstractVectormatrixLike in class AbstractVectorrows - the row cardinalitycolumns - the column cardinalitypublic Vector clone()
Vectorclone in interface Vectorclone in class AbstractVectorpublic boolean isDense()
public boolean isSequentialAccess()
Vector.all() and Vector.nonZeroes() ()} return elements
in ascending order by index.public VectorView like()
Vectorpublic Vector like(int cardinality)
Vectorpublic double getQuick(int index)
Vectorindex - an int indexpublic void setQuick(int index,
double value)
Vectorindex - an int index into the receivervalue - a double value to setpublic int getNumNondefaultElements()
Vectorpublic Vector viewPart(int offset, int length)
VectorviewPart in interface VectorviewPart in class AbstractVectoroffset - an int offset into the receiverlength - the cardinality of the desired resultpublic Iterator<Vector.Element> iterateNonZero()
AbstractVectorAbstractVector.getElement(int) for the given indexiterateNonZero in class AbstractVectorIterator over all non-zero elementspublic Iterator<Vector.Element> iterator()
AbstractVectorAbstractVector.getElement(int) for the given indexiterator in class AbstractVectorIterator over all elementspublic double getLengthSquared()
VectorgetLengthSquared in interface VectorgetLengthSquared in class AbstractVectorpublic double getDistanceSquared(Vector v)
VectorgetDistanceSquared in interface VectorgetDistanceSquared in class AbstractVectorpublic double getLookupCost()
Vectorpublic double getIteratorAdvanceCost()
Vectorpublic boolean isAddConstantTime()
Vectorpublic void mergeUpdates(OrderedIntDoubleMapping updates)
updates - a mapping of indices to values to merge in the vector.Copyright © 2008–2016 The Apache Software Foundation. All rights reserved.