LSST Applications g070148d5b3+33e5256705,g0d53e28543+25c8b88941,g0da5cf3356+2dd1178308,g1081da9e2a+62d12e78cb,g17e5ecfddb+7e422d6136,g1c76d35bf8+ede3a706f7,g295839609d+225697d880,g2e2c1a68ba+cc1f6f037e,g2ffcdf413f+853cd4dcde,g38293774b4+62d12e78cb,g3b44f30a73+d953f1ac34,g48ccf36440+885b902d19,g4b2f1765b6+7dedbde6d2,g5320a0a9f6+0c5d6105b6,g56b687f8c9+ede3a706f7,g5c4744a4d9+ef6ac23297,g5ffd174ac0+0c5d6105b6,g6075d09f38+66af417445,g667d525e37+2ced63db88,g670421136f+2ced63db88,g71f27ac40c+2ced63db88,g774830318a+463cbe8d1f,g7876bc68e5+1d137996f1,g7985c39107+62d12e78cb,g7fdac2220c+0fd8241c05,g96f01af41f+368e6903a7,g9ca82378b8+2ced63db88,g9d27549199+ef6ac23297,gabe93b2c52+e3573e3735,gb065e2a02a+3dfbe639da,gbc3249ced9+0c5d6105b6,gbec6a3398f+0c5d6105b6,gc9534b9d65+35b9f25267,gd01420fc67+0c5d6105b6,geee7ff78d7+a14128c129,gf63283c776+ede3a706f7,gfed783d017+0c5d6105b6,w.2022.47
LSST Data Management Base Package
Loading...
Searching...
No Matches
Function.cc
Go to the documentation of this file.
1/*
2 * LSST Data Management System
3 * Copyright 2008, 2009, 2010 LSST Corporation.
4 *
5 * This product includes software developed by the
6 * LSST Project (http://www.lsst.org/).
7 *
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the LSST License Statement and
19 * the GNU General Public License along with this program. If not,
20 * see <http://www.lsstcorp.org/LegalNotices/>.
21 */
22
23/*
24 * Support routines for
25 */
28
29namespace lsst {
30namespace afw {
31namespace math {
32
33template <typename ReturnT>
35 std::vector<double> coeffs(this->getNParameters());
36
37 //
38 // Go through params order by order, evaluating x^r y^s; we do this by first evaluating
39 // y^s for a complete order, then going through again multiplying by x^r
40 //
41 int i0 = 0; // starting index for this order's coefficients
42 for (int order = 0; order <= this->_order; ++order) {
43 coeffs[i0] = 1;
44 double zn = y; // y^s
45 for (int i = 1; i <= order; ++i) {
46 coeffs[i0 + i] = zn;
47 zn *= y;
48 }
49
50 zn = x; // x^r
51 for (int i = order - 1; i >= 0; --i) {
52 coeffs[i0 + i] *= zn;
53 zn *= x;
54 }
55
56 i0 += order + 1;
57 }
58
59 assert(i0 == static_cast<int>(coeffs.size()));
60
61 return coeffs;
62}
63
64} // namespace math
65
67#define INSTANTIATE(TYPE) \
68 template std::shared_ptr<math::Function<TYPE>> \
69 table::io::PersistableFacade<math::Function<TYPE>>::dynamicCast( \
70 std::shared_ptr<table::io::Persistable> const&); \
71 template std::shared_ptr<math::Function1<TYPE>> \
72 table::io::PersistableFacade<math::Function1<TYPE>>::dynamicCast( \
73 std::shared_ptr<table::io::Persistable> const&); \
74 template std::shared_ptr<math::Function2<TYPE>> \
75 table::io::PersistableFacade<math::Function2<TYPE>>::dynamicCast( \
76 std::shared_ptr<table::io::Persistable> const&); \
77 template std::vector<double> math::PolynomialFunction2<TYPE>::getDFuncDParameters(double x, double y) \
78 const
79
80INSTANTIATE(double);
81INSTANTIATE(float);
83} // namespace afw
84} // namespace lsst
double x
#define INSTANTIATE(FROMSYS, TOSYS)
Definition: Detector.cc:509
int y
Definition: SpanSet.cc:48
std::vector< double > getDFuncDParameters(double x, double y) const override
Return the coefficients of the Function's parameters, evaluated at (x, y) I.e.
Definition: Function.cc:34
T size(T... args)
table::Key< int > order