$\newcommand{\W}[1]{ \; #1 \; } \newcommand{\R}[1]{ {\rm #1} } \newcommand{\B}[1]{ {\bf #1} } \newcommand{\D}[2]{ \frac{\partial #1}{\partial #2} } \newcommand{\DD}[3]{ \frac{\partial^2 #1}{\partial #2 \partial #3} } \newcommand{\Dpow}[2]{ \frac{\partial^{#1}}{\partial {#2}^{#1}} } \newcommand{\dpow}[2]{ \frac{ {\rm d}^{#1}}{{\rm d}\, {#2}^{#1}} }$
Using Eigen Arrays: Example and Test
# include <Eigen/Dense>

bool eigen_array(void)
{     bool ok = true;
using Eigen::Matrix;
using Eigen::Dynamic;
//
typedef Matrix< AD<double> , Dynamic, 1 > a_vector;
//
// some temporary indices
size_t i, j;

// domain and range space vectors
size_t n  = 10, m = n;
a_vector a_x(n), a_y(m);

// set and declare independent variables and start tape recording
for(j = 0; j < n; j++)
a_x[j] = double(1 + j);

// evaluate a component wise function
a_y = a_x.array() + a_x.array().sin();

// create f: x -> y and stop tape recording

// compute the derivative of y w.r.t x using CppAD
for(j = 0; j < n; j++)
x[j] = double(j) + 1.0 / double(j+1);

// check Jacobian
double eps = 100. * CppAD::numeric_limits<double>::epsilon();
for(i = 0; i < m; i++)
{     for(j = 0; j < n; j++)
{     double check = 1.0 + cos(x[i]);
if( i != j )
check = 0.0;
ok &= NearEqual(jac[i * n + j], check, eps, eps);
}
}

return ok;
}

Input File: example/general/eigen_array.cpp