Generalizing utility method for constructing AD primitives with vector arguments.