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) {
176 dst[
j].v[offset +
j] =
T(1.0);
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_
Matrix< RealScalar, Dynamic, Dynamic > M
#define CERES_MAKE_1ST_ORDER_PERTURBATION(i)
A matrix or vector expression mapping an existing array of data.
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy y set format x g set format y g set format x2 g set format y2 g set format z g set angles radians set nogrid set key title set key left top Right noreverse box linetype linewidth samplen spacing width set nolabel set noarrow set nologscale set logscale x set set pointsize set encoding default set nopolar set noparametric set set set set surface set nocontour set clabel set mapping cartesian set nohidden3d set cntrparam order set cntrparam linear set cntrparam levels auto set cntrparam points set size set set xzeroaxis lt lw set x2zeroaxis lt lw set yzeroaxis lt lw set y2zeroaxis lt lw set tics in set ticslevel set tics set mxtics default set mytics default set mx2tics default set my2tics default set xtics border mirror norotate autofreq set ytics border mirror norotate autofreq set ztics border nomirror norotate autofreq set nox2tics set noy2tics set timestamp bottom norotate offset
void Take0thOrderPart(int M, const JetT *src, T dst)
void Take1stOrderPart(const int M, const JetT *src, T *dst)
Eigen::Triplet< double > T
static ConjugateGradientParameters parameters
#define CERES_TAKE_1ST_ORDER_PERTURBATION(i)
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy x
void Make1stOrderPerturbation(int offset, const T *src, JetT *dst)
static bool Differentiate(const Functor &functor, T const *const *parameters, int num_outputs, T *function_value, T **jacobians)