Added size() member for ease of use.

This makes it easier to write for example templated code
acting on either AD vectors or non-ad vectors.
This commit is contained in:
Atgeirr Flø Rasmussen 2013-05-15 08:48:36 +02:00
parent 51a5bdd039
commit 38259f43bf

View File

@ -173,7 +173,13 @@ namespace AutoDiff
return os;
}
/// Number of variables or Jacobian blocks.
/// Number of elements
int size() const
{
return val_.size();
}
/// Number of Jacobian blocks.
int numBlocks() const
{
return jac_.size();