public class Matrix
extends java.lang.Object
implements java.lang.Cloneable
Modifier and Type | Field and Description |
---|---|
protected double[][] |
matrix
The matrix.
|
Constructor and Description |
---|
Matrix(int rows,
int columns)
Constructs an m x n matrix with all elements invalidated.
|
Matrix(int rows,
int columns,
double value)
Constructs an m x n matrix with all elements set to 'value'.
|
Modifier and Type | Method and Description |
---|---|
Matrix |
clone()
A deep clone.
|
void |
fill(double v)
Sets all matrix elements to the same value.
|
double |
getValue(int row,
int column)
Returns a matrix element.
|
void |
invalidate(int row,
int column)
Invalidates an element in the matrix.
|
boolean |
isValid(double value)
Checks if the value is valid.
|
boolean |
isValid(int row,
int column)
Checks if the element has a valid value.
|
void |
setValue(int row,
int column,
double value)
Sets a matrix elements to the given value.
|
java.lang.String |
toString()
Returns the matrix in a basic rows/columns string format.
|
public Matrix(int rows, int columns)
rows
- the number of rowscolumns
- he number of columnspublic Matrix(int rows, int columns, double value)
rows
- the number of rowscolumns
- the number of columnsvalue
- the element valuepublic Matrix clone()
clone
in class java.lang.Object
public void fill(double v)
v
- a valuepublic double getValue(int row, int column)
row
- the rowcolumn
- the columnpublic void setValue(int row, int column, double value)
row
- the rwocolumn
- the columnvalue
- a valuepublic java.lang.String toString()
toString
in class java.lang.Object
public boolean isValid(double value)
value
- a valuepublic boolean isValid(int row, int column)
row
- the rowcolumn
- the columnpublic void invalidate(int row, int column)
row
- a rowcolumn
- a column