|
||||||||||
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(DoubleDoubleFunction combiner,
DoubleFunction 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. |
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(DoubleFunction function)
Apply the function to each element of the receiver |
Matrix |
assign(Matrix other)
Assign the other vector values to the receiver |
Matrix |
assign(Matrix other,
DoubleDoubleFunction function)
Apply the function to each element of the receiver and the corresponding element of the other argument |
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(String rowLabel,
String columnLabel)
Return the value at the given labels |
Map<String,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 |
Map<String,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(String rowLabel,
double[] rowData)
Sets the row values at the given row label |
void |
set(String rowLabel,
int row,
double[] rowData)
Sets the row values at the given row index and updates the row labels |
void |
set(String rowLabel,
String columnLabel,
double value)
Set the value at the given index |
void |
set(String rowLabel,
String columnLabel,
int row,
int column,
double value)
Set the value at the given index, updating the row and column label bindings |
void |
setColumnLabelBindings(Map<String,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(Map<String,Integer> bindings)
Sets a map of row label bindings in the receiver |
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)
Return a reference to a column. |
Vector |
viewDiagonal()
Returns a reference to the diagonal of a matrix. |
Matrix |
viewPart(int[] offset,
int[] size)
Return a view into part of a matrix. |
Matrix |
viewPart(int rowOffset,
int rowsRequested,
int columnOffset,
int columnsRequested)
Return a view into part of a matrix. |
Vector |
viewRow(int row)
Return a reference to a 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 |
---|
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(DoubleFunction function)
function
- a DoubleFunction to apply
Matrix assign(Matrix other, DoubleDoubleFunction function)
other
- a Matrix containing the second arguments to the functionfunction
- a DoubleDoubleFunction 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(DoubleDoubleFunction combiner, DoubleFunction mapper)
combiner
- A function that combines the results of the mapper.mapper
- A function to apply to each element.
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 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()
double zSum()
Map<String,Integer> getColumnLabelBindings()
Map<String,Integer> getRowLabelBindings()
void setColumnLabelBindings(Map<String,Integer> bindings)
bindings
- a Mapvoid setRowLabelBindings(Map<String,Integer> bindings)
bindings
- a Mapdouble get(String rowLabel, String columnLabel)
rowLabel
- a String row labelcolumnLabel
- a String column label
IndexException
- if the index is out of boundsvoid set(String rowLabel, 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(String rowLabel, 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(String rowLabel, double[] rowData)
rowLabel
- a String row labelrowData
- a double[] array of row datavoid set(String rowLabel, int row, double[] rowData)
rowLabel
- the String row labelrow
- an int the row indexrowData
- a double[] array of row dataMatrix 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
receiverVector viewRow(int row)
row
- The index of the row to return.
Vector viewColumn(int column)
column
- The index of the column to return.
Vector viewDiagonal()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |