Fix assertion failures in AutoDiffScalar
This commit fixes #2235 (closed) and cleans up AutoDiffScalar.
Note: The "fix" to make the resizing of CwiseNullaryOp work is a terrible hack and shouldn't go in as is.
Reference issue
What does this implement/fix?
It fixes the resizing behavior of a dynamically-sized AutoDiffScalar when used in more complex expressions.
Edited by Daniel Vollmer