It is not necessary to convert z to an ADB here. The expression ops_.ngrad * geo_.z() will not compile since geo_.z() is an Eigen Array and not a Vector/Matrix. However, ops_.ngrad * (geo_.z().matrix()) should work.