|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.ObjectJSci.maths.matrices.Matrix
JSci.maths.matrices.AbstractDoubleMatrix
JSci.maths.matrices.DoubleSparseMatrix
public final class DoubleSparseMatrix
The DoubleSparseMatrix class provides an object for encapsulating sparse matrices. Uses compressed row storage (Yale sparse matrix format).
| Field Summary |
|---|
| Fields inherited from class JSci.maths.matrices.Matrix |
|---|
numCols, numRows |
| Constructor Summary | |
|---|---|
DoubleSparseMatrix(double[][] array)
Constructs a matrix from an array. |
|
DoubleSparseMatrix(int rowCount,
int colCount)
Constructs an empty matrix. |
|
DoubleSparseMatrix(int rowCount,
int colCount,
int capacityIncrement)
|
|
| Method Summary | |
|---|---|
AbstractDoubleMatrix |
add(AbstractDoubleMatrix m)
Returns the addition of this matrix and another. |
DoubleMatrix |
add(DoubleMatrix m)
|
DoubleSparseMatrix |
add(DoubleSparseMatrix m)
Returns the addition of this matrix and another. |
int |
elementCount()
Returns the number of non-zero elements. |
boolean |
equals(AbstractDoubleMatrix m,
double tol)
Compares two double sparse matrices for equality. |
boolean |
equals(DoubleSparseMatrix m)
|
boolean |
equals(DoubleSparseMatrix m,
double tol)
|
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. |
AbstractDoubleMatrix |
mapElements(Mapping f)
Applies a function on all the matrix elements. |
AbstractDoubleMatrix |
multiply(AbstractDoubleMatrix m)
Returns the multiplication of this matrix and another. |
AbstractDoubleVector |
multiply(AbstractDoubleVector v)
Returns the multiplication of a vector by this matrix. |
AbstractDoubleMatrix |
multiply(DoubleMatrix m)
|
AbstractDoubleMatrix |
multiply(DoubleSparseMatrix m)
Returns the multiplication of this matrix and another. |
AbstractDoubleVector |
multiply(DoubleSparseVector v)
Returns the multiplication of a sparse vector by this matrix. |
AbstractDoubleMatrix |
scalarDivide(double x)
Returns the division of this matrix by a scalar. |
AbstractDoubleMatrix |
scalarMultiply(double x)
Returns the multiplication of this matrix by a scalar. |
double |
scalarProduct(AbstractDoubleMatrix m)
Returns the scalar product of this matrix and another. |
double |
scalarProduct(DoubleMatrix m)
|
void |
setElement(int i,
int j,
double x)
Sets the value of an element of the matrix. |
AbstractDoubleMatrix |
subtract(AbstractDoubleMatrix m)
Returns the subtraction of this matrix and another. |
DoubleMatrix |
subtract(DoubleMatrix m)
|
DoubleSparseMatrix |
subtract(DoubleSparseMatrix m)
Returns the addition of this matrix and another. |
AbstractComplexMatrix |
toComplexMatrix()
Converts this matrix to a complex matrix. |
AbstractIntegerMatrix |
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.matrices.AbstractDoubleMatrix |
|---|
add, directSum, equals, equals, getSet, hashCode, multiply, negate, scalarDivide, scalarMultiply, subtract, tensor |
| Methods inherited from class JSci.maths.matrices.Matrix |
|---|
columns, getInvalidElementMsg, rows |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public DoubleSparseMatrix(int rowCount,
int colCount)
rowCount - the number of rowscolCount - the number of columns
public DoubleSparseMatrix(int rowCount,
int colCount,
int capacityIncrement)
public DoubleSparseMatrix(double[][] array)
array - an assigned value| Method Detail |
|---|
public boolean equals(AbstractDoubleMatrix m,
double tol)
equals in class AbstractDoubleMatrixm - a double matrixpublic final boolean equals(DoubleSparseMatrix m)
public boolean equals(DoubleSparseMatrix m,
double tol)
public java.lang.String toString()
toString in class AbstractDoubleMatrixpublic AbstractIntegerMatrix toIntegerMatrix()
toIntegerMatrix in class AbstractDoubleMatrixpublic AbstractComplexMatrix toComplexMatrix()
toComplexMatrix in class AbstractDoubleMatrix
public double getElement(int i,
int j)
getElement in class AbstractDoubleMatrixi - 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 AbstractDoubleMatrixi - row index of the elementj - column index of the elementx - a number
MatrixDimensionException - If attempting to access an invalid element.public int elementCount()
public double infNorm()
-norm.
infNorm in class AbstractDoubleMatrixpublic double frobeniusNorm()
frobeniusNorm in class AbstractDoubleMatrixpublic AbstractDoubleMatrix add(AbstractDoubleMatrix m)
add in class AbstractDoubleMatrixm - a double matrix
MatrixDimensionException - If the matrices are different sizes.public DoubleMatrix add(DoubleMatrix m)
public DoubleSparseMatrix add(DoubleSparseMatrix m)
m - a double sparse matrix
MatrixDimensionException - If the matrices are different sizes.public AbstractDoubleMatrix subtract(AbstractDoubleMatrix m)
subtract in class AbstractDoubleMatrixm - a double matrix
MatrixDimensionException - If the matrices are different sizes.public DoubleMatrix subtract(DoubleMatrix m)
public DoubleSparseMatrix subtract(DoubleSparseMatrix m)
m - a double sparse matrix
MatrixDimensionException - If the matrices are different sizes.public AbstractDoubleMatrix scalarMultiply(double x)
scalarMultiply in class AbstractDoubleMatrixx - a double
public AbstractDoubleMatrix scalarDivide(double x)
AbstractDoubleMatrix
scalarDivide in class AbstractDoubleMatrixx - a double.
public double scalarProduct(AbstractDoubleMatrix m)
scalarProduct in class AbstractDoubleMatrixm - a double matrix.
MatrixDimensionException - If the matrices are different sizes.public double scalarProduct(DoubleMatrix m)
public AbstractDoubleVector multiply(AbstractDoubleVector v)
multiply in class AbstractDoubleMatrixv - a double vector
DimensionException - If the matrix and vector are incompatible.public AbstractDoubleVector multiply(DoubleSparseVector v)
v - a double vector
DimensionException - If the matrix and vector are incompatible.public AbstractDoubleMatrix multiply(AbstractDoubleMatrix m)
multiply in class AbstractDoubleMatrixm - a double matrix
MatrixDimensionException - If the matrices are incompatible.public AbstractDoubleMatrix multiply(DoubleMatrix m)
public AbstractDoubleMatrix multiply(DoubleSparseMatrix m)
m - a double sparse matrix
MatrixDimensionException - If the matrices are incompatible.public Matrix transpose()
transpose in class AbstractDoubleMatrixpublic AbstractDoubleMatrix mapElements(Mapping f)
mapElements in class AbstractDoubleMatrixf - a user-defined function
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||