cynosurex.math
Class Matrix

java.lang.Object
  extended by cynosurex.math.Matrix
All Implemented Interfaces:
cynosurex.internal.AuthorCommon, cynosurex.internal.CommonInterface, cynosurex.internal.CompanyCommon

public class Matrix
extends java.lang.Object
implements cynosurex.internal.CommonInterface


Field Summary
protected  int columns
           
protected  double[][] matrix
           
protected  int rows
           
 
Fields inherited from interface cynosurex.internal.CommonInterface
copyright, copyrightYears, notice, program, version
 
Fields inherited from interface cynosurex.internal.AuthorCommon
author, copyrightSymbol, noticeMsg, rights
 
Fields inherited from interface cynosurex.internal.CompanyCommon
company, email, website
 
Constructor Summary
Matrix(double[][] initValue)
          Create a new matrix based on the specified array.
Matrix(int rows, int columns)
          Create a new matrix based on the specified rows and columns.
Matrix(int rows, int columns, double initValue)
          Create a new matrix based on the specified rows, columns, and initial value.
 
Method Summary
static Matrix addition(Matrix a, Matrix b)
          This static method adds two matrices and produces the result in the thrid matrix.
 double[][] getArray()
          This method returns the matrix as a double array.
 int getColumns()
          This method returns the number of columns in the matrix.
 java.awt.Dimension getDimension()
          This method returns the Dimension of the matrix.
 int getRows()
          This method returns the number of rows in the matrix.
 Matrix getTranspose()
          This method returns the transpose the current matrix.
 double getValueAt(int row, int column)
          This method returns one of the value in the matrix.
static Matrix identityMatrix(int dimension)
          This static method creates an identity matrix based on the specified dimension.
static Matrix multiplication(Matrix a, Matrix b)
          This static method multiplies two matrices and produces the result in the third matrix.
 void setValueAt(double value, int row, int column)
          This method sets one of the value in the matrix.
 java.lang.String toString()
          Overrides the super class method.
 void Transpose()
          This method transposes the current matrix.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

rows

protected int rows

columns

protected int columns

matrix

protected double[][] matrix
Constructor Detail

Matrix

public Matrix(int rows,
              int columns)
Create a new matrix based on the specified rows and columns.

Parameters:
rows - number of rows in the matrix
columns - number of columns in the matrix

Matrix

public Matrix(int rows,
              int columns,
              double initValue)
Create a new matrix based on the specified rows, columns, and initial value.

Parameters:
rows - number of rows in the matrix
columns - number of columns in the matrix
initValue - initial value of the matrix

Matrix

public Matrix(double[][] initValue)
Create a new matrix based on the specified array. Each column and row size must be the same or a MatrixDimensionMismatchException will be thrown.

Parameters:
initValue - array containing the initial values
Method Detail

addition

public static Matrix addition(Matrix a,
                              Matrix b)
This static method adds two matrices and produces the result in the thrid matrix.

Parameters:
a - the first matrix
b - the second matrix

multiplication

public static Matrix multiplication(Matrix a,
                                    Matrix b)
This static method multiplies two matrices and produces the result in the third matrix.

Parameters:
a - the first matrix
b - the second matrix

identityMatrix

public static final Matrix identityMatrix(int dimension)
This static method creates an identity matrix based on the specified dimension.

Parameters:
dimension - dimension of the matrix to produce

getDimension

public java.awt.Dimension getDimension()
This method returns the Dimension of the matrix.


getColumns

public int getColumns()
This method returns the number of columns in the matrix.


getRows

public int getRows()
This method returns the number of rows in the matrix.


getValueAt

public double getValueAt(int row,
                         int column)
This method returns one of the value in the matrix.

Parameters:
row - specifies the row of the value
column - specifies the column of the value

setValueAt

public void setValueAt(double value,
                       int row,
                       int column)
This method sets one of the value in the matrix.

Parameters:
value - value to place in the matrix
row - specifies the row of the value
column - specifies the column of the value

getArray

public double[][] getArray()
This method returns the matrix as a double array.


Transpose

public void Transpose()
This method transposes the current matrix.


getTranspose

public Matrix getTranspose()
This method returns the transpose the current matrix.


toString

public java.lang.String toString()
Overrides the super class method.

Overrides:
toString in class java.lang.Object