Package org.tweetyproject.math.matrix
Class Matrix
java.lang.Object
org.tweetyproject.math.matrix.Matrix
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionAdds the given matrix to this one and returns the result.double
Returns the distance of this matrix to the zero matrix.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
Creates the Jama matrix representation of this matrix.int
Returns the x dimension of this matrix.int
Returns the y dimension of this matrix.boolean
isFinite()
Checks whether each entry in this matrix describes a finite number.Makes a subtraction of the given matrix from this one and returns the result.mult
(double scalar) Multiply this matrix with the given scalar (every entry is multiplied)Multiply this matrix with the given one.Multiply this matrix with the given scalar (every entry is multiplied)void
Sets the entry at the given coordinates.simplify()
Simplifies every entry.toString()
Transposes this matrix, i.e.
-
Constructor Details
-
Matrix
public Matrix(int n, int m) Creates a new matrix of the given dimension.- Parameters:
n
- the x dimension of the matrix.m
- the y dimension of the matrix.
-
-
Method Details
-
getEntry
Returns the entry with the given coordinates.- Parameters:
x
- the x coordinate of the entry.y
- the y coordinate of the entry.- Returns:
- the entry at the given coordinates.
-
setEntry
Sets the entry at the given coordinates.- Parameters:
x
- the x coordinate of the entry.y
- the y coordinate of the entry.entry
- the entry to be set.
-
getXDimension
public int getXDimension()Returns the x dimension of this matrix.- Returns:
- the x dimension of this matrix.
-
getYDimension
public int getYDimension()Returns the y dimension of this matrix.- Returns:
- the y dimension of this matrix.
-
mult
Multiply this matrix with the given one.- Parameters:
other
- a matrix- Returns:
- the product of the two matrices.
- Throws:
IllegalArgumentException
- if the x dimension of this matrix does not equal the y dimension of the other matrix
-
mult
-
mult
Multiply this matrix with the given scalar (every entry is multiplied)- Parameters:
scalar
- a double- Returns:
- a new matrix.
-
transpose
Transposes this matrix, i.e. switches x and y dimension.- Returns:
- the transposed matrix.
-
add
Adds the given matrix to this one and returns the result.- Parameters:
other
- a matrix- Returns:
- the sum of the two matrices.
- Throws:
IllegalArgumentException
- if the dimensions of the matrices do not correspond.
-
minus
Makes a subtraction of the given matrix from this one and returns the result.- Parameters:
other
- a matrix- Returns:
- the subtraction of the two matrices.
- Throws:
IllegalArgumentException
- if the dimensions of the matrices do not correspond.
-
simplify
-
getJamaMatrix
public Jama.Matrix getJamaMatrix()Creates the Jama matrix representation of this matrix.- Returns:
- the Jama matrix representation of this matrix.
-
distanceToZero
public double distanceToZero()Returns the distance of this matrix to the zero matrix.- Returns:
- the distance of this matrix to the zero matrix.
-
getIdentityMatrix
Returns the identity matrix of the given dimension.- Parameters:
dim
- the dimension.- Returns:
- the identity matrix of the given dimension.
-
isFinite
public boolean isFinite()Checks whether each entry in this matrix describes a finite number.- Returns:
- "true" iff this matrix is finite.
-
toString
-