Class SquareMatrix
- java.lang.Object
-
- org.hortonmachine.gears.utils.math.matrixes.Matrix
-
- org.hortonmachine.gears.utils.math.matrixes.SquareMatrix
-
- Direct Known Subclasses:
IdentityMatrix,LinearSystem
public class SquareMatrix extends Matrix
From: Java Number Cruncher The Java Programmer's Guide to Numerical Computation by Ronald Mak A square matrix.
-
-
Constructor Summary
Constructors Constructor Description SquareMatrix(double[][] values)Constructor.SquareMatrix(int n)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SquareMatrixadd(SquareMatrix sm)Add another square matrix to this matrix.SquareMatrixmultiply(SquareMatrix sm)Multiply this square matrix by another square matrix.protected voidset(double[][] values)Set this square matrix from a 2-d array of values.SquareMatrixsubtract(SquareMatrix sm)Subtract another square matrix from this matrix.
-
-
-
Method Detail
-
set
protected void set(double[][] values)
Set this square matrix from a 2-d array of values. If the values are not square, only the upper left square is used.
-
add
public SquareMatrix add(SquareMatrix sm) throws MatrixException
Add another square matrix to this matrix.- Parameters:
sm- the square matrix addend- Returns:
- the sum matrix
- Throws:
numbercruncher.MatrixException- for invalid sizeMatrixException
-
subtract
public SquareMatrix subtract(SquareMatrix sm) throws MatrixException
Subtract another square matrix from this matrix.- Parameters:
sm- the square matrix subrrahend- Returns:
- the difference matrix
- Throws:
numbercruncher.MatrixException- for invalid sizeMatrixException
-
multiply
public SquareMatrix multiply(SquareMatrix sm) throws MatrixException
Multiply this square matrix by another square matrix.- Parameters:
sm- the square matrix multiplier- Returns:
- the product matrix
- Throws:
numbercruncher.MatrixException- for invalid sizeMatrixException
-
-