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.
22 using AutoDiffXd = Eigen::AutoDiffScalar<Eigen::VectorXd>;
23 
24 // TODO(hongkai-dai): Recursive template to get arbitrary gradient order.
25 
26 /// An autodiff variable with `num_vars` partials.
27 template <int num_vars>
28 using AutoDiffd = Eigen::AutoDiffScalar<Eigen::Matrix<double, num_vars, 1> >;
29 
30 /// A vector of `rows` autodiff variables, each with `num_vars` partials.
31 template <int num_vars, int rows>
32 using AutoDiffVecd = Eigen::Matrix<AutoDiffd<num_vars>, rows, 1>;
33 
34 /// A dynamic-sized vector of autodiff variables, each with a dynamic-sized
35 /// vector of partials.
37 
38 } // namespace drake
Eigen::AutoDiffScalar< Eigen::VectorXd > AutoDiffXd
An autodiff variable with a dynamic number of partials.
Definition: eigen_autodiff_types.h:22
Eigen::AutoDiffScalar< Eigen::Matrix< double, num_vars, 1 > > AutoDiffd
An autodiff variable with num_vars partials.
Definition: eigen_autodiff_types.h:28
This file contains abbreviated definitions for certain specializations of Eigen::Matrix that are comm...
Definition: automotive_demo.cc:105
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:36
Eigen::Matrix< AutoDiffd< num_vars >, rows, 1 > AutoDiffVecd
A vector of rows autodiff variables, each with num_vars partials.
Definition: eigen_autodiff_types.h:32