Alexandria  2.18
Please provide a description of the project.
PdfModeExtraction.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2012-2021 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 "XYDataset/XYDataset.h"
29 #include <cstddef>
30 #include <tuple>
31 #include <utility>
32 #include <vector>
33 
34 namespace Euclid {
35 namespace MathUtils {
46 class ModeInfo {
47 public:
48  ModeInfo(double highest_sample, double mean, double interpolated, double area)
49  : m_sample{highest_sample}, m_mean{mean}, m_interp{interpolated}, m_area{area} {}
50 
51  double getHighestSamplePosition() const {
52  return m_sample;
53  }
54 
55  double getMeanPosition() const {
56  return m_mean;
57  }
58 
59  double getInterpolatedMaxPosition() const {
60  return m_interp;
61  }
62 
63  double getModeArea() const {
64  return m_area;
65  }
66 
67 private:
68  double m_sample;
69  double m_mean;
70  double m_interp;
71  double m_area;
72 };
73 
89 std::vector<ModeInfo> extractNHighestModes(const XYDataset::XYDataset& pdf, double merge_ratio, size_t n);
90 
107 std::vector<ModeInfo> extractNHighestModes(std::vector<double>& x_sampling, std::vector<double>& pdf_sampling, double merge_ratio,
108  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, std::vector<double>& pdf_sampling, double merge_ratio,
144  size_t n);
145 
146 } /* namespace MathUtils */
147 } // namespace Euclid
148 
149 #endif
Euclid::XYDataset::XYDataset
This module provides an interface for accessing two dimensional datasets (pairs of (X,...
Definition: XYDataset.h:59
std::vector
STL class.
Euclid::MathUtils::ModeInfo::m_sample
double m_sample
Definition: PdfModeExtraction.h:68
Euclid::MathUtils::ModeInfo::getModeArea
double getModeArea() const
Definition: PdfModeExtraction.h:63
Euclid::MathUtils::ModeInfo::getInterpolatedMaxPosition
double getInterpolatedMaxPosition() const
Definition: PdfModeExtraction.h:59
Euclid::MathUtils::ModeInfo::ModeInfo
ModeInfo(double highest_sample, double mean, double interpolated, double area)
Definition: PdfModeExtraction.h:48
Euclid::MathUtils::extractNHighestModes
std::vector< ModeInfo > extractNHighestModes(const XYDataset::XYDataset &pdf, double merge_ratio, size_t n)
Definition: PdfModeExtraction.cpp:192
Euclid::MathUtils::ModeInfo::getMeanPosition
double getMeanPosition() const
Definition: PdfModeExtraction.h:55
Euclid::MathUtils::ModeInfo::m_interp
double m_interp
Definition: PdfModeExtraction.h:70
Euclid::MathUtils::ModeInfo::m_area
double m_area
Definition: PdfModeExtraction.h:71
Euclid::MathUtils::ModeInfo::m_mean
double m_mean
Definition: PdfModeExtraction.h:69
Euclid
Definition: InstOrRefHolder.h:29
XYDataset.h
Euclid::MathUtils::extractNBigestModes
std::vector< ModeInfo > extractNBigestModes(const XYDataset::XYDataset &pdf, double merge_ratio, size_t n)
Definition: PdfModeExtraction.cpp:238
Euclid::MathUtils::ModeInfo::getHighestSamplePosition
double getHighestSamplePosition() const
Definition: PdfModeExtraction.h:51
Euclid::MathUtils::ModeInfo
Class for storing the information of a PDF mode.
Definition: PdfModeExtraction.h:46