public class Matrix
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
private Term[][] |
entries
The entries of the matrix
|
| Constructor and Description |
|---|
Matrix(int n,
int m)
Creates a new matrix of the given dimension.
|
| Modifier and Type | Method and Description |
|---|---|
Matrix |
add(Matrix other)
Adds the given matrix to this one and returns the result.
|
double |
distanceToZero()
Returns the distance of this matrix to the zero matrix.
|
Term |
getEntry(int x,
int y)
Returns the entry with the given coordinates.
|
static Matrix |
getIdentityMatrix(int dim)
Returns the identity matrix of the given dimension.
|
Jama.Matrix |
getJamaMatrix()
Creates the Jama matrix representation of this matrix.
|
int |
getXDimension()
Returns the x dimension of this matrix.
|
int |
getYDimension()
Returns the y dimension of this matrix.
|
boolean |
isFinite()
Checks whether each entry in this matrix describes a finite number.
|
Matrix |
minus(Matrix other)
Makes a subtraction of the given matrix from this one and returns the result.
|
Matrix |
mult(double scalar)
Multiply this matrix with the given scalar
(every entry is multiplied)
|
Matrix |
mult(Matrix other)
Multiply this matrix with the given one.
|
Matrix |
mult(Term scalar)
Multiply this matrix with the given scalar
(every entry is multiplied)
|
void |
setEntry(int x,
int y,
Term entry)
Sets the entry at the given coordinates.
|
Matrix |
simplify()
Simplifies every entry.
|
java.lang.String |
toString() |
Matrix |
transpose()
Transposes this matrix, i.e.
|
private Term[][] entries
public Matrix(int n,
int m)
n - the x dimension of the matrix.m - the y dimension of the matrix.public Term getEntry(int x, int y)
x - the x coordinate of the entry.y - the y coordinate of the entry.public void setEntry(int x,
int y,
Term entry)
x - the x coordinate of the entry.y - the y coordinate of the entry.entry - the entry to be set.public int getXDimension()
public int getYDimension()
public Matrix mult(Matrix other) throws java.lang.IllegalArgumentException
other - a matrixjava.lang.IllegalArgumentException - if the x dimension of this matrix
does not equal the y dimension of the other matrixpublic Matrix mult(Term scalar)
scalar - a termpublic Matrix mult(double scalar)
scalar - a doublepublic Matrix transpose()
public Matrix add(Matrix other) throws java.lang.IllegalArgumentException
other - a matrixjava.lang.IllegalArgumentException - if the dimensions of the matrices
do not correspond.public Matrix minus(Matrix other) throws java.lang.IllegalArgumentException
other - a matrixjava.lang.IllegalArgumentException - if the dimensions of the matrices
do not correspond.public Matrix simplify()
public Jama.Matrix getJamaMatrix()
public double distanceToZero()
public static Matrix getIdentityMatrix(int dim)
dim - the dimension.public boolean isFinite()
public java.lang.String toString()
toString in class java.lang.Object