|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.ObjectJSci.maths.Matrix
JSci.maths.DoubleMatrix
JSci.maths.DoubleSparseMatrix
public final class DoubleSparseMatrix
The DoubleSparseMatrix class provides an object for encapsulating sparse matrices. Uses compressed row storage.
| Field Summary | |
|---|---|
protected static int |
SPARSE
Storage format identifier. |
| Fields inherited from class JSci.maths.DoubleMatrix |
|---|
ARRAY_2D, matrix |
| Fields inherited from class JSci.maths.Matrix |
|---|
CLASS_SPECIFIC, numCols, numRows, storageFormat |
| Constructor Summary | |
|---|---|
DoubleSparseMatrix(double[][] array)
Constructs a matrix from an array. |
|
DoubleSparseMatrix(int rows,
int cols)
Constructs an empty matrix. |
|
| Method Summary | |
|---|---|
DoubleMatrix |
add(DoubleMatrix m)
Returns the addition of this matrix and another. |
DoubleSparseMatrix |
add(DoubleSparseMatrix m)
Returns the addition of this matrix and another. |
boolean |
equals(java.lang.Object m)
Compares two double sparse matrices for equality. |
protected void |
finalize()
Finalize. |
double |
frobeniusNorm()
Returns the Frobenius (l2) norm. |
double |
getElement(int i,
int j)
Returns an element of the matrix. |
double |
infNorm()
Returns the l -norm. |
DoubleMatrix |
mapElements(Mapping f)
Applies a function on all the matrix elements. |
DoubleMatrix |
multiply(DoubleMatrix m)
Returns the multiplication of this matrix and another. |
DoubleMatrix |
multiply(DoubleSparseMatrix m)
Returns the multiplication of this matrix and another. |
DoubleVector |
multiply(DoubleVector v)
Returns the multiplication of a vector by this matrix. |
DoubleMatrix |
scalarMultiply(double x)
Returns the multiplication of this matrix by a scalar. |
double |
scalarProduct(DoubleMatrix m)
Returns the scalar product of this matrix and another. |
double |
scalarProduct(DoubleSparseMatrix m)
Returns the scalar product of this matrix and another. |
void |
setElement(int i,
int j,
double x)
Sets the value of an element of the matrix. |
DoubleMatrix |
subtract(DoubleMatrix m)
Returns the subtraction of this matrix and another. |
DoubleSparseMatrix |
subtract(DoubleSparseMatrix m)
Returns the addition of this matrix and another. |
ComplexMatrix |
toComplexMatrix()
Converts this matrix to a complex matrix. |
IntegerMatrix |
toIntegerMatrix()
Converts this matrix to an integer matrix. |
java.lang.String |
toString()
Returns a string representing this matrix. |
Matrix |
transpose()
Returns the transpose of this matrix. |
| Methods inherited from class JSci.maths.DoubleMatrix |
|---|
add, directSum, hashCode, multiply, negate, scalarDivide, scalarDivide, scalarMultiply, subtract, tensorProduct |
| Methods inherited from class JSci.maths.Matrix |
|---|
columns, getInvalidElementMsg, rows |
| Methods inherited from class java.lang.Object |
|---|
clone, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected static final int SPARSE
| Constructor Detail |
|---|
public DoubleSparseMatrix(int rows,
int cols)
rows - the number of rowscols - the number of columnspublic DoubleSparseMatrix(double[][] array)
array - an assigned value| Method Detail |
|---|
protected void finalize()
throws java.lang.Throwable
finalize in class DoubleMatrixjava.lang.Throwable - Any that occur.public boolean equals(java.lang.Object m)
equals in class DoubleMatrixm - a double matrixpublic java.lang.String toString()
toString in class DoubleMatrixpublic IntegerMatrix toIntegerMatrix()
toIntegerMatrix in class DoubleMatrixpublic ComplexMatrix toComplexMatrix()
toComplexMatrix in class DoubleMatrix
public double getElement(int i,
int j)
getElement in class DoubleMatrixi - row index of the elementj - column index of the element
MatrixDimensionException - If attempting to access an invalid element.
public void setElement(int i,
int j,
double x)
setElement in class DoubleMatrixi - row index of the elementj - column index of the elementx - a number
MatrixDimensionException - If attempting to access an invalid element.public double infNorm()
-norm.
infNorm in class DoubleMatrixpublic double frobeniusNorm()
frobeniusNorm in class DoubleMatrixpublic DoubleMatrix add(DoubleMatrix m)
add in class DoubleMatrixm - a double matrix
MatrixDimensionException - If the matrices are different sizes.public DoubleSparseMatrix add(DoubleSparseMatrix m)
m - a double sparse matrix
MatrixDimensionException - If the matrices are different sizes.public DoubleMatrix subtract(DoubleMatrix m)
subtract in class DoubleMatrixm - a double matrix
MatrixDimensionException - If the matrices are different sizes.public DoubleSparseMatrix subtract(DoubleSparseMatrix m)
m - a double sparse matrix
MatrixDimensionException - If the matrices are different sizes.public DoubleMatrix scalarMultiply(double x)
scalarMultiply in class DoubleMatrixx - a double
public double scalarProduct(DoubleMatrix m)
scalarProduct in class DoubleMatrixm - a double matrix.
MatrixDimensionException - If the matrices are different sizes.public double scalarProduct(DoubleSparseMatrix m)
m - a double sparse matrix.
MatrixDimensionException - If the matrices are different sizes.public DoubleVector multiply(DoubleVector v)
multiply in class DoubleMatrixv - a double vector
DimensionException - If the matrix and vector are incompatible.public DoubleMatrix multiply(DoubleMatrix m)
multiply in class DoubleMatrixm - a double matrix
MatrixDimensionException - If the matrices are incompatible.public DoubleMatrix multiply(DoubleSparseMatrix m)
m - a double sparse matrix
MatrixDimensionException - If the matrices are incompatible.public Matrix transpose()
transpose in class DoubleMatrixpublic DoubleMatrix mapElements(Mapping f)
mapElements in class DoubleMatrixf - a user-defined function
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||