26 std::vector<double> steps;
27 std::vector<double> weights;
29 steps({ 0.4, 0.2, 0.1, 0.05 }),
30 weights({ 0.25, 0.25, 0.25, 0.25 }) { }
34 if (params.steps.empty()) {
35 throw std::invalid_argument(
"Quantize steps must not be empty");
37 if (params.steps.size() != params.weights.size()) {
38 throw std::invalid_argument(
"Must have same number of quantize steps and weights");
43 std::vector<double> process(
const std::vector<double> &in) {
45 int m = m_params.steps.size();
46 std::vector<double> out(n, 0.0);
47 for (
int i = 0; i < n; ++i) {
48 for (
int j = 0; j < m; ++j) {
49 if (in[i] > m_params.steps[j]) {
50 out[i] += m_params.weights[j];
Definition: Quantize.h:24
Definition: Quantize.h:21