Parallel Colt 0.9.4

cern.colt.matrix.tlong.impl
Class WrapperLongMatrix1D

java.lang.Object
  extended by cern.colt.PersistentObject
      extended by cern.colt.matrix.AbstractMatrix
          extended by cern.colt.matrix.AbstractMatrix1D
              extended by cern.colt.matrix.tlong.LongMatrix1D
                  extended by cern.colt.matrix.tlong.impl.WrapperLongMatrix1D
All Implemented Interfaces:
Serializable, Cloneable

public class WrapperLongMatrix1D
extends LongMatrix1D

1-d matrix holding int elements; either a view wrapping another matrix or a matrix whose views are wrappers.

Version:
1.0, 09/24/99, 1.1, 08/22/2007
Author:
wolfgang.hoschek@cern.ch, Piotr Wendykier (piotr.wendykier@gmail.com)
See Also:
Serialized Form

Constructor Summary
WrapperLongMatrix1D(LongMatrix1D newContent)
           
 
Method Summary
 Object elements()
          Returns the elements of this matrix.
 long getQuick(int index)
          Returns the matrix cell value at coordinate index.
 LongMatrix1D like(int size)
          Construct and returns a new empty matrix of the same dynamic type as the receiver, having the specified size.
 LongMatrix2D like2D(int rows, int columns)
          Construct and returns a new 2-d matrix of the corresponding dynamic type, entirelly independent of the receiver.
 LongMatrix2D reshape(int rows, int columns)
          Returns new LongMatrix2D of size rows x columns whose elements are taken column-wise from this matrix.
 LongMatrix3D reshape(int slices, int rows, int columns)
          Returns new LongMatrix3D of size slices x rows x columns, whose elements are taken column-wise from this matrix.
 void setQuick(int index, long value)
          Sets the matrix cell at coordinate index to the specified value.
 LongMatrix1D viewFlip()
          Constructs and returns a new flip view.
 LongMatrix1D viewPart(int index, int width)
          Constructs and returns a new sub-range view that is a width sub matrix starting at index.
 LongMatrix1D viewSelection(int[] indexes)
          Constructs and returns a new selection view that is a matrix holding the indicated cells.
 LongMatrix1D viewStrides(int _stride)
          Constructs and returns a new stride view which is a sub matrix consisting of every i-th cell.
 
Methods inherited from class cern.colt.matrix.tlong.LongMatrix1D
aggregate, aggregate, aggregate, assign, assign, assign, assign, assign, assign, assign, assign, assign, cardinality, copy, equals, equals, get, getMaxLocation, getMinLocation, getNegativeValues, getNonZeros, getNonZeros, getPositiveValues, like, set, setSize, swap, toArray, toArray, toString, viewSelection, viewSorted, zDotProduct, zDotProduct, zDotProduct, zSum
 
Methods inherited from class cern.colt.matrix.AbstractMatrix1D
checkSize, index, size, stride, toStringShort
 
Methods inherited from class cern.colt.matrix.AbstractMatrix
ensureCapacity, isView, trimToSize
 
Methods inherited from class cern.colt.PersistentObject
clone
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WrapperLongMatrix1D

public WrapperLongMatrix1D(LongMatrix1D newContent)
Method Detail

getQuick

public long getQuick(int index)
Returns the matrix cell value at coordinate index.

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): index<0 || index>=size().

Specified by:
getQuick in class LongMatrix1D
Parameters:
index - the index of the cell.
Returns:
the value of the specified cell.

elements

public Object elements()
Description copied from class: LongMatrix1D
Returns the elements of this matrix.

Specified by:
elements in class LongMatrix1D
Returns:
the elements

like

public LongMatrix1D like(int size)
Construct and returns a new empty matrix of the same dynamic type as the receiver, having the specified size. For example, if the receiver is an instance of type DenseLongMatrix1D the new matrix must also be of type DenseLongMatrix1D, if the receiver is an instance of type SparseLongMatrix1D the new matrix must also be of type SparseLongMatrix1D, etc. In general, the new matrix should have internal parametrization as similar as possible.

Specified by:
like in class LongMatrix1D
Parameters:
size - the number of cell the matrix shall have.
Returns:
a new empty matrix of the same dynamic type.

like2D

public LongMatrix2D like2D(int rows,
                           int columns)
Construct and returns a new 2-d matrix of the corresponding dynamic type, entirelly independent of the receiver. For example, if the receiver is an instance of type DenseLongMatrix1D the new matrix must be of type DenseLongMatrix2D, if the receiver is an instance of type SparseLongMatrix1D the new matrix must be of type SparseLongMatrix2D, etc.

Specified by:
like2D in class LongMatrix1D
Parameters:
rows - the number of rows the matrix shall have.
columns - the number of columns the matrix shall have.
Returns:
a new matrix of the corresponding dynamic type.

reshape

public LongMatrix2D reshape(int rows,
                            int columns)
Description copied from class: LongMatrix1D
Returns new LongMatrix2D of size rows x columns whose elements are taken column-wise from this matrix.

Specified by:
reshape in class LongMatrix1D
Parameters:
rows - number of rows
columns - number of columns
Returns:
new 2D matrix with columns being the elements of this matrix.

reshape

public LongMatrix3D reshape(int slices,
                            int rows,
                            int columns)
Description copied from class: LongMatrix1D
Returns new LongMatrix3D of size slices x rows x columns, whose elements are taken column-wise from this matrix.

Specified by:
reshape in class LongMatrix1D
rows - number of rows
columns - number of columns
Returns:
new 2D matrix with columns being the elements of this matrix.

setQuick

public void setQuick(int index,
                     long value)
Sets the matrix cell at coordinate index 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): index<0 || index>=size().

Specified by:
setQuick in class LongMatrix1D
Parameters:
index - the index of the cell.
value - the value to be filled into the specified cell.

viewFlip

public LongMatrix1D viewFlip()
Constructs and returns a new flip view. What used to be index 0 is now index size()-1, ..., what used to be index size()-1 is now index 0. The returned view is backed by this matrix, so changes in the returned view are reflected in this matrix, and vice-versa.

Overrides:
viewFlip in class LongMatrix1D
Returns:
a new flip view.

viewPart

public LongMatrix1D viewPart(int index,
                             int width)
Constructs and returns a new sub-range view that is a width sub matrix starting at index. Operations on the returned view can only be applied to the restricted range. Any attempt to access coordinates not contained in the view will throw an IndexOutOfBoundsException.

Note that the view is really just a range restriction: The returned matrix is backed by this matrix, so changes in the returned matrix are reflected in this matrix, and vice-versa.

The view contains the cells from index..index+width-1. and has view.size() == width. A view's legal coordinates are again zero based, as usual. In other words, legal coordinates of the view are 0 .. view.size()-1==width-1. As usual, any attempt to access a cell at other coordinates will throw an IndexOutOfBoundsException.

Overrides:
viewPart in class LongMatrix1D
Parameters:
index - The index of the first cell.
width - The width of the range.
Returns:
the new view.
Throws:
IndexOutOfBoundsException - if index<0 || width<0 || index+width>size().

viewSelection

public LongMatrix1D viewSelection(int[] indexes)
Constructs and returns a new selection view that is a matrix holding the indicated cells. There holds view.size() == indexes.length and view.get(i) == this.get(indexes[i]). Indexes can occur multiple times and can be in arbitrary order.

Example:

         this     = (0,0,8,0,7)
         indexes  = (0,2,4,2)
         -->
         view     = (0,8,7,8)
 
 
Note that modifying indexes after this call has returned has no effect on the view. The returned view is backed by this matrix, so changes in the returned view are reflected in this matrix, and vice-versa.

Overrides:
viewSelection in class LongMatrix1D
Parameters:
indexes - The indexes of the cells that shall be visible in the new view. To indicate that all cells shall be visible, simply set this parameter to null.
Returns:
the new view.
Throws:
IndexOutOfBoundsException - if !(0 <= indexes[i] < size()) for any i=0..indexes.length()-1.

viewStrides

public LongMatrix1D viewStrides(int _stride)
Constructs and returns a new stride view which is a sub matrix consisting of every i-th cell. More specifically, the view has size this.size()/stride holding cells this.get(i*stride) for all i = 0..size()/stride - 1.

Overrides:
viewStrides in class LongMatrix1D
Parameters:
_stride - the step factor.
Returns:
the new view.
Throws:
IndexOutOfBoundsException - if stride <= 0.

Parallel Colt 0.9.4

Jump to the Parallel Colt Homepage