|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.mahout.math.AbstractVector
org.apache.mahout.math.VectorView
public class VectorView
Implements subset view of a Vector
| Nested Class Summary | |
|---|---|
class |
VectorView.AllIterator
|
class |
VectorView.NonZeroIterator
|
| Nested classes/interfaces inherited from class org.apache.mahout.math.AbstractVector |
|---|
AbstractVector.LocalElement |
| Nested classes/interfaces inherited from interface org.apache.mahout.math.Vector |
|---|
Vector.Element |
| Field Summary |
|---|
| Fields inherited from class org.apache.mahout.math.AbstractVector |
|---|
lengthSquared |
| Constructor Summary | |
|---|---|
VectorView()
For serialization purposes only |
|
VectorView(Vector vector,
int offset,
int cardinality)
|
|
| Method Summary | |
|---|---|
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 |
getLengthSquared()
Return the sum of squares of all elements in the 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 |
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 Vector.getElement(int) for the given index |
VectorView |
like()
Return an empty vector of the same underlying class as the receiver |
protected Matrix |
matrixLike(int rows,
int columns)
Subclasses must override to return an appropriately sparse or dense result |
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 |
| Methods inherited from class org.apache.mahout.math.AbstractVector |
|---|
aggregate, aggregate, asFormatString, assign, assign, assign, assign, assign, assign, cross, divide, dot, dotSelf, equals, get, getElement, hashCode, logNormalize, logNormalize, logNormalize, maxValue, maxValueIndex, minus, minValue, minValueIndex, norm, normalize, normalize, plus, plus, set, size, times, times, toString, toString, zSum |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public VectorView()
public VectorView(Vector vector,
int offset,
int cardinality)
| Method Detail |
|---|
protected Matrix matrixLike(int rows,
int columns)
AbstractVector
matrixLike in class AbstractVectorrows - the row cardinalitycolumns - the column cardinality
public Vector clone()
Vector
clone in interface Vectorclone in class AbstractVectorpublic boolean isDense()
public boolean isSequentialAccess()
Vector.iterator() and Vector.iterateNonZero() return elements
in ascending order by index.public VectorView like()
Vector
public double getQuick(int index)
Vector
index - an int index
public void setQuick(int index,
double value)
Vector
index - an int index into the receivervalue - a double value to setpublic int getNumNondefaultElements()
Vector
public Vector viewPart(int offset,
int length)
Vector
viewPart in interface VectorviewPart in class AbstractVectoroffset - an int offset into the receiverlength - the cardinality of the desired result
public Iterator<Vector.Element> iterateNonZero()
VectorVector.getElement(int) for the given index
Iterator over all non-zero elementspublic Iterator<Vector.Element> iterator()
VectorVector.getElement(int) for the given index
Iterator over all elementspublic double getLengthSquared()
Vector
getLengthSquared in interface VectorgetLengthSquared in class AbstractVectorpublic double getDistanceSquared(Vector v)
Vector
getDistanceSquared in interface VectorgetDistanceSquared in class AbstractVector
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||