140 #ifndef CERES_PUBLIC_INTERNAL_AUTODIFF_H_
141 #define CERES_PUBLIC_INTERNAL_AUTODIFF_H_
149 #define DCHECK assert
150 #define DCHECK_GT(a,b) assert((a)>(b))
169 template <
typename JetT,
typename T,
int N>
173 for (
int j = 0;
j <
N; ++
j) {
182 template <
typename JetT,
typename T>
185 for (
int i = 0;
i <
M; ++
i) {
192 template <
typename JetT,
typename T,
int N0,
int N>
196 for (
int i = 0;
i <
M; ++
i) {
198 src[
i].
v.template segment<N>(N0);
206 template <
typename Functor,
typename T,
207 int N0 = 0,
int N1 = 0,
int N2 = 0,
int N3 = 0,
int N4 = 0,
208 int N5 = 0,
int N6 = 0,
int N7 = 0,
int N8 = 0,
int N9 = 0>
217 DCHECK((!N1 && !N2 && !N3 && !N4 && !N5 && !N6 && !N7 && !N8 && !N9) ||
218 ((N1 > 0) && !N2 && !N3 && !N4 && !N5 && !N6 && !N7 && !N8 && !N9) ||
219 ((N1 > 0) && (N2 > 0) && !N3 && !N4 && !N5 && !N6 && !N7 && !N8 && !N9) ||
220 ((N1 > 0) && (N2 > 0) && (N3 > 0) && !N4 && !N5 && !N6 && !N7 && !N8 && !N9) ||
221 ((N1 > 0) && (N2 > 0) && (N3 > 0) && (N4 > 0) && !N5 && !N6 && !N7 && !N8 && !N9) ||
222 ((N1 > 0) && (N2 > 0) && (N3 > 0) && (N4 > 0) && (N5 > 0) && !N6 && !N7 && !N8 && !N9) ||
223 ((N1 > 0) && (N2 > 0) && (N3 > 0) && (N4 > 0) && (N5 > 0) && (N6 > 0) && !N7 && !N8 && !N9) ||
224 ((N1 > 0) && (N2 > 0) && (N3 > 0) && (N4 > 0) && (N5 > 0) && (N6 > 0) && (N7 > 0) && !N8 && !N9) ||
225 ((N1 > 0) && (N2 > 0) && (N3 > 0) && (N4 > 0) && (N5 > 0) && (N6 > 0) && (N7 > 0) && (N8 > 0) && !N9) ||
226 ((N1 > 0) && (N2 > 0) && (N3 > 0) && (N4 > 0) && (N5 > 0) && (N6 > 0) && (N7 > 0) && (N8 > 0) && (N9 > 0)));
230 N0 + N1 + N2 + N3 + N4 + N5 + N6 + N7 + N8 + N9 + num_outputs);
235 const int jet2 = N0 + N1;
236 const int jet3 = N0 + N1 + N2;
237 const int jet4 = N0 + N1 + N2 + N3;
238 const int jet5 = N0 + N1 + N2 + N3 + N4;
239 const int jet6 = N0 + N1 + N2 + N3 + N4 + N5;
240 const int jet7 = N0 + N1 + N2 + N3 + N4 + N5 + N6;
241 const int jet8 = N0 + N1 + N2 + N3 + N4 + N5 + N6 + N7;
242 const int jet9 = N0 + N1 + N2 + N3 + N4 + N5 + N6 + N7 + N8;
244 const JetT *unpacked_parameters[10] = {
257 JetT* output =
x.get() + N0 + N1 + N2 + N3 + N4 + N5 + N6 + N7 + N8 + N9;
259 #define CERES_MAKE_1ST_ORDER_PERTURBATION(i) \
261 internal::Make1stOrderPerturbation<JetT, T, N ## i>( \
264 x.get() + jet ## i); \
276 #undef CERES_MAKE_1ST_ORDER_PERTURBATION
279 N0, N1, N2, N3, N4, N5, N6, N7, N8, N9>::Call(
280 functor, unpacked_parameters, output)) {
286 #define CERES_TAKE_1ST_ORDER_PERTURBATION(i) \
288 if (jacobians[i]) { \
289 internal::Take1stOrderPart<JetT, T, \
291 N ## i>(num_outputs, \
306 #undef CERES_TAKE_1ST_ORDER_PERTURBATION
314 #endif // CERES_PUBLIC_INTERNAL_AUTODIFF_H_