19 std::vector<double> res;
42 if (xvalues.empty()) {
43 throw std::invalid_argument(
"FunctionDomain1D cannot have zero size.");
45 m_X.assign(xvalues.begin(), xvalues.end());
54 if (xvalues.empty()) {
55 throw std::invalid_argument(
"FunctionDomain1D cannot have zero size.");
57 m_X = std::move(xvalues);
69 std::vector<double>::const_iterator to)
72 throw std::invalid_argument(
"FunctionDomain1D cannot have zero size.");
89 throw std::invalid_argument(
"FunctionDomain1D cannot have zero size.");
93 m_X[0] = (startX + endX) / 2;
95 const double dx = (endX - startX) /
double(
n - 1);
96 for (
size_t i = 0; i <
n; ++i) {
97 m_X[i] = startX + dx * double(i);
126 if (
right.m_X.empty()) {
127 throw std::invalid_argument(
"FunctionDomain1D cannot have zero size.");
149 std::vector<double>::const_iterator to)
163 std::vector<double>::const_iterator to)
166 throw std::runtime_error(
"Cannot initialize FunctionDomain1DHistogram with "
167 "less than 2 bin boundaries.");
const std::vector< Type > & m_data
Implements FunctionDomain1D as a set of bins for a histogram.
double leftBoundary() const
Get the leftmost boundary.
std::vector< double > m_bins
vector of bin boundaries
FunctionDomain1DHistogram(const std::vector< double > &bins)
Constructor.
FunctionDomain1DSpectrum(size_t wi, const std::vector< double > &xvalues)
Constructor.
Implements FunctionDomain1D with its own storage in form of a std::vector.
FunctionDomain1DVector(const double x)
Constructor.
FunctionDomain1DVector & operator=(const FunctionDomain1DVector &)
Copy assignment operator.
std::vector< double > m_X
vector of function arguments
Represent a domain for functions of one real argument.
int getPeakRadius() const
Get the peak radius.
void setPeakRadius(int radius)
Set a peak radius to pass to peak functions.
size_t m_n
size of the data
int m_peakRadius
A peak radius that IPeakFunctions should use.
const double * m_data
pointer to the start of the domain data
std::vector< double > toVector() const
Convert to a vector.
FunctionDomain1D(const FunctionDomain1D &right)=delete
copying is not allowed.
void resetData(const double *x, size_t n)
Reset the pointer and size of the domain.