Skip to content

update for ECOS 2.0.5 #46

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 4, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion deps/build.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ if is_apple()
provides( Homebrew.HB, "ecos", ecos, os = :Darwin )
end

version = "2.0.4"
version = "2.0.5"
win_version = "2.0.2"
provides(Sources, URI("https://github.com/ifa-ethz/ecos/archive/v$version.tar.gz"),
[ecos], os = :Unix, unpacked_dir="ecos-$version")
Expand Down
14 changes: 7 additions & 7 deletions src/ECOS.jl
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ else
error("ECOS not properly installed. Please run Pkg.build(\"ECOS\")")
end

# ver [not exported]
# Returns the version of ECOS in use
function ver()
ver_ptr = ccall((:ECOS_ver, ECOS.ecos), Ptr{UInt8}, ())
return unsafe_string(ver_ptr)
end

macro ecos_ccall(func, args...)
f = "ECOS_$(func)"
quote
Expand Down Expand Up @@ -172,11 +179,4 @@ function cleanup(problem::Ptr{Cpwork}, keepvars::Int = 0)
ccall((:ECOS_cleanup, ECOS.ecos), Void, (Ptr{Cpwork}, Clong), problem, keepvars)
end

# ver [not exported]
# Returns the version of ECOS in use
function ver()
ver_ptr = ccall((:ECOS_ver, ECOS.ecos), Ptr{UInt8}, ())
return unsafe_string(ver_ptr)
end

end # module
257 changes: 174 additions & 83 deletions src/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -140,87 +140,178 @@ immutable Csettings
centrality::Cdouble
end

immutable Cpwork
# Dimensions
n::Clong
m::Clong
p::Clong
D::Clong

# Variables
x::Ptr{Cdouble}
y::Ptr{Cdouble}
z::Ptr{Cdouble}
s::Ptr{Cdouble}
lambda::Ptr{Cdouble}
kap::Cdouble
tau::Cdouble

# Best iterates seen so far
best_x::Ptr{Cdouble}
best_y::Ptr{Cdouble}
best_z::Ptr{Cdouble}
best_s::Ptr{Cdouble}
best_kap::Cdouble
best_tau::Cdouble
best_cx::Cdouble
best_by::Cdouble
best_hz::Cdouble
best_info::Ptr{Cstats}

# Temporary variables
dsaff::Ptr{Cdouble}
dzaff::Ptr{Cdouble}
W_times_dzaff::Ptr{Cdouble}
dsaff_by_W::Ptr{Cdouble}
saff::Ptr{Cdouble}
zaff::Ptr{Cdouble}

# Cone
C::Ptr{Ccone}
A::Ptr{Cspmat}
G::Ptr{Cspmat}
c::Ptr{Cdouble}
b::Ptr{Cdouble}
h::Ptr{Cdouble}

# equilibration vector
xequil::Ptr{Cdouble}
Aequil::Ptr{Cdouble}
Gequil::Ptr{Cdouble}

# scalings of problem data
resx0::Cdouble
resy0::Cdouble
resz0::Cdouble

# residuals
rx::Ptr{Cdouble}
ry::Ptr{Cdouble}
rz::Ptr{Cdouble}
rt::Cdouble
hresx::Cdouble
hresy::Cdouble
hresz::Cdouble

# norm iterates
nx::Cdouble
ny::Cdouble
nz::Cdouble
ns::Cdouble

# temporary storage
cx::Cdouble
by::Cdouble
hz::Cdouble
sz::Cdouble

# KKT System
KKT::Ptr{Ckkt}

# info struct
info::Ptr{Cstats}

# settings struct
stgs::Ptr{Csettings}
if VersionNumber(ver()) >= v"2.0.5"
@eval immutable Cpwork
# Dimensions
n::Clong
m::Clong
p::Clong
D::Clong

# Variables
x::Ptr{Cdouble}
y::Ptr{Cdouble}
z::Ptr{Cdouble}
s::Ptr{Cdouble}
lambda::Ptr{Cdouble}
kap::Cdouble
tau::Cdouble

# Best iterates seen so far
best_x::Ptr{Cdouble}
best_y::Ptr{Cdouble}
best_z::Ptr{Cdouble}
best_s::Ptr{Cdouble}
best_kap::Cdouble
best_tau::Cdouble
best_cx::Cdouble
best_by::Cdouble
best_hz::Cdouble
best_info::Ptr{Cstats}

# Temporary variables
dsaff::Ptr{Cdouble}
dzaff::Ptr{Cdouble}
W_times_dzaff::Ptr{Cdouble}
dsaff_by_W::Ptr{Cdouble}
saff::Ptr{Cdouble}
zaff::Ptr{Cdouble}

# Cone
C::Ptr{Ccone}
A::Ptr{Cspmat}
G::Ptr{Cspmat}
c::Ptr{Cdouble}
b::Ptr{Cdouble}
h::Ptr{Cdouble}

# indices that map entries of A and G to the KKT matrix
AtoK::Ptr{Clong}
GtoK::Ptr{Clong}

# equilibration vector
xequil::Ptr{Cdouble}
Aequil::Ptr{Cdouble}
Gequil::Ptr{Cdouble}

# scalings of problem data
resx0::Cdouble
resy0::Cdouble
resz0::Cdouble

# residuals
rx::Ptr{Cdouble}
ry::Ptr{Cdouble}
rz::Ptr{Cdouble}
rt::Cdouble
hresx::Cdouble
hresy::Cdouble
hresz::Cdouble

# norm iterates
nx::Cdouble
ny::Cdouble
nz::Cdouble
ns::Cdouble

# temporary storage
cx::Cdouble
by::Cdouble
hz::Cdouble
sz::Cdouble

# KKT System
KKT::Ptr{Ckkt}

# info struct
info::Ptr{Cstats}

# settings struct
stgs::Ptr{Csettings}
end
else
@eval immutable Cpwork
# Dimensions
n::Clong
m::Clong
p::Clong
D::Clong

# Variables
x::Ptr{Cdouble}
y::Ptr{Cdouble}
z::Ptr{Cdouble}
s::Ptr{Cdouble}
lambda::Ptr{Cdouble}
kap::Cdouble
tau::Cdouble

# Best iterates seen so far
best_x::Ptr{Cdouble}
best_y::Ptr{Cdouble}
best_z::Ptr{Cdouble}
best_s::Ptr{Cdouble}
best_kap::Cdouble
best_tau::Cdouble
best_cx::Cdouble
best_by::Cdouble
best_hz::Cdouble
best_info::Ptr{Cstats}

# Temporary variables
dsaff::Ptr{Cdouble}
dzaff::Ptr{Cdouble}
W_times_dzaff::Ptr{Cdouble}
dsaff_by_W::Ptr{Cdouble}
saff::Ptr{Cdouble}
zaff::Ptr{Cdouble}

# Cone
C::Ptr{Ccone}
A::Ptr{Cspmat}
G::Ptr{Cspmat}
c::Ptr{Cdouble}
b::Ptr{Cdouble}
h::Ptr{Cdouble}

# equilibration vector
xequil::Ptr{Cdouble}
Aequil::Ptr{Cdouble}
Gequil::Ptr{Cdouble}

# scalings of problem data
resx0::Cdouble
resy0::Cdouble
resz0::Cdouble

# residuals
rx::Ptr{Cdouble}
ry::Ptr{Cdouble}
rz::Ptr{Cdouble}
rt::Cdouble
hresx::Cdouble
hresy::Cdouble
hresz::Cdouble

# norm iterates
nx::Cdouble
ny::Cdouble
nz::Cdouble
ns::Cdouble

# temporary storage
cx::Cdouble
by::Cdouble
hz::Cdouble
sz::Cdouble

# KKT System
KKT::Ptr{Ckkt}

# info struct
info::Ptr{Cstats}

# settings struct
stgs::Ptr{Csettings}
end
end