|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object JSci.maths.matrices.Matrix JSci.maths.matrices.AbstractDoubleMatrix JSci.maths.matrices.AbstractDoubleSquareMatrix JSci.maths.matrices.DoubleSparseSquareMatrix
public final class DoubleSparseSquareMatrix
The DoubleSparseSquareMatrix class provides an object for encapsulating sparse square matrices. Uses compressed row storage (Yale sparse matrix format).
Field Summary |
---|
Fields inherited from class JSci.maths.matrices.AbstractDoubleSquareMatrix |
---|
luCache |
Fields inherited from class JSci.maths.matrices.Matrix |
---|
numCols, numRows |
Constructor Summary | |
---|---|
DoubleSparseSquareMatrix(double[][] array)
Constructs a matrix from an array. |
|
DoubleSparseSquareMatrix(int size)
Constructs an empty matrix. |
|
DoubleSparseSquareMatrix(int size,
int capacityIncrement)
|
Method Summary | |
---|---|
AbstractDoubleSquareMatrix |
add(AbstractDoubleSquareMatrix m)
Returns the addition of this matrix and another. |
DoubleSparseSquareMatrix |
add(DoubleSparseSquareMatrix m)
Returns the addition of this matrix and another. |
DoubleSquareMatrix |
add(DoubleSquareMatrix m)
|
AbstractDoubleSquareMatrix[] |
choleskyDecompose()
Returns the Cholesky decomposition of this matrix. |
double |
det()
Returns the determinant. |
int |
elementCount()
Returns the number of non-zero elements. |
boolean |
equals(AbstractDoubleSquareMatrix m,
double tol)
Compares two double sparse square matrices for equality. |
boolean |
equals(DoubleSparseSquareMatrix m)
|
boolean |
equals(DoubleSparseSquareMatrix 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. |
AbstractDoubleSquareMatrix[] |
luDecompose()
Returns the LU decomposition of this matrix. |
AbstractDoubleSquareMatrix[] |
luDecompose(int[] pivot)
Returns the LU decomposition of this matrix. |
AbstractDoubleMatrix |
mapElements(Mapping f)
Applies a function on all the matrix elements. |
AbstractDoubleSquareMatrix |
multiply(AbstractDoubleSquareMatrix m)
Returns the multiplication of this matrix and another. |
AbstractDoubleVector |
multiply(AbstractDoubleVector v)
Returns the multiplication of a vector by this matrix. |
DoubleSparseSquareMatrix |
multiply(DoubleSparseSquareMatrix m)
Returns the multiplication of this matrix and another. |
AbstractDoubleVector |
multiply(DoubleSparseVector v)
Returns the multiplication of a sparse vector by this matrix. |
DoubleSquareMatrix |
multiply(DoubleSquareMatrix m)
|
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(AbstractDoubleSquareMatrix m)
Returns the scalar product of this matrix and another. |
double |
scalarProduct(DoubleSquareMatrix m)
|
void |
setElement(int i,
int j,
double x)
Sets the value of an element of the matrix. |
AbstractDoubleSquareMatrix |
subtract(AbstractDoubleSquareMatrix m)
Returns the subtraction of this matrix and another. |
DoubleSparseSquareMatrix |
subtract(DoubleSparseSquareMatrix m)
Returns the addition of this matrix and another. |
DoubleSquareMatrix |
subtract(DoubleSquareMatrix m)
|
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. |
double |
trace()
Returns the trace. |
Matrix |
transpose()
Returns the transpose of this matrix. |
Methods inherited from class JSci.maths.matrices.AbstractDoubleSquareMatrix |
---|
add, directSum, inverse, isSymmetric, isUnitary, luDecompose_cache, negate, operatorNorm, polarDecompose, qrDecompose, scalarProduct, singularValueDecompose, subtract, tensor |
Methods inherited from class JSci.maths.matrices.AbstractDoubleMatrix |
---|
add, directSum, equals, equals, equals, getSet, hashCode, multiply, multiply, 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 DoubleSparseSquareMatrix(int size)
size
- the number of rows/columnspublic DoubleSparseSquareMatrix(int size, int capacityIncrement)
public DoubleSparseSquareMatrix(double[][] array)
array
- an assigned value
MatrixDimensionException
- If the array is not square.Method Detail |
---|
public boolean equals(AbstractDoubleSquareMatrix m, double tol)
m
- a double matrixpublic final boolean equals(DoubleSparseSquareMatrix m)
public boolean equals(DoubleSparseSquareMatrix m, double tol)
public java.lang.String toString()
toString
in class AbstractDoubleMatrix
public AbstractIntegerMatrix toIntegerMatrix()
toIntegerMatrix
in class AbstractDoubleSquareMatrix
public AbstractComplexMatrix toComplexMatrix()
toComplexMatrix
in class AbstractDoubleSquareMatrix
public double getElement(int i, int j)
getElement
in class AbstractDoubleMatrix
i
- 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 AbstractDoubleMatrix
i
- 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 det()
det
in class AbstractDoubleSquareMatrix
public double trace()
trace
in class AbstractDoubleSquareMatrix
public double infNorm()
infNorm
in class AbstractDoubleMatrix
public double frobeniusNorm()
frobeniusNorm
in class AbstractDoubleMatrix
public AbstractDoubleSquareMatrix add(AbstractDoubleSquareMatrix m)
add
in class AbstractDoubleSquareMatrix
m
- a double matrix
MatrixDimensionException
- If the matrices are different sizes.public DoubleSquareMatrix add(DoubleSquareMatrix m)
public DoubleSparseSquareMatrix add(DoubleSparseSquareMatrix m)
m
- a double sparse matrix
MatrixDimensionException
- If the matrices are different sizes.public AbstractDoubleSquareMatrix subtract(AbstractDoubleSquareMatrix m)
subtract
in class AbstractDoubleSquareMatrix
m
- a double matrix
MatrixDimensionException
- If the matrices are different sizes.public DoubleSquareMatrix subtract(DoubleSquareMatrix m)
public DoubleSparseSquareMatrix subtract(DoubleSparseSquareMatrix m)
m
- a double sparse matrix
MatrixDimensionException
- If the matrices are different sizes.public AbstractDoubleMatrix scalarMultiply(double x)
scalarMultiply
in class AbstractDoubleSquareMatrix
x
- a double
public AbstractDoubleMatrix scalarDivide(double x)
AbstractDoubleSquareMatrix
scalarDivide
in class AbstractDoubleSquareMatrix
x
- a double.
public double scalarProduct(AbstractDoubleSquareMatrix m)
scalarProduct
in class AbstractDoubleSquareMatrix
m
- a double matrix.
MatrixDimensionException
- If the matrices are different sizes.public double scalarProduct(DoubleSquareMatrix m)
public AbstractDoubleVector multiply(AbstractDoubleVector v)
multiply
in class AbstractDoubleMatrix
v
- 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 AbstractDoubleSquareMatrix multiply(AbstractDoubleSquareMatrix m)
multiply
in class AbstractDoubleSquareMatrix
m
- a double matrix
MatrixDimensionException
- If the matrices are incompatible.public DoubleSquareMatrix multiply(DoubleSquareMatrix m)
public DoubleSparseSquareMatrix multiply(DoubleSparseSquareMatrix m)
m
- a double sparse matrix
MatrixDimensionException
- If the matrices are incompatible.public Matrix transpose()
transpose
in class AbstractDoubleSquareMatrix
public AbstractDoubleSquareMatrix[] luDecompose(int[] pivot)
luDecompose
in class AbstractDoubleSquareMatrix
pivot
- an empty array of length rows()+1
to hold the pivot information (null if not interested)
public AbstractDoubleSquareMatrix[] luDecompose()
luDecompose
in class AbstractDoubleSquareMatrix
public AbstractDoubleSquareMatrix[] choleskyDecompose()
choleskyDecompose
in class AbstractDoubleSquareMatrix
public AbstractDoubleMatrix mapElements(Mapping f)
mapElements
in class AbstractDoubleSquareMatrix
f
- a user-defined function
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |