net.sourceforge.combean.mathprog.linalg
Class ColumnVectorOfMatrix

Package class diagram package ColumnVectorOfMatrix
java.lang.Object
  extended by net.sourceforge.combean.mathprog.linalg.ColumnVectorOfMatrix
All Implemented Interfaces:
SparseVec<NoLabel>, SparseVector

public class ColumnVectorOfMatrix
extends Object
implements SparseVector

A column of a matrix as a vector.


Constructor Summary
ColumnVectorOfMatrix(Matrix matrix, int column)
          Constructor.
 
Method Summary
 int getColumn()
           
 int getDimension()
          Get the dimension of the vector.
 Matrix getMatrix()
           
 int getNumIterations()
          Return the number of entries of the vector through which the iterator returned by getIterator() iterates.
 VectorIterator<NoLabel> iterator()
          Get an iterator which iterates through all non-zero entries of the vector.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ColumnVectorOfMatrix

public ColumnVectorOfMatrix(Matrix matrix,
                            int column)
Constructor.

Parameters:
matrix - the matrix from which the column shall be taken.
column - the index of the column.
Method Detail

getDimension

public int getDimension()
Description copied from interface: SparseVector
Get the dimension of the vector.

Specified by:
getDimension in interface SparseVector
Returns:
the dimension of the vector.

iterator

public VectorIterator<NoLabel> iterator()
Description copied from interface: SparseVec
Get an iterator which iterates through all non-zero entries of the vector. The iteration must stop after exactly getNumNonZeroEntries() steps. An implementation may choose to also return zero entries during the iteration. In that case, these entries must also be counted by getNumIterations(); The iteration does not have to return the values in order of increasing indices.

Specified by:
iterator in interface SparseVec<NoLabel>
Returns:
an iterator for the non-zero entries.

getNumIterations

public int getNumIterations()
Description copied from interface: SparseVec
Return the number of entries of the vector through which the iterator returned by getIterator() iterates.

Specified by:
getNumIterations in interface SparseVec<NoLabel>
Returns:
the number of iterations of getIterator.

getColumn

public final int getColumn()
Returns:
Returns the column.

getMatrix

public final Matrix getMatrix()
Returns:
Returns the matrix.

toString

public String toString()
Overrides:
toString in class Object