# Complex-value SDP， status: Inaccurate/Solved

## Hello，there. Recently I met a complex-value SDP(See Fig1) and I have written an example, in order to fulfil the CVX requirement, I transform the complex cost function Q d_z d_z^H to the real from.Fig 1865×546 40 KB

Here is the code:
cvx_begin sdp

``````variable Q(37,37) complex
variable U(37,37) complex
variable D_B(37,16) complex
``````

## % minimize( real(trace(Q * d * d’)) ) minimize( trace([real(Q * d * d’) imag(Q * d * d’);… imag(Q * d * d’) real(Q * d * d’) ] ) ) [Q eye(37); … eye(37) U ] >= 0; [U D_B;… D_B’ H{1}’ * H{1} ] >= 0; norm( covar.^0.5 *(D_B - H{1}), ‘fro’ ) <= sqrt(epsilon); cvx_end

Here is the results obtained by the CVX toolbox (a powerful tool ), below is the information in the command window, What I pay attention to is the solution status: Inaccurate/Solved，Does this mean that the parameter ϵ need to be reselected to get accurate results? Are there any other reasons cause this problem?

## Calling SDPT3 4.0: 9471 variables, 3923 equality constraints For improved efficiency, SDPT3 is solving the dual problem.

num. of constraints = 3923
dim. of sdp var = 254, num. of sdp blk = 2
dim. of socp var = 1185, num. of socp blk = 1
dim. of linear var = 1

SDPT3: Infeasible path-following algorithms

## number of iterations = 30 primal objective value = -9.31980730e-05 dual objective value = -5.25804496e-05 gap := trace(XZ) = 4.89e-05 relative gap = 4.89e-05 actual relative gap = -4.06e-05 rel. primal infeas (scaled problem) = 8.09e-09 rel. dual " " " = 9.24e-09 rel. primal infeas (unscaled problem) = 0.00e+00 rel. dual " " " = 0.00e+00 norm(X), norm(y), norm(Z) = 1.7e+01, 1.2e+04, 1.5e+04 norm(A), norm(b), norm© = 8.1e+01, 2.1e+00, 7.8e+00 Total CPU time (secs) = 69.68 CPU time per iteration = 2.32 termination code = -5 DIMACS: 1.5e-08 0.0e+00 4.8e-08 0.0e+00 -4.1e-05 4.9e-05

Status: Inaccurate/Solved
Optimal value (cvx_optval): +5.25804e-05

That means that the SPT3 solver could not obtain the desired accuracy. perhaps another solver, such as Mosek, could. It may be that numerically poorly scaled input data very large and/or small magnitude non-zero numbers, is contributing to the difficulty.

1 Like

## Thanks for your reply :grinning, I have try to use the Mosek like that, and get the result:Status: Infeasible.

covar = eye(size(H{1},1));
epsilon = 1e-6;

% cvx_precision best % high? low ? medium
cvx_solver mosek
cvx_begin sdp

``````variable Q(37,37) complex
variable U(37,37) complex
variable D_B(37,16) complex
``````

## % minimize( real(trace(Q * d * d’)) ) minimize( trace([real(Q * d * d’) imag(Q * d * d’);… imag(Q * d * d’) real(Q * d * d’) ] ) ) [Q eye(37); … eye(37) U ] >= 0; [U D_B;… D_B’ H{1}’ * H{1} ] >= 0; norm( covar.^0.5 *(D_B - H{1}), ‘fro’ ) <= sqrt(epsilon); cvx_end

and get the result:Status: Infeasible

## Calling Mosek 9.1.9: 9471 variables, 3923 equality constraints For improved efficiency, Mosek is solving the dual problem.

MOSEK Version 9.1.9 (Build date: 2019-11-21 11:34:40)
Platform: Windows/64-X86

Problem
Name :
Objective sense : min
Type : CONIC (conic optimization problem)
Constraints : 3923
Cones : 1
Scalar variables : 1186
Matrix variables : 2
Integer variables : 0

Optimizer started.
Presolve started.
Linear dependency checker started.
Linear dependency checker terminated.
Eliminator started.
Freed constraints in eliminator : 0
Eliminator terminated.
Eliminator - tries : 1 time : 0.00
Lin. dep. - tries : 1 time : 0.00
Lin. dep. - number : 0
Presolve terminated. Time: 0.01
Problem
Name :
Objective sense : min
Type : CONIC (conic optimization problem)
Constraints : 3923
Cones : 1
Scalar variables : 1186
Matrix variables : 2
Integer variables : 0

Optimizer - solved problem : the primal
Optimizer - Constraints : 3922
Optimizer - Cones : 1
Optimizer - Scalar variables : 1185 conic : 1185
Optimizer - Semi-definite variables: 2 scalarized : 16697
Factor - setup time : 0.56 dense det. time : 0.00
Factor - ML order time : 0.16 GP order time : 0.00
Factor - nonzeros before factor : 6.07e+06 after factor : 6.07e+06
Factor - dense dim. : 2 flops : 1.17e+10
ITE PFEAS DFEAS GFEAS PRSTATUS POBJ DOBJ MU TIME
0 4.0e+00 1.0e+00 1.2e+01 0.00e+00 1.075029164e+01 0.000000000e+00 1.0e+00 0.63
1 8.6e-01 2.1e-01 4.1e+00 -8.53e-01 3.495018759e+00 -1.796711256e+00 2.1e-01 1.20
2 1.7e-01 4.4e-02 5.1e-01 9.75e-02 -5.430604350e-01 -1.851203388e+00 4.4e-02 1.70
Optimizer terminated. Time: 1.73

Interior-point solution summary
Problem status : DUAL_INFEASIBLE
Solution status : DUAL_INFEASIBLE_CER
Primal. obj: -1.2057798334e-01 nrm: 1e+00 Viol. con: 2e-01 var: 0e+00 barvar: 0e+00 cones: 0e+00
Optimizer summary
Optimizer - time: 1.73
Interior-point - iterations : 2 time: 1.70
Basis identification - time: 0.00
Primal - iterations : 0 time: 0.00
Dual - iterations : 0 time: 0.00
Clean primal - iterations : 0 time: 0.00
Clean dual - iterations : 0 time: 0.00
Simplex - time: 0.00
Primal simplex - iterations : 0 time: 0.00
Dual simplex - iterations : 0 time: 0.00
Mixed integer - relaxations: 0 time: 0.00

Status: Infeasible
Optimal value (cvx_optval): +Inf

Look at the input data scaling. Follow the advice at https://yalmip.github.io/debugginginfeasible , except for section 1.

Perhaps a very small value of epsilon is contributing to difficulty. Try increasing that and see what happens.

Maybe you need to declare `Q` and `U` as complex hermitian.

## Thanks for your suggestions, I have declared Q and U as complex hermitian, also I adjust the solver precision.

cvx_precision medium %best % high? low ? medium
% cvx_solver mosek
cvx_begin sdp

``````variable Q(37,37) complex hermitian
variable U(37,37) complex hermitian
variable D_B(37,16) complex
``````

## % minimize( real(trace(Q * d * d’)) ) minimize( trace([real(Q * d * d’) imag(Q * d * d’);… imag(Q * d * d’) real(Q * d * d’) ] ) ) [Q eye(37); … eye(37) U ] >= 0; [U D_B;… D_B’ H{1}’ * H{1} ] >= 0; norm( covar.^0.5 *(D_B - H{1}), ‘fro’ ) <= sqrt(epsilon); cvx_end

Here is the result: Status: Solved

## Calling Mosek 9.1.9: 9471 variables, 3923 equality constraints For improved efficiency, Mosek is solving the dual problem.

MOSEK Version 9.1.9 (Build date: 2019-11-21 11:34:40)
Platform: Windows/64-X86

Problem
Name :
Objective sense : min
Type : CONIC (conic optimization problem)
Constraints : 3923
Cones : 1
Scalar variables : 1186
Matrix variables : 2
Integer variables : 0

Optimizer started.
Presolve started.
Linear dependency checker started.
Linear dependency checker terminated.
Eliminator started.
Freed constraints in eliminator : 0
Eliminator terminated.
Eliminator - tries : 1 time : 0.00
Lin. dep. - tries : 1 time : 0.00
Lin. dep. - number : 0
Presolve terminated. Time: 0.03
Problem
Name :
Objective sense : min
Type : CONIC (conic optimization problem)
Constraints : 3923
Cones : 1
Scalar variables : 1186
Matrix variables : 2
Integer variables : 0

Optimizer - solved problem : the primal
Optimizer - Constraints : 3922
Optimizer - Cones : 1
Optimizer - Scalar variables : 1185 conic : 1185
Optimizer - Semi-definite variables: 2 scalarized : 16697
Factor - setup time : 0.55 dense det. time : 0.00
Factor - ML order time : 0.16 GP order time : 0.00
Factor - nonzeros before factor : 6.07e+06 after factor : 6.07e+06
Factor - dense dim. : 2 flops : 1.17e+10
ITE PFEAS DFEAS GFEAS PRSTATUS POBJ DOBJ MU TIME
0 4.0e+00 1.0e+00 1.2e+01 0.00e+00 1.078091442e+01 0.000000000e+00 1.0e+00 0.63
1 8.5e-01 2.1e-01 4.1e+00 -8.53e-01 3.450716834e+00 -1.810695397e+00 2.1e-01 1.20
2 1.1e-01 2.7e-02 2.4e-01 1.11e-01 -9.303731649e-01 -1.733217328e+00 2.7e-02 1.78
3 6.3e-03 1.6e-03 3.4e-03 1.17e+00 -1.423387997e-01 -1.830590373e-01 1.6e-03 2.36
4 1.1e-03 2.7e-04 2.8e-04 8.68e-01 -5.537669385e-02 -6.188782836e-02 2.7e-04 2.89
5 1.7e-04 4.2e-05 2.2e-05 7.44e-01 -2.645045314e-02 -2.723537572e-02 4.2e-05 3.50
6 3.2e-05 8.1e-06 2.3e-06 5.51e-01 -1.756040827e-02 -1.770233324e-02 8.1e-06 4.08
7 5.3e-06 1.3e-06 2.8e-07 7.94e-02 -7.827966333e-03 -7.717110728e-03 1.3e-06 4.61
8 1.5e-06 3.8e-07 6.3e-08 5.05e-01 -4.997426540e-03 -4.888073631e-03 3.8e-07 5.20
9 5.2e-07 1.3e-07 1.7e-08 5.19e-01 -3.552141570e-03 -3.470225164e-03 1.3e-07 5.75
10 1.3e-07 3.1e-08 3.1e-09 4.39e-01 -2.219054936e-03 -2.165172129e-03 3.1e-08 6.36
11 2.9e-08 7.2e-09 5.0e-10 3.02e-01 -1.370240166e-03 -1.340397205e-03 7.2e-09 6.91
12 6.1e-09 1.5e-09 7.8e-11 2.23e-01 -7.889729774e-04 -7.724152117e-04 1.5e-09 7.59
13 1.4e-09 3.5e-10 1.3e-11 2.80e-01 -4.506254366e-04 -4.405945546e-04 3.4e-10 8.16
14 3.4e-10 1.5e-10 2.5e-12 3.36e-01 -2.718409410e-04 -2.658648290e-04 8.5e-11 8.91
15 7.5e-11 7.2e-11 4.1e-13 3.55e-01 -1.664255088e-04 -1.630508473e-04 1.9e-11 9.45
16 1.7e-11 4.6e-10 7.2e-14 2.62e-01 -1.010381683e-04 -9.901119761e-05 4.3e-12 9.98
17 3.9e-12 4.1e-10 1.3e-14 2.62e-01 -6.069352252e-05 -5.944296667e-05 9.6e-13 10.72
18 4.0e-13 8.3e-10 1.0e-15 2.75e-01 -3.240464962e-05 -3.173581567e-05 1.1e-13 12.30
19 5.7e-14 1.0e-08 1.1e-16 1.40e-01 -1.784600698e-05 -1.751477956e-05 1.6e-14 13.02
20 1.9e-14 6.1e-09 3.0e-17 1.35e-01 -1.154413762e-05 -1.130348608e-05 5.2e-15 13.53
21 2.6e-15 2.0e-08 2.9e-18 1.45e-01 -6.080209731e-06 -5.960160864e-06 7.0e-16 14.17
22 6.9e-16 3.2e-08 3.0e-19 1.33e-01 -2.801916059e-06 -2.721701236e-06 1.1e-16 15.31
23 5.9e-16 2.8e-07 1.8e-19 5.14e-01 -2.590845848e-06 -2.532166053e-06 7.1e-17 15.84
24 5.3e-16 7.8e-06 4.0e-20 3.26e-01 -1.420289373e-06 -1.385140295e-06 1.0e-17 16.38
25 6.4e-16 4.4e-06 5.0e-20 2.81e-01 -8.169523092e-07 -8.018784040e-07 1.3e-18 16.97
26 6.6e-16 3.1e-06 1.6e-21 -1.84e-01 -3.988525491e-07 -3.895729258e-07 2.1e-19 17.55
Optimizer terminated. Time: 17.59

Interior-point solution summary
Problem status : PRIMAL_AND_DUAL_FEASIBLE
Solution status : OPTIMAL
Primal. obj: -3.9885254919e-07 nrm: 1e-01 Viol. con: 1e-10 var: 0e+00 barvar: 0e+00 cones: 0e+00
Dual. obj: -3.8951429815e-07 nrm: 3e+05 Viol. con: 0e+00 var: 0e+00 barvar: 7e-10 cones: 0e+00
Optimizer summary
Optimizer - time: 17.59
Interior-point - iterations : 26 time: 17.55
Basis identification - time: 0.00
Primal - iterations : 0 time: 0.00
Dual - iterations : 0 time: 0.00
Clean primal - iterations : 0 time: 0.00
Clean dual - iterations : 0 time: 0.00
Simplex - time: 0.00
Primal simplex - iterations : 0 time: 0.00
Dual simplex - iterations : 0 time: 0.00
Mixed integer - relaxations: 0 time: 0.00

Status: Solved
Optimal value (cvx_optval): +3.89514e-07

What happens if you leave cvx_precision at default? The Mosek people do not reconmend changing it from default.

## I leave cvx_precision at default,

covar = eye(size(H{1},1));
epsilon = 1e-3;

cvx_precision default %best % high? low ? medium
% cvx_solver mosek
cvx_begin sdp

``````variable Q(37,37) complex hermitian
variable U(37,37) complex hermitian
variable D_B(37,16) complex
``````

## % minimize( real(trace(Q * d * d’)) ) minimize( trace([real(Q * d * d’) imag(Q * d * d’);… imag(Q * d * d’) real(Q * d * d’) ] ) ) [Q eye(37); … eye(37) U ] >= 0; [U D_B;… D_B’ H{1}’ * H{1} ] >= 0; norm( covar.^0.5 *(D_B - H{1}), ‘fro’ ) <= sqrt(epsilon); cvx_end

Here is the result:

## Calling Mosek 9.1.9: 9471 variables, 3923 equality constraints For improved efficiency, Mosek is solving the dual problem.

MOSEK Version 9.1.9 (Build date: 2019-11-21 11:34:40)

Problem
Name :
Objective sense : min
Type : CONIC (conic optimization problem)
Constraints : 3923
Cones : 1
Scalar variables : 1186
Matrix variables : 2
Integer variables : 0

Optimizer started.
Presolve started.
Linear dependency checker started.
Linear dependency checker terminated.
Eliminator started.
Freed constraints in eliminator : 0
Eliminator terminated.
Eliminator - tries : 1 time : 0.00
Lin. dep. - tries : 1 time : 0.02
Lin. dep. - number : 0
Presolve terminated. Time: 0.03
Problem
Name :
Objective sense : min
Type : CONIC (conic optimization problem)
Constraints : 3923
Cones : 1
Scalar variables : 1186
Matrix variables : 2
Integer variables : 0

Optimizer - solved problem : the primal
Optimizer - Constraints : 3922
Optimizer - Cones : 1
Optimizer - Scalar variables : 1185 conic : 1185
Optimizer - Semi-definite variables: 2 scalarized : 16697
Factor - setup time : 0.58 dense det. time : 0.00
Factor - ML order time : 0.16 GP order time : 0.00
Factor - nonzeros before factor : 6.07e+06 after factor : 6.07e+06
Factor - dense dim. : 2 flops : 1.17e+10
ITE PFEAS DFEAS GFEAS PRSTATUS POBJ DOBJ MU TIME
0 4.0e+00 1.0e+00 1.2e+01 0.00e+00 1.078091442e+01 0.000000000e+00 1.0e+00 0.64
1 8.5e-01 2.1e-01 4.1e+00 -8.53e-01 3.450716834e+00 -1.810695397e+00 2.1e-01 1.24
2 1.1e-01 2.7e-02 2.4e-01 1.11e-01 -9.303731649e-01 -1.733217328e+00 2.7e-02 1.81
3 6.3e-03 1.6e-03 3.4e-03 1.17e+00 -1.423387997e-01 -1.830590373e-01 1.6e-03 2.42
4 1.1e-03 2.7e-04 2.8e-04 8.68e-01 -5.537669385e-02 -6.188782836e-02 2.7e-04 2.92
5 1.7e-04 4.2e-05 2.2e-05 7.44e-01 -2.645045314e-02 -2.723537572e-02 4.2e-05 3.52
6 3.2e-05 8.1e-06 2.3e-06 5.51e-01 -1.756040827e-02 -1.770233324e-02 8.1e-06 4.08
7 5.3e-06 1.3e-06 2.8e-07 7.94e-02 -7.827966333e-03 -7.717110728e-03 1.3e-06 4.59
8 1.5e-06 3.8e-07 6.3e-08 5.05e-01 -4.997426540e-03 -4.888073631e-03 3.8e-07 5.11
9 5.2e-07 1.3e-07 1.7e-08 5.19e-01 -3.552141570e-03 -3.470225164e-03 1.3e-07 5.59
10 1.3e-07 3.1e-08 3.1e-09 4.39e-01 -2.219054936e-03 -2.165172129e-03 3.1e-08 6.11
11 2.9e-08 7.2e-09 5.0e-10 3.02e-01 -1.370240166e-03 -1.340397205e-03 7.2e-09 6.59
12 6.1e-09 1.5e-09 7.8e-11 2.23e-01 -7.889729774e-04 -7.724152117e-04 1.5e-09 7.11
13 1.4e-09 3.5e-10 1.3e-11 2.80e-01 -4.506254366e-04 -4.405945546e-04 3.4e-10 7.63
14 3.4e-10 1.5e-10 2.5e-12 3.36e-01 -2.718409410e-04 -2.658648290e-04 8.5e-11 8.14
15 7.5e-11 7.2e-11 4.1e-13 3.55e-01 -1.664255088e-04 -1.630508473e-04 1.9e-11 8.63
16 1.7e-11 4.6e-10 7.2e-14 2.62e-01 -1.010381683e-04 -9.901119761e-05 4.3e-12 9.14
17 3.9e-12 4.1e-10 1.3e-14 2.62e-01 -6.069352252e-05 -5.944296667e-05 9.6e-13 9.63
18 4.0e-13 8.3e-10 1.0e-15 2.75e-01 -3.240464962e-05 -3.173581567e-05 1.1e-13 10.86
19 5.7e-14 1.0e-08 1.1e-16 1.40e-01 -1.784600698e-05 -1.751477956e-05 1.6e-14 11.39
20 1.9e-14 6.1e-09 3.0e-17 1.35e-01 -1.154413762e-05 -1.130348608e-05 5.2e-15 11.88
21 2.6e-15 2.0e-08 2.9e-18 1.45e-01 -6.080209731e-06 -5.960160864e-06 7.0e-16 12.42
22 6.9e-16 3.2e-08 3.0e-19 1.33e-01 -2.801916059e-06 -2.721701236e-06 1.1e-16 13.39
23 5.9e-16 2.8e-07 1.8e-19 5.14e-01 -2.590845848e-06 -2.532166053e-06 7.1e-17 13.88
24 5.3e-16 7.8e-06 4.0e-20 3.26e-01 -1.420289373e-06 -1.385140295e-06 1.0e-17 14.42
25 6.4e-16 4.4e-06 5.0e-20 2.81e-01 -8.169523092e-07 -8.018784040e-07 1.3e-18 14.97
26 6.6e-16 3.1e-06 1.6e-21 -1.84e-01 -3.988525491e-07 -3.895729258e-07 2.1e-19 15.53
Optimizer terminated. Time: 15.59

Interior-point solution summary
Problem status : PRIMAL_AND_DUAL_FEASIBLE
Solution status : OPTIMAL
Primal. obj: -3.9885254919e-07 nrm: 1e-01 Viol. con: 1e-10 var: 0e+00 barvar: 0e+00 cones: 0e+00
Dual. obj: -3.8951429815e-07 nrm: 3e+05 Viol. con: 0e+00 var: 0e+00 barvar: 7e-10 cones: 0e+00
Optimizer summary
Optimizer - time: 15.59
Interior-point - iterations : 26 time: 15.53
Basis identification - time: 0.00
Primal - iterations : 0 time: 0.00
Dual - iterations : 0 time: 0.00
Clean primal - iterations : 0 time: 0.00
Clean dual - iterations : 0 time: 0.00
Simplex - time: 0.00
Primal simplex - iterations : 0 time: 0.00
Dual simplex - iterations : 0 time: 0.00
Mixed integer - relaxations: 0 time: 0.00

Status: Solved
Optimal value (cvx_optval): +3.89514e-07

it looks like the problem was that Q and U weren’t hermitian, so you did not originally specify the SDP constraints you thought you did.

The matrix Q and U should be hermitian, So I think I should add this initialization

variable Q(37,37) complex hermitian
variable U(37,37) complex hermitian

Dear Mark