|
||||||||||
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.FileBasedMatrix
public final class FileBasedMatrix
Provides a way to get data from a file and treat it as if it were a matrix, but avoids putting all that data onto the Java heap. Instead, the file is mapped into non-heap memory as a DoubleBuffer and we access that instead.
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, columns, ROW, rowLabelBindings, rows |
Constructor Summary | |
---|---|
FileBasedMatrix(int rows,
int columns)
Constructs an empty matrix of the given size. |
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 |
double |
getQuick(int row,
int column)
Return the value at the given indexes, without checking bounds |
Matrix |
like()
Return an empty matrix of the same underlying class as the receiver |
Matrix |
like(int rows,
int columns)
Returns an empty matrix of the same underlying class as the receiver and of the specified size. |
void |
setData(File f,
boolean loadNow)
|
void |
setQuick(int row,
int column,
double value)
Set the value at the given index, without checking bounds |
Matrix |
viewPart(int[] offset,
int[] size)
Return a view into part of a matrix. |
static void |
writeMatrix(File f,
Matrix m)
|
Methods inherited from class org.apache.mahout.math.AbstractMatrix |
---|
aggregate, aggregateColumns, aggregateRows, asFormatString, assign, assign, assign, assign, assign, clone, columnSize, determinant, divide, get, get, getColumnLabelBindings, getNumNondefaultElements, getRowLabelBindings, iterateAll, iterator, minus, numCols, numRows, numSlices, plus, plus, rowSize, set, set, set, set, set, set, setColumnLabelBindings, setRowLabelBindings, times, times, times, timesSquared, toString, transpose, viewColumn, viewDiagonal, viewPart, viewRow, zSum |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public FileBasedMatrix(int rows, int columns)
rows
- The number of rows in the result.columns
- The number of columns in the result.Method Detail |
---|
public void setData(File f, boolean loadNow) throws IOException
IOException
public static void writeMatrix(File f, Matrix m) throws IOException
IOException
public Matrix assignColumn(int column, Vector other)
column
- the int row to assignother
- a Vector
CardinalityException
- if the cardinalities differpublic Matrix assignRow(int row, Vector other)
row
- the int row to assignother
- a Vector
CardinalityException
- if the cardinalities differpublic double getQuick(int row, int column)
row
- an int row indexcolumn
- an int column index
public Matrix like()
public Matrix like(int rows, int columns)
rows
- the int number of rowscolumns
- the int number of columnspublic void setQuick(int row, int column, double value)
row
- an int row index into the receivercolumn
- an int column index into the receivervalue
- a double value to setpublic Matrix viewPart(int[] offset, int[] size)
viewPart
in interface Matrix
viewPart
in class AbstractMatrix
offset
- an int[2] offset into the receiversize
- the int[2] size of the desired result
CardinalityException
- if the length is greater than the cardinality of the receiver
IndexException
- if the offset is negative or the offset+length is outside of the receiver
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |