public interface Matrix
Matrix
objects.MatrixIO
,
Matrix.Type
Modifier and Type | Interface and Description |
---|---|
static class |
Matrix.Type
The type of
Matrix instance. |
Modifier and Type | Method and Description |
---|---|
int |
columns()
Returns the number of columns in this
Matrix . |
double |
get(int row,
int col)
Returns the value of the
Matrix at the provided row and column. |
double[] |
getColumn(int column)
Returns the entire column.
|
DoubleVector |
getColumnVector(int column)
Returns the column as a vector.
|
double[] |
getRow(int row)
Returns the entire row.
|
DoubleVector |
getRowVector(int row)
Returns a
DoubleVector for an entire row. |
int |
rows()
Returns the number of rows in this
Matrix . |
void |
set(int row,
int col,
double val)
Sets the location at the row and column to the provided value.
|
void |
setColumn(int column,
double[] values)
Sets the values for the column of this
Matrix using the provided
array. |
void |
setColumn(int column,
DoubleVector values)
Sets the values for the column of this
Matrix using the provided
DoubleVector . |
void |
setRow(int row,
double[] values)
Sets the values for the row of this
Matrix using the provided
array. |
void |
setRow(int row,
DoubleVector values)
Sets the values for the row of this
Matrix using the provided
DoubleVector . |
double[][] |
toDenseArray()
Converts the
Matrix to a two dimensional array. |
double get(int row, int col)
Matrix
at the provided row and column.row
- The row values of the cell to return.col
- The column value of the cell to return.row
and col
.double[] getColumn(int column)
column
- The column to return an array for.column
.DoubleVector getColumnVector(int column)
SparseVector
instance.column
- The column to return a DoubleVector
for.DoubleVector
representing the column at column
.double[] getRow(int row)
row
- The row to return an array for.row
.DoubleVector getRowVector(int row)
DoubleVector
for an entire row. Implementations should
return an approriately typed DoubleVector. Whether updates to the vector
are written through to the backing matrix is left open to the specific
implementation. Implementations that maintain their data in a sparse
format are encouraged to return a SparseVector
instance.row
- the index of the row to return.DoubleVector
representing the row at row
.int columns()
Matrix
.Matrix
.double[][] toDenseArray()
Matrix
to a two dimensional array. Note that for
large matrices, this may exhaust all available memory.Matrix
.int rows()
Matrix
.Matrix
.void set(int row, int col, double val)
row
- The row of the cell to update.col
- The column of the cell to update.val
- The new value of the specified cell.void setColumn(int column, double[] values)
Matrix
using the provided
array. Note that the array itself is not made internal to the instance
itself.column
- The column to update.values
- The values to update into column
.void setColumn(int column, DoubleVector values)
Matrix
using the provided
DoubleVector
. Note that the DoubleVector
itself is not
made internal to the instance itself.column
- The column to update.values
- The values to update into column
.void setRow(int row, double[] values)
Matrix
using the provided
array. Note that the array itself is not made internal to the instance
itself.row
- The row to update.values
- The values to update into row
.void setRow(int row, DoubleVector values)
Matrix
using the provided
DoubleVector
. Note that the DoubleVector
itself is not
made internal to the instance itself.row
- The row to update.values
- The values to update into row
.Copyright © 2012. All Rights Reserved.