|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectMaths.SquareMatrix
public class SquareMatrix
Represents a square matrix.
Nested Class Summary | |
---|---|
static class |
SquareMatrix.Calculation
Enumeration of the possible ways of calculating the matrix exponential |
class |
SquareMatrix.SquareMatrixException
Exception thrown when there is a problem with a SquareMatrix operation |
Constructor Summary | |
---|---|
SquareMatrix(double[][] m)
Default constructor |
Method Summary | |
---|---|
SquareMatrix |
add(SquareMatrix o)
Adds a matrix to this one and returns a new matrix as the result |
SquareMatrix |
divide(SquareMatrix B)
Divides this matrix by another (this / B) and returns a new matrix as the result |
double[] |
eigValues()
Calculates the Eigenvalues. |
SquareMatrix |
eigValuesDiag()
Calculates the Eigenvalues. |
SquareMatrix |
eigVectors()
Calculates the Eigenvectors. |
boolean |
equals(java.lang.Object ob)
|
SquareMatrix |
exp()
Calculates e^A where A is the current matrix and returns a new matrix as the result |
SquareMatrix |
expMult(double x)
Calculates e^Ax where A is this matrix and returns a new matrix as the result. |
double[][] |
getArray()
Gets the matrix as an array of doubles |
double |
getPosition(int i,
int j)
Returns the value in position (i,j) of the matrix |
int |
hashCode()
|
SquareMatrix |
inverse()
Calculates the inverse of this matrix and returns a new matrix as the result. |
SquareMatrix |
multiply(SquareMatrix o)
Multiplies this matrix by another (this × o) and returns a new matrix as a result |
double |
norm()
Calculates the maximum absolute column sum norm |
SquareMatrix |
scalarDivide(double n)
Divides the matrix by a scalar and returns a new matrix as the result |
SquareMatrix |
scalarMultiply(double n)
Multiplies the matrix by a scalar and returns a new matrix as the result |
static void |
setExpMethod(SquareMatrix.Calculation i)
Sets the method to be used for Exponentiation |
static void |
setForce(int f)
Sets the minimum number of repeating squaring that will be performed when using the Taylor method |
static void |
setNoThreads(int number)
Sets the number of threads to be used when doing matrix multiplication |
int |
size()
Gets the size of the matrix. |
SquareMatrix |
square()
Sqaures the matrix and returns a new Matrix that is the result |
java.lang.String |
toString()
|
SquareMatrix |
transpose()
Transposes the matrix and returns a new matrix as the result |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public SquareMatrix(double[][] m) throws SquareMatrix.SquareMatrixException
m
- Array representing the matrix
SquareMatrix.SquareMatrixException
- Thrown if the input array isn't squareMethod Detail |
---|
public SquareMatrix square()
public SquareMatrix scalarMultiply(double n)
n
- The scalar to multiply by
public SquareMatrix scalarDivide(double n)
n
- The scalar to divide by
public SquareMatrix add(SquareMatrix o) throws SquareMatrix.SquareMatrixException
o
- The matrix to add
SquareMatrix.SquareMatrixException
- Thrown if the matrices are not the same sizepublic SquareMatrix multiply(SquareMatrix o) throws SquareMatrix.SquareMatrixException
o
- The matrix to multiply by
SquareMatrix.SquareMatrixException
- Thrown if the matrices are not the same sizepublic SquareMatrix expMult(double x) throws SquareMatrix.SquareMatrixException
setExpMethod(Maths.SquareMatrix.Calculation)
.
x
- x in the above equation
SquareMatrix.SquareMatrixException
- Thrown if the calculation can't be performed
as the Eigenvalues can't be computedpublic SquareMatrix exp() throws SquareMatrix.SquareMatrixException
SquareMatrix.SquareMatrixException
- Thrown if the calculation can't be performed
as the Eigenvalues can't be computedpublic double norm()
public SquareMatrix inverse()
public double getPosition(int i, int j)
i
- The row positionj
- The column position
public int size()
public double[][] getArray()
public static void setExpMethod(SquareMatrix.Calculation i)
i
- The method to be usedpublic static void setForce(int f)
f
- public static void setNoThreads(int number)
number
- public boolean equals(java.lang.Object ob)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public SquareMatrix eigVectors() throws EigenvalueDecomposition.ConvergenceException
EigenvalueDecomposition.ConvergenceException
- Thrown if the eigendeompisition does not convergepublic double[] eigValues() throws EigenvalueDecomposition.ConvergenceException
EigenvalueDecomposition.ConvergenceException
- Thrown if the eigendeompisition does not convergepublic SquareMatrix eigValuesDiag() throws EigenvalueDecomposition.ConvergenceException
EigenvalueDecomposition.ConvergenceException
public SquareMatrix transpose()
public SquareMatrix divide(SquareMatrix B)
B
- The matrix to divide by
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |