public class SubVectorEvaluator extends DefaultVectorFactoryContainer implements VectorInputEvaluator<Vectorizable,Vector>, VectorOutputEvaluator<Vectorizable,Vector>
Modifier and Type | Field and Description |
---|---|
protected int |
inputDimensionality
The expected dimensionality of the input.
|
protected int[] |
subIndices
The indices to pull out of an input vector to create a new vector from.
|
vectorFactory
Constructor and Description |
---|
SubVectorEvaluator()
Creates a new
SubVectorEvaluator . |
SubVectorEvaluator(int inputDimensionality,
int[] subIndices)
Creates a new
SubVectorEvaluator with the given parameters. |
SubVectorEvaluator(int inputDimensionality,
int[] subIndices,
VectorFactory<? extends Vector> vectorFactory)
Creates a new
SubVectorEvaluator with the given parameters. |
Modifier and Type | Method and Description |
---|---|
Vector |
evaluate(Vectorizable input)
Evaluates the function on the given input and returns the output.
|
int |
getInputDimensionality()
Gets the expected dimensionality of the input vector to the evaluator,
if it is known.
|
int |
getOutputDimensionality()
Gets the expected dimensionality of the output vector of the evaluator,
if it is known.
|
int[] |
getSubIndices()
Gets the array of indices used to create the sub-vector.
|
void |
setInputDimensionality(int inputDimensionality)
Sets the expected input dimensionality.
|
void |
setSubIndices(int[] subIndices)
Sets the array of sub-indices.
|
getVectorFactory, setVectorFactory
clone
protected int inputDimensionality
protected int[] subIndices
public SubVectorEvaluator()
SubVectorEvaluator
. The dimensionality and indices
are initialized to invalid values and must be set later before use.public SubVectorEvaluator(int inputDimensionality, int[] subIndices)
SubVectorEvaluator
with the given parameters.inputDimensionality
- The dimensionality of the expected input vectors. This is checked
against all the incoming vectors.subIndices
- The indices used to create the sub-vector. Must be between 0
(inclusive) and the input dimensionality (exclusive).public SubVectorEvaluator(int inputDimensionality, int[] subIndices, VectorFactory<? extends Vector> vectorFactory)
SubVectorEvaluator
with the given parameters.inputDimensionality
- The dimensionality of the expected input vectors. This is checked
against all the incoming vectors.subIndices
- The indices used to create the sub-vector. Must be between 0
(inclusive) and the input dimensionality (exclusive).vectorFactory
- The vector factory used to create the new sub-vector.public Vector evaluate(Vectorizable input)
Evaluator
evaluate
in interface Evaluator<Vectorizable,Vector>
input
- The input to evaluate.public int getInputDimensionality()
VectorInputEvaluator
getInputDimensionality
in interface VectorInputEvaluator<Vectorizable,Vector>
public void setInputDimensionality(int inputDimensionality)
inputDimensionality
- The expected input dimensionality.public int getOutputDimensionality()
VectorOutputEvaluator
getOutputDimensionality
in interface VectorOutputEvaluator<Vectorizable,Vector>
public int[] getSubIndices()
public void setSubIndices(int[] subIndices)
subIndices
- The array of indices to use to create a sub-vector from an input
vector.