Drake
eigen_autodiff_types.h
Go to the documentation of this file.
1 #pragma once
2 
3 /// @file
4 /// This file contains abbreviated definitions for certain uses of
5 /// AutoDiffScalar that are commonly used in Drake.
6 /// @see also eigen_types.h
7 
8 #ifndef DRAKE_COMMON_AUTODIFF_HEADER
9 // TODO(soonho-tri): Change to #error.
10 #warning Do not directly include this file. Include "drake/common/autodiff.h".
11 #endif
12 
13 #include <type_traits>
14 
15 #include <Eigen/Dense>
16 
18 
19 namespace drake {
20 
21 /// An autodiff variable with a dynamic number of partials, up to 73 maximum.
22 using AutoDiffUpTo73d = Eigen::AutoDiffScalar<VectorUpTo73d>;
23 
24 /// An autodiff variable with a dynamic number of partials.
25 using AutoDiffXd = Eigen::AutoDiffScalar<Eigen::VectorXd>;
26 
27 // TODO(hongkai-dai): Recursive template to get arbitrary gradient order.
28 
29 /// An autodiff variable with `num_vars` partials.
30 template <int num_vars>
31 using AutoDiffd = Eigen::AutoDiffScalar<Eigen::Matrix<double, num_vars, 1> >;
32 
33 /// A vector of `rows` autodiff variables, each with `num_vars` partials.
34 template <int num_vars, int rows>
35 using AutoDiffVecd = Eigen::Matrix<AutoDiffd<num_vars>, rows, 1>;
36 
37 /// A dynamic-sized vector of autodiff variables, each with a dynamic-sized
38 /// vector of partials.
40 
41 } // namespace drake
Eigen::AutoDiffScalar< Eigen::VectorXd > AutoDiffXd
An autodiff variable with a dynamic number of partials.
Definition: eigen_autodiff_types.h:25
Eigen::AutoDiffScalar< Eigen::Matrix< double, num_vars, 1 > > AutoDiffd
An autodiff variable with num_vars partials.
Definition: eigen_autodiff_types.h:31
This file contains abbreviated definitions for certain specializations of Eigen::Matrix that are comm...
Eigen::AutoDiffScalar< VectorUpTo73d > AutoDiffUpTo73d
An autodiff variable with a dynamic number of partials, up to 73 maximum.
Definition: eigen_autodiff_types.h:22
Definition: automotive_demo.cc:88
AutoDiffVecd< Eigen::Dynamic, Eigen::Dynamic > AutoDiffVecXd
A dynamic-sized vector of autodiff variables, each with a dynamic-sized vector of partials...
Definition: eigen_autodiff_types.h:39
Eigen::Matrix< AutoDiffd< num_vars >, rows, 1 > AutoDiffVecd
A vector of rows autodiff variables, each with num_vars partials.
Definition: eigen_autodiff_types.h:35