|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jscience.mathematics.algebraic.AbstractHypermatrix
org.jscience.mathematics.algebraic.AbstractMatrix
org.jscience.mathematics.algebraic.matrices.AbstractDoubleMatrix
org.jscience.mathematics.algebraic.matrices.DoubleSparseMatrix
public class DoubleSparseMatrix
The DoubleSparseMatrix class provides an object for encapsulating sparse matrices. Uses compressed row storage.
| Constructor Summary | |
|---|---|
DoubleSparseMatrix(double[][] array)
Constructs a matrix from an array. |
|
DoubleSparseMatrix(DoubleSparseMatrix mat)
Copy constructor. |
|
DoubleSparseMatrix(int rowCount,
int colCount)
Constructs an empty matrix. |
|
| Method Summary | |
|---|---|
AbstractDoubleMatrix |
add(AbstractDoubleMatrix m)
Returns the addition of this matrix and another. |
DoubleMatrix |
add(DoubleMatrix m)
DOCUMENT ME! |
DoubleSparseMatrix |
add(DoubleSparseMatrix m)
Returns the addition of this matrix and another. |
java.lang.Object |
clone()
Clone matrix into a new matrix. |
boolean |
equals(AbstractDoubleMatrix m,
double tol)
Compares two double sparse matrices for equality. |
boolean |
equals(DoubleSparseMatrix m)
DOCUMENT ME! |
boolean |
equals(DoubleSparseMatrix m,
double tol)
DOCUMENT ME! |
double |
frobeniusNorm()
Returns the Frobenius (l2) norm. |
double |
getPrimitiveElement(int i,
int j)
Returns an element of the matrix. |
double |
infNorm()
Returns the l -norm. |
AbstractDoubleMatrix |
mapElements(PrimitiveMapping 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)
DOCUMENT ME! |
AbstractDoubleMatrix |
multiply(DoubleSparseMatrix m)
Returns the multiplication of this matrix and another. |
AbstractDoubleMatrix |
scalarDivide(double x)
DOCUMENT ME! |
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)
DOCUMENT ME! |
void |
setAllElements(double x)
Sets the value of all elements of the matrix. |
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)
DOCUMENT ME! |
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. |
double[][] |
toPrimitiveArray()
Projects the matrix to an array. |
java.lang.String |
toString()
Returns a string representing this matrix. |
Matrix |
transpose()
Returns the transpose of this matrix. |
| Methods inherited from class org.jscience.mathematics.algebraic.matrices.AbstractDoubleMatrix |
|---|
abs, add, directSum, equals, equals, getColumn, getElement, getMatrixAsColumns, getMatrixAsRows, getRow, getSet, getSubMatrix, hashCode, horizontalAxisSymmetry, mass, max, mean, min, multiply, negate, read, reverse, scalarDivide, scalarMultiply, setColumn, setRow, setSubMatrix, subtract, tensorProduct, verticalAxisSymmetry |
| Methods inherited from class org.jscience.mathematics.algebraic.AbstractMatrix |
|---|
getElement, getInvalidElementMsg, numColumns, numRows, print, print, print, print, toArray, toArray |
| Methods inherited from class org.jscience.mathematics.algebraic.AbstractHypermatrix |
|---|
getDimensions, numDimensions, numElements, numElements, toArray |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.jscience.mathematics.algebraic.Hypermatrix |
|---|
getDimensions, numDimensions, numElements, numElements, toArray |
| Constructor Detail |
|---|
public DoubleSparseMatrix(int rowCount,
int colCount)
rowCount - the number of rowscolCount - the number of columnspublic DoubleSparseMatrix(double[][] array)
array - an assigned valuepublic DoubleSparseMatrix(DoubleSparseMatrix mat)
mat - an assigned value| Method Detail |
|---|
public boolean equals(AbstractDoubleMatrix m,
double tol)
equals in class AbstractDoubleMatrixm - a double matrixtol - DOCUMENT ME!
public boolean equals(DoubleSparseMatrix m)
m - DOCUMENT ME!
public boolean equals(DoubleSparseMatrix m,
double tol)
m - DOCUMENT ME!tol - DOCUMENT ME!
public java.lang.String toString()
toString in class AbstractDoubleMatrixpublic AbstractIntegerMatrix toIntegerMatrix()
toIntegerMatrix in class AbstractDoubleMatrixpublic AbstractComplexMatrix toComplexMatrix()
toComplexMatrix in class AbstractDoubleMatrix
public double getPrimitiveElement(int i,
int j)
getPrimitiveElement in class AbstractDoubleMatrixi - row index of the elementj - column index of the element
IllegalDimensionException - 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
IllegalDimensionException - If attempting to access an invalid
element.public void setAllElements(double x)
setAllElements in class AbstractDoubleMatrixx - a double elementpublic double infNorm()
-norm.
infNorm in class AbstractDoubleMatrixjava.lang.ArithmeticException - DOCUMENT ME!public double frobeniusNorm()
frobeniusNorm in class AbstractDoubleMatrixjava.lang.ArithmeticException - DOCUMENT ME!public AbstractDoubleMatrix add(AbstractDoubleMatrix m)
add in class AbstractDoubleMatrixm - a double matrix
IllegalDimensionException - If the matrices are different sizes.public DoubleMatrix add(DoubleMatrix m)
m - DOCUMENT ME!
public DoubleSparseMatrix add(DoubleSparseMatrix m)
m - a double sparse matrix
IllegalDimensionException - If the matrices are different sizes.public AbstractDoubleMatrix subtract(AbstractDoubleMatrix m)
subtract in class AbstractDoubleMatrixm - a double matrix
IllegalDimensionException - If the matrices are different sizes.public DoubleMatrix subtract(DoubleMatrix m)
m - DOCUMENT ME!
public DoubleSparseMatrix subtract(DoubleSparseMatrix m)
m - a double sparse matrix
IllegalDimensionException - If the matrices are different sizes.public AbstractDoubleMatrix scalarMultiply(double x)
scalarMultiply in class AbstractDoubleMatrixx - a double
public AbstractDoubleMatrix scalarDivide(double x)
scalarDivide in class AbstractDoubleMatrixx - DOCUMENT ME!
public double scalarProduct(AbstractDoubleMatrix m)
scalarProduct in class AbstractDoubleMatrixm - a double matrix.
IllegalDimensionException - If the matrices are different sizes.public double scalarProduct(DoubleMatrix m)
m - DOCUMENT ME!
public AbstractDoubleVector multiply(AbstractDoubleVector v)
multiply in class AbstractDoubleMatrixv - a double vector
IllegalDimensionException - If the matrix and vector are
incompatible.public AbstractDoubleMatrix multiply(AbstractDoubleMatrix m)
multiply in class AbstractDoubleMatrixm - a double matrix
IllegalDimensionException - If the matrices are incompatible.public AbstractDoubleMatrix multiply(DoubleMatrix m)
m - DOCUMENT ME!
public AbstractDoubleMatrix multiply(DoubleSparseMatrix m)
m - a double sparse matrix
IllegalDimensionException - If the matrices are incompatible.public Matrix transpose()
transpose in interface Matrixtranspose in class AbstractDoubleMatrixpublic AbstractDoubleMatrix mapElements(PrimitiveMapping f)
mapElements in class AbstractDoubleMatrixf - a user-defined function
public java.lang.Object clone()
clone in class java.lang.Objectpublic double[][] toPrimitiveArray()
toPrimitiveArray in class AbstractDoubleMatrix
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||