#include "diplib/distribution.h"
Sample class
One sample of a distribution.
Contents
A sample implicitly converts to dip::dfloat, evaluating to the value of y for
the sample. For multi-valued samples, evaluates to the first y value.
Given a Sample s, s.X() accesses the x-value of the sample, s.Y() accesses
the (first) y-value, s.Y(ii) accesses the (ii+1)-th y value, and s.Y(ii,jj) accesses
the element at (ii,jj). s.Y(ii,jj) is equivalent to s.Y(ii+jj*nRows), where nRows
is the number of rows in the matrix. None of these accessors test for out-of-bounds accesses.
Constructors, destructors, assignment and conversion operators
- auto operator=(dip::Distribution::Sample&& other) -> dip::Distribution::Sample&
- Move assignment actually copies value over to sample referenced
- auto operator=(dip::Distribution::Sample const& other) -> dip::Distribution::Sample&
- Copy assignment, data is copied to sample referenced
- Sample() deleted
- Not default constructable
- Sample(dip::Distribution::Sample&& ) defaulted
- Move constructor
- Sample(dip::Distribution::Sample const& ) defaulted
- Copy constructor, references the same data. Careful!
Functions
- void swap(dip::Distribution::Sample& other)
- Swaps two samples, copying the data from
otherto*this, and that from*thistoother. Both must have the same number of values. - auto X() -> dip::Distribution::ValueType&
- Returns reference to sample’s x value.
- auto Y(dip::uint index = 0) -> dip::Distribution::ValueType&
- Returns reference to sample’s
(index+1)-th y value. - auto Y(dip::uint row, dip::uint col) -> dip::Distribution::ValueType&
- Returns reference to sample’s y value at (
row,col).
Operators
- auto operator dfloat() const -> dip::dfloat
- Implicitly casts to sample’s first y value.
Function documentation
Sample( ) deleted
Not default constructable
Sample( dip::Distribution::Sample&& ) defaulted
Move constructor
Sample( dip::Distribution::Sample const& ) defaulted
Copy constructor, references the same data. Careful!
dip::Distribution::Sample& operator=( dip::Distribution::Sample&& other)
Move assignment actually copies value over to sample referenced
dip::Distribution::Sample& operator=( dip::Distribution::Sample const& other)
Copy assignment, data is copied to sample referenced
dip::Distribution::ValueType& X( )
Returns reference to sample’s x value.
dip::Distribution::ValueType& Y( dip::uint index = 0)
Returns reference to sample’s (index+1)-th y value.
dip::Distribution::ValueType& Y( dip::uint row, dip::uint col)
Returns reference to sample’s y value at (row,col).
void swap( dip::Distribution::Sample& other)
Swaps two samples, copying the data from other to *this, and that from *this to other.
Both must have the same number of values.
dip::dfloat operator dfloat( ) const
Implicitly casts to sample’s first y value.