jump-dev / ComplexOptInterface.jl

Compare c9045bf ... +0 ... d7bac30

No flags found

Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.

e.g., #unittest #integration

#production #enterprise

#frontend #backend

Learn more about Codecov Flags here.

Showing 1 of 3 files from the diff.
Other files ignored by Codecov
test/jump.jl has changed.
README.md has changed.

@@ -7,6 +7,33 @@
Loading
7 7
    return JuMP.add_bridge(model, Bridges.Constraint.SplitZeroBridge)
8 8
end
9 9
10 +
struct ComplexPlane end
11 +
12 +
struct ComplexVariable{S,T,U,V} <: JuMP.AbstractVariable
13 +
    info::JuMP.VariableInfo{S,T,U,V}
14 +
end
15 +
16 +
function JuMP.build_variable(::Function, v::JuMP.ScalarVariable, ::ComplexPlane)
17 +
    return ComplexVariable(v.info)
18 +
end
19 +
20 +
function JuMP.add_variable(
21 +
    model::JuMP.Model,
22 +
    v::ComplexVariable,
23 +
    name::String = "",
24 +
)
25 +
    model.is_model_dirty = true
26 +
    var = JuMP.ScalarVariable(v.info)
27 +
    real_part = JuMP.add_variable(model, _real(var), _real(name))
28 +
    imag_part = JuMP.add_variable(model, _imag(var), _imag(name))
29 +
    # Efficiently build `real_part + imag_part * im`
30 +
    return JuMP.GenericAffExpr{ComplexF64,JuMP.VariableRef}(
31 +
        zero(ComplexF64),
32 +
        real_part => one(ComplexF64),
33 +
        imag_part => convert(ComplexF64, im),
34 +
    )
35 +
end
36 +
10 37
struct HermitianPSDCone end
11 38
12 39
struct HermitianMatrixShape <: JuMP.AbstractShape
@@ -64,8 +91,8 @@
Loading
64 91
    )
65 92
end
66 93
67 -
_real(s::String) = s
68 -
_imag(s::String) = s
94 +
_real(s::String) = string("real(", s, ")")
95 +
_imag(s::String) = string("imag(", s, ")")
69 96
70 97
_real(v::JuMP.ScalarVariable) = _mapinfo(real, v)
71 98
_imag(v::JuMP.ScalarVariable) = _mapinfo(imag, v)

Everything is accounted for!

No changes detected that need to be reviewed.
What changes does Codecov check for?
Lines, not adjusted in diff, that have changed coverage data.
Files that introduced coverage data that had none before.
Files that have missing coverage data that once were tracked.
Files Coverage
src -1.75% 58.70%
Project Totals (5 files) 58.70%
Loading