org.apache.mahout.math
Class AbstractMatrix.TransposeViewVector

java.lang.Object
  extended by org.apache.mahout.math.AbstractVector
      extended by org.apache.mahout.math.AbstractMatrix.TransposeViewVector
All Implemented Interfaces:
java.lang.Cloneable, Vector
Enclosing class:
AbstractMatrix

protected class AbstractMatrix.TransposeViewVector
extends AbstractVector


Nested Class Summary
 
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, size
 
Constructor Summary
protected AbstractMatrix.TransposeViewVector(Matrix m, int offset)
           
protected AbstractMatrix.TransposeViewVector(Matrix m, int offset, boolean rowToColumn)
           
 
Method Summary
 Vector clone()
          Return a copy of the recipient
 Vector.Element getElement(int i)
          Return an object of Vector.Element representing an element of this Vector.
 int getNumNondefaultElements()
          TODO: currently I don't know of an efficient way to getVector this value correctly.
 double getQuick(int index)
          Return the value at the given index, without checking bounds
 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()
          Currently delegates to iterateAll.
 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
protected  Vector newVector(int cardinality)
           
 void setQuick(int index, double value)
          Set the value at the given index, without checking bounds
 
Methods inherited from class org.apache.mahout.math.AbstractVector
addTo, aggregate, aggregate, asFormatString, assign, assign, assign, assign, assign, assign, cross, decodeVector, divide, dot, dotSelf, equivalent, get, get, getDistanceSquared, getLabelBindings, getLengthSquared, getName, hashCode, maxValue, maxValueIndex, minus, norm, normalize, normalize, plus, plus, set, set, set, setLabelBindings, setName, size, strictEquivalence, times, times, viewPart, zSum
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractMatrix.TransposeViewVector

protected AbstractMatrix.TransposeViewVector(Matrix m,
                                             int offset)

AbstractMatrix.TransposeViewVector

protected AbstractMatrix.TransposeViewVector(Matrix m,
                                             int offset,
                                             boolean rowToColumn)
Method Detail

clone

public Vector clone()
Description copied from interface: Vector
Return a copy of the recipient

Specified by:
clone in interface Vector
Overrides:
clone in class AbstractVector
Returns:
a new Vector

matrixLike

protected Matrix matrixLike(int rows,
                            int columns)
Description copied from class: AbstractVector
Subclasses must override to return an appropriately sparse or dense result

Specified by:
matrixLike in class AbstractVector
Parameters:
rows - the row cardinality
columns - the column cardinality
Returns:
a Matrix

iterateAll

public java.util.Iterator<Vector.Element> iterateAll()
Description copied from interface: Vector
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

Returns:
An Iterator over all elements

iterateNonZero

public java.util.Iterator<Vector.Element> iterateNonZero()
Currently delegates to iterateAll. TODO: This could be optimized to at least skip empty rows if there are many of them.

Returns:
an iterator (currently dense).

getElement

public Vector.Element getElement(int i)
Description copied from interface: Vector
Return an object of Vector.Element representing an element of this Vector. Useful when designing new iterator types.

Parameters:
i - Index of the Vector.Element required
Returns:
The Vector.Element Object

getQuick

public double getQuick(int index)
Description copied from interface: Vector
Return the value at the given index, without checking bounds

Parameters:
index - an int index
Returns:
the double at the index

setQuick

public void setQuick(int index,
                     double value)
Description copied from interface: Vector
Set the value at the given index, without checking bounds

Parameters:
index - an int index into the receiver
value - a double value to set

newVector

protected Vector newVector(int cardinality)

like

public Vector like()
Description copied from interface: Vector
Return an empty matrix of the same underlying class as the receiver

Returns:
a Vector

like

public Vector like(int cardinality)
Description copied from interface: Vector
Return an empty matrix of the same underlying class as the receiver and of the given cardinality

Parameters:
cardinality - an int specifying the desired cardinality
Returns:
a Vector

getNumNondefaultElements

public int getNumNondefaultElements()
TODO: currently I don't know of an efficient way to getVector this value correctly.

Returns:
the number of nonzero entries


Copyright © 2008-2010 The Apache Software Foundation. All Rights Reserved.