29 namespace lsst {
namespace meas {
namespace astrom {
77 pex::exceptions::LengthError,
78 "PolynomialTransform order must be >= 0"
82 _xCoeffs.reset(ndarray::Array<double,2,2>(ndarray::allocate(order + 1, order + 1)));
83 _yCoeffs.reset(ndarray::Array<double,2,2>(ndarray::allocate(order + 1, order + 1)));
86 _u = Eigen::VectorXd(order + 1);
87 _v = Eigen::VectorXd(order + 1);
91 ndarray::Array<double const,2,2>
const & xCoeffs,
92 ndarray::Array<double const,2,2>
const & yCoeffs
93 ) : _xCoeffs(ndarray::copy(xCoeffs)),
94 _yCoeffs(ndarray::copy(yCoeffs)),
98 if (xCoeffs.getShape() != yCoeffs.getShape()) {
100 pex::exceptions::LengthError,
102 "X and Y coefficient matrices must have the same shape: "
103 " (%d,%d) != (%d,%d)"
104 ) % xCoeffs.getSize<0>() % xCoeffs.getSize<1>()
105 % yCoeffs.getSize<0>() % yCoeffs.getSize<1>()
111 pex::exceptions::LengthError,
113 "Coefficient matrices must be triangular, not trapezoidal: "
122 _xCoeffs(ndarray::copy(other.getXCoeffs())),
123 _yCoeffs(ndarray::copy(other.getYCoeffs())),
138 if (&other !=
this) {
146 if (&other !=
this) {
160 double xu = 0.0, xv = 0.0, yu = 0.0, yv = 0.0,
x = 0.0,
y = 0.0;
164 for (
int p = 0; p <= order; ++p) {
165 for (
int q = 0; q <= order; ++q) {
193 for (
int p = 0; p <= order; ++p) {
194 for (
int q = 0; q <= order; ++q) {
226 result._poly._yCoeffs(0, 1) += 1;
236 _inputScaling(inputScaling),
237 _outputScalingInverse(outputScalingInverse)
259 result._xCoeffs(0, 0) += t1[
AT::X];
260 result._yCoeffs(0, 0) += t1[
AT::Y];
282 for (
int p = 0; p <= order; ++p) {
283 for (
int m = 0;
m <= p; ++
m) {
284 for (
int j = 0; j <=
m; ++j) {
285 for (
int q = 0; p + q <= order; ++q) {
286 for (
int n = 0;
n <= q; ++
n) {
287 for (
int k = 0; k <=
n; ++k) {
288 double z = binomial(p,
m) * t2u[p-
m] * binomial(
m,j) * t2uu[j] * t2uv[
m-j] *
289 binomial(q,
n) * t2v[q-
n] * binomial(
n,k) * t2vu[k] * t2vv[
n-k];
A class that computes binomial coefficients up to a certain power.
PolynomialTransform compose(afw::geom::AffineTransform const &t1, PolynomialTransform const &t2)
Return a PolynomialTransform that is equivalent to the composition t1(t2())
void swap(Mask< PixelT > &a, Mask< PixelT > &b)
metadata import lsst afw display as afwDisplay n
math::Chebyshev1Function2< double > _poly
#define LSST_EXCEPT(type,...)
Create an exception with a given type and message and optionally other arguments (dependent on the ty...
Point< double, 2 > Point2D
void computePowers(Eigen::VectorXd &r, double x)
Fill an array with integer powers of x, so .