Optimize jacobian computation.