22#ifndef LSST_AFW_MATH_POLYNOMIALS_PackedBasis2d_h_INCLUDED
23#define LSST_AFW_MATH_POLYNOMIALS_PackedBasis2d_h_INCLUDED
32template <
typename Basis1d, PackingOrder packing>
51 template <
typename Recurrence, PackingOrder packing>
58template <
typename Basis>
74template <
typename Basis1d, PackingOrder packing>
97 template <
typename ...Args>
125 return Scaled(*
this, first);
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) {
192 sum += coefficients[
index.flat]*workspace._x[
index.nx]*workspace._y[
index.ny];
203 result =
static_cast<double>(z);
209 template <
typename Vector>
213 return sumWith(point, coefficients, workspace, mode);
227 template <
typename Vector>
230 _basis1d.fill(point.getX(), workspace._x);
231 _basis1d.fill(point.getY(), workspace._y);
238 template <
typename Vector>
A basis interface for 1-d series expansions.
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
double sumWith(geom::Point2D const &point, Vector const &coefficients, SumMode mode=SumMode::FAST) const
void fill(geom::Point2D const &point, Vector &&basis) const
PackedBasis2d & operator=(PackedBasis2d &&)=default
PackedBasis2d(PackedBasis2d &&)=default
static constexpr std::size_t computeSize(std::size_t order)
PackedBasis2d(PackedBasis2d const &)=default
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
IndexRange getIndices() const noexcept
double sumWith(geom::Point2D const &point, Vector const &coefficients, Workspace &workspace, SumMode mode=SumMode::FAST) const
PackedBasis2d & operator=(PackedBasis2d const &)=default
std::size_t getOrder() const noexcept
ScaledBasis2d< PackedBasis2d > Scaled
Workspace makeWorkspace() const
Scaled scaled(Scaling2d const &first) const
PackedBasisWorkspace2d Workspace
PackedBasis2d(Args &&...args)
Function2d< PackedBasis2d > Function
PackedIndexRange< packing > IndexRange
std::size_t size() const noexcept
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.
friend class PackedBasis2d
A specialized iterator range class for PackedIndexIterator, providing size calculation,...
PackedIndexIterator< packing > iterator
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.
Low-level polynomials (including special polynomials) in C++.
SumMode
Enum used to control how to sum polynomial terms.
@ FAST
Summation using regular floating-point addition.
Point< double, 2 > Point2D