    All Packages  Class Hierarchy  This Package  Previous  Next  Index

# Class JSci.maths.DoubleSparseMatrix

    java.lang.Object
       |
       +----JSci.maths.Matrix
               |
               +----JSci.maths.DoubleMatrix
                       |
                       +----JSci.maths.DoubleSquareMatrix
                               |
                               +----JSci.maths.DoubleSparseMatrix

public final class DoubleSparseMatrix
extends DoubleSquareMatrix

The DoubleSparseMatrix class provides an object for encapsulating sparse matrices. Uses compressed row storage.

##

SPARSE
  Storage format identifier.
storageFormat

##

DoubleSparseMatrix()
  Constructs a matrix.
DoubleSparseMatrix(int)
  Constructs an empty matrix.

##

add(DoubleMatrix)
  Returns the addition of this matrix and another.
add(DoubleSparseMatrix)
  Returns the addition of this matrix and another.
add(DoubleSquareMatrix)
  Returns the addition of this matrix and another.
choleskyDecompose()
  Returns the Cholesky decomposition of this matrix.
columns()
  Returns the number of columns.
det()
  Returns the determinant.
equals(Object)
  Compares two double sparse matrices for equality.
finalize()
  Finalize.
frobeniusNorm()
  Returns the Frobenius norm.
getElement(int, int)
  Returns an element of the matrix.
infNorm()
  Returns the l(infinity)-norm.
luDecompose()
  Returns the LU decomposition of this matrix.
mapElements(Mapping)
  Applies a function on all the matrix elements.
multiply(DoubleMatrix)
  Returns the multiplication of this matrix and another.
multiply(DoubleSparseMatrix)
  Returns the multiplication of this matrix and another.
multiply(DoubleSquareMatrix)
  Returns the multiplication of this matrix and another.
multiply(DoubleVector)
  Returns the multiplication of a vector by this matrix.
rows()
  Returns the number of rows.
scalarMultiply(double)
  Returns the multiplication of this matrix by a scalar.
setElement(int, int, double)
  Sets the value of an element of the matrix.
subtract(DoubleMatrix)
  Returns the subtraction of this matrix and another.
subtract(DoubleSparseMatrix)
  Returns the addition of this matrix and another.
subtract(DoubleSquareMatrix)
  Returns the subtraction of this matrix by another.
toComplexMatrix()
  Converts this matrix to a complex matrix.
toIntegerMatrix()
  Converts this matrix to an integer matrix.
toString()
  Returns a string representing this matrix.
trace()
  Returns the trace.
transpose()
  Returns the transpose of this matrix.

##

SPARSE

     protected static final int SPARSE

  Storage format identifier.

storageFormat

     protected static final int storageFormat

##

DoubleSparseMatrix

     protected DoubleSparseMatrix()

  Constructs a matrix.

DoubleSparseMatrix

     public DoubleSparseMatrix(int size)

  Constructs an empty matrix.

  Parameters:
    size - the number of rows/columns

##

finalize

     protected void finalize() throws Throwable

  Finalize.

  Throws: Throwable
    Any that occur.
  Overrides:
    finalize in class DoubleMatrix

equals

     public boolean equals(Object m)

  Compares two double sparse matrices for equality.

  Parameters:
    m - a double matrix
  Overrides:
    equals in class DoubleMatrix

toString

     public String toString()

  Returns a string representing this matrix.

  Overrides:
    toString in class DoubleMatrix

toIntegerMatrix

     public IntegerMatrix toIntegerMatrix()

  Converts this matrix to an integer matrix.

  Returns:
    an integer square matrix
  Overrides:
    toIntegerMatrix in class DoubleMatrix

toComplexMatrix

     public ComplexMatrix toComplexMatrix()

  Converts this matrix to a complex matrix.

  Returns:
    a complex square matrix
  Overrides:
    toComplexMatrix in class DoubleMatrix

getElement

     public double getElement(int i,
                              int j)

  Returns an element of the matrix.

  Parameters:
    i - row index of the element
    j - column index of the element
  Throws: MatrixDimensionException
    If attempting to access an invalid element.
  Overrides:
    getElement in class DoubleMatrix

setElement

     public void setElement(int i,
                            int j,
                            double x)

  Sets the value of an element of the matrix.

  Parameters:
    i - row index of the element
    j - column index of the element
    x - a number
  Throws: MatrixDimensionException
    If attempting to access an invalid element.
  Overrides:
    setElement in class DoubleMatrix

det

     public double det()

  Returns the determinant.

  Overrides:
    det in class DoubleSquareMatrix

trace

     public double trace()

  Returns the trace.

  Overrides:
    trace in class DoubleSquareMatrix

infNorm

     public double infNorm()

  Returns the l(infinity)-norm.

  Overrides:
    infNorm in class DoubleMatrix

frobeniusNorm

     public double frobeniusNorm()

  Returns the Frobenius norm.

  Overrides:
    frobeniusNorm in class DoubleMatrix

rows

     public int rows()

  Returns the number of rows.

  Overrides:
    rows in class DoubleMatrix

columns

     public int columns()

  Returns the number of columns.

  Overrides:
    columns in class DoubleMatrix

add

     public DoubleMatrix add(DoubleMatrix m)

  Returns the addition of this matrix and another.

  Parameters:
    m - a double matrix
  Throws: MatrixDimensionException
    If the matrices are different sizes.
  Overrides:
    add in class DoubleSquareMatrix

add

     public DoubleSquareMatrix add(DoubleSquareMatrix m)

  Returns the addition of this matrix and another.

  Parameters:
    m - a double square matrix
  Throws: MatrixDimensionException
    If the matrices are different sizes.
  Overrides:
    add in class DoubleSquareMatrix

add

     public DoubleSparseMatrix add(DoubleSparseMatrix m)

  Returns the addition of this matrix and another.

  Parameters:
    m - a double sparse matrix
  Throws: MatrixDimensionException
    If the matrices are different sizes.

subtract

     public DoubleMatrix subtract(DoubleMatrix m)

  Returns the subtraction of this matrix and another.

  Parameters:
    m - a double matrix
  Throws: MatrixDimensionException
    If the matrices are different sizes.
  Overrides:
    subtract in class DoubleSquareMatrix

subtract

     public DoubleSquareMatrix subtract(DoubleSquareMatrix m)

  Returns the subtraction of this matrix by another.

  Parameters:
    m - a double square matrix
  Throws: MatrixDimensionException
    If the matrices are different sizes.
  Overrides:
    subtract in class DoubleSquareMatrix

subtract

     public DoubleSparseMatrix subtract(DoubleSparseMatrix m)

  Returns the addition of this matrix and another.

  Parameters:
    m - a double sparse matrix
  Throws: MatrixDimensionException
    If the matrices are different sizes.

scalarMultiply

     public DoubleMatrix scalarMultiply(double x)

  Returns the multiplication of this matrix by a scalar.

  Parameters:
    x - a double
  Returns:
    a double sparse matrix
  Overrides:
    scalarMultiply in class DoubleSquareMatrix

multiply

     public DoubleVector multiply(DoubleVector v)

  Returns the multiplication of a vector by this matrix.

  Parameters:
    v - a double vector
  Throws: DimensionException
    If the matrix and vector are incompatible.
  Overrides:
    multiply in class DoubleSquareMatrix

multiply

     public DoubleMatrix multiply(DoubleMatrix m)

  Returns the multiplication of this matrix and another.

  Parameters:
    m - a double matrix
  Throws: MatrixDimensionException
    If the matrices are incompatible.
  Overrides:
    multiply in class DoubleSquareMatrix

multiply

     public DoubleSquareMatrix multiply(DoubleSquareMatrix m)

  Returns the multiplication of this matrix and another.

  Parameters:
    m - a double square matrix
  Throws: MatrixDimensionException
    If the matrices are incompatible.
  Overrides:
    multiply in class DoubleSquareMatrix

multiply

     public DoubleSparseMatrix multiply(DoubleSparseMatrix m)

  Returns the multiplication of this matrix and another.

  Parameters:
    m - a double sparse matrix
  Throws: MatrixDimensionException
    If the matrices are incompatible.

transpose

     public Matrix transpose()

  Returns the transpose of this matrix.

  Returns:
    a double sparse matrix
  Overrides:
    transpose in class DoubleSquareMatrix

luDecompose

     public DoubleSquareMatrix[] luDecompose()

  Returns the LU decomposition of this matrix.

  Returns:
    an array with [0] containing the L-matrix and [1] containing the U-matrix.
  Overrides:
    luDecompose in class DoubleSquareMatrix

choleskyDecompose

     public DoubleSquareMatrix[] choleskyDecompose()

  Returns the Cholesky decomposition of this matrix. Matrix must be symmetric and positive definite.

  Returns:
    an array with [0] containing the L-matrix and [1] containing the U-matrix.
  Overrides:
    choleskyDecompose in class DoubleSquareMatrix

mapElements

     public DoubleMatrix mapElements(Mapping f)

  Applies a function on all the matrix elements.

  Parameters:
    f - a user-defined function
  Returns:
    a double sparse matrix
  Overrides:
    mapElements in class DoubleSquareMatrix

    All Packages  Class Hierarchy  This Package  Previous  Next  Index