Class PDFSegmentNormal
Defined in File PDFSegmentNormal.hpp
Inheritance Relationships
Base Type
public pdfs::PDFSegment(Class PDFSegment)
Class Documentation
-
class PDFSegmentNormal : public pdfs::PDFSegment
Class representing a normal segment of a PDF.
This class implements the PDFSegment interface for a normal distribution, defined by a mean and a standard deviation. It provides methods to evaluate the PDF at a given point and to sample a random value from the PDF segment according to the normal distribution.
Public Functions
-
inline PDFSegmentNormal(double sMin, double sMax, double mean, double stddev)
Constructor for PDFSegmentNormal.
- Parameters:
sMin – The lower limit of the segment.
sMax – The upper limit of the segment.
mean – The mean of the normal distribution.
stddev – The standard deviation of the normal distribution.
-
PDFSegmentNormal(std::ifstream &file, FileFormats fmt, double &sMin, double &sMax, double &wgt)
Construct PDFSegmentNormal from a PDF file contents.
How the arguments are interpreted depends on fmt; if fmt is basic, then sMin and sMax are inputs, and wgt is ignored, while if fmt is advanced, then sMin and sMax are ignored and wgt is an output.
- Parameters:
file – File stream from which to construct
fmt – Format of the file being read
sMin – The lower limit of the segment
sMax – The upper limit of the segment
wgt – The weight of the segment
-
PDFSegmentNormal(toml::node_view<const toml::node> node, FileFormats fmt, double &sMin, double &sMax, double &wgt)
Construct PDFSegmentNormal from a toml-format PDF descriptor.
A toml-based counterpart to the ifstream-based constructor above, interpreting its arguments identically: how they are interpreted depends on fmt; if fmt is basic, then sMin and sMax are inputs, and wgt is ignored, while if fmt is advanced, then sMin and sMax are ignored and wgt is an output.
- Parameters:
node – A toml node view onto this segment’s own segmentN table (see parsePDFToml)
fmt – Format of the descriptor being read
sMin – The lower limit of the segment
sMax – The upper limit of the segment
wgt – The weight of the segment
-
PDFSegmentNormal(const PDFSegmentNormal&) = default
-
auto operator=(const PDFSegmentNormal&) -> PDFSegmentNormal& = default
-
PDFSegmentNormal(PDFSegmentNormal&&) = default
-
auto operator=(PDFSegmentNormal&&) -> PDFSegmentNormal& = default
-
~PDFSegmentNormal() override = default
-
inline virtual auto operator()(double x) const -> double override
Evaluate the PDF segment at a given point.
-
inline virtual auto expectationValue(const double a, const double b) const -> double override
Calculate the expectation value of the PDF segment.
- Parameters:
a – The lower limit of the range for expectation value calculation; if set to a value <= sMin, will be set to sMin_.
b – The upper limit of the range for expectation value calculation; if set to a value >= sMax, will be set to sMax_.
- Returns:
The expectation value of the PDF segment.
-
inline virtual auto expectationValue() const -> double override
Calculate the expectation value of the PDF segment over its entire range.
- Returns:
The expectation value of the PDF segment.
-
inline virtual auto integral(const double a, const double b) const -> double override
Calculate the integral of the PDF segment over a specified range.
- Parameters:
a – The lower limit of the range for integral calculation; if set to a value <= sMin, will be set to sMin_.
b – The upper limit of the range for integral calculation; if set to a value >= sMax, will be set to sMax_.
- Returns:
The integral of the PDF segment over the specified range.
-
inline virtual auto draw(const double a, const double b) const -> double override
Sample a random value from the PDF segment within a specified range.
- Parameters:
a – The lower limit of the sampling range (should be >= sMin_).
b – The upper limit of the sampling range (should be <= sMax_).
- Returns:
A random value drawn from the PDF segment within the specified range.
-
inline PDFSegmentNormal(double sMin, double sMax, double mean, double stddev)