eDSP  0.0.1
A cross-platform DSP library written in C++.
histogram.hpp
Go to the documentation of this file.
1 /*
2  * eDSP, A cross-platform Digital Signal Processing library written in modern C++.
3  * Copyright (C) 2018 Mohammed Boujemaoui Boulaghmoudi, All rights reserved.
4  *
5  * This program is free software: you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License as published by the Free
7  * Software Foundation, either version 3 of the License, or (at your option)
8  * any later version.
9  *
10  * This program is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13  * more details.
14  *
15  * You should have received a copy of the GNU General Public License along width
16  * this program. If not, see <http://www.gnu.org/licenses/>
17  *
18  * File: histogram.hpp
19  * Author: Mohammed Boujemaoui
20  * Date: 31/7/2018
21  */
22 #ifndef EDSP_FISHER_HISTOGRAM_HPP
23 #define EDSP_FISHER_HISTOGRAM_HPP
24 
25 #include <edsp/meta/unused.hpp>
26 #include <vector>
27 
28 namespace edsp { namespace statistics {
29 
40  template <typename T, typename Allocator = std::allocator<std::pair<T, T>>>
41  struct histogram {
42  using size_type = std::size_t;
43  using value_type = T;
44 
50  constexpr histogram(size_type num_bins, size_type cache_size) :
51  num_bins_(num_bins),
52  cache_size_(cache_size),
53  bins_(num_bins) {}
54 
64  template <typename InIterator, typename OutputIt>
65  constexpr void compute(InIterator first, InIterator last, OutputIt out) {
66  // TODO: implement the histogram class
67  meta::unused(first);
68  meta::unused(last);
69  meta::unused(out);
70  }
71 
72  private:
73  size_type num_bins_;
74  size_type cache_size_;
75  std::vector<std::pair<T, T>, Allocator> bins_;
76  };
77 
78 }} // namespace edsp::statistics
79 
80 #endif // EDSP_FISHER_HISTOGRAM_HPP
std::size_t size_type
Definition: histogram.hpp:42
constexpr void compute(InIterator first, InIterator last, OutputIt out)
Computes the histogram of the range [first, last).
Definition: histogram.hpp:65
Histogram density estimator.
Definition: histogram.hpp:41
constexpr histogram(size_type num_bins, size_type cache_size)
Creates an Histogram with the specified number of bins and cache size.
Definition: histogram.hpp:50
T value_type
Definition: histogram.hpp:43
Definition: amplifier.hpp:29