@Shareable public class ValueArrayQuantizer extends Object implements Quantizer, Serializable
Abstract quantizer implementation using a pre-generated array of possible values. Values are quantized to their closest discrete possibility.
Modifier and Type | Field and Description |
---|---|
protected org.apache.commons.math3.linear.ArrayRealVector |
values
The values to quantize to.
|
Constructor and Description |
---|
ValueArrayQuantizer(double[] vs)
Construct a new quantizer using the specified array of values.
|
ValueArrayQuantizer(org.apache.commons.math3.linear.RealVector vs) |
Modifier and Type | Method and Description |
---|---|
int |
getCount()
Get the number of discrete values the output can take.
|
double |
getIndexValue(int i)
Get the value corresponding to a quantized value, based on the index into the list of possible values.
|
org.apache.commons.math3.linear.RealVector |
getValues()
Get the possible values into which this quantizer will map input values.
|
int |
index(double val)
Convert a value into a discrete, quantized value.
|
double |
quantize(double val)
Convert a value into a quantized value, returning the quantized value.
|
protected final org.apache.commons.math3.linear.ArrayRealVector values
The values to quantize to. Subclasses must not modify this array after the object has been constructed.
public ValueArrayQuantizer(double[] vs)
Construct a new quantizer using the specified array of values.
vs
- The discrete values to quantize to.public ValueArrayQuantizer(org.apache.commons.math3.linear.RealVector vs)
public org.apache.commons.math3.linear.RealVector getValues()
Quantizer
Get the possible values into which this quantizer will map input values. These are the values corresponding to each “bin” into which the quantizer will put values.
public int getCount()
Quantizer
Get the number of discrete values the output can take.
public double getIndexValue(int i)
Quantizer
Get the value corresponding to a quantized value, based on the index into the list of possible values.
getIndexValue
in interface Quantizer
i
- The quantized value number, in the range [0,n) where n is the number of possible discrete values (see Quantizer.getCount()
).i
.public int index(double val)
Quantizer
Convert a value into a discrete, quantized value.