public class MaskedDoubleVectorView extends Object implements DoubleVector
Vector 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 boolean |
updated
Set to true whenever the vector's values have been modified.
|
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. |
| Constructor and Description |
|---|
MaskedDoubleVectorView(DoubleVector v,
int[] columnMask)
Creates a new
DoubleVector view of the data in the provided
DoubleVector. |
| Modifier and Type | Method and Description |
|---|---|
double |
add(int index,
double delta)
Changes the value in this vector by a specified amount (optional
operation).
|
double |
get(int index)
Returns the value of this vector at the given index.
|
protected int |
getIndex(int index)
Returns the new index for a given column, or -1 if the column is not
mapped.
|
DoubleVector |
getOriginalVector()
Returns the original vector that this view is wrapping.
|
Double |
getValue(int index)
Return the value of the vector at the given index as a
Number. |
int |
length()
Return the size of the
Vector. |
double |
magnitude()
Returns the magnitude of this vector
|
void |
set(int index,
double value)
Sets the length in this vector (optional operation).
|
void |
set(int index,
Number value)
Throws
UnsupportedOperationException if called |
double[] |
toArray()
Returns a double array representing this vector.
|
String |
toString() |
protected boolean updated
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 MaskedDoubleVectorView(DoubleVector v, int[] columnMask)
DoubleVector view of the data in the provided
DoubleVector.v - the DoubleVector to view as containing double data.columnMask - A mapping from new indices to old indices.protected int getIndex(int index)
public double add(int index,
double delta)
add in interface DoubleVectorindex - index to change.delta - the amount to change by.public void set(int index,
double value)
set in interface DoubleVectorindex - index to set.value - value to set in the vector.public double get(int index)
get in interface DoubleVectorindex - index to retrieve.public Double getValue(int index)
Number.getValue in interface DoubleVectorgetValue in interface Vector<Double>index - index to retrieve.public double[] toArray()
toArray in interface DoubleVectordouble array of this vector.public int length()
Vector.public DoubleVector getOriginalVector()
Vectors.copyOf can create a copy of the real
vector.public void set(int index,
Number value)
UnsupportedOperationException if calledpublic double magnitude()
Copyright © 2012. All Rights Reserved.