public final class Matrix
extends java.lang.Object
Title: Matrix
Description: A very simple implementation of a general matrix. Not really that useful. Will probably become an interface at some point, with this class as a default implementation (so that users may switch to alternative libraries such as Jama)
Constructor and Description |
---|
Matrix(double[][] data) |
Matrix(int size,
boolean identity) |
Matrix(int width,
int height) |
Modifier and Type | Method and Description |
---|---|
Matrix |
getAppendedHorizontally(Matrix other) |
Matrix |
getAppendedVertically(Matrix other) |
int |
getHeight() |
Matrix |
getInverse()
Obtains the inverse of a matrix by appending identity and doing row reduction.
|
Matrix |
getMatrixCopy()
Cloning
|
Matrix |
getMultiplied(double scale) |
Matrix |
getMultiplied(Matrix other)
Multiply as in [this][other]
|
Matrix |
getRowReduced()
Peforms a simple row reduction tramsformation
|
Matrix |
getSubsetColumns(int startColumn,
int numberToKeep)
Returns a new Matrix that is formed from a subset of the colums of this matrix
|
Matrix |
getTranspose() |
double |
getValue(int row,
int col) |
int |
getWidth() |
boolean |
isSquare() |
void |
multiply(double scale) |
void |
rowReduce() |
void |
setValue(int row,
int col,
double value) |
double[] |
toArray() |
java.lang.String |
toString() |
void |
transpose() |
public Matrix(int size, boolean identity)
public Matrix(int width, int height)
public Matrix(double[][] data)
public double[] toArray()
public final void setValue(int row, int col, double value)
public final double getValue(int row, int col)
public final boolean isSquare()
public final int getWidth()
public final int getHeight()
public Matrix getAppendedHorizontally(Matrix other)
public Matrix getAppendedVertically(Matrix other)
public Matrix getSubsetColumns(int startColumn, int numberToKeep)
startColumn
- the first column to include in new MatrixnumberToKeep
- the number of columns to keeppublic final void transpose()
public final Matrix getTranspose()
public final void multiply(double scale)
public final Matrix getMultiplied(double scale)
public Matrix getInverse()
public void rowReduce()
public Matrix getRowReduced()
public Matrix getMatrixCopy()
public java.lang.String toString()
toString
in class java.lang.Object