|
|||||||||
| 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.AbstractIntegerMatrix
org.jscience.mathematics.algebraic.matrices.IntegerSparseMatrix
public class IntegerSparseMatrix
The IntegerSparseMatrix class provides an object for encapsulating sparse matrices. Uses compressed row storage.
| Constructor Summary | |
|---|---|
IntegerSparseMatrix(int[][] array)
Constructs a matrix from an array. |
|
IntegerSparseMatrix(IntegerSparseMatrix mat)
Copy constructor. |
|
IntegerSparseMatrix(int rowCount,
int colCount)
Constructs an empty matrix. |
|
| Method Summary | |
|---|---|
AbstractIntegerMatrix |
add(AbstractIntegerMatrix m)
Returns the addition of this matrix and another. |
IntegerMatrix |
add(IntegerMatrix m)
|
IntegerSparseMatrix |
add(IntegerSparseMatrix m)
Returns the addition of this matrix and another. |
java.lang.Object |
clone()
Clone matrix into a new matrix. |
boolean |
equals(AbstractIntegerMatrix m,
double tol)
Compares two double sparse matrices for equality. |
boolean |
equals(IntegerSparseMatrix m)
|
boolean |
equals(IntegerSparseMatrix m,
double tol)
|
double |
frobeniusNorm()
Returns the Frobenius (l2) norm. |
int |
getPrimitiveElement(int i,
int j)
Returns an element of the matrix. |
int |
infNorm()
Returns the l -norm. |
AbstractDoubleMatrix |
mapElements(PrimitiveMapping f)
Applies a function on all the matrix elements. |
AbstractIntegerMatrix |
multiply(AbstractIntegerMatrix m)
Returns the multiplication of this matrix and another. |
AbstractIntegerVector |
multiply(AbstractIntegerVector v)
Returns the multiplication of a vector by this matrix. |
AbstractIntegerMatrix |
multiply(IntegerMatrix m)
|
AbstractIntegerMatrix |
multiply(IntegerSparseMatrix m)
Returns the multiplication of this matrix and another. |
AbstractIntegerMatrix |
scalarMultiply(int x)
Returns the multiplication of this matrix by a scalar. |
int |
scalarProduct(AbstractIntegerMatrix m)
Returns the scalar product of this matrix and another. |
int |
scalarProduct(IntegerMatrix m)
|
void |
setAllElements(int x)
Sets the value of all elements of the matrix. |
void |
setElement(int i,
int j,
int x)
Sets the value of an element of the matrix. |
AbstractIntegerMatrix |
subtract(AbstractIntegerMatrix m)
Returns the subtraction of this matrix and another. |
IntegerMatrix |
subtract(IntegerMatrix m)
|
IntegerSparseMatrix |
subtract(IntegerSparseMatrix m)
Returns the addition of this matrix and another. |
AbstractComplexMatrix |
toComplexMatrix()
Converts this matrix to a complex matrix. |
AbstractDoubleMatrix |
toDoubleMatrix()
Converts this matrix to an double matrix. |
int[][] |
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.AbstractIntegerMatrix |
|---|
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 IntegerSparseMatrix(int rowCount,
int colCount)
rowCount - the number of rowscolCount - the number of columnspublic IntegerSparseMatrix(int[][] array)
array - an assigned valuepublic IntegerSparseMatrix(IntegerSparseMatrix mat)
mat - an assigned value| Method Detail |
|---|
public boolean equals(AbstractIntegerMatrix m,
double tol)
equals in class AbstractIntegerMatrixm - a integer matrixpublic boolean equals(IntegerSparseMatrix m)
public boolean equals(IntegerSparseMatrix m,
double tol)
public java.lang.String toString()
toString in class AbstractIntegerMatrixpublic AbstractDoubleMatrix toDoubleMatrix()
toDoubleMatrix in class AbstractIntegerMatrixpublic AbstractComplexMatrix toComplexMatrix()
toComplexMatrix in class AbstractIntegerMatrix
public int getPrimitiveElement(int i,
int j)
getPrimitiveElement in class AbstractIntegerMatrixi - 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,
int x)
setElement in class AbstractIntegerMatrixi - row index of the elementj - column index of the elementx - a number
IllegalDimensionException - If attempting to access an invalid element.public void setAllElements(int x)
setAllElements in class AbstractIntegerMatrixx - a int elementpublic int infNorm()
-norm.
infNorm in class AbstractIntegerMatrixpublic double frobeniusNorm()
frobeniusNorm in class AbstractIntegerMatrixpublic AbstractIntegerMatrix add(AbstractIntegerMatrix m)
add in class AbstractIntegerMatrixm - a integer matrix
IllegalDimensionException - If the matrices are different sizes.public IntegerMatrix add(IntegerMatrix m)
public IntegerSparseMatrix add(IntegerSparseMatrix m)
m - a integer sparse matrix
IllegalDimensionException - If the matrices are different sizes.public AbstractIntegerMatrix subtract(AbstractIntegerMatrix m)
subtract in class AbstractIntegerMatrixm - a integer matrix
IllegalDimensionException - If the matrices are different sizes.public IntegerMatrix subtract(IntegerMatrix m)
public IntegerSparseMatrix subtract(IntegerSparseMatrix m)
m - a integer sparse matrix
IllegalDimensionException - If the matrices are different sizes.public AbstractIntegerMatrix scalarMultiply(int x)
scalarMultiply in class AbstractIntegerMatrixx - a integer
public int scalarProduct(AbstractIntegerMatrix m)
scalarProduct in class AbstractIntegerMatrixm - a integer matrix.
IllegalDimensionException - If the matrices are different sizes.public int scalarProduct(IntegerMatrix m)
public AbstractIntegerVector multiply(AbstractIntegerVector v)
multiply in class AbstractIntegerMatrixv - a integer vector
IllegalDimensionException - If the matrix and vector are incompatible.public AbstractIntegerMatrix multiply(AbstractIntegerMatrix m)
multiply in class AbstractIntegerMatrixm - a integer matrix
IllegalDimensionException - If the matrices are incompatible.public AbstractIntegerMatrix multiply(IntegerMatrix m)
public AbstractIntegerMatrix multiply(IntegerSparseMatrix m)
m - a integer sparse matrix
IllegalDimensionException - If the matrices are incompatible.public Matrix transpose()
transpose in interface Matrixtranspose in class AbstractIntegerMatrixpublic AbstractDoubleMatrix mapElements(PrimitiveMapping f)
mapElements in class AbstractIntegerMatrixf - a user-defined function
public java.lang.Object clone()
clone in class java.lang.Objectpublic int[][] toPrimitiveArray()
toPrimitiveArray in class AbstractIntegerMatrix
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||