@Test
public void functionGradientHessian() {
TrustRegionUpdateDogleg_F64<DMatrixSparseCSC> dogleg = new TrustRegionUpdateDogleg_F64<>();
HessianSchurComplement_DSCC hessian = new HessianSchurComplement_DSCC();
UnconLeastSqTrustRegionSchur_F64<DMatrixSparseCSC> alg = new UnconLeastSqTrustRegionSchur_F64<>(dogleg,hessian);
alg.setFunction(new MockFunction(),new MockJacobian());
alg.initialize(new double[N],1e-6,1e-8);
DMatrixRMaj x = new DMatrixRMaj(1,1);
DMatrixRMaj g = new DMatrixRMaj(N,1);
alg.functionGradientHessian(x,false,g,hessian);
DMatrixRMaj exp_g = new DMatrixRMaj(N,1);
CommonOps_DSCC.multTransA(J,residuals,exp_g);
assertTrue(MatrixFeatures_DDRM.isIdentical(exp_g,g,UtilEjml.TEST_F64));
}