Sorry @frederichecht but I don’t understand very well what I have to do.
My code was very similar to that you wrote, except that MatriceMorse had to be created using the usual arrays [I,J,A] of sparse matrices. I mean, before I wrote
MatriceMorse<double> * ret = new MatriceMorse<double>(np,np,newnnz,false,newa,newlg,newcl);
where A = newa, I=newlg and J=newcl.
And now, I have to write:
MatriceMorse<double> * ret = new MatriceMorse<double>(np);
for (int k=0; k< newnnz; ++k)
(*ret)( newlg[k],newcl[k]) = newa[k];