public class Matrix extends Object
Modifier and Type | Field and Description |
---|---|
private org.apache.commons.math3.linear.Array2DRowRealMatrix |
data |
private int |
numCols |
private int |
numRows |
Modifier | Constructor and Description |
---|---|
private |
Matrix(org.apache.commons.math3.linear.Array2DRowRealMatrix data)
Create a matrix from the internal representation of the matrix (copy construtor).
|
private |
Matrix(double[][] data)
Create a matrix using the data in an array (copy constructor).
|
|
Matrix(int rowDimension,
int columnDimension)
Create a matrix with the given dimensions.
|
Modifier and Type | Method and Description |
---|---|
int |
columns()
Get the number of columns in the matrix.
|
Matrix |
copy()
Create a copy of the matrix.
|
double |
element(int row,
int column)
Get the contents of the matrix.
|
Matrix |
inverse()
Get the inverse of the matrix.
|
Matrix |
multiply(double d)
Returns the result of postmultiplying this by a scalar.
|
Matrix |
multiply(Matrix m)
Returns the result of postmultiplying this by m.
|
Vector |
multiply(Vector v)
Returns the result of multiplying this by the vector v.
|
Vector |
preMultiply(Vector v)
Returns the (row) vector result of premultiplying this by the vector v.
|
int |
rows()
Get the number of rows in the matrix.
|
double |
setEntry(int row,
int column,
double value)
Set the matrix element at a given point.
|
Matrix |
subtract(Matrix m)
Returns the result of subtracting m from this.
|
double[][] |
toArray()
Return an array representation of this matrix.
|
String |
toString() |
Matrix |
transpose()
Get the transpose of the matrix.
|
private final int numRows
private final int numCols
private final org.apache.commons.math3.linear.Array2DRowRealMatrix data
private Matrix(org.apache.commons.math3.linear.Array2DRowRealMatrix data)
data
- the data to be copied.private Matrix(double[][] data)
data
- the data array to be copied.public Matrix(int rowDimension, int columnDimension)
rowDimension
- the number of rows in the matrix.columnDimension
- the number of columns in the matrix.public double element(int row, int column)
row
- the row index.column
- the column index.public double setEntry(int row, int column, double value)
row
- the row index of the new element.column
- the column element of the new element.value
- the value to be set.public double[][] toArray()
public Matrix copy()
public int rows()
public int columns()
public Matrix inverse()
public Matrix transpose()
public Matrix subtract(Matrix m)
m
- matrix to be subtractedpublic Matrix multiply(Matrix m)
m
- matrix to postmultiply bypublic Matrix multiply(double d)
d
- the scalar with which we will multiply this matrixpublic Vector multiply(Vector v)
v
- the vector.Copyright © 2015 University of Glasgow. All rights reserved.