Skip to content

Commit f16eda9

Browse files
authored
fix conj (#417)
* fix `conj` * improve wording
1 parent 806955c commit f16eda9

File tree

4 files changed

+17
-3
lines changed

4 files changed

+17
-3
lines changed

NEWS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# Changes in v0.14.1
2+
3+
* there was a bug causing `conj` to act in-place (reported in [#416](https://github.com/jump-dev/Convex.jl/issues/416)), which has been fixed ([#417](https://github.com/jump-dev/Convex.jl/pull/417)). This bug appears to have existed since the introduction of `conj` in Convex.jl v0.5.0.
4+
15
# Changes in v0.14.0
26

37
## Breaking changes

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "Convex"
22
uuid = "f65535da-76fb-5f13-bab9-19810c17039a"
3-
version = "0.14.0"
3+
version = "0.14.1"
44

55
[deps]
66
AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"

src/atoms/affine/conjugate.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,13 @@ end
3030
function conic_form!(x::ConjugateAtom, unique_conic_forms::UniqueConicForms)
3131
if !has_conic_form(unique_conic_forms, x)
3232
objective = conic_form!(x.children[1], unique_conic_forms)
33+
new_obj = ConicObj()
3334
for var in keys(objective)
3435
x1 = conj(objective[var][1])
3536
x2 = conj(objective[var][2])
36-
objective[var] = (x1,x2)
37+
new_obj[var] = (x1,x2)
3738
end
38-
cache_conic_form!(unique_conic_forms, x, objective)
39+
cache_conic_form!(unique_conic_forms, x, new_obj)
3940
end
4041
return get_conic_form(unique_conic_forms, x)
4142
end

test/definitions.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,12 @@ end
1414
hvar.value = h
1515
@test evaluate(conv(hvar, x)) _conv(h, x)
1616
end
17+
18+
19+
@testset "`conj` (issue #416)" begin
20+
A = [1 1im; -1im 1]
21+
X = ComplexVariable(2, 2)
22+
p = minimize(real(tr(conj(X))), [X == A])
23+
solve!(p, () -> SCS.Optimizer(verbose=1, eps=1e-6))
24+
@test evaluate(X) A atol=1e-3
25+
end

0 commit comments

Comments
 (0)