Skip to content

Commit

Permalink
[docs] adapt transitioning tutorial to new code (#3809)
Browse files Browse the repository at this point in the history
  • Loading branch information
araujoms authored Aug 26, 2024
1 parent a242957 commit cfea5ef
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions docs/src/tutorials/transitioning/transitioning_from_matlab.jl
Original file line number Diff line number Diff line change
Expand Up @@ -127,17 +127,15 @@ m[2]
# | `@constraint(model, [t; v] in SecondOrderCone())` | `cone(v, t)` | `{v, t} == lorentz(length(v))` |
# | `@constraint(model, [x, y, z] in MOI.ExponentialCone())` | `expcone([x, y, z])` | `{x, y, z} == exponential(1)` |

# A subtlety appears when declaring equality constraints for matrices. In
# general, JuMP uses `@constraint(model, m .== c)`, with the dot meaning
# broadcasting in Julia, except when `m` is `Symmetric` or `Hermitian`: in this
# case `@constraint(model, m == c)` is allowed, and is much better, as JuMP is
# smart enough to not generate redundant constraints for the lower diagonal and
# the imaginary part of the diagonal (in the complex case). Both YALMIP and CVX
# are also smart enough to do this and the syntax is always just `m == c`.

# Experienced YALMIP users will probably be relieved to see that you must pass
# `PSDCone()` or `HermitianPSDCone()` to make a matrix positive semidefinite, as
# the `>=` ambiguity in YALMIP is common source of bugs.
# Like YALMIP and CVX, JuMP is smart enough to not generate redundant
# constraints when declaring equality constraints between `Symmetric` or
# `Hermitian` matrices. In these cases `@constraint(model, m == c)` will not
# generate constraints for the lower diagonal and the imaginary part of the
# diagonal (in the complex case).

# Experienced MATLAB users will probably be relieved to see that you must pass
# `PSDCone()` or `HermitianPSDCone()` to make a matrix positive semidefinite, because
# the `>=` ambiguity in YALMIP and CVX is common source of bugs.

# ## Setting the objective

Expand Down

0 comments on commit cfea5ef

Please sign in to comment.