|
||||||||||
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.Element
|
class |
VectorView.NonZeroIterator
|
Field Summary |
---|
Fields inherited from class org.apache.mahout.math.AbstractVector |
---|
lengthSquared, size |
Constructor Summary | |
---|---|
VectorView()
For serialization purposes only |
|
VectorView(Vector vector,
int offset,
int cardinality)
|
Method Summary | |
---|---|
void |
addTo(Vector v)
Add the elements to the other vector and results are stored in that vector. |
Vector |
clone()
Return a copy of the recipient |
double |
dot(Vector x)
Return the dot product of the recipient and the argument |
boolean |
equals(java.lang.Object o)
|
double |
getDistanceSquared(Vector v)
Get the square of the distance between this vector and the other vector. |
Vector.Element |
getElement(int index)
Return an object of Vector.Element representing an element of this Vector. |
double |
getLengthSquared()
Return the sum of squares of all elements in the vector. |
int |
getNumNondefaultElements()
Return the number of values in the recipient |
double |
getQuick(int index)
Return the value at the given index, without checking bounds |
int |
hashCode()
|
java.util.Iterator<Vector.Element> |
iterateAll()
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 |
java.util.Iterator<Vector.Element> |
iterateNonZero()
Iterates over all non-zero elements. |
Vector |
like()
Return an empty matrix of the same underlying class as the receiver |
Vector |
like(int cardinality)
Return an empty matrix of the same underlying class as the receiver and of the given cardinality |
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 |
int |
size()
Return the cardinality of the recipient (the maximum number of values) |
Vector |
viewPart(int offset,
int length)
Return a new matrix 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, decodeVector, divide, dotSelf, equivalent, get, get, getLabelBindings, getName, maxValue, maxValueIndex, minus, norm, normalize, normalize, plus, plus, set, set, set, setLabelBindings, setName, strictEquivalence, times, times, zSum |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, toString, 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 AbstractVector
rows
- the row cardinalitycolumns
- the column cardinality
public int size()
Vector
size
in interface Vector
size
in class AbstractVector
public Vector clone()
Vector
clone
in interface Vector
clone
in class AbstractVector
public double getQuick(int index)
Vector
index
- an int index
public Vector like()
Vector
public Vector like(int cardinality)
Vector
cardinality
- an int specifying the desired cardinality
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 Vector
viewPart
in class AbstractVector
offset
- an int offset into the receiverlength
- the cardinality of the desired result
public java.util.Iterator<Vector.Element> iterateNonZero()
Vector
Vector.getElement(int)
for the given index
Iterator
over all non-zero elementspublic java.util.Iterator<Vector.Element> iterateAll()
Vector
Vector.getElement(int)
for the given index
Iterator
over all elementspublic double dot(Vector x)
Vector
dot
in interface Vector
dot
in class AbstractVector
x
- a Vector
public Vector.Element getElement(int index)
Vector
index
- Index of the Vector.Element required
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class AbstractVector
public double getLengthSquared()
Vector
getLengthSquared
in interface Vector
getLengthSquared
in class AbstractVector
public double getDistanceSquared(Vector v)
Vector
getDistanceSquared
in interface Vector
getDistanceSquared
in class AbstractVector
public void addTo(Vector v)
Vector
addTo
in interface Vector
addTo
in class AbstractVector
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |