|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.ObjectMatrix
public class Matrix
this class represents a matrix object and performs matrix operations that are needed to compute the eigenvectors and eigenvalues
| Field Summary | |
|---|---|
protected int |
col
|
static int |
DIAGONAL
|
protected double[][] |
Elem
|
static int |
FULL
|
static int |
LOWER_TRIANGULAR
|
protected int |
row
|
static int |
SPARSE
|
static int |
SYMMETRIC
|
protected int |
type_d
|
static int |
UPPER_TRIANGULAR
|
| Constructor Summary | |
|---|---|
Matrix()
|
|
| Method Summary | |
|---|---|
void |
addMatrix(Matrix A)
This routine adds two matrices |
void |
addMatrixElements(double val_a)
This routine adds a double value to every element in a matrix |
boolean |
choleskySolve(Matrix out_vec_a,
Matrix l_a,
Matrix in_vec_a)
This method solves the linear equation l * l' * x = b, where L is the cholesky decomposition matrix and b is an input vector. |
void |
copyLowerMatrix(Matrix A)
this routine computes the inverse of a matrix |
void |
copyMatrix(Matrix A)
This routine takes a matrix as an argument and copies it to the the matrix object that invoked it |
void |
copyMatrixRows(Matrix A,
boolean[] flags_a)
This routine takes a matrix as an argument and copies its rows to the the matrix object that invoked it only for columns that the flags are true. |
boolean |
decompositionCholesky(Matrix l_a)
this method constructs the Cholesky decomposition of an input matrix: W. |
void |
expMatrix()
This routine takes every element to its exponent with Math.exp() |
void |
gaussj(double[][] a,
int n,
double[][] b,
int m)
This routine computes the inverse matrix using the gauss jordan method see numerical recipes, the are of scientific computing, second edition, cambridge university press. |
double |
getColSumSquare(int col_a)
this routine computes the sum of a column |
void |
getDiagonalVector(java.util.Vector<java.lang.Double> vec_a)
Puts the diagonal of a matrix in the vector passed |
int |
getNumColumns()
Gets the number of Columns |
int |
getNumRows()
Gets the number of Rows |
double |
getValue(int r,
int c)
gets value at indexed row and column |
void |
identityMatrix()
This routine makes an identity matrix |
void |
initDiagonalMatrix(java.util.Vector<java.lang.Double> vec_a)
Creates a diagonal matrix of values specified by the input vector |
void |
initMatrix(double[][] initVal,
int r,
int c)
this method initializes matrix to be the values of the 2-d array passed |
void |
initMatrix(java.util.Vector<java.lang.Double> vec_a)
Creates a 1 row matrix of values specified by the input vector |
void |
initMatrixValue(int r,
int c,
double value_a,
int type_a)
this method initialize the matrix to all r x n elements being the double value passed |
void |
inverseMatrixElements()
This routine inverses every element of the matrix |
void |
invertMatrix(Matrix A)
this routine computes the inverse of a matrix |
void |
multMatrix(Matrix A,
Matrix B)
This routine multiplys two matrices |
void |
normMatrix()
This routine takes the square root of the matrix object |
static void |
printDoubleVector(java.util.Vector<java.lang.Double> vec_a)
Puts the DoubleVector contents in a vector and calls printMatrix() |
void |
printMatrix()
Prints the matrix contents to STDOUT |
void |
resetMatrix()
This routine takes a matrix as an argument and copies it to the the matrix object that invoked it |
void |
scalarMultMatrix(double scalar)
This routine multiplys a matrix with a scalar |
void |
setValue(int r,
int c,
double value_a)
sets the value given row and column index to the double value passed |
void |
subtractMatrix(Matrix A,
Matrix B)
This routine subtracts two matrices |
void |
toDoubleVector(java.util.Vector<java.lang.Double> vec_a)
Given a column or row matrix the values can be put into a vector |
void |
transposeMatrix(Matrix B)
This routine performs the transpose of a matrix |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int FULL
public static final int DIAGONAL
public static final int SYMMETRIC
public static final int LOWER_TRIANGULAR
public static final int UPPER_TRIANGULAR
public static final int SPARSE
protected int row
protected int col
protected int type_d
protected double[][] Elem
| Constructor Detail |
|---|
public Matrix()
| Method Detail |
|---|
public int getNumRows()
public int getNumColumns()
public void copyLowerMatrix(Matrix A)
A - inverse matrixpublic double getColSumSquare(int col_a)
col_a - column number to be summed
public void setValue(int r,
int c,
double value_a)
r - number of rows in the matrixc - number of columns in the matrixvalue_a - input set of points
public double getValue(int r,
int c)
r - number of rows in the matrixc - number of columns in the matrix
public void initMatrixValue(int r,
int c,
double value_a,
int type_a)
r - number of rows in the matrixc - number of columns in the matrixvalue_a - double value to initialize all elements of matrixtype_a - integer value of type
public void initMatrix(double[][] initVal,
int r,
int c)
initVal - 2-dimensional array to be copyiedr - number of rows in the matrixc - number of columns in the matrixpublic void initMatrix(java.util.Vector<java.lang.Double> vec_a)
vec_a - values to be put in matrixpublic void initDiagonalMatrix(java.util.Vector<java.lang.Double> vec_a)
vec_a - values to be put in matrixpublic void getDiagonalVector(java.util.Vector<java.lang.Double> vec_a)
vec_a - Vector for values to be added from diagonal of a matrixpublic void toDoubleVector(java.util.Vector<java.lang.Double> vec_a)
vec_a - Vector for values to be added from column or row matrixpublic void copyMatrix(Matrix A)
A - input matrix to be copyied
public void copyMatrixRows(Matrix A,
boolean[] flags_a)
A - input matrix to be copyiedflags_a - 2-dimensional array of boolean variables to tell which
elements to copypublic void identityMatrix()
public boolean choleskySolve(Matrix out_vec_a,
Matrix l_a,
Matrix in_vec_a)
out_vec_a - output vector of matrix typel_a - lower triangular matrix cholesky decomposition marixin_vec_a - input vector of matrix type
public boolean decompositionCholesky(Matrix l_a)
l_a - output lower triangular matrix
public void gaussj(double[][] a,
int n,
double[][] b,
int m)
a - input matrix as 2-d double arrayn - number of rows and columns in the input matrixb - output matrix as 2-d double arraym - number of rows and columns in the output matrixpublic void invertMatrix(Matrix A)
A - inverse matrixpublic void resetMatrix()
public void addMatrix(Matrix A)
A - matrix to be added to object evoked
public void subtractMatrix(Matrix A,
Matrix B)
A - input matrixB - difference matrixpublic void scalarMultMatrix(double scalar)
scalar - matrix double scalar valuepublic void normMatrix()
public void expMatrix()
public void inverseMatrixElements()
public void addMatrixElements(double val_a)
val_a - double value to be added to every element
public void multMatrix(Matrix A,
Matrix B)
A - input matrixB - product matrixpublic void transposeMatrix(Matrix B)
B - matrix transposepublic void printMatrix()
public static void printDoubleVector(java.util.Vector<java.lang.Double> vec_a)
vec_a - Vector to be printed
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||