com.altair.hwm.beans.utils
Class HWMMatrix

java.lang.Object
  extended by com.altair.hwm.beans.utils.HWMMatrix
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable

public class HWMMatrix
extends java.lang.Object
implements java.io.Externalizable

Title: HWMMatrix

Description: This is a utility class that will perform Matrix functions

Company: Altair Engineering, Inc.

See Also:
Serialized Form

Constructor Summary
HWMMatrix()
          Constructor
HWMMatrix(int nNumRows, int nNumCols)
          Constructor
 
Method Summary
 HWMMatrix Add(HWMMatrix hwmMatrix)
          Add two matrices together
 double GetData(int nRow, int nCol)
          Get the data at the specified location
 double GetDeterminant()
          Get the determinant of the matrix.
 HWMMatrix Inverse()
          Get the inverse of the matrix.
 HWMMatrix Multiply(HWMMatrix hwmMatrix)
          Multiplpy this matrix with another matrix
 void readExternal(java.io.ObjectInput objInput)
          Loads the version and then calls the appropriate read function for the version
 void SetData(int nRow, int nCol, double dData)
          Set the data at the specified location
 HWMMatrix Subtract(HWMMatrix hwmMatrix)
          Subtract another matrix from this
 java.lang.String toString()
          Represents the matix as a String.
 void writeExternal(java.io.ObjectOutput objOutput)
          Save the persistent properties
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HWMMatrix

public HWMMatrix()
Constructor


HWMMatrix

public HWMMatrix(int nNumRows,
                 int nNumCols)
Constructor

Method Detail

SetData

public void SetData(int nRow,
                    int nCol,
                    double dData)
             throws java.lang.ArrayIndexOutOfBoundsException
Set the data at the specified location

Parameters:
nRow - The row index
nCol - The column index
dData - The data to be set at that location
Throws:
java.lang.ArrayIndexOutOfBoundsException

GetData

public double GetData(int nRow,
                      int nCol)
               throws java.lang.ArrayIndexOutOfBoundsException
Get the data at the specified location

Parameters:
nRow - The row index
nCol - The column index
Returns:
double The data to from the specifed location in the matrix
Throws:
java.lang.ArrayIndexOutOfBoundsException

Add

public HWMMatrix Add(HWMMatrix hwmMatrix)
              throws java.lang.Exception
Add two matrices together

Parameters:
hwmMatrix - The other matrix
Returns:
The sum of the two matrices
Throws:
java.lang.Exception

Subtract

public HWMMatrix Subtract(HWMMatrix hwmMatrix)
                   throws java.lang.Exception
Subtract another matrix from this

Parameters:
hwmMatrix - The other matrix
Returns:
The difference of the two matrices
Throws:
java.lang.Exception

Multiply

public HWMMatrix Multiply(HWMMatrix hwmMatrix)
                   throws java.lang.Exception
Multiplpy this matrix with another matrix

Parameters:
hwmMatrix - The other matrix
Returns:
The product of the two matrices
Throws:
java.lang.Exception

GetDeterminant

public double GetDeterminant()
                      throws java.lang.Exception
Get the determinant of the matrix. The matrix has to be a square matrix for determinant determination to be possible

Returns:
double The detereminant of the matrix
Throws:
java.lang.Exception

Inverse

public HWMMatrix Inverse()
                  throws java.lang.Exception
Get the inverse of the matrix. The matrix has to be a square matrix for inverse determination to be possible. This subroutine is from "Numerical recipes in C"

Returns:
HWMMatrix The inverse of the matrix
Throws:
java.lang.Exception

toString

public java.lang.String toString()
Represents the matix as a String. Useful in printing out the matrix

Overrides:
toString in class java.lang.Object
Returns:
The matrix as a String

writeExternal

public void writeExternal(java.io.ObjectOutput objOutput)
                   throws java.io.IOException
Save the persistent properties

Specified by:
writeExternal in interface java.io.Externalizable
Parameters:
objOutput - The stream to which data will be written
Throws:
java.io.IOException

readExternal

public void readExternal(java.io.ObjectInput objInput)
                  throws java.lang.ClassNotFoundException,
                         java.io.IOException
Loads the version and then calls the appropriate read function for the version

Specified by:
readExternal in interface java.io.Externalizable
Parameters:
objInput - The stream from which data will be read
Throws:
IOException, - ClassNotFoundException
java.lang.ClassNotFoundException
java.io.IOException