|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--ru.sscc.matrix.RealMatrix
An abstract implementation of a real rectangular algebraic matrix
based on RealContainer
entries vector.
A storage of entries in the vector depends on a subclass.
An abstract operations set and get provide a subclass
independent access to matrix entries.
All matrices are supposed to be cloneable and serializable.
Four static matrix-bymatrix multiplication methods are implemented here.
Field Summary | |
protected RealContainer |
entries
A container for matrix entries. |
int |
nColumns
A number of matrix columns. |
int |
nRows
A number of matrix rows. |
Constructor Summary | |
protected |
RealMatrix(RealContainer entries,
int nRows,
int nColumns)
Constructor. |
Method Summary | |
abstract double |
add(int i,
int j,
double value)
Adds the value of a matrix entry at the position (i,j). |
java.lang.Object |
clone()
Clones the matrix. |
int |
columnsNumber()
Returns a number of matrix columns. |
void |
ensureAlgebraic()
Tests the matrix to be algebraic and throws the IllegalStateException if not. |
void |
ensureDimensions(int rowsNumber,
int columnsNumber)
Tests the matrix dimensions to be equal to specified dimensions and throws the IllegalArgumentException if not. |
void |
ensureDimensions(Matrix matrix)
Tests the matrix dimensions to be equal to the parameter matrix dimensions and throws the IllegalArgumentException if not. |
void |
ensureSquareMatrix()
Tests the matrix to be square matrix and throws the IllegalArgumentException if not. |
abstract double |
get(int i,
int j)
Gets a value of a matrix entry at the position (i,j). |
RealContainer |
getContainer()
Returns the matrix data container. |
void |
lock()
Locks matrix by vector operations (sets the matrix to be nonalgebraic). |
abstract double |
mul(int i,
int j,
double value)
Multiplies a matrix entry at the position (i,j) by a value. |
abstract void |
multiply(RealVector source,
RealVector target)
Multiplies the matrix by a column-vector. |
static DenseMatrix |
multiplyNN(RealMatrix A,
RealMatrix B,
DenseMatrix C)
Calculates C=AB, where A and B are arbitrary real matrices, and C is the dense rectangular matrix. |
static DenseMatrix |
multiplyNT(RealMatrix A,
RealMatrix B,
DenseMatrix C)
Calculates C=ABT, where A and B are arbitrary real matrices, and C is the dense rectangular matrix. |
abstract void |
multiplyT(RealVector source,
RealVector target)
Multiplies the transposed matrix by a column-vector. |
static DenseMatrix |
multiplyTN(RealMatrix A,
RealMatrix B,
DenseMatrix C)
Calculates C=ATB, where A and B are arbitrary real matrices, and C is the dense rectangular matrix. |
static DenseMatrix |
multiplyTT(RealMatrix A,
RealMatrix B,
DenseMatrix C)
Calculates C=ATBT, where A and B are arbitrary real matrices, and C is the dense rectangular matrix. |
double |
relativeAccuracy()
Returns the matrix entries relative accuracy: the smallest value e such that 1+e isn't equal to 1 for the data type used for the matrix entries. |
int |
rowsNumber()
Returns a number of matrix rows. |
abstract double |
set(int i,
int j,
double value)
Sets the value of a matrix entry at the position (i,j). |
protected void |
unlock()
Clears nonalgebraicness tag for the matrix and allows use the matrix in algebraic operations again. |
Methods inherited from class java.lang.Object |
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public final int nRows
public final int nColumns
protected RealContainer entries
Constructor Detail |
protected RealMatrix(RealContainer entries, int nRows, int nColumns)
entries
- a container of matrix entriesnRows
- a number of matrix rowsnColumns
- a number of matrix columnsMethod Detail |
public final int rowsNumber()
public final int columnsNumber()
public final RealContainer getContainer()
public final double relativeAccuracy()
public final void lock()
protected void unlock()
public void ensureAlgebraic()
public final void ensureDimensions(Matrix matrix)
public final void ensureDimensions(int rowsNumber, int columnsNumber)
public void ensureSquareMatrix()
public java.lang.Object clone()
public abstract double get(int i, int j)
i
- a zero based row numberj
- a zero based column numberpublic abstract double set(int i, int j, double value)
i
- a zero based row numberj
- a zero based column numbervalue
- a value to setpublic abstract double add(int i, int j, double value)
i
- a zero based row numberj
- a zero based column numbervalue
- a value to setpublic abstract double mul(int i, int j, double value)
i
- a zero based row numberj
- a zero based column numbervalue
- a value to setpublic abstract void multiply(RealVector source, RealVector target)
source
- a source vector to multiplytarget
- a target vector to write the resultpublic abstract void multiplyT(RealVector source, RealVector target)
source
- a source vector to multiplytarget
- a target vector to write the resultpublic static DenseMatrix multiplyNN(RealMatrix A, RealMatrix B, DenseMatrix C)
A
- the first multiplierB
- the second multiplierC
- the matrix to store the result (null is possible)public static DenseMatrix multiplyTN(RealMatrix A, RealMatrix B, DenseMatrix C)
A
- the first multiplierB
- the second multiplierC
- the matrix to store the result (null is possible)public static DenseMatrix multiplyNT(RealMatrix A, RealMatrix B, DenseMatrix C)
A
- the first multiplierB
- the second multiplierC
- the matrix to store the result (null is possible)public static DenseMatrix multiplyTT(RealMatrix A, RealMatrix B, DenseMatrix C)
A
- the first multiplierB
- the second multiplierC
- the matrix to store the result (null is possible)
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |