lsst.geom
20.0.0-2-gec03fae+01e3669f2c
|
Go to the documentation of this file.
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())
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
Basis const & getBasis() const
Return the associated Basis2d object.
A 2-d separable affine transform that can be used to map one interval to another.
Function2d(Basis const &basis)
Construct with zero-valued coefficients.
Function2d(Basis const &basis, Eigen::VectorXd const &coefficients)
Construct with coefficients from an Eigen object.
double const * const_iterator
Function2d(Function2d const &)=default
Default copy constructor.
iterator begin()
Iterators over coefficients.
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...
Workspace makeWorkspace() const
Allocate workspace that can be passed to operator() to avoid repeated memory allocations.
const_iterator end() const
double & operator[](std::size_t n)
Return the coefficient associated with the nth basis function.
auto getCoefficients() const
double operator()(geom::Point2D const &point, Workspace &workspace, SumMode mode=SumMode::FAST) const
Evaluate the function at the given point.
SumMode
Enum used to control how to sum polynomial terms.
typename Basis::Workspace Workspace
Type returned by makeWorkspace().
Basis_ Basis
The basis type used by this function.
Function2d & operator=(Function2d const &)=default
Default copy assignment.
Function2d & operator=(Function2d &&)=default
Default move assignment.
Function2d(Basis const &basis, Iterator first, Iterator last)
Construct by copying coefficients from an STL iterator range.
Function2d(Function2d &&)=default
Default move constructor.
std::size_t size() const
Return the number of coefficients.
double operator()(geom::Point2D const &point, SumMode mode=SumMode::FAST) const
Evaluate the function at the given point.
const_iterator cend() const
double const & operator[](std::size_t n) const
Function2d< typename Basis::Scaled > scaled(Scaling2d const &scaling) const
Return a new function that applies the given scaling to all points before evaluation.
auto getCoefficients()
Return the coefficient vector as an Eigen matrix-like object.
@ FAST
Summation using regular floating-point addition.
const_iterator begin() const
const_iterator cbegin() const
A 2-d function defined by a series expansion and its coefficients.