21 template <
typename Type,
size_t M>
24 template <
typename Scalar,
size_t N>
27 static constexpr
size_t WIDTH = N;
37 if (inputDimension < N) {
43 value(v), derivative(d)
55 return (*
this = *
this + a);
60 return (*
this = *
this * a);
65 return (*
this = *
this - a);
70 return (*
this = *
this / a);
75 return (*
this = *
this + a);
80 return (*
this = *
this - a);
85 return (*
this = *
this * a);
90 return (*
this = *
this / a);
97 template <
typename Scalar,
size_t N>
103 template <
typename Scalar,
size_t N>
109 template <
typename Scalar,
size_t N>
115 template <
typename Scalar,
size_t N>
121 template <
typename Scalar,
size_t N>
127 template <
typename Scalar,
size_t N>
133 template <
typename Scalar,
size_t N>
139 template <
typename Scalar,
size_t N>
145 template <
typename Scalar,
size_t N>
151 template <
typename Scalar,
size_t N>
157 template <
typename Scalar,
size_t N>
163 template <
typename Scalar,
size_t N>
171 template <
typename Scalar,
size_t N>
174 return a * (
Scalar(1) / b);
177 template <
typename Scalar,
size_t N>
187 template <
typename Scalar,
size_t N>
195 template <
typename Scalar,
size_t N>
202 template <
typename Scalar,
size_t N>
209 template <
typename Scalar,
size_t N>
216 template <
typename Scalar,
size_t N>
223 template <
typename Scalar,
size_t N>
230 template <
typename Scalar,
size_t N>
237 template <
typename Scalar>
243 template <
typename Scalar,
size_t N>
250 template <
typename Scalar>
256 template <
typename Scalar,
size_t N>
263 template <
typename Scalar>
269 template <
typename Scalar,
size_t N>
278 template <
typename Scalar,
size_t N>
285 template <
typename Scalar,
size_t N>
292 template <
typename Scalar,
size_t N>
300 template <
typename Scalar,
size_t N>
308 template <
typename Scalar,
size_t N>
316 template <
typename Scalar,
size_t N>
324 template <
typename Scalar,
size_t N>
333 template <
typename Scalar,
size_t M,
size_t N>
337 for (
size_t i = 0; i < M; i++) {
338 jac.
row(i) = input(i, 0).derivative;
344 template <
typename Scalar,
size_t M,
size_t N,
size_t D>
348 for (
size_t i = 0; i < M; i++) {
349 for (
size_t j = 0; j < N; j++) {
350 r(i,j) = input(i,j).value;
356 #if defined(SUPPORT_STDIOSTREAM) 357 template<
typename Type,
size_t N>
358 std::ostream& operator<<(std::ostream& os,
362 os << std::setw(10) << dual.
value <<
";";
363 for (
size_t j = 0; j < N; ++j) {
365 os << std::setw(10) << static_cast<double>(dual.
derivative(j));
370 #endif // defined(SUPPORT_STDIOSTREAM)
Dual< Scalar, N > acos(const Dual< Scalar, N > &a)
Dual< Scalar, N > atan(const Dual< Scalar, N > &a)
Dual< Scalar, N > & operator=(const Scalar &a)
Dual< Scalar, N > operator-(const Dual< Scalar, N > &a)
Dual< Scalar, N > ceil(const Dual< Scalar, N > &a)
Dual< Scalar, N > asin(const Dual< Scalar, N > &a)
Dual< Scalar, N > & operator-=(const Dual< Scalar, N > &a)
Dual(Scalar v, size_t inputDimension=65535)
static constexpr size_t WIDTH
Vector< Scalar, N > derivative
Dual< Scalar, N > cos(const Dual< Scalar, N > &a)
Dual(Scalar v, const Vector< Scalar, N > &d)
Matrix< Scalar, M, N > collectReals(const Matrix< Dual< Scalar, D >, M, N > &input)
Dual< Scalar, N > min(const Dual< Scalar, N > &a, const Dual< Scalar, N > &b)
Dual< Scalar, N > operator/(const Dual< Scalar, N > &a, const Dual< Scalar, N > &b)
Dual< Scalar, N > tan(const Dual< Scalar, N > &a)
Dual< Scalar, N > & operator+=(const Dual< Scalar, N > &a)
Dual< Scalar, N > & operator*=(const Dual< Scalar, N > &a)
Dual< Scalar, N > operator*(const Dual< Scalar, N > &a, const Dual< Scalar, N > &b)
Dual< Scalar, N > & operator/=(const Dual< Scalar, N > &a)
Dual< Scalar, N > fmod(const Dual< Scalar, N > &a, Scalar mod)
Dual< Scalar, N > operator+(const Dual< Scalar, N > &a)
const Slice< Type, 1, N, M, N > row(size_t i) const
Dual< Scalar, N > max(const Dual< Scalar, N > &a, const Dual< Scalar, N > &b)
Dual< Scalar, N > abs(const Dual< Scalar, N > &a)
Dual< Scalar, N > sin(const Dual< Scalar, N > &a)
Dual< Scalar, N > floor(const Dual< Scalar, N > &a)
Matrix< Scalar, M, N > collectDerivatives(const Matrix< Dual< Scalar, N >, M, 1 > &input)
Dual< Scalar, N > sqrt(const Dual< Scalar, N > &a)
Dual< Scalar, N > atan2(const Dual< Scalar, N > &a, const Dual< Scalar, N > &b)