Alexandria 2.31.0
SDC-CH common library for the Euclid project
Loading...
Searching...
No Matches
Cumulative.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 _FUNCTIONUTILS_CUMULATIVE_H
26#define _FUNCTIONUTILS_CUMULATIVE_H
27
28#include "XYDataset/XYDataset.h"
29#include <utility>
30#include <vector>
31
32namespace Euclid {
33namespace MathUtils {
34
42
43public:
52
57
62
66 Cumulative(const Cumulative& other) = default;
67
72
81
88
99
108
112 void normalize();
113
126 double findValue(double ratio, TrayPosition position = TrayPosition::middle) const;
127
136
147
155 double eval(double x_value) const;
156
160 virtual ~Cumulative() = default;
161
162private:
165
166}; /* End of Cumulative class */
167
168} /* namespace MathUtils */
169} // namespace Euclid
170
171#endif
Class for build cumulative from PDF and extract feature out of it.
Definition Cumulative.h:41
Cumulative(Cumulative &&other)=default
move constructor
Cumulative & operator=(Cumulative &&other)=default
move assignation operator
TrayPosition
when looking for the position having a given value, one may encounter tray where the value is constan...
Definition Cumulative.h:51
virtual ~Cumulative()=default
Destructor.
std::vector< double > m_x_sampling
Definition Cumulative.h:163
std::pair< double, double > findCenteredInterval(double rate) const
return the horizontal interval starting where the Cumulative has value (1-ratio)/2 and ending where t...
std::vector< double > m_y_sampling
Definition Cumulative.h:164
Cumulative(const Cumulative &other)=default
copy constructor
Cumulative & operator=(const Cumulative &other)=default
copy assignation operator
void normalize()
Normalize the Cumulative. After calling this function the last vertical value is 1....
double findValue(double ratio, TrayPosition position=TrayPosition::middle) const
Find the first horizontal sample which vertical value is bigger or equal to the ratio value....
std::pair< double, double > findMinInterval(double rate) const
Scan the horizontal axis looking for the smallest x-interval for which the vertical interval is at le...
static Cumulative fromPdf(std::vector< double > &x_sampling, std::vector< double > &pdf_sampling)
Factory from the sampling of a PDF. The Cumulative vertical samples are build as the sum of the the p...
double eval(double x_value) const
return the value of the cumulative at a given value of the horizontal axis. If the value do not match...
This module provides an interface for accessing two dimensional datasets (pairs of (X,...
Definition XYDataset.h:59