Derivative of Lagrangain with respect to A parameter is not zero?

I have a very peculiar problem. I have a semi-definite problem. My problem is

$$ min. t $$
$$ s.t. L>=0, $$
$$ A>=0,$$
$$ L=[K.A,\tau;\tau^T,t-m]$$
$$ A.M=Y_M$$
$$ norm(A,‘fro’)^2 <=r $$
And the computed dual is
$$ max. -1/(4\rho)norm(T+X.K-U.(M+I),‘fro’)^2-<U,Y_M+I>-2x^T
$$ T>=0,X>=0;$$
where Z is the dual variable of L and X is the dual variable of L=[K.*A,\tau;\tau^T,t-m] and T is the dual variable of A.

I check this many times mathematically but when I check it using cvx ( which returns dual variables) its optimal value does not mach with primal( even if cvx exits with solved problem and duality gap on the scale of e-6). Unfortuantely the dual variables in cvx does not satisfy KKT condition, esp, with respect to A.
I coded primal in cvx :

 cvx_begin sdp
    variable   A_uu(n_u,n_u) symmetric
    variable   A_uq(n_u,n_q) 
    variable   A_lu(n_l,n_u)
    variable   A_lq(n_l,n_q)
    variable   A_qq(n_q,n_q) symmetric
    variable   A_ll(n_l,n_l) symmetric
    variable   tVar
    dual variable drho;
    dual variable U_uu;
    dual variable Z;
    dual variable T;
    dual variable U;
    expression B
    expression A 
    A = [A_ll,A_lu,A_lq;A_lu',A_uu,A_uq;A_lq',A_uq',A_qq]; 
    B = [Yl*Yl',Yl*ONEQ';ONEQ*Yl',ONEQ*ONEQ'];   
    minimize (tVar)
    subject to 
       Z:[K .* A,ONED-beta_Var+eta_Var;(ONED-beta_Var+eta_Var)',2*tVar/lambda-m ]>=0;
       drho: norm(A,'fro')<=r;
norm(2*drho*A-(T+X.*K-U2.*CM),'fro') % checking derivative of Lagrangian with respect to A is zero or not?

Derivative of Lagrangian with respect to A is not zero? What is wrong?

I asked the correctness of dual of this problem in But till now, no one answered it. I check it many times. I will appreciate any help. Thanks.

Sorry, this one’s too complicated. I don’t have time to re-derive the dual. But given your error in the previous question, and the fact that CVX was proven correct, I would suggest that the issue is with your dual derivations.

@mcg, Thank you. I updated the question in math.stackexchange with dual derivation of the above problem. Is it possible that CVX(or the underlying solvers) scales some variables, which results in this problem? Or you are completely sure that dual derivation is incorrect?

Obviously there can be bugs. But remember: CVX often converts problems to their dual form before solving them, for efficiency reasons. If CVX’s handling of duals were extremely buggy, that would fail far more often than it does. I’m putting my money on CVX.

So you consider scaling as a bug and CVX isn’t buggy. Thank you