|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Matrix
The basic interface including numerous convenience functions
Method Summary | |
---|---|
double |
aggregate(BinaryFunction combiner,
UnaryFunction mapper)
Collects the results of a function applied to each element of a matrix and then aggregated. |
Vector |
aggregateColumns(VectorFunction f)
Collects the results of a function applied to each column of a matrix. |
Vector |
aggregateRows(VectorFunction f)
Collects the results of a function applied to each row of a matrix. |
java.lang.String |
asFormatString()
|
Matrix |
assign(double value)
Assign the value to all elements of the receiver |
Matrix |
assign(double[][] values)
Assign the values to the receiver |
Matrix |
assign(Matrix other)
Assign the other vector values to the receiver |
Matrix |
assign(Matrix other,
BinaryFunction function)
Apply the function to each element of the receiver and the corresponding element of the other argument |
Matrix |
assign(UnaryFunction function)
Apply the function to each element of the receiver |
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 |
int |
columnSize()
|
double |
determinant()
Returns matrix determinator using Laplace theorem |
Matrix |
divide(double x)
Return a new matrix containing the values of the recipient divided by the argument |
double |
get(int row,
int column)
Return the value at the given indexes |
double |
get(java.lang.String rowLabel,
java.lang.String columnLabel)
Return the value at the given labels |
Vector |
getColumn(int column)
Return the column at the given index |
java.util.Map<java.lang.String,java.lang.Integer> |
getColumnLabelBindings()
Return a map of the current column label bindings of the receiver |
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 |
java.util.Map<java.lang.String,java.lang.Integer> |
getRowLabelBindings()
Return a map of the current row label bindings of the receiver |
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. |
Matrix |
minus(Matrix x)
Return a new matrix containing the element by element difference of the recipient and the argument |
Matrix |
plus(double x)
Return a new matrix containing the sum of each value of the recipient and the argument |
Matrix |
plus(Matrix x)
Return a new matrix containing the element by element sum of the recipient and the argument |
int |
rowSize()
|
void |
set(int row,
double[] data)
|
void |
set(int row,
int column,
double value)
Set the value at the given index |
void |
set(java.lang.String rowLabel,
double[] rowData)
Sets the row values at the given row label |
void |
set(java.lang.String rowLabel,
int row,
double[] rowData)
Sets the row values at the given row index and updates the row labels |
void |
set(java.lang.String rowLabel,
java.lang.String columnLabel,
double value)
Set the value at the given index |
void |
set(java.lang.String rowLabel,
java.lang.String columnLabel,
int row,
int column,
double value)
Set the value at the given index, updating the row and column label bindings |
void |
setColumnLabelBindings(java.util.Map<java.lang.String,java.lang.Integer> bindings)
Sets a map of column label bindings in the receiver |
void |
setQuick(int row,
int column,
double value)
Set the value at the given index, without checking bounds |
void |
setRowLabelBindings(java.util.Map<java.lang.String,java.lang.Integer> bindings)
Sets a map of row label bindings in the receiver |
int[] |
size()
Return the cardinality of the recipient (the maximum number of values) |
Matrix |
times(double x)
Return a new matrix containing the product of each value of the recipient and the argument |
Matrix |
times(Matrix x)
Return a new matrix containing the product of the recipient and the argument |
Matrix |
transpose()
Return a new matrix that is the transpose of the receiver |
Vector |
viewColumn(int column)
|
Matrix |
viewPart(int[] offset,
int[] size)
Return a new matrix containing the subset of the recipient |
Matrix |
viewPart(int rowOffset,
int rowsRequested,
int columnOffset,
int columnsRequested)
Return a new matrix containing the subset of the recipient |
Vector |
viewRow(int row)
|
double |
zSum()
Return the sum of all the elements of the receiver |
Methods inherited from interface org.apache.mahout.math.VectorIterable |
---|
iterateAll, numCols, numRows, numSlices, times, timesSquared |
Methods inherited from interface java.lang.Iterable |
---|
iterator |
Method Detail |
---|
java.lang.String asFormatString()
Matrix assign(double value)
value
- a double value
Matrix assign(double[][] values)
values
- a double[] of values
CardinalityException
- if the cardinalities differMatrix assign(Matrix other)
other
- a Matrix
CardinalityException
- if the cardinalities differMatrix assign(UnaryFunction function)
function
- a UnaryFunction to apply
Matrix assign(Matrix other, BinaryFunction function)
other
- a Matrix containing the second arguments to the functionfunction
- a BinaryFunction to apply
CardinalityException
- if the cardinalities differMatrix assignColumn(int column, Vector other)
column
- the int row to assignother
- a Vector
CardinalityException
- if the cardinalities differMatrix assignRow(int row, Vector other)
row
- the int row to assignother
- a Vector
CardinalityException
- if the cardinalities differVector aggregateRows(VectorFunction f)
f
- The function to be applied to each row.
Vector aggregateColumns(VectorFunction f)
f
- The function to be applied to each column.
double aggregate(BinaryFunction combiner, UnaryFunction mapper)
combiner
- A function that combines the results of the mapper.mapper
- A function to apply to each element.
int[] size()
int columnSize()
int rowSize()
Matrix clone()
double determinant()
Matrix divide(double x)
x
- a double value
double get(int row, int column)
row
- an int row indexcolumn
- an int column index
IndexException
- if the index is out of boundsVector getColumn(int column)
column
- an int column index
IndexException
- if the index is out of boundsVector getRow(int row)
row
- an int row index
IndexException
- if the index is out of boundsdouble getQuick(int row, int column)
row
- an int row indexcolumn
- an int column index
Matrix like()
Matrix like(int rows, int columns)
rows
- the int number of rowscolumns
- the int number of columnsMatrix minus(Matrix x)
x
- a Matrix
CardinalityException
- if the cardinalities differMatrix plus(double x)
x
- a double
Matrix plus(Matrix x)
x
- a Matrix
CardinalityException
- if the cardinalities differvoid set(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 set
IndexException
- if the index is out of boundsvoid set(int row, double[] data)
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 setint[] getNumNondefaultElements()
Matrix times(double x)
x
- a double argument
Matrix times(Matrix x)
x
- a Matrix argument
CardinalityException
- if the cardinalities are incompatibleMatrix transpose()
Matrix viewPart(int[] offset, int[] size)
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 receiverMatrix viewPart(int rowOffset, int rowsRequested, int columnOffset, int columnsRequested)
rowOffset
- The first row of the viewrowsRequested
- The number of rows in the viewcolumnOffset
- The first column in the viewcolumnsRequested
- The number of columns in the view
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
receiverdouble zSum()
java.util.Map<java.lang.String,java.lang.Integer> getColumnLabelBindings()
java.util.Map<java.lang.String,java.lang.Integer> getRowLabelBindings()
void setColumnLabelBindings(java.util.Map<java.lang.String,java.lang.Integer> bindings)
bindings
- a Mapvoid setRowLabelBindings(java.util.Map<java.lang.String,java.lang.Integer> bindings)
bindings
- a Mapdouble get(java.lang.String rowLabel, java.lang.String columnLabel)
rowLabel
- a String row labelcolumnLabel
- a String column label
IndexException
- if the index is out of boundsvoid set(java.lang.String rowLabel, java.lang.String columnLabel, double value)
rowLabel
- a String row labelcolumnLabel
- a String column labelvalue
- a double value to set
IndexException
- if the index is out of boundsvoid set(java.lang.String rowLabel, java.lang.String columnLabel, int row, int column, double value)
rowLabel
- a String row labelcolumnLabel
- a String column labelrow
- an int row indexcolumn
- an int column indexvalue
- a double valuevoid set(java.lang.String rowLabel, double[] rowData)
rowLabel
- a String row labelrowData
- a double[] array of row datavoid set(java.lang.String rowLabel, int row, double[] rowData)
rowLabel
- the String row labelrow
- an int the row indexrowData
- a double[] array of row dataVector viewRow(int row)
Vector viewColumn(int column)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |