{"action":"created","issue":{"url":"https://api.github.com/repos/JuliaOpt/Convex.jl/issues/204","repository_url":"https://api.github.com/repos/JuliaOpt/Convex.jl","labels_url":"https://api.github.com/repos/JuliaOpt/Convex.jl/issues/204/labels{/name}","comments_url":"https://api.github.com/repos/JuliaOpt/Convex.jl/issues/204/comments","events_url":"https://api.github.com/repos/JuliaOpt/Convex.jl/issues/204/events","html_url":"https://github.com/JuliaOpt/Convex.jl/issues/204","id":243001550,"number":204,"title":"Problem with complex variables","user":{"login":"falbarelli","id":1019360,"avatar_url":"https://avatars7.githubusercontent.com/u/1019360?v=4","gravatar_id":"","url":"https://api.github.com/users/falbarelli","html_url":"https://github.com/falbarelli","followers_url":"https://api.github.com/users/falbarelli/followers","following_url":"https://api.github.com/users/falbarelli/following{/other_user}","gists_url":"https://api.github.com/users/falbarelli/gists{/gist_id}","starred_url":"https://api.github.com/users/falbarelli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/falbarelli/subscriptions","organizations_url":"https://api.github.com/users/falbarelli/orgs","repos_url":"https://api.github.com/users/falbarelli/repos","events_url":"https://api.github.com/users/falbarelli/events{/privacy}","received_events_url":"https://api.github.com/users/falbarelli/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2017-07-14T13:43:41Z","updated_at":"2017-07-15T10:27:30Z","closed_at":null,"body":"Hi, it is the first time I write an issue so forgive me if I do not respect some kind of etiquette.\r\nI was trying to solve an optimization problem coming from quantum information theory in Convex.jl since it supports complex numbers, however, I ran into some issues.\r\n\r\nIf I just try to run the code listed on the [official documentation](https://convexjl.readthedocs.io/en/latest/complex-domain_optimization.html#optimizing-over-quantum-states), i.e. I run the following code\r\n\r\n```\r\nusing Convex\r\n\r\nA = [ 0.47213595 0.11469794+0.48586827im; 0.11469794-0.48586827im  0.52786405]\r\nB = ComplexVariable(2, 2)\r\nρ = kron(A, B)\r\nconstraints = [partialtrace(ρ, 1, [2; 2]) == [1 0; 0 0]\r\n               trace(ρ) == 1\r\n               ρ in :SDP]\r\np = satisfy(constraints)\r\n```\r\nI get this error message:\r\n\r\n```\r\nMethodError: no method matching .<=(::Int64, ::Complex{Float64})\r\nClosest candidates are:\r\n  .<=(::Real, ::Real) at operators.jl:160\r\n  .<=(::Any, ::AbstractArray{T,N}) at broadcast.jl:370\r\n  .<=(::AbstractArray{T,N}, ::Any) at broadcast.jl:370\r\n\r\n in Convex.Constant(::Complex{Float64}, ::Bool) at /home/francesco/.julia/v0.5/Convex/src/constant.jl:25\r\n in kron(::Array{Complex{Float64},2}, ::Convex.Variable) at /home/francesco/.julia/v0.5/Convex/src/atoms/affine/kron.jl:9\r\n```\r\nApparently, he error is due to `kron()`.\r\n\r\nAnother similar error I get comes from running this minimal example: \r\n\r\n```\r\nusing Convex\r\n\r\nx=ComplexVariable()\r\n\r\na=x*(1.0+0.0im)\r\n```\r\nwhich throws:\r\n\r\n```\r\nMethodError: no method matching .<=(::Int64, ::Complex{Float64})\r\nClosest candidates are:\r\n  .<=(::Real, ::Real) at operators.jl:160\r\n  .<=(::Any, ::AbstractArray{T,N}) at broadcast.jl:370\r\n  .<=(::AbstractArray{T,N}, ::Any) at broadcast.jl:370\r\n\r\n in Convex.Constant(::Complex{Float64}, ::Bool) at /home/francesco/.julia/v0.5/Convex/src/constant.jl:25\r\n in *(::Convex.Variable, ::Complex{Float64}) at /home/francesco/.julia/v0.5/Convex/src/atoms/affine/multiply_divide.jl:105\r\n```\r\nInterestingly, there is no error if the imaginary part is not zero, i.e. with `a=x*(1.0+1.0im)`.\r\nCan someone tell me what is happening here?\r\nIntuitively I would say it is a bug; this renders my code unusable since sometimes complex numbers with zero imaginary part come out...\r\n\r\nBy the way, thank you for this nice piece of software.\r\n\r\nP.S. For completeness, this is the output of `versioninfo()` on my system (Ubuntu 16.04.02):\r\n```\r\nJulia Version 0.5.2\r\nCommit f4c6c9d4bb (2017-05-06 16:34 UTC)\r\nPlatform Info:\r\n  OS: Linux (x86_64-linux-gnu)\r\n  CPU: Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz\r\n  WORD_SIZE: 64\r\n  BLAS: libopenblas (NO_LAPACKE DYNAMIC_ARCH NO_AFFINITY Haswell)\r\n  LAPACK: liblapack.so.3\r\n  LIBM: libopenlibm\r\n  LLVM: libLLVM-3.7.1 (ORCJIT, broadwell)\r\n```"},"comment":{"url":"https://api.github.com/repos/JuliaOpt/Convex.jl/issues/comments/315525265","html_url":"https://github.com/JuliaOpt/Convex.jl/issues/204#issuecomment-315525265","issue_url":"https://api.github.com/repos/JuliaOpt/Convex.jl/issues/204","id":315525265,"user":{"login":"falbarelli","id":1019360,"avatar_url":"https://avatars7.githubusercontent.com/u/1019360?v=4","gravatar_id":"","url":"https://api.github.com/users/falbarelli","html_url":"https://github.com/falbarelli","followers_url":"https://api.github.com/users/falbarelli/followers","following_url":"https://api.github.com/users/falbarelli/following{/other_user}","gists_url":"https://api.github.com/users/falbarelli/gists{/gist_id}","starred_url":"https://api.github.com/users/falbarelli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/falbarelli/subscriptions","organizations_url":"https://api.github.com/users/falbarelli/orgs","repos_url":"https://api.github.com/users/falbarelli/repos","events_url":"https://api.github.com/users/falbarelli/events{/privacy}","received_events_url":"https://api.github.com/users/falbarelli/received_events","type":"User","site_admin":false},"created_at":"2017-07-15T10:27:30Z","updated_at":"2017-07-15T10:27:30Z","body":"@Ayush-iitkgp thank you for answering!\r\nI tried what you said:\r\n```\r\njulia> Pkg.checkout(\"Convex\")\r\nINFO: Checking out Convex master...\r\nINFO: Pulling Convex latest master...\r\nINFO: No packages to install, update or remove\r\n```\r\nbut the problem when giving `x+(1.0+0.0im)` persists :("}}
{"actor":{"display_login":"falbarelli"}}