22 #ifndef LSST_AFW_MATH_POLYNOMIALS_Function1d_h_INCLUDED 23 #define LSST_AFW_MATH_POLYNOMIALS_Function1d_h_INCLUDED 29 namespace lsst {
namespace geom {
namespace polynomials {
41 template <
typename Basis_>
54 _coefficients(Eigen::VectorXd::Zero(basis.
size()))
60 _coefficients(coefficients)
62 assert(basis.size() ==
static_cast<std::size_t>(_coefficients.size()));
66 template <
typename Iterator>
69 _coefficients(basis.
size())
71 assert(
std::distance(first, last) == static_cast<std::ptrdiff_t>(basis.size()));
72 std::copy(first, last, &_coefficients[0]);
105 return _basis.sumWith(x, _coefficients, mode);
127 return _coefficients.head(
size());
139 Eigen::VectorXd _coefficients;
143 template <
typename Basis>
149 template <
typename Basis,
typename Iterator>
157 #endif // !LSST_AFW_MATH_POLYNOMIALS_Function1d_h_INCLUDED Function1d< typename Basis::Scaled > scaled(Scaling1d const &scaling) const
Return a new function that applies the given scaling to all points before evaluation.
Function1d(Basis const &basis)
Construct with zero-valued coefficients.
double & operator[](std::size_t n)
Return the coefficient associated with the nth basis function.
Summation using regular floating-point addition.
Function1d & operator=(Function1d const &)=default
Default copy assignment.
auto getCoefficients()
Return the coefficient vector as an Eigen matrix-like object.
double const * const_iterator
Basis_ Basis
The basis type used by this function.
SumMode
Enum used to control how to sum polynomial terms.
A 1-d function defined by a series expansion and its coefficients.
FastFinder::Iterator Iterator
const_iterator cend() const
Iterators over coefficients.
A base class for image defects.
std::size_t size() const
Return the number of coefficients.
Basis const & getBasis() const
Return the associated Basis1d object.
Function1d(Basis const &basis, Eigen::VectorXd const &coefficients)
Construct with coefficients from an Eigen object.
auto getCoefficients() const
Return the coefficient vector as an Eigen matrix-like object.
Function1d(Basis const &basis, Iterator first, Iterator last)
Construct by copying coefficients from an STL iterator range.
double const & operator[](std::size_t n) const
Return the coefficient associated with the nth basis function.
table::Key< table::Array< double > > basis
const_iterator begin() const
Iterators over coefficients.
Function1d< Basis > makeFunction1d(Basis const &basis, Eigen::VectorXd const &coefficients)
Create a Function1d of the appropriate type from a Basis1d and an Eigen object containing coefficient...
iterator begin()
Iterators over coefficients.
A 1-d affine transform that can be used to map one interval to another.
iterator end()
Iterators over coefficients.
const_iterator end() const
Iterators over coefficients.
double operator()(double x, SumMode mode=SumMode::FAST) const
Evaluate the function at the given point.
const_iterator cbegin() const
Iterators over coefficients.
ndarray::Array< double const, 2, 2 > coefficients