Thanks Frédéric !

I have

load “MUMPS_seq”

I put

matrix AA=StokesForces3(Xh,Xh,solver=GMRES);

in place of

matrix AA=StokesForces3(Xh,Xh,solver=sparsesolver);

but

for(int j=0; j<BB1.m; j++){

matHJ2(:,j)=AA^-1 * matBB1(:,j);

}

takes a lot of time.

I put also

matrix AA=StokesForces3(Xh,Xh,solver=LU,factorize=1);

It is better, but I am forced to use in a unit square a mesh with h=1/40 when I use the HessianL

IPOPT(J,dJ,HL,C,dC,gh,clb=clb,cub=cub,checkindex=1,structjacc=[gvi,gvj],maxiter=dk);

Without the HessianL (LBFGS)

IPOPT(J,dJ,C,dC,gh,clb=clb,cub=cub,checkindex=1,structjacc=[gvi,gvj],maxiter=dk);

I can use fine meshes h=1/200 etc

For h=1/40, after 20 iterations, LBFGS obtains a smaller cost value than I use HessinL.

Maybe, I have some errors when I compute dJ.

Thanks a lot Frédéric !

Cornel