|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.mahout.math.AbstractMatrix
org.apache.mahout.math.SparseColumnMatrix
public class SparseColumnMatrix
sparse matrix with general element values whose columns are accessible quickly. Implemented as a column array of SparseVectors.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.apache.mahout.math.AbstractMatrix |
---|
AbstractMatrix.TransposeViewVector |
Field Summary |
---|
Fields inherited from class org.apache.mahout.math.AbstractMatrix |
---|
COL, columnLabelBindings, ROW, rowLabelBindings |
Constructor Summary | |
---|---|
SparseColumnMatrix()
|
|
SparseColumnMatrix(int[] cardinality)
Construct a matrix of the given cardinality |
|
SparseColumnMatrix(int[] cardinality,
RandomAccessSparseVector[] columns)
Construct a matrix of the given cardinality with the given data columns |
Method Summary | |
---|---|
Matrix |
assignColumn(int column,
Vector other)
Assign the other vector values to the column of the receiver |
Matrix |
assignRow(int row,
Vector other)
Assign the other vector values to the row of the receiver |
Matrix |
clone()
Return a copy of the recipient |
Vector |
getColumn(int column)
Return the column at the given index |
int[] |
getNumNondefaultElements()
Return the number of values in the recipient |
double |
getQuick(int row,
int column)
Return the value at the given indexes, without checking bounds |
Vector |
getRow(int row)
Return the row at the given index |
Matrix |
like()
Return an empty matrix of the same underlying class as the receiver |
Matrix |
like(int rows,
int columns)
Return an empty matrix of the same underlying class as the receiver and of the given cardinality |
int |
numSlices()
Abstracted out for the iterator |
void |
setQuick(int row,
int column,
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) |
protected Vector |
slice(int index)
Iterate over columns. |
Matrix |
viewPart(int[] offset,
int[] size)
Return a new matrix containing the subset of the recipient |
Methods inherited from class org.apache.mahout.math.AbstractMatrix |
---|
asFormatString, assign, assign, assign, assign, assign, decodeMatrix, determinant, divide, get, get, getColumnLabelBindings, getRowLabelBindings, iterateAll, iterator, minus, numCols, numRows, plus, plus, set, set, set, set, set, set, setColumnLabelBindings, setRowLabelBindings, times, times, times, timesSquared, transpose, zSum |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SparseColumnMatrix()
public SparseColumnMatrix(int[] cardinality, RandomAccessSparseVector[] columns)
cardinality
- the int[2] cardinalitycolumns
- a RandomAccessSparseVector[] array of columnspublic SparseColumnMatrix(int[] cardinality)
cardinality
- the int[2] cardinalityMethod Detail |
---|
public int[] size()
Matrix
public Matrix clone()
Matrix
clone
in interface Matrix
clone
in class AbstractMatrix
protected Vector slice(int index)
slice
in class AbstractMatrix
index
- of the column number to grab as a vector (shallowly)
public int numSlices()
numSlices
in interface VectorIterable
numSlices
in class AbstractMatrix
public double getQuick(int row, int column)
Matrix
row
- an int row indexcolumn
- an int column index
public Matrix like()
Matrix
public Matrix like(int rows, int columns)
Matrix
rows
- the int number of rowscolumns
- the int number of columnspublic void setQuick(int row, int column, double value)
Matrix
row
- an int row index into the receivercolumn
- an int column index into the receivervalue
- a double value to setpublic int[] getNumNondefaultElements()
Matrix
public Matrix viewPart(int[] offset, int[] size)
Matrix
offset
- an int[2] offset into the receiversize
- the int[2] size of the desired result
public Matrix assignColumn(int column, Vector other)
Matrix
column
- the int row to assignother
- a Vector
public Matrix assignRow(int row, Vector other)
Matrix
row
- the int row to assignother
- a Vector
public Vector getColumn(int column)
Matrix
column
- an int column index
public Vector getRow(int row)
Matrix
row
- an int row index
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |