Class pmr.euclid.IntSquareMatrix
All Packages Class Hierarchy This Package Previous Next Index
Class pmr.euclid.IntSquareMatrix
java.lang.Object
|
+----pmr.euclid.Status
|
+----pmr.euclid.IntMatrix
|
+----pmr.euclid.IntSquareMatrix
- public class IntSquareMatrix
- extends IntMatrix
IntSquareMatrix - square matrix class
IntSquareMatrix represents a square m-x-m matrix.
The basic matrix algebra for square matrices is represented here
Check out the exciting member functions, which are supported by
Exceptions where appropriate. (NB. No attempt has been made to
provide numerical robustness and inversion, diagonalisation, etc
are as you find them.)
- Author:
- (C) P. Murray-Rust, 1996
-
IntSquareMatrix()
- This gives a default matrix, with cols = rows = 0.
-
IntSquareMatrix(int)
- This gives a null matrix
-
IntSquareMatrix(int, int)
- initalises all elements in the array with a given int[]
-
IntSquareMatrix(int, int[])
- Formed by feeding in an existing array to a colsXcols matrix.
-
IntSquareMatrix(int[][])
- form from a Java 2-D array (it holds row and column count)
-
IntSquareMatrix(IntMatrix)
- assign a IntMatrix - i.e.
-
IntSquareMatrix(IntMatrix, int, int, int)
- submatrix of another matrix
-
IntSquareMatrix(IntSquareMatrix)
-
-
copyLowerToUpper()
- copy lower triangle into upper triangle (i.e.
-
copyUpperToLower()
- copy upper triangle into lower triangle (i.e.
-
determinant()
- determinant - only goes up to order 3 at present :-(
-
diagonal(IntArray)
- make diagonal matrix
-
equals(IntSquareMatrix)
- are two matrices identical?
-
isLowerTriangular()
- is matrix lower triangular (including diagonal)?
-
isSymmetric()
- is matrix symmetric?
-
isUnit()
- is it a unit matrix?
-
isUpperTriangular()
- is matrix UpperTriangular?
-
lowerTriangle()
- copy lower triangle into linear array; order: 0,0; 1,0; 1,1; 2,0 ..
-
multiply(IntSquareMatrix)
- matrix multiplication - multiplies conformable matrices;
result is this*m
-
outerProduct(IntArray)
- special types of matrix (Outerproduct, Diagonal, etc)
-
plus(IntSquareMatrix)
- matrix addition - adds conformable matrices
-
shallowCopy(IntSquareMatrix)
- shallowCopy an existing object
-
subtract(IntSquareMatrix)
- matrix subtraction - subtracts conformable matrices
-
trace()
- trace
-
transpose()
- transpose - MODIFIES matrix
IntSquareMatrix
public IntSquareMatrix()
- This gives a default matrix, with cols = rows = 0.
IntSquareMatrix
public IntSquareMatrix(int rows)
- This gives a null matrix
IntSquareMatrix
public IntSquareMatrix(int rows,
int array[]) throws InvalidArgumentException
- Formed by feeding in an existing array to a colsXcols matrix.
THE COLUMN IS THE FASTEST MOVING INDEX, i.e. the matrix is filled
as mat(0,0), mat(0,1) ... C-LIKE
- Throws: InvalidArgumentException
- array size must be multiple of rows
IntSquareMatrix
public IntSquareMatrix(int rows,
int f)
- initalises all elements in the array with a given int[]
IntSquareMatrix
public IntSquareMatrix(IntMatrix m,
int lowrow,
int lowcol,
int rows) throws InvalidArgumentException
- submatrix of another matrix
- Throws: InvalidArgumentException
- lowrow, lowcol or rows are not consistent with size of m
IntSquareMatrix
public IntSquareMatrix(IntSquareMatrix m)
IntSquareMatrix
public IntSquareMatrix(IntMatrix m) throws NonSquareMatrixException
- assign a IntMatrix - i.e. NOT copied
- Throws: NonSquareMatrixException
- m must be square (i.e. cols = rows)
IntSquareMatrix
public IntSquareMatrix(int matrix[][]) throws MatrixShapeException
- form from a Java 2-D array (it holds row and column count)
- Throws: MatrixShapeException
- matrix is not square (might even not be rectangular!)
outerProduct
public static IntSquareMatrix outerProduct(IntArray f)
- special types of matrix (Outerproduct, Diagonal, etc)
diagonal
public static IntSquareMatrix diagonal(IntArray f)
- make diagonal matrix
shallowCopy
public void shallowCopy(IntSquareMatrix m) throws UnconformableMatricesException
- shallowCopy an existing object
- Throws: UnconformableMatricesException
- m must have the same number of rows and cols as this
equals
public boolean equals(IntSquareMatrix r) throws UnconformableMatricesException
- are two matrices identical?
- Throws: UnconformableMatricesException
- m must have the same number of rows and cols as this
plus
public IntSquareMatrix plus(IntSquareMatrix m) throws MatrixShapeException
- matrix addition - adds conformable matrices
- Throws: MatrixShapeException
- m must have the same number of rows and cols as this
subtract
public IntSquareMatrix subtract(IntSquareMatrix m) throws MatrixShapeException
- matrix subtraction - subtracts conformable matrices
- Throws: MatrixShapeException
- m must have the same number of rows and cols as this
multiply
public IntSquareMatrix multiply(IntSquareMatrix m) throws MatrixShapeException
- matrix multiplication - multiplies conformable matrices;
result is this*m
- Throws: MatrixShapeException
- m must have the same number of rows as this has cols
determinant
public int determinant() throws UnimplementedException
- determinant - only goes up to order 3 at present :-(
- Throws: UnimplementedException
- I have only written this for this.rows up to 3. If anyone can find a determinant routine, this will disappear ... -(
trace
public int trace()
- trace
isUnit
public boolean isUnit()
- is it a unit matrix?
isSymmetric
public boolean isSymmetric()
- is matrix symmetric?
isUpperTriangular
public boolean isUpperTriangular()
- is matrix UpperTriangular?
isLowerTriangular
public boolean isLowerTriangular()
- is matrix lower triangular (including diagonal)?
copyUpperToLower
public IntSquareMatrix copyUpperToLower()
- copy upper triangle into lower triangle (i.e. make symmetric)
copyLowerToUpper
public IntSquareMatrix copyLowerToUpper()
- copy lower triangle into upper triangle (i.e. make symmetric)
lowerTriangle
public IntArray lowerTriangle()
- copy lower triangle into linear array; order: 0,0; 1,0; 1,1; 2,0 ..
transpose
public void transpose()
- transpose - MODIFIES matrix
All Packages Class Hierarchy This Package Previous Next Index