22#ifndef LSST_AFW_MATH_POLYNOMIALS_PackedBasis2d_h_INCLUDED
23#define LSST_AFW_MATH_POLYNOMIALS_PackedBasis2d_h_INCLUDED
30namespace lsst {
namespace geom {
namespace polynomials {
32template <
typename Basis1d, PackingOrder packing>
51 template <
typename Recurrence, PackingOrder packing>
58template <
typename Basis>
74template <
typename Basis1d, PackingOrder packing>
97 template <
typename ...Args>
181 template <
typename Vector>
185 _basis1d.
fill(point.getX(), workspace._x);
186 _basis1d.
fill(point.getY(), workspace._y);
190 auto accumulate = [
coefficients, &workspace,
this](
auto & sum) {
203 result =
static_cast<double>(
z);
209 template <
typename Vector>
227 template <
typename Vector>
230 _basis1d.
fill(point.getX(), workspace._x);
231 _basis1d.
fill(point.getY(), workspace._y);
238 template <
typename Vector>
241 fill(point, std::forward<Vector>(
basis), workspace);
ndarray::Array< double const, 2, 2 > coefficients
A basis interface for 1-d series expansions.
std::size_t getOrder() const
Return the order of the basis.
void fill(double x, Vector &&basis) const
Evaluate the basis at a given point.
A 2-d function defined by a series expansion and its coefficients.
A Basis2d formed from the product of a Basis1d for each of x and y, truncated at the sum of their ord...
void fill(geom::Point2D const &point, Vector &&basis, Workspace &workspace) const
Evaluate the basis at a given point.
double sumWith(geom::Point2D const &point, Vector const &coefficients, SumMode mode=SumMode::FAST) const
Evaluate a basis expansion with the given coefficients (internal workspace version).
void fill(geom::Point2D const &point, Vector &&basis) const
Evaluate the basis at a given point (internal workspace version).
PackedBasis2d & operator=(PackedBasis2d &&)=default
Default move assignment.
PackedBasis2d(PackedBasis2d &&)=default
Default move constructor.
static constexpr std::size_t computeSize(std::size_t order)
Return the size of a PackedBasis with the given order.
PackedBasis2d(PackedBasis2d const &)=default
Default copy constructor.
PackedBasis2d(Basis1d const &basis1d)
Construct from a 1-d basis that will be used for both x and y.
std::size_t index(std::size_t x, std::size_t y) const
Return the flattened index of the basis function with the given x and y orders.
IndexRange getIndices() const noexcept
Return a range of iterators that dereference to Index2d.
double sumWith(geom::Point2D const &point, Vector const &coefficients, Workspace &workspace, SumMode mode=SumMode::FAST) const
Evaluate a basis expansion with the given coefficients.
PackedBasis2d & operator=(PackedBasis2d const &)=default
Default copy assignment.
std::size_t getOrder() const noexcept
Return the maximum order of the basis.
ScaledBasis2d< PackedBasis2d > Scaled
The type returned by scale().
Workspace makeWorkspace() const
Allocate a workspace that can be passed to sumWith() and fill() to avoid repeated memory allocations.
Scaled scaled(Scaling2d const &first) const
Return a scaled basis that delegates to a copy of this.
PackedBasisWorkspace2d Workspace
The type returned by makeWorkspace().
PackedBasis2d(Args &&...args)
Construct by forwarding all arguments to the 1-d basis constructor.
PackedIndexRange< packing > IndexRange
The type returned by getIndices().
std::size_t size() const noexcept
Return the number of basis functions.
A workspace object that can be used to avoid extra memory allocations in repeated calls to PackedBasi...
std::size_t getOrder() const
Return the maximum order this workspace supports.
PackedBasisWorkspace2d(std::size_t order)
Construct workspace for a basis with the given order.
An iterator for traversing "packed" triangular 2-d series expansions, in which two 1-d expansions are...
static constexpr PackedIndexIterator makeEnd(std::size_t order) noexcept
Construct an iterator one past the end of an expansion with the given order.
A specialized iterator range class for PackedIndexIterator, providing size calculation,...
static constexpr std::size_t computeSize(std::size_t order) noexcept
Return the flattened size of an expansion with the given maximum order (inclusive).
static constexpr std::size_t computeIndex(std::size_t nx, std::size_t ny) noexcept
Return the flattened index for the element with the given x and y orders.
A numerically stable summation algorithm for floating-point numbers.
A 2-d basis that transforms all input points before evaluating nested basis.
A 2-d separable affine transform that can be used to map one interval to another.
SumMode
Enum used to control how to sum polynomial terms.
@ FAST
Summation using regular floating-point addition.
Eigen::Matrix< Scalar, Eigen::Dynamic, 1 > Vector
A base class for image defects.
table::Key< table::Array< double > > basis