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[][].
-
MatrixArray(double[])
- Create a column matrix from the given array
-
MatrixArray(double[][])
- Create a matrix from the given array
-
MatrixArray(int, int)
- Create an array with the given dimensions
-
add(Matrix)
- Add the given matrix to the current 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...
-
copyColumns(int, int)
- Slice the matrix columnise and return a copy of the specified columns
-
copyRows(int, int)
- Slice the matrix rowise and return a copy of the specified rows
-
determinant()
- Compute the determinant of the matrix
-
getColumns()
- Get the number of columns
-
getElement(int, int)
- Returns the element at the specified row and column
-
getRows()
- Get the number of rows
-
infinityNorm()
- Get the infinity norm of the matrix
-
main(String[])
-
Exercise the class by trying the various functions.
-
multiply(double)
- Multiply the current matrix by the given scalar
-
multiply(Matrix)
- Post multiply the current matrix by the given matrix
-
nullSpaceBasis()
- Return a matrix whose columns are a basis of the null space
of the matrix.
-
oneNorm()
- Get the one norm of the matrix
-
random()
- Fill in the matrix with random entries
-
setElement(int, int, double)
- Sets the element at the specified row and column
-
solve(Matrix)
- Solve the linear system AX=B and return X.
-
subtract(Matrix)
- Subtract the given matrix from the current matrix
-
toArray()
- Returns the native array representation of the matrix
-
toString()
- Prints out the matrix
-
toVector()
- Returns the native array representation of the matrix
as a vector if it has exactly 1 column
-
transpose()
- Transpose the current matrix
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
MatrixArray
public MatrixArray(double input[])
- Create a column matrix from the given array
- Parameters:
- input - Input array to make into a matrix
MatrixArray
public MatrixArray(double input[][])
- Create a matrix from the given array
- Parameters:
- input - Input array to make into a matrix
random
public void random()
- Fill in the matrix with random entries
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.
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
add
public void add(Matrix B)
- Add the given matrix to the current matrix
- Parameters:
- B - The matrix to be added
subtract
public void subtract(Matrix B)
- Subtract the given matrix from the current matrix
- Parameters:
- B - The matrix to be added
multiply
public void multiply(Matrix B)
- Post multiply the current matrix by the given matrix
- Parameters:
- B - The matrix to be multiplied by
transpose
public void transpose()
- Transpose the current matrix
multiply
public void multiply(double x)
- Multiply the current matrix by the given scalar
- Parameters:
- x - The scalar to be multiplied by
toArray
public double[][] toArray()
- Returns the native array representation of the matrix
- Returns:
- A double[][] representation of the matrix
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
toString
public String toString()
- Prints out the matrix
- Returns:
- A string representation of the matrix
- Overrides:
- toString in class Object
getRows
public int getRows()
- Get the number of rows
- Returns:
- The number of rows
getColumns
public int getColumns()
- Get the number of columns
- Returns:
- The number of columns
oneNorm
public double oneNorm()
- Get the one norm of the matrix
- Returns:
- The one norm of the matrix
infinityNorm
public double infinityNorm()
- Get the infinity norm of the matrix
- Returns:
- The infinity norm of the matrix
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
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
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)
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)
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
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
main
public static void main(String argv[])
- Exercise the class by trying the various functions.
All Packages Class Hierarchy This Package Previous Next Index