private void computeGradientAndHessian(DMatrixRMaj param  )
    {
        // residuals = f(x) - y
        function.compute(param, residuals);

        computeNumericalJacobian(param,jacobian);

        CommonOps_DDRM.multTransA(jacobian, residuals, g);
        CommonOps_DDRM.multTransA(jacobian, jacobian,  H);

        CommonOps_DDRM.extractDiag(H,Hdiag);
    }
private void computeGradientAndHessian ( DMatrixRMaj param ) { function . compute ( param , residuals ) ; computeNumericalJacobian ( param , jacobian ) ; CommonOps_DDRM . multTransA ( jacobian , residuals , g ) ; CommonOps_DDRM . multTransA ( jacobian , jacobian , H ) ; CommonOps_DDRM . extractDiag ( H , Hdiag ) ; }
Computes the d and H parameters.

d = J'*(f(x)-y)    <--- that's also the gradient
H = J'*J