|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.openmali.number.matrix.MatrixMxNrad
public class MatrixMxNrad
A general matrix implementing basic radical algebra. The implementation is aimed for applications where trigonomic constants are applicable, where exact arithmatic can be performed and is useful, and where speed is not an issue.
| Field Summary | |
|---|---|
protected int |
colSkip
A matrix might be part of another, larger matrix. |
protected int |
dataBegin
A matrix might be part of another, larger matrix. |
protected Radical1[] |
values
The data of the Matrix |
| Constructor Summary | |
|---|---|
protected |
MatrixMxNrad(boolean readOnly,
int rows,
int cols)
Constructs an nRow by nCol identity matrix. |
protected |
MatrixMxNrad(boolean readOnly,
int dataBegin,
int colskip,
int rows,
int cols,
Radical1[] values)
|
protected |
MatrixMxNrad(boolean readOnly,
int rows,
int cols,
Radical1[] values)
Constructs an nRow by nCol matrix initialized to the values in the matrix array. |
protected |
MatrixMxNrad(boolean readOnly,
MatrixMxNrad matrix)
Constructs a new GMatrix and copies the initial values from the parameter matrix. |
|
MatrixMxNrad(int rows,
int cols)
Constructs an nRow by nCol identity matrix. |
protected |
MatrixMxNrad(int dataBegin,
int colskip,
int rows,
int cols,
Radical1[] values)
|
|
MatrixMxNrad(int rows,
int cols,
Radical1[] values)
Constructs an nRow by nCol matrix initialized to the values in the matrix array. |
|
MatrixMxNrad(MatrixMxNrad matrix)
Constructs a new GMatrix and copies the initial values from the parameter matrix. |
| Method Summary | |
|---|---|
void |
add(float scalar)
Adds a scalar to this Matrix. |
void |
add(MatrixMxNrad m2)
Sets the value of this matrix to sum of itself and matrix m2. |
void |
add(MatrixMxNrad m1,
MatrixMxNrad m2)
Sets the value of this matrix to the matrix sum of matrices m1 and m2. |
MatrixMxNrad |
clone()
|
void |
copySubMatrix(int rowSource,
int colSource,
int numRows,
int numCols,
int rowDest,
int colDest,
MatrixMxNrad target)
Copies a sub-matrix derived from this matrix into the target matrix. |
boolean |
equals(MatrixMxNrad mat2)
Returns true if all of the data members of Matrix4d m1 are equal to the corresponding data members in this Matrix4d. |
boolean |
equals(java.lang.Object o)
Returns true if the Object o1 is of type GMatrix and all of the data members of t1 are equal to the corresponding data members in this Matrix. |
Radical1 |
get(int row,
int column,
Radical1 passback)
Retrieves the value at the specified row and column of this matrix. |
void |
getColumn(int col,
TupleNrad<?> tuple)
Places the values of the specified column into the vector parameter. |
int |
getNumCols()
|
int |
getNumRows()
|
Radical1 |
getReference(int row,
int column)
|
void |
getRow(int row,
TupleNrad<?> tuple)
Places the values of the specified row into the vector parameter. |
MatrixMxNrad |
getSharedSubMatrix(boolean readOnly,
int beginRow,
int beginCol,
int rows,
int cols)
Creates a Submatrix of mat, that begins in beginRow and beginCol. |
MatrixMxNrad |
getSharedSubMatrix(int beginRow,
int beginCol,
int rows,
int cols)
Creates a Submatrix of mat, that begins in beginRow and beginCol. |
int |
hashCode()
Returns a hash number based on the data values in this object. |
boolean |
isDirty()
|
boolean |
isReadOnly()
|
boolean |
isSquare()
|
boolean |
isSubMatrix()
|
void |
mul(float scalar)
Multiplies this Matrix with a scalar. |
void |
mul(MatrixMxNrad gmat)
Sets the value of this matrix to the result of multiplying itself with matrix m1 (this = this * m1). |
void |
mul(MatrixMxNrad m1,
MatrixMxNrad m2)
Sets the value of this matrix to the result of multiplying the two argument matrices together (this = m1 * m2). |
void |
mul(TupleNrad<?> v1,
TupleNrad<?> v2)
Computes the outer product of the two vectors; multiplies the the first vector by the transpose of the second vector and places the matrix result into this matrix. |
void |
mulTransposeBoth(MatrixMxNrad m1,
MatrixMxNrad m2)
Multiplies the transpose of matrix m1 times the transpose of matrix m2, and places the result into this. |
void |
mulTransposeLeft(MatrixMxNrad m1,
MatrixMxNrad m2)
Multiplies the transpose of matrix m1 times the matrix m2, and places the result into this. |
void |
negate()
Negates the value of this matrix: this = -this. |
void |
negate(MatrixMxNrad m)
Sets the value of this matrix to the negation of the Matrix parameter. |
static MatrixMxNrad |
newReadOnly(int rows,
int cols)
Constructs an nRow by nCol identity matrix. |
static MatrixMxNrad |
newReadOnly(int rows,
int cols,
Radical1[] values)
Constructs an nRow by nCol matrix initialized to the values in the matrix array. |
static MatrixMxNrad |
newReadOnly(MatrixMxNrad matrix)
Constructs a new GMatrix and copies the initial values from the parameter matrix. |
void |
set(int row,
int column,
Radical1 value)
Modifies the value at the specified row and column of this matrix. |
void |
set(MatrixMxNrad values)
|
boolean |
setClean()
Marks this Matrix non-dirty. |
void |
setColumn(int col,
TupleNrad<?> tuple)
Copy the values from the array into the specified column of this matrix. |
void |
setIdentity()
Sets this GMatrix to the identity matrix. |
void |
setReference(int row,
int column,
Radical1 ref)
sets the underlying reference of this matrix. |
void |
setZero()
Sets all the values in this matrix to zero. |
static MatrixMxNf |
sharedSubMatrixMxNrad(MatrixMxNf mat,
int beginRow,
int beginCol,
int rows,
int cols,
boolean readOnly)
creates a shared Submatrix of mat. |
static MatrixMxNrad |
sharedSubMatrixMxNrad(MatrixMxNrad mat,
int beginRow,
int beginCol,
int rows,
int cols)
creates a shared Submatrix of mat. |
void |
sub(float scalar)
Subtracts a scalar from this Matrix. |
void |
sub(MatrixMxNrad m2)
Sets the value of this matrix to the matrix difference of itself and matrix m2 (this = this - m2). |
void |
sub(MatrixMxNrad m1,
MatrixMxNrad m2)
Sets the value of this matrix to the matrix difference of matrices m1 and m2 (this = m1 - m2). |
java.lang.String |
toString()
|
void |
transpose()
Transposes this matrix in place. |
void |
transpose(MatrixMxNrad mat)
Places the matrix values of the transpose of matrix mat into this matrix. |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected final Radical1[] values
protected final int dataBegin
dataBegin describes, where the data of this matrix begins.
protected final int colSkip
colskip describes, how many columns the submatrix has, so we really are able to simulate the submatrix.cols.
| Constructor Detail |
|---|
protected MatrixMxNrad(boolean readOnly,
int rows,
int cols)
readOnly - rows - number of rows in this matrix.cols - number of columns in this matrix.
protected MatrixMxNrad(boolean readOnly,
int rows,
int cols,
Radical1[] values)
readOnly - rows - number of rows in this matrix.cols - number of columns in this matrix.values - a 1D array that specifies a matrix in row major fashion
protected MatrixMxNrad(boolean readOnly,
MatrixMxNrad matrix)
readOnly - matrix - the source of the initial values of the new GMatrix
protected MatrixMxNrad(boolean readOnly,
int dataBegin,
int colskip,
int rows,
int cols,
Radical1[] values)
readOnly - dataBegin - colskip - values - getSharedSubMatrix(int, int, int, int),
MatrixMxNf.MatrixMxNf(int, int, int, int, float[])
public MatrixMxNrad(int rows,
int cols)
rows - number of rows in this matrix.cols - number of columns in this matrix.
public MatrixMxNrad(int rows,
int cols,
Radical1[] values)
rows - number of rows in this matrix.cols - number of columns in this matrix.values - a 1D array that specifies a matrix in row major fashionpublic MatrixMxNrad(MatrixMxNrad matrix)
matrix - the source of the initial values of the new GMatrix
protected MatrixMxNrad(int dataBegin,
int colskip,
int rows,
int cols,
Radical1[] values)
dataBegin - colskip - values - getSharedSubMatrix(int, int, int, int),
MatrixMxNf.MatrixMxNf(int, int, int, int, float[])| Method Detail |
|---|
public final int getNumRows()
public final int getNumCols()
public final boolean isSquare()
public final boolean isReadOnly()
public final boolean setClean()
public final boolean isDirty()
public final boolean isSubMatrix()
true, if this Matrix is backed by another (usually larger) matrix.
public final void set(int row,
int column,
Radical1 value)
row - the row number to be modified (zero indexed)column - the column number to be modified (zero indexed)value - the new matrix element value
public void setReference(int row,
int column,
Radical1 ref)
row - column - ref -
public final Radical1 get(int row,
int column,
Radical1 passback)
row - the row number to be retrieved (zero indexed)column - the column number to be retrieved (zero indexed)
public final Radical1 getReference(int row,
int column)
public void set(MatrixMxNrad values)
public final void getRow(int row,
TupleNrad<?> tuple)
row - the target row numbertuple - the vector into which the row values will be placed
public final void setColumn(int col,
TupleNrad<?> tuple)
col - the column of this matrix into which the vector values will be copied.tuple - the source vector
public final void getColumn(int col,
TupleNrad<?> tuple)
col - the target column numbertuple - the vector into which the column values will be placedpublic final void setZero()
public final void setIdentity()
public final void negate()
public final void negate(MatrixMxNrad m)
m - The source matrixpublic void transpose()
public void transpose(MatrixMxNrad mat)
mat - the matrix to be transposed (but not modified)
public final void copySubMatrix(int rowSource,
int colSource,
int numRows,
int numCols,
int rowDest,
int colDest,
MatrixMxNrad target)
rowSource - the top-most row of the sub-matrixcolSource - the left-most column of the sub-matrixnumRows - the number of rows in the sub-matrixnumCols - the number of columns in the sub-matrixrowDest - the top-most row of the position of the copied sub-matrix
within the target matrixcolDest - the left-most column of the position of the copied
sub-matrix within the target matrixtarget - the matrix into which the sub-matrix will be copiedpublic final void add(float scalar)
scalar - public final void add(MatrixMxNrad m2)
m2 - the other matrix
public final void add(MatrixMxNrad m1,
MatrixMxNrad m2)
m1 - the first matrixm2 - the second matrixpublic final void sub(float scalar)
scalar - public final void sub(MatrixMxNrad m2)
m2 - the other matrix
public final void sub(MatrixMxNrad m1,
MatrixMxNrad m2)
m1 - the first matrixm2 - the second matrixpublic final void mul(float scalar)
scalar -
public void mul(MatrixMxNrad m1,
MatrixMxNrad m2)
m1 - the first matrixm2 - the second matrixpublic void mul(MatrixMxNrad gmat)
gmat - the other matrix
public void mul(TupleNrad<?> v1,
TupleNrad<?> v2)
v1 - the first vector, treated as a row vectorv2 - the second vector, treated as a column vector
public void mulTransposeBoth(MatrixMxNrad m1,
MatrixMxNrad m2)
m1 - The matrix on the left hand side of the multiplicationm2 - The matrix on the right hand side of the multiplication
public void mulTransposeLeft(MatrixMxNrad m1,
MatrixMxNrad m2)
m1 - The matrix on the left hand side of the multiplicationm2 - The matrix on the right hand side of the multiplicationpublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(MatrixMxNrad mat2)
mat2 - The matrix with which the comparison is made.
public boolean equals(java.lang.Object o)
equals in class java.lang.Objecto - the object with which the comparison is made.public java.lang.String toString()
toString in class java.lang.Objectpublic MatrixMxNrad clone()
clone in class java.lang.Object
public MatrixMxNrad getSharedSubMatrix(boolean readOnly,
int beginRow,
int beginCol,
int rows,
int cols)
readOnly - beginRow - the row to start this matrix atbeginCol - the column to start this matrix atrows - cols -
public MatrixMxNrad getSharedSubMatrix(int beginRow,
int beginCol,
int rows,
int cols)
beginRow - the row to start this matrix atbeginCol - the column to start this matrix atrows - cols -
public static MatrixMxNrad newReadOnly(int rows,
int cols)
rows - number of rows in this matrix.cols - number of columns in this matrix.
public static MatrixMxNrad newReadOnly(int rows,
int cols,
Radical1[] values)
rows - number of rows in this matrix.cols - number of columns in this matrix.values - a 1D array that specifies a matrix in row major fashionpublic static MatrixMxNrad newReadOnly(MatrixMxNrad matrix)
matrix - the source of the initial values of the new GMatrix
public static MatrixMxNf sharedSubMatrixMxNrad(MatrixMxNf mat,
int beginRow,
int beginCol,
int rows,
int cols,
boolean readOnly)
getSharedSubMatrix(int, int, int, int)
getSharedSubMatrix(int, int, int, int)
public static MatrixMxNrad sharedSubMatrixMxNrad(MatrixMxNrad mat,
int beginRow,
int beginCol,
int rows,
int cols)
getSharedSubMatrix(int, int, int, int)
getSharedSubMatrix(int, int, int, int)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||