Class WrapperDoubleMatrix1D
- All Implemented Interfaces:
Serializable
,Cloneable
- Direct Known Subclasses:
DelegateDoubleMatrix1D
- Version:
- 1.0, 09/24/99
-
Field Summary
FieldsFields inherited from class cern.colt.matrix.impl.AbstractMatrix1D
size, stride, zero
Fields inherited from class cern.colt.matrix.impl.AbstractMatrix
isNoView
Fields inherited from class cern.colt.PersistentObject
serialVersionUID
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected DoubleMatrix1D
Returns the content of this matrix if it is a wrapper; or this otherwise.double
getQuick
(int index) Returns the matrix cell value at coordinate index.like
(int size) Construct and returns a new empty matrix of the same dynamic type as the receiver, having the specified size.like2D
(int rows, int columns) Construct and returns a new 2-d matrix of the corresponding dynamic type, entirelly independent of the receiver.void
setQuick
(int index, double value) Sets the matrix cell at coordinate index to the specified value.viewFlip()
Constructs and returns a new flip view.viewPart
(int index, int width) Constructs and returns a new sub-range view that is a width sub matrix starting at index.viewSelection
(int[] indexes) Constructs and returns a new selection view that is a matrix holding the indicated cells.protected DoubleMatrix1D
viewSelectionLike
(int[] offsets) Construct and returns a new selection view.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.DoubleMatrix1D
aggregate, aggregate, assign, assign, assign, assign, assign, assign, cardinality, cardinality, copy, equals, equals, get, getNonZeros, getNonZeros, haveSharedCells, haveSharedCellsRaw, like, set, swap, toArray, toArray, toString, view, viewSelection, viewSorted, zDotProduct, zDotProduct, zDotProduct, zDotProduct, zSum
Methods inherited from class cern.colt.matrix.impl.AbstractMatrix1D
_offset, _rank, checkIndex, checkIndexes, checkRange, checkSize, checkSize, index, setUp, setUp, size, stride, toStringShort, vFlip, vPart, vStrides
Methods inherited from class cern.colt.matrix.impl.AbstractMatrix
ensureCapacity, isView, trimToSize
Methods inherited from class cern.colt.PersistentObject
clone
-
Field Details
-
-
Constructor Details
-
WrapperDoubleMatrix1D
-
-
Method Details
-
getContent
Returns the content of this matrix if it is a wrapper; or this otherwise. Override this method in wrappers.- Overrides:
getContent
in classDoubleMatrix1D
-
getQuick
public double 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 classDoubleMatrix1D
- Parameters:
index
- the index of the cell.- Returns:
- the value of the specified cell.
-
like
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 DenseDoubleMatrix1D the new matrix must also be of type DenseDoubleMatrix1D, if the receiver is an instance of type SparseDoubleMatrix1D the new matrix must also be of type SparseDoubleMatrix1D, etc. In general, the new matrix should have internal parametrization as similar as possible.- Specified by:
like
in classDoubleMatrix1D
- Parameters:
size
- the number of cell the matrix shall have.- Returns:
- a new empty matrix of the same dynamic type.
-
like2D
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 DenseDoubleMatrix1D the new matrix must be of type DenseDoubleMatrix2D, if the receiver is an instance of type SparseDoubleMatrix1D the new matrix must be of type SparseDoubleMatrix2D, etc.- Specified by:
like2D
in classDoubleMatrix1D
- 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.
-
setQuick
public void setQuick(int index, double 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 classDoubleMatrix1D
- Parameters:
index
- the index of the cell.value
- the value to be filled into the specified cell.
-
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 classDoubleMatrix1D
- Returns:
- a new flip view.
-
viewPart
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 classDoubleMatrix1D
- Parameters:
index
- The index of the first cell.width
- The width of the range.- Returns:
- the new view.
- Throws:
IndexOutOfBoundsException
- if indexinvalid input: '<'0 || widthinvalid input: '<'0 || index+width>size().
-
viewSelection
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 classDoubleMatrix1D
- 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 invalid input: '<'= indexes[i] invalid input: '<' size()) for any i=0..indexes.length()-1.
-
viewSelectionLike
Construct and returns a new selection view.- Specified by:
viewSelectionLike
in classDoubleMatrix1D
- Parameters:
offsets
- the offsets of the visible elements.- Returns:
- a new view.
-
viewStrides
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 classDoubleMatrix1D
- Parameters:
_stride
- the step factor.stride
- the step factor.- Returns:
- the new view.
- Throws:
IndexOutOfBoundsException
- if stride invalid input: '<'= 0.
-