public class SymmetricMatrix extends AbstractMatrix implements Serializable
Matrix.Type
Constructor and Description |
---|
SymmetricMatrix(int rows,
int columns)
Constructs a new
SymmetricMatrix with the specified dimensions. |
Modifier and Type | Method and Description |
---|---|
int |
columns()
Returns the number of columns in this
Matrix . |
double |
get(int row,
int column)
Returns the value of the
Matrix at the provided row and column. |
DoubleVector |
getColumnVector(int column)
Returns the column as a vector.
|
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 column,
double val)
Throws an
UnsupportedOperationException if called (matrix is
unmodifiable). |
equals, getColumn, getRow, hashCode, setColumn, setColumn, setRow, setRow, toDenseArray
public SymmetricMatrix(int rows, int columns)
SymmetricMatrix
with the specified dimensions.public int columns()
Matrix
.columns
in interface Matrix
columns
in class AbstractMatrix
Matrix
.public double get(int row, int column)
Matrix
at the provided row and column.get
in interface Matrix
get
in class AbstractMatrix
row
- The row values of the cell to return.column
- The column value of the cell to return.row
and col
.public DoubleVector getColumnVector(int column)
SparseVector
instance.getColumnVector
in interface Matrix
getColumnVector
in class AbstractMatrix
column
- The column to return a DoubleVector
for.DoubleVector
representing the column at column
.public 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.getRowVector
in interface Matrix
getRowVector
in class AbstractMatrix
row
- the index of the row to return.DoubleVector
representing the row at row
.public int rows()
Matrix
.rows
in interface Matrix
rows
in class AbstractMatrix
Matrix
.public void set(int row, int column, double val)
UnsupportedOperationException
if called (matrix is
unmodifiable).set
in interface Matrix
set
in class AbstractMatrix
row
- The row of the cell to update.column
- The column of the cell to update.val
- The new value of the specified cell.Copyright © 2012. All Rights Reserved.