22 #ifndef LSST_AFW_MATH_POLYNOMIALS_Function2d_h_INCLUDED 23 #define LSST_AFW_MATH_POLYNOMIALS_Function2d_h_INCLUDED 29 namespace lsst {
namespace geom {
namespace polynomials {
41 template <
typename Basis_>
57 _coefficients(Eigen::VectorXd::Zero(basis.
size()))
63 _coefficients(coefficients)
65 assert(basis.size() ==
static_cast<std::size_t>(_coefficients.size()));
69 template <
typename Iterator>
72 _coefficients(basis.
size())
74 assert(
std::distance(first, last) == static_cast<std::ptrdiff_t>(basis.size()));
75 std::copy(first, last, &_coefficients[0]);
111 return _basis.sumWith(point, _coefficients, mode);
116 return _basis.sumWith(point, _coefficients, workspace, mode);
138 return _coefficients.head(
size());
150 Eigen::VectorXd _coefficients;
154 template <
typename Basis>
160 template <
typename Basis,
typename Iterator>
167 #endif // !LSST_AFW_MATH_POLYNOMIALS_Function2d_h_INCLUDED const_iterator end() const
Iterators over coefficients.
iterator begin()
Iterators over coefficients.
auto getCoefficients() const
Return the coefficient vector as an Eigen matrix-like object.
Basis_ Basis
The basis type used by this function.
double operator()(geom::Point2D const &point, SumMode mode=SumMode::FAST) const
Evaluate the function at the given point.
double const & operator[](std::size_t n) const
Return the coefficient associated with the nth basis function.
Summation using regular floating-point addition.
Function2d(Basis const &basis, Iterator first, Iterator last)
Construct by copying coefficients from an STL iterator range.
A 2-d function defined by a series expansion and its coefficients.
double & operator[](std::size_t n)
Return the coefficient associated with the nth basis function.
const_iterator cbegin() const
Iterators over coefficients.
SumMode
Enum used to control how to sum polynomial terms.
FastFinder::Iterator Iterator
Function2d< Basis > makeFunction2d(Basis const &basis, Eigen::VectorXd const &coefficients)
Create a Function2d of the appropriate type from a Basis2d and an Eigen object containing coefficient...
double const * const_iterator
A 2-d separable affine transform that can be used to map one interval to another. ...
typename Basis::Workspace Workspace
Type returned by makeWorkspace().
A base class for image defects.
std::size_t size() const
Return the number of coefficients.
table::Key< table::Array< double > > basis
double operator()(geom::Point2D const &point, Workspace &workspace, SumMode mode=SumMode::FAST) const
Evaluate the function at the given point.
Function2d(Basis const &basis)
Construct with zero-valued coefficients.
const_iterator cend() const
Iterators over coefficients.
Function2d & operator=(Function2d const &)=default
Default copy assignment.
iterator end()
Iterators over coefficients.
const_iterator begin() const
Iterators over coefficients.
Basis const & getBasis() const
Return the associated Basis2d object.
Workspace makeWorkspace() const
Allocate workspace that can be passed to operator() to avoid repeated memory allocations.
Function2d< typename Basis::Scaled > scaled(Scaling2d const &scaling) const
Return a new function that applies the given scaling to all points before evaluation.
Function2d(Basis const &basis, Eigen::VectorXd const &coefficients)
Construct with coefficients from an Eigen object.
auto getCoefficients()
Return the coefficient vector as an Eigen matrix-like object.
ndarray::Array< double const, 2, 2 > coefficients