public class Matrix
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected java.util.List<java.util.HashMap<java.lang.Integer,java.lang.Double>> |
data |
int |
nr |
Constructor and Description |
---|
Matrix(int nr)
sparse matrix constructor
|
Modifier and Type | Method and Description |
---|---|
void |
add(int i,
int j,
double val)
add value to row r, column c in full matri
|
void |
clearRow(int i)
clears (sets to zero) a single ro
|
static Matrix |
copy(Matrix A)
copy constructor
|
void |
copyRow(Matrix A,
int i)
copies single row between matrixe
|
Matrix[] |
decomposeLU() |
Matrix |
diag_matrix()
returns a new matrix which is the diagonal of the specified on
|
double[] |
diag(Matrix A)
returns a vector containing the diagona
|
double |
get(int i,
int j)
returns the value held by full matrix at row i and column
|
Matrix |
identity()
returns the identity matrix of size of
|
Matrix |
inverse()
returns the inverse
NOTE: this is currently defined only for diagonal matrix!
|
static Matrix |
makeTransformationMatrix(double[] scaling,
double theta,
double[] translation)
creates 2D transformation matrix
M = T*R*S
|
double[] |
mult(double[] x)
performs matrix vector multiplication
|
void |
mult(double[] x,
double[] result)
performs matrix vector multiplication and stores it in result vector
|
void |
mult(int i,
int j,
double val)
multiplies value held in full matrix row i, column j, by valu
|
Matrix |
mult(Matrix A)
performs matrix matrix multiplication
|
void |
multRow(int i,
double s)
multiplies entire row by
|
double |
multRowNonDiag(double[] x,
int i)
multiplies one row of the matrix by a vector but
excludes the diagonal element
|
void |
print()
prints self
|
void |
set(int i,
int j,
double val)
sets value at row i, column j in full matri
|
void |
subtract(int i,
int j,
double val)
add value to row r, column c in full matri
|
Matrix |
subtract(Matrix B)
returns A-
|
Matrix |
subtractDiag(double[] b)
returns A-diag(B), for now defined only for identical matrices (nv is equal
|
Matrix |
transpose()
returns the transpose
|
protected java.util.List<java.util.HashMap<java.lang.Integer,java.lang.Double>> data
public final int nr
public void clearRow(int i)
iw
- public double get(int i, int j)
i
- jj
- public void set(int i, int j, double val)
i
- jx
- val
- public void add(int i, int j, double val)
i
- jx
- val
- public void copyRow(Matrix A, int i)
A
- is
- public void subtract(int i, int j, double val)
i
- jx
- val
- public Matrix subtractDiag(double[] b)
b
- public Matrix mult(Matrix A)
A
- matrix to multiply bypublic double[] mult(double[] x)
x
- public void mult(double[] x, double[] result)
x
- result
- public void mult(int i, int j, double val)
i
- j
- vale
- public void multRow(int i, double s)
is
- s
- public double multRowNonDiag(double[] x, int i)
x
- i
- public Matrix identity()
public Matrix diag_matrix()
public double[] diag(Matrix A)
A
- public Matrix inverse()
public Matrix transpose()
public void print()
public static Matrix makeTransformationMatrix(double[] scaling, double theta, double[] translation)
scaling
- theta
- translation
- public Matrix[] decomposeLU() throws java.lang.UnsupportedOperationException
java.lang.UnsupportedOperationException