|
27 | 27 | # The purpose of this tutorial is to help new users to JuMP who have previously |
28 | 28 | # used YALMIP or CVX by comparing and contrasting their different features. |
29 | 29 |
|
| 30 | +# !!!tip |
| 31 | +# If you have not used Julia before, read the [Getting started with Julia](@ref) |
| 32 | +# tutorial. |
| 33 | + |
30 | 34 | # ## Namespaces |
31 | 35 |
|
32 | 36 | # Julia has namespaces, which MATLAB lacks. Therefore one needs to either use |
@@ -268,9 +272,9 @@ objective_value(model) |
268 | 272 |
|
269 | 273 | # ## Rosetta stone |
270 | 274 |
|
271 | | -# To finish this tutorial, we show a complete example of the same optimization |
272 | | -# problem being solved with JuMP, YALMIP, and CVX. It is a semidefinite program |
273 | | -# that computes a lower bound on the random robustness of entanglement using the |
| 275 | +# In this section, we show a complete example of the same optimization problem |
| 276 | +# being solved with JuMP, YALMIP, and CVX. It is a semidefinite program that |
| 277 | +# computes a lower bound on the random robustness of entanglement using the |
274 | 278 | # partial transposition criterion. |
275 | 279 |
|
276 | 280 | # The code is complete, apart from the function that does partial transposition. |
@@ -306,15 +310,11 @@ end |
306 | 310 |
|
307 | 311 | function robustness_jump(d) |
308 | 312 | rho = random_state_pure(d^2) |
309 | | - id = LinearAlgebra.I(d^2) |
310 | | - rhoT = partial_transpose(rho, 1, [d, d]) |
| 313 | + id = LinearAlgebra.Hermitian(LinearAlgebra.I(d^2)) |
| 314 | + rhoT = LinearAlgebra.Hermitian(partial_transpose(rho, 1, [d, d])) |
311 | 315 | model = Model() |
312 | 316 | @variable(model, λ) |
313 | | - @constraint( |
314 | | - model, |
315 | | - PPT, |
316 | | - LinearAlgebra.Hermitian(rhoT + λ * id) in HermitianPSDCone(), |
317 | | - ) |
| 317 | + @constraint(model, PPT, rhoT + λ * id in HermitianPSDCone()) |
318 | 318 | @objective(model, Min, λ) |
319 | 319 | set_optimizer(model, Clarabel.Optimizer) |
320 | 320 | set_attribute(model, "verbose", true) |
|
0 commit comments