All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class CH.epfl.lcvm.mccc.MatrixArray

java.lang.Object
   |
   +----CH.epfl.lcvm.mccc.MatrixArray

public class MatrixArray
extends Object
implements Matrix, Cloneable
A Matrix implemented as a double[][].


Constructor Index

 o MatrixArray(double[])
Create a column matrix from the given array
 o MatrixArray(double[][])
Create a matrix from the given array
 o MatrixArray(int, int)
Create an array with the given dimensions

Method Index

 o add(Matrix)
Add the given matrix to the current matrix
 o copy()
So, it appears that clone doesn't really support polymorphic copying correctly (in java 1.1) so until it does we will use this...
 o copyColumns(int, int)
Slice the matrix columnise and return a copy of the specified columns
 o copyRows(int, int)
Slice the matrix rowise and return a copy of the specified rows
 o determinant()
Compute the determinant of the matrix
 o getColumns()
Get the number of columns
 o getElement(int, int)
Returns the element at the specified row and column
 o getRows()
Get the number of rows
 o infinityNorm()
Get the infinity norm of the matrix
 o main(String[])
Exercise the class by trying the various functions.
 o multiply(double)
Multiply the current matrix by the given scalar
 o multiply(Matrix)
Post multiply the current matrix by the given matrix
 o nullSpaceBasis()
Return a matrix whose columns are a basis of the null space of the matrix.
 o oneNorm()
Get the one norm of the matrix
 o random()
Fill in the matrix with random entries
 o setElement(int, int, double)
Sets the element at the specified row and column
 o solve(Matrix)
Solve the linear system AX=B and return X.
 o subtract(Matrix)
Subtract the given matrix from the current matrix
 o toArray()
Returns the native array representation of the matrix
 o toString()
Prints out the matrix
 o toVector()
Returns the native array representation of the matrix as a vector if it has exactly 1 column
 o transpose()
Transpose the current matrix

Constructors

 o MatrixArray
 public MatrixArray(int rows,
                    int columns)
Create an array with the given dimensions

Parameters:
row - The number of requested rows
column - The number of requested columns
 o MatrixArray
 public MatrixArray(double input[])
Create a column matrix from the given array

Parameters:
input - Input array to make into a matrix
 o MatrixArray
 public MatrixArray(double input[][])
Create a matrix from the given array

Parameters:
input - Input array to make into a matrix

Methods

 o random
 public void random()
Fill in the matrix with random entries

 o getElement
 public double getElement(int row,
                          int column)
Returns the element at the specified row and column

Parameters:
row - The row of the desired element
column - The column of the desired element
Returns:
the element at the specified coordinates.
 o setElement
 public void setElement(int row,
                        int column,
                        double value)
Sets the element at the specified row and column

Parameters:
row - The row of the desired element
column - The column of the desired element
value - The value to place into the array
 o add
 public void add(Matrix B)
Add the given matrix to the current matrix

Parameters:
B - The matrix to be added
 o subtract
 public void subtract(Matrix B)
Subtract the given matrix from the current matrix

Parameters:
B - The matrix to be added
 o multiply
 public void multiply(Matrix B)
Post multiply the current matrix by the given matrix

Parameters:
B - The matrix to be multiplied by
 o transpose
 public void transpose()
Transpose the current matrix

 o multiply
 public void multiply(double x)
Multiply the current matrix by the given scalar

Parameters:
x - The scalar to be multiplied by
 o toArray
 public double[][] toArray()
Returns the native array representation of the matrix

Returns:
A double[][] representation of the matrix
 o toVector
 public double[] toVector()
Returns the native array representation of the matrix as a vector if it has exactly 1 column

Returns:
A double[] representation of the matrix
 o toString
 public String toString()
Prints out the matrix

Returns:
A string representation of the matrix
Overrides:
toString in class Object
 o getRows
 public int getRows()
Get the number of rows

Returns:
The number of rows
 o getColumns
 public int getColumns()
Get the number of columns

Returns:
The number of columns
 o oneNorm
 public double oneNorm()
Get the one norm of the matrix

Returns:
The one norm of the matrix
 o infinityNorm
 public double infinityNorm()
Get the infinity norm of the matrix

Returns:
The infinity norm of the matrix
 o solve
 public Matrix solve(Matrix B) throws SolverException
Solve the linear system AX=B and return X. The method is up to the derived class. The solution matrix X has as many columns as B.

Returns:
The solution X
Throws: SolverException
for the solver
 o copy
 public Matrix copy()
So, it appears that clone doesn't really support polymorphic copying correctly (in java 1.1) so until it does we will use this...

Returns:
A copy of the matrix
 o copyRows
 public Matrix copyRows(int start,
                        int end)
Slice the matrix rowise and return a copy of the specified rows

Parameters:
start - The starting row
end - The ending row
Returns:
A copy of the matrix with just the given rows (inclusive)
 o copyColumns
 public Matrix copyColumns(int start,
                           int end)
Slice the matrix columnise and return a copy of the specified columns

Parameters:
start - The starting column
end - The ending column
Returns:
A copy of the matrix with just the given columns (inclusive)
 o determinant
 public double determinant() throws SolverException
Compute the determinant of the matrix

Returns:
The determinant of the matrix
Throws: SolverException
The exception thrown when the solver fails
 o nullSpaceBasis
 public Matrix nullSpaceBasis() throws MCCCException
Return a matrix whose columns are a basis of the null space of the matrix. Only guarenteed to work if the matrix is Nx(N+M) and has rank N.

Returns:
The basis of the null space.
Throws: MCCCException
The exception thrown when method fails
 o main
 public static void main(String argv[])
Exercise the class by trying the various functions.


All Packages  Class Hierarchy  This Package  Previous  Next  Index