|
||||||||||
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.DoubleSquareMatrix
JSci.maths.DoubleSparseSquareMatrix
public final class DoubleSparseSquareMatrix
The DoubleSparseSquareMatrix class provides an object for encapsulating sparse square matrices. Uses compressed row storage.
Field Summary | |
---|---|
protected static int |
SPARSE
Storage format identifier. |
Fields inherited from class JSci.maths.DoubleSquareMatrix |
---|
LU, LUpivot |
Fields inherited from class JSci.maths.DoubleMatrix |
---|
ARRAY_2D, matrix |
Fields inherited from class JSci.maths.Matrix |
---|
CLASS_SPECIFIC, numCols, numRows, storageFormat |
Constructor Summary | |
---|---|
DoubleSparseSquareMatrix(double[][] array)
Constructs a matrix from an array. |
|
DoubleSparseSquareMatrix(int size)
Constructs an empty matrix. |
Method Summary | |
---|---|
DoubleMatrix |
add(DoubleMatrix 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)
Returns the addition of this matrix and another. |
DoubleSquareMatrix[] |
choleskyDecompose()
Returns the Cholesky decomposition of this matrix. |
double |
det()
Returns the determinant. |
boolean |
equals(java.lang.Object m)
Compares two double sparse square 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 ![]() |
DoubleSquareMatrix[] |
luDecompose(int[] pivot)
Returns the LU decomposition of this matrix. |
DoubleMatrix |
mapElements(Mapping f)
Applies a function on all the matrix elements. |
DoubleMatrix |
multiply(DoubleMatrix m)
Returns the multiplication of this matrix and another. |
DoubleSparseSquareMatrix |
multiply(DoubleSparseSquareMatrix m)
Returns the multiplication of this matrix and another. |
DoubleSquareMatrix |
multiply(DoubleSquareMatrix 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(DoubleSparseSquareMatrix m)
Returns the scalar product of this matrix and another. |
double |
scalarProduct(DoubleSquareMatrix 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. |
DoubleSparseSquareMatrix |
subtract(DoubleSparseSquareMatrix m)
Returns the addition of this matrix and another. |
DoubleSquareMatrix |
subtract(DoubleSquareMatrix m)
Returns the subtraction of this matrix by 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. |
double |
trace()
Returns the trace. |
Matrix |
transpose()
Returns the transpose of this matrix. |
Methods inherited from class JSci.maths.DoubleSquareMatrix |
---|
inverse, isSymmetric, isUnitary, operatorNorm, polarDecompose, singularValueDecompose |
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 DoubleSparseSquareMatrix(int size)
size
- the number of rows/columnspublic DoubleSparseSquareMatrix(double[][] array)
array
- an assigned value
MatrixDimensionException
- If the array is not square.Method Detail |
---|
protected void finalize() throws java.lang.Throwable
finalize
in class DoubleMatrix
java.lang.Throwable
- Any that occur.public boolean equals(java.lang.Object m)
equals
in class DoubleMatrix
m
- a double matrixpublic java.lang.String toString()
toString
in class DoubleMatrix
public IntegerMatrix toIntegerMatrix()
toIntegerMatrix
in class DoubleMatrix
public ComplexMatrix toComplexMatrix()
toComplexMatrix
in class DoubleMatrix
public double getElement(int i, int j)
getElement
in class DoubleMatrix
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 DoubleMatrix
i
- row index of the elementj
- column index of the elementx
- a number
MatrixDimensionException
- If attempting to access an invalid element.public double det()
det
in class DoubleSquareMatrix
public double trace()
trace
in class DoubleSquareMatrix
public double infNorm()
infNorm
in class DoubleMatrix
public double frobeniusNorm()
frobeniusNorm
in class DoubleMatrix
public DoubleMatrix add(DoubleMatrix m)
add
in class DoubleSquareMatrix
m
- a double matrix
MatrixDimensionException
- If the matrices are different sizes.public DoubleSquareMatrix add(DoubleSquareMatrix m)
add
in class DoubleSquareMatrix
m
- a double square matrix
MatrixDimensionException
- If the matrices are different sizes.public DoubleSparseSquareMatrix add(DoubleSparseSquareMatrix m)
m
- a double sparse matrix
MatrixDimensionException
- If the matrices are different sizes.public DoubleMatrix subtract(DoubleMatrix m)
subtract
in class DoubleSquareMatrix
m
- a double matrix
MatrixDimensionException
- If the matrices are different sizes.public DoubleSquareMatrix subtract(DoubleSquareMatrix m)
subtract
in class DoubleSquareMatrix
m
- a double square matrix
MatrixDimensionException
- If the matrices are different sizes.public DoubleSparseSquareMatrix subtract(DoubleSparseSquareMatrix m)
m
- a double sparse matrix
MatrixDimensionException
- If the matrices are different sizes.public DoubleMatrix scalarMultiply(double x)
scalarMultiply
in class DoubleSquareMatrix
x
- a double
public double scalarProduct(DoubleMatrix m)
scalarProduct
in class DoubleSquareMatrix
m
- a double matrix.
MatrixDimensionException
- If the matrices are different sizes.public double scalarProduct(DoubleSquareMatrix m)
scalarProduct
in class DoubleSquareMatrix
m
- a double square matrix.
MatrixDimensionException
- If the matrices are different sizes.public double scalarProduct(DoubleSparseSquareMatrix m)
m
- a double sparse matrix.
MatrixDimensionException
- If the matrices are different sizes.public DoubleVector multiply(DoubleVector v)
multiply
in class DoubleSquareMatrix
v
- a double vector
DimensionException
- If the matrix and vector are incompatible.public DoubleMatrix multiply(DoubleMatrix m)
multiply
in class DoubleMatrix
m
- a double matrix
MatrixDimensionException
- If the matrices are incompatible.public DoubleSquareMatrix multiply(DoubleSquareMatrix m)
multiply
in class DoubleSquareMatrix
m
- a double square matrix
MatrixDimensionException
- If the matrices are incompatible.public DoubleSparseSquareMatrix multiply(DoubleSparseSquareMatrix m)
m
- a double sparse matrix
MatrixDimensionException
- If the matrices are incompatible.public Matrix transpose()
transpose
in class DoubleSquareMatrix
public DoubleSquareMatrix[] luDecompose(int[] pivot)
luDecompose
in class DoubleSquareMatrix
pivot
- an empty array of length rows()+1
to hold the pivot information (null if not interested)
public DoubleSquareMatrix[] choleskyDecompose()
choleskyDecompose
in class DoubleSquareMatrix
public DoubleMatrix mapElements(Mapping f)
mapElements
in class DoubleSquareMatrix
f
- a user-defined function
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |