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

Constructor Index

 o IntSquareMatrix()
This gives a default matrix, with cols = rows = 0.
 o IntSquareMatrix(int)
This gives a null matrix
 o IntSquareMatrix(int, int)
initalises all elements in the array with a given int[]
 o IntSquareMatrix(int, int[])
Formed by feeding in an existing array to a colsXcols matrix.
 o IntSquareMatrix(int[][])
form from a Java 2-D array (it holds row and column count)
 o IntSquareMatrix(IntMatrix)
assign a IntMatrix - i.e.
 o IntSquareMatrix(IntMatrix, int, int, int)
submatrix of another matrix
 o IntSquareMatrix(IntSquareMatrix)

Method Index

 o copyLowerToUpper()
copy lower triangle into upper triangle (i.e.
 o copyUpperToLower()
copy upper triangle into lower triangle (i.e.
 o determinant()
determinant - only goes up to order 3 at present :-(
 o diagonal(IntArray)
make diagonal matrix
 o equals(IntSquareMatrix)
are two matrices identical?
 o isLowerTriangular()
is matrix lower triangular (including diagonal)?
 o isSymmetric()
is matrix symmetric?
 o isUnit()
is it a unit matrix?
 o isUpperTriangular()
is matrix UpperTriangular?
 o lowerTriangle()
copy lower triangle into linear array; order: 0,0; 1,0; 1,1; 2,0 ..
 o multiply(IntSquareMatrix)
matrix multiplication - multiplies conformable matrices; result is this*m
 o outerProduct(IntArray)
special types of matrix (Outerproduct, Diagonal, etc)
 o plus(IntSquareMatrix)
matrix addition - adds conformable matrices
 o shallowCopy(IntSquareMatrix)
shallowCopy an existing object
 o subtract(IntSquareMatrix)
matrix subtraction - subtracts conformable matrices
 o trace()
trace
 o transpose()
transpose - MODIFIES matrix

Constructors

 o IntSquareMatrix
  public IntSquareMatrix()
This gives a default matrix, with cols = rows = 0.
 o IntSquareMatrix
  public IntSquareMatrix(int rows)
This gives a null matrix
 o 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
 o IntSquareMatrix
  public IntSquareMatrix(int rows,
                         int f)
initalises all elements in the array with a given int[]
 o 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
 o IntSquareMatrix
  public IntSquareMatrix(IntSquareMatrix m)
 o IntSquareMatrix
  public IntSquareMatrix(IntMatrix m) throws NonSquareMatrixException
assign a IntMatrix - i.e. NOT copied
Throws: NonSquareMatrixException
m must be square (i.e. cols = rows)
 o 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!)

Methods

 o outerProduct
  public static IntSquareMatrix outerProduct(IntArray f)
special types of matrix (Outerproduct, Diagonal, etc)
 o diagonal
  public static IntSquareMatrix diagonal(IntArray f)
make diagonal matrix
 o 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
 o 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
 o 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
 o 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
 o 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
 o 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 ... -(
 o trace
  public int trace()
trace
 o isUnit
  public boolean isUnit()
is it a unit matrix?
 o isSymmetric
  public boolean isSymmetric()
is matrix symmetric?
 o isUpperTriangular
  public boolean isUpperTriangular()
is matrix UpperTriangular?
 o isLowerTriangular
  public boolean isLowerTriangular()
is matrix lower triangular (including diagonal)?
 o copyUpperToLower
  public IntSquareMatrix copyUpperToLower()
copy upper triangle into lower triangle (i.e. make symmetric)
 o copyLowerToUpper
  public IntSquareMatrix copyLowerToUpper()
copy lower triangle into upper triangle (i.e. make symmetric)
 o lowerTriangle
  public IntArray lowerTriangle()
copy lower triangle into linear array; order: 0,0; 1,0; 1,1; 2,0 ..
 o transpose
  public void transpose()
transpose - MODIFIES matrix

All Packages  Class Hierarchy  This Package  Previous  Next  Index