|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.faceless.graph.math.Matrix
public class Matrix
A simple class defining a mathematical matrix.
| Constructor Summary | |
|---|---|
Matrix(int cols,
int rows)
Create a new Matrix of the specified number of rows and columns |
|
Matrix(Matrix m)
Create a new Matrix that's a clone of the specified matrix |
|
| Method Summary | |
|---|---|
Matrix |
add(Matrix m)
Return a new matrix that is the sum of this matrix and the specified matrix. |
Matrix |
appendHorizontal(Matrix m)
Append the specified matrix to the current matrix by extending the number of columns in the current matrix |
Matrix |
appendVertical(Matrix m)
Append the specified matrix to the current matrix by extending the number of columns in the current matrix |
Matrix |
div(Matrix m)
Return a new matrix that is the result of this matrix divided by the specified matrix. |
Matrix |
exchangeRows(int row1,
int row2)
Return a duplicate of the current matrix with the specified rows swapped |
double |
get(int col,
int row)
Get the element at the specified row and column. |
int |
getCols()
Return the number of columns in this matrix |
int |
getRows()
Return the number of rows in this matrix |
static Matrix |
identity(int ord)
Return a new Identity Matrix of the specified size |
Matrix |
inverse()
Return the inverse of the current matrix |
static void |
main(String[] args)
|
Matrix |
mul(double fac)
Return a new matrix that is the product of this matrix and the specified factor. |
Matrix |
mul(Matrix m)
Return a new matrix that is the product of this matrix and the specified matrix. |
Matrix |
pivot(int col,
int row)
Pivot the current matrix around the specified row and column |
void |
set(int col,
int row,
double val)
Set the element at the specified row and column to the specified value |
Matrix |
subMatrix(int col,
int row,
int numcols,
int numrows)
Return a subset of this matrix consisiting of just the specified columns and rows |
String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Matrix(int cols,
int rows)
public Matrix(Matrix m)
| Method Detail |
|---|
public void set(int col,
int row,
double val)
col - the column to set the value in, from 0 to getCols()-1row - the row to set the value in, from 0 to getRows()-1val - the value to set.
ArrayIndexOutOfBoundsException - if the matrix doesn't contain the specified row or column
public double get(int col,
int row)
col - the column to set the value in, from 0 to getCols()-1row - the row to set the value in, from 0 to getRows()-1
ArrayIndexOutOfBoundsException - if the matrix doesn't contain the specified row or columnpublic String toString()
toString in class Object
public Matrix exchangeRows(int row1,
int row2)
public static Matrix identity(int ord)
ord - the number of rows and columns in the matrixpublic Matrix add(Matrix m)
public int getRows()
public int getCols()
public Matrix mul(double fac)
public Matrix mul(Matrix m)
IllegalArgumentException - if the two matrices are incompatible sizes.public Matrix div(Matrix m)
IllegalArgumentException - if the two matrices are incompatible sizes.
ArithmeticException - if the second matrix has no inverse.public Matrix appendHorizontal(Matrix m)
public Matrix appendVertical(Matrix m)
public Matrix subMatrix(int col,
int row,
int numcols,
int numrows)
public Matrix inverse()
throws ArithmeticException
ArithmeticException - if there is no inverse
public Matrix pivot(int col,
int row)
public static void main(String[] args)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||