public class MaskedSparseDoubleVectorView extends MaskedDoubleVectorView implements SparseDoubleVector
SparseVector
through the use of a
mapping from new column indices to original column indices. The size of the
new vector is based on the number of valid mappings.Modifier and Type | Field and Description |
---|---|
protected boolean |
isImmutable
Whether the vector data backing this instance is immutable
|
protected double |
magnitude
The magnitude of the vector or -1 if the value is currently invalid needs
to be recomputed
|
protected Vector |
vector
The actual vector this
ViewDoubleAsDoubleVector is decorating. |
protected int |
vectorLength
A fixed length for this
Vector . |
protected int |
vectorOffset
The index at which the values
vector are stored. |
updated
Constructor and Description |
---|
MaskedSparseDoubleVectorView(T v,
int[] columnMask,
Map<Integer,Integer> reverseMask)
Creates a new
SparseDoubleVector view of the data in the provided
SparseDoubleVector . |
Modifier and Type | Method and Description |
---|---|
int[] |
getNonZeroIndices()
Returns all the indices whose values are non-zero
|
double |
magnitude()
Returns the magnitude of this vector
|
void |
set(int index,
Number value)
Throws
UnsupportedOperationException if called |
String |
toString() |
add, get, getIndex, getOriginalVector, getValue, length, set, toArray
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
protected final boolean isImmutable
protected final Vector vector
ViewDoubleAsDoubleVector
is decorating.protected final int vectorLength
Vector
. This length may be longer or
less than that of vector
.protected final int vectorOffset
vector
are stored.protected double magnitude
public MaskedSparseDoubleVectorView(T v, int[] columnMask, Map<Integer,Integer> reverseMask)
SparseDoubleVector
view of the data in the provided
SparseDoubleVector
.v
- the DoubleVector
to view as containing double data.columnMask
- A mapping from new indices to old indices.public int[] getNonZeroIndices()
getNonZeroIndices
in interface SparseVector<Double>
public void set(int index, Number value)
UnsupportedOperationException
if calledpublic double magnitude()
Copyright © 2012. All Rights Reserved.