Class PDFSegmentExponential
Defined in File PDFSegmentExponential.hpp
Inheritance Relationships
Base Type
public pdfs::PDFSegment(Class PDFSegment)
Class Documentation
-
class PDFSegmentExponential : public pdfs::PDFSegment
Class representing an exponential segment of a PDF.
This class implements the PDFSegment interface for an exponential distribution, defined by an exponential scale length. It provides methods to evaluate the PDF at a given point and to sample a random value from the PDF segment according to the exponential distribution.
Public Functions
-
inline PDFSegmentExponential(double sMin, double sMax, double scale)
Explicit constructor for PDFSegmentExponential.
- Parameters:
sMin – The lower limit of the segment.
sMax – The upper limit of the segment.
scale – The exponential scale length of the distribution.
-
PDFSegmentExponential(std::ifstream &file, FileFormats fmt, double &sMin, double &sMax, double &wgt)
Construct PDFSegmentExponential 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
-
PDFSegmentExponential(toml::node_view<const toml::node> node, FileFormats fmt, double &sMin, double &sMax, double &wgt)
Construct PDFSegmentExponential 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
-
PDFSegmentExponential(const PDFSegmentExponential&) = default
-
auto operator=(const PDFSegmentExponential&) -> PDFSegmentExponential& = default
-
PDFSegmentExponential(PDFSegmentExponential&&) = default
-
auto operator=(PDFSegmentExponential&&) -> PDFSegmentExponential& = default
-
~PDFSegmentExponential() 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 virtual auto draw() const -> double override
Sample a random value from the PDF segment.
- Returns:
A random value drawn from the PDF segment.
-
virtual void toToml(toml::table &tbl) const override
Write this segment’s parameters into a toml table.
- Parameters:
tbl – The table to write into
-
inline PDFSegmentExponential(double sMin, double sMax, double scale)