Alexandria  2.16
Please provide a description of the project.
PdfModeExtraction.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2020 Euclid Science Ground Segment
3  *
4  * This library is free software; you can redistribute it and/or modify it under
5  * the terms of the GNU Lesser General Public License as published by the Free
6  * Software Foundation; either version 3.0 of the License, or (at your option)
7  * any later version.
8  *
9  * This library is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12  * details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * along with this library; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
25 #ifndef _MATHUTILS_PDF_PDFMODEEXTRACTION_H
26 #define _MATHUTILS_PDF_PDFMODEEXTRACTION_H
27 
28 #include <vector>
29 #include <tuple>
30 #include <cstddef>
31 #include <utility>
32 #include "XYDataset/XYDataset.h"
33 
34 
35 namespace Euclid {
36 namespace MathUtils {
47  class ModeInfo {
48  public:
49  ModeInfo(double highest_sample, double mean, double interpolated, double area):
50  m_sample{highest_sample}, m_mean{mean}, m_interp{interpolated}, m_area{area} {}
51 
52  double getHighestSamplePosition() const {
53  return m_sample;
54  }
55 
56  double getMeanPosition() const {
57  return m_mean;
58  }
59 
60  double getInterpolatedMaxPosition() const {
61  return m_interp;
62  }
63 
64  double getModeArea() const {
65  return m_area;
66  }
67 
68  private:
69  double m_sample;
70  double m_mean;
71  double m_interp;
72  double m_area;
73  };
74 
90  std::vector<ModeInfo> extractNHighestModes(const XYDataset::XYDataset& pdf, double merge_ratio, size_t n);
91 
108  std::vector<ModeInfo> extractNHighestModes(std::vector<double>& x_sampling, std::vector<double>& pdf_sampling, double merge_ratio, size_t n);
109 
125  std::vector<ModeInfo> extractNBigestModes(const XYDataset::XYDataset& pdf, double merge_ratio, size_t n);
126 
143  std::vector<ModeInfo> extractNBigestModes(std::vector<double>& x_sampling,
144  std::vector<double>& pdf_sampling,
145  double merge_ratio,
146  size_t n);
147 
148 
149 } /* namespace MathUtils */
150 }
151 
152 #endif
ModeInfo(double highest_sample, double mean, double interpolated, double area)
Class for storing the information of a PDF mode.
double getHighestSamplePosition() const
std::vector< ModeInfo > extractNHighestModes(const XYDataset::XYDataset &pdf, double merge_ratio, size_t n)
This module provides an interface for accessing two dimensional datasets (pairs of (X...
Definition: XYDataset.h:59
std::vector< ModeInfo > extractNBigestModes(const XYDataset::XYDataset &pdf, double merge_ratio, size_t n)
double getInterpolatedMaxPosition() const