Euclidean Distance Matrix completion


I’m trying to code the Euclidean Distance Matrix completion problem. I have tried the following code and although CVX solves it, the solution is not correct.

cvx_begin sdp
    variable G(n,n) symmetric nonnegative;        
    minimize(  0.5 * square_pos( norm( H.*( (diag(G)) * ones(n,1)' + ones(n,1) * (diag(G))' - 2*G ) - H.*D, 'fro' )  ) )
    subject to
        G >= 0;

Can you show us the solver and CVX output, and tell is in what way the solution is not correct? Does CVX report solved? Is the solution “wrong” by more than accounted for by solver tolerance?

Note: I am not rendering a jufgment on the correctness of your program with regard to performing EDM, which i know nothing about.

Is there any reason you are applying square_pos in the objective function? In exact arithmetic, the argmin would be the same without the square_pos. And the problem should generally be numerically better behaved without the square_pos, so that should be preferred.