Alexandria
2.16
Please provide a description of the project.
|
Class for build cumulative from PDF and extract feature out of it. More...
#include <Cumulative.h>
Public Types | |
enum | TrayPosition { begin, middle, end } |
when looking for the position having a given value, one may encounter tray where the value is constant on an interval. This enum allow to specify if one want an extremity or the middle of the tray. More... | |
Public Member Functions | |
Cumulative (Cumulative &&other) | |
move constructor More... | |
Cumulative & | operator= (Cumulative &&other) |
move assignation operator More... | |
Cumulative (const Cumulative &other) | |
copy constructor More... | |
Cumulative & | operator= (const Cumulative &other) |
copy assignation operator More... | |
Cumulative (std::vector< double > &x_sampling, std::vector< double > &y_sampling) | |
Constructor from the sampling of a cumulative. More... | |
Cumulative (const XYDataset::XYDataset &sampling) | |
Constructor from the sampling of a cumulative. More... | |
void | normalize () |
Normalize the Cumulative. After calling this function the last vertical value is 1.0. More... | |
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. If the Cumulative is not normalize the searched value is the last vertical value of the Cumulative time the ratio. If the selected sample is part of a tray (next sample(s) have the same vertical value), the position param allow to specify if the first, the last or the average of the point with the same value has to be returned. More... | |
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 least rate*Last Value of the Cumulative. More... | |
std::pair< double, double > | findCenteredInterval (double rate) const |
return the horizontal interval starting where the Cumulative has value (1-ratio)/2 and ending where the Cumulative has value (1+ratio)/2. If the Cumulative is not normalized the searched value are multiplied by the last cumulative vertical value. More... | |
virtual | ~Cumulative ()=default |
Destructor. More... | |
Static Public Member Functions | |
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 pdf vertical sample with horizontal value smaller or equal to the cumulative horizontal value. More... | |
static Cumulative | fromPdf (const XYDataset::XYDataset &sampling) |
Factory from the sampling of a PDF. The Cumulative vertical samples are build as the sum of the the pdf vertical sample with horizontal value smaller or equal to the cumulative horizontal value. More... | |
Private Attributes | |
std::vector< double > | m_x_sampling |
std::vector< double > | m_y_sampling |
Class for build cumulative from PDF and extract feature out of it.
Definition at line 41 of file Cumulative.h.
when looking for the position having a given value, one may encounter tray where the value is constant on an interval. This enum allow to specify if one want an extremity or the middle of the tray.
Enumerator | |
---|---|
begin | |
middle | |
end |
Definition at line 51 of file Cumulative.h.
Euclid::MathUtils::Cumulative::Cumulative | ( | Cumulative && | other | ) |
Euclid::MathUtils::Cumulative::Cumulative | ( | const Cumulative & | other | ) |
copy constructor
Definition at line 42 of file Cumulative.cpp.
Euclid::MathUtils::Cumulative::Cumulative | ( | std::vector< double > & | x_sampling, |
std::vector< double > & | y_sampling | ||
) |
Constructor from the sampling of a cumulative.
x_sampling | horizontal sampling. |
y_sampling | vertical sampling. |
Exception | if the 2 axis have not the same length |
Definition at line 50 of file Cumulative.cpp.
|
explicit |
Constructor from the sampling of a cumulative.
sampling | cumulative sampling. |
Definition at line 57 of file Cumulative.cpp.
|
virtualdefault |
Destructor.
std::pair< double, double > Euclid::MathUtils::Cumulative::findCenteredInterval | ( | double | rate | ) | const |
return the horizontal interval starting where the Cumulative has value (1-ratio)/2 and ending where the Cumulative has value (1+ratio)/2. If the Cumulative is not normalized the searched value are multiplied by the last cumulative vertical value.
rate | Vertical interval, |
Definition at line 180 of file Cumulative.cpp.
References findValue().
std::pair< double, double > Euclid::MathUtils::Cumulative::findMinInterval | ( | double | rate | ) | const |
Scan the horizontal axis looking for the smallest x-interval for which the vertical interval is at least rate*Last Value of the Cumulative.
rate | Vertical interval, |
Definition at line 141 of file Cumulative.cpp.
References m_x_sampling, and m_y_sampling.
double Euclid::MathUtils::Cumulative::findValue | ( | double | ratio, |
TrayPosition | position = TrayPosition::middle |
||
) | const |
Find the first horizontal sample which vertical value is bigger or equal to the ratio value. If the Cumulative is not normalize the searched value is the last vertical value of the Cumulative time the ratio. If the selected sample is part of a tray (next sample(s) have the same vertical value), the position param allow to specify if the first, the last or the average of the point with the same value has to be returned.
ratio | The value to be searched, |
position | Selection of the returned value in case of tray, |
Definition at line 110 of file Cumulative.cpp.
References begin, end, m_x_sampling, and m_y_sampling.
Referenced by findCenteredInterval().
|
static |
Factory from the sampling of a PDF. The Cumulative vertical samples are build as the sum of the the pdf vertical sample with horizontal value smaller or equal to the cumulative horizontal value.
x_sampling | pdf horizontal sampling. |
y_sampling | pdf vertical sampling. |
Exception | if the 2 axis have not the same length |
Definition at line 82 of file Cumulative.cpp.
References Cumulative().
Referenced by fromPdf().
|
static |
Factory from the sampling of a PDF. The Cumulative vertical samples are build as the sum of the the pdf vertical sample with horizontal value smaller or equal to the cumulative horizontal value.
sampling | pdf sampling. |
Definition at line 69 of file Cumulative.cpp.
References Euclid::XYDataset::XYDataset::begin(), Euclid::XYDataset::XYDataset::end(), and fromPdf().
void Euclid::MathUtils::Cumulative::normalize | ( | ) |
Normalize the Cumulative. After calling this function the last vertical value is 1.0.
Definition at line 97 of file Cumulative.cpp.
References m_y_sampling.
Cumulative & Euclid::MathUtils::Cumulative::operator= | ( | Cumulative && | other | ) |
move assignation operator
Definition at line 36 of file Cumulative.cpp.
References m_x_sampling, and m_y_sampling.
Cumulative & Euclid::MathUtils::Cumulative::operator= | ( | const Cumulative & | other | ) |
copy assignation operator
Definition at line 44 of file Cumulative.cpp.
References m_x_sampling, and m_y_sampling.
|
private |
Definition at line 154 of file Cumulative.h.
Referenced by findMinInterval(), findValue(), and operator=().
|
private |
Definition at line 155 of file Cumulative.h.
Referenced by findMinInterval(), findValue(), normalize(), and operator=().