Parallel Colt 0.9.4

cern.colt.matrix.tint.impl
Class SparseRCMIntMatrix2D

java.lang.Object
  extended by cern.colt.PersistentObject
      extended by cern.colt.matrix.AbstractMatrix
          extended by cern.colt.matrix.AbstractMatrix2D
              extended by cern.colt.matrix.tint.IntMatrix2D
                  extended by cern.colt.matrix.tint.impl.WrapperIntMatrix2D
                      extended by cern.colt.matrix.tint.impl.SparseRCMIntMatrix2D
All Implemented Interfaces:
Serializable, Cloneable

public class SparseRCMIntMatrix2D
extends WrapperIntMatrix2D

Sparse row-compressed-modified 2-d matrix holding int elements. Each row is stored as SparseIntMatrix1D.

Author:
Piotr Wendykier (piotr.wendykier@gmail.com)
See Also:
Serialized Form

Constructor Summary
SparseRCMIntMatrix2D(int rows, int columns)
          Constructs a matrix with a given number of rows and columns.
 
Method Summary
 SparseIntMatrix1D[] elements()
          Returns the elements of this matrix.
 int getQuick(int row, int column)
          Returns the matrix cell value at coordinate [row,column].
 IntMatrix2D like(int rows, int columns)
          Construct and returns a new empty matrix of the same dynamic type as the receiver, having the specified number of rows and columns.
 void setQuick(int row, int column, int value)
          Sets the matrix cell at coordinate [row,column] to the specified value.
 void trimToSize()
          Releases any superfluous internal memory.
 SparseIntMatrix1D viewRow(int row)
          Constructs and returns a new slice view representing the columns of the given row.
 
Methods inherited from class cern.colt.matrix.tint.impl.WrapperIntMatrix2D
assign, assign, equals, equals, like1D, vectorize, viewColumn, viewColumnFlip, viewDice, viewPart, viewRowFlip, viewSelection, viewStrides
 
Methods inherited from class cern.colt.matrix.tint.IntMatrix2D
aggregate, aggregate, aggregate, aggregate, assign, assign, assign, assign, assign, assign, assign, cardinality, copy, forEachNonZero, get, getMaxLocation, getMinLocation, getNegativeValues, getNonZeros, getPositiveValues, like, set, toArray, toString, viewSelection, viewSelection, viewSorted, zMult, zMult, zMult, zMult, zSum
 
Methods inherited from class cern.colt.matrix.AbstractMatrix2D
checkShape, checkShape, columns, columnStride, index, rows, rowStride, size, toStringShort
 
Methods inherited from class cern.colt.matrix.AbstractMatrix
ensureCapacity, isView
 
Methods inherited from class cern.colt.PersistentObject
clone
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SparseRCMIntMatrix2D

public SparseRCMIntMatrix2D(int rows,
                            int columns)
Constructs a matrix with a given number of rows and columns. All entries are initially 0.

Parameters:
rows - the number of rows the matrix shall have.
columns - the number of columns the matrix shall have.
Throws:
IllegalArgumentException - if rows<0 || columns<0 || (double)columns*rows > Integer.MAX_VALUE .
Method Detail

elements

public SparseIntMatrix1D[] elements()
Description copied from class: IntMatrix2D
Returns the elements of this matrix.

Overrides:
elements in class WrapperIntMatrix2D
Returns:
the elements

getQuick

public int getQuick(int row,
                    int column)
Description copied from class: IntMatrix2D
Returns the matrix cell value at coordinate [row,column].

Provided with invalid parameters this method may return invalid objects without throwing any exception. You should only use this method when you are absolutely sure that the coordinate is within bounds. Precondition (unchecked): 0 <= column < columns() && 0 <= row < rows().

Overrides:
getQuick in class WrapperIntMatrix2D
Parameters:
row - the index of the row-coordinate.
column - the index of the column-coordinate.
Returns:
the value at the specified coordinate.

setQuick

public void setQuick(int row,
                     int column,
                     int value)
Description copied from class: IntMatrix2D
Sets the matrix cell at coordinate [row,column] to the specified value.

Provided with invalid parameters this method may access illegal indexes without throwing any exception. You should only use this method when you are absolutely sure that the coordinate is within bounds. Precondition (unchecked): 0 <= column < columns() && 0 <= row < rows().

Overrides:
setQuick in class WrapperIntMatrix2D
Parameters:
row - the index of the row-coordinate.
column - the index of the column-coordinate.
value - the value to be filled into the specified cell.

trimToSize

public void trimToSize()
Description copied from class: AbstractMatrix
Releases any superfluous internal memory. An application can use this operation to minimize the storage of the receiver.

This default implementation does nothing. Override this method if necessary.

Overrides:
trimToSize in class AbstractMatrix

viewRow

public SparseIntMatrix1D viewRow(int row)
Description copied from class: IntMatrix2D
Constructs and returns a new slice view representing the columns of the given row. The returned view is backed by this matrix, so changes in the returned view are reflected in this matrix, and vice-versa. To obtain a slice view on subranges, construct a sub-ranging view ( viewPart(...)), then apply this method to the sub-range view.

Example:

2 x 3 matrix:
1, 2, 3
4, 5, 6
viewRow(0) ==> Matrix1D of size 3:
1, 2, 3

Overrides:
viewRow in class WrapperIntMatrix2D
Parameters:
row - the row to fix.
Returns:
a new slice view.
See Also:
IntMatrix2D.viewColumn(int)

like

public IntMatrix2D like(int rows,
                        int columns)
Description copied from class: IntMatrix2D
Construct and returns a new empty matrix of the same dynamic type as the receiver, having the specified number of rows and columns. For example, if the receiver is an instance of type DenseIntMatrix2D the new matrix must also be of type DenseIntMatrix2D, if the receiver is an instance of type SparseIntMatrix2D the new matrix must also be of type SparseIntMatrix2D, etc. In general, the new matrix should have internal parametrization as similar as possible.

Overrides:
like in class WrapperIntMatrix2D
Parameters:
rows - the number of rows the matrix shall have.
columns - the number of columns the matrix shall have.
Returns:
a new empty matrix of the same dynamic type.

Parallel Colt 0.9.4

Jump to the Parallel Colt Homepage