Skip to content

Commit 793bf75

Browse files
femtocleaner[bot]pkofod
authored andcommitted
Fix deprecations (#14)
1 parent 517f95f commit 793bf75

5 files changed

Lines changed: 18 additions & 18 deletions

File tree

src/optim_tests/multivariate/more_testing.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ function _extrosenbrockproblem(N::Int;
6969
zero(T),
7070
true,
7171
false,
72-
MatVecHolder(Array{T}(0,0),similar(initial_x)))
72+
MatVecHolder(Array{T}(undef, 0,0),similar(initial_x)))
7373
end
7474

7575
examples["Extended Rosenbrock"] = _extrosenbrockproblem(100)
@@ -162,7 +162,7 @@ function _extpowellproblem(N::Int;
162162
zero(T),
163163
true,
164164
false,
165-
MatVecHolder(Array{T}(0,0),similar(initial_x)))
165+
MatVecHolder(Array{T}(undef, 0,0),similar(initial_x)))
166166
end
167167

168168
examples["Extended Powell"] = _extpowellproblem(100)
@@ -239,7 +239,7 @@ function _penfunIproblem(N::Int;
239239
fsol,
240240
true,
241241
false,
242-
ParaboloidStruct(Array{T}(0,0),Array{T}(0),
242+
ParaboloidStruct(Array{T}(undef, 0,0),Array{T}(undef, 0),
243243
similar(initial_x), alpha))
244244
end
245245

@@ -307,7 +307,7 @@ function _trigonometricproblem(N::Int;
307307
zero(T),
308308
true,
309309
false,
310-
MatVecHolder(Array{T}(0,0),similar(initial_x)))
310+
MatVecHolder(Array{T}(undef, 0,0),similar(initial_x)))
311311
end
312312

313313
examples["Trigonometric"] = _trigonometricproblem(100)

src/optim_tests/multivariate/multivariate.jl

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ struct ConstraintData{F,J,H,Tx,Tc}
1616
uc::Vector{Tc}
1717
end
1818

19-
immutable OptimizationProblem{P, Tfg, Tf <: Real, TS <: AbstractString,
20-
CT <: Union{Void,ConstraintData}}
19+
struct OptimizationProblem{P, Tfg, Tf <: Real, TS <: AbstractString,
20+
CT <: Union{Nothing,ConstraintData}}
2121
name::TS
2222
f::Function
2323
g!::Function
@@ -37,7 +37,7 @@ OptimizationProblem(name::AbstractString,
3737
g!::Function,
3838
fg!::Tfg,
3939
h!::Function,
40-
constraints::Union{Void,ConstraintData},
40+
constraints::Union{Nothing,ConstraintData},
4141
initial_x::Vector,
4242
solutions::Vector,
4343
minimum::Tf,
@@ -49,24 +49,24 @@ OptimizationProblem(name::AbstractString,
4949
istwicedifferentiable,
5050
nothing)
5151

52-
objective(p::OptimizationProblem{P}) where P<:Void = p.f
53-
gradient(p::OptimizationProblem{P}) where P<:Void = p.g!
54-
objective_gradient(p::OptimizationProblem{P}) where P<:Void = p.fg!
55-
hessian(p::OptimizationProblem{P}) where P<:Void = p.h!
52+
objective(p::OptimizationProblem{P}) where P<:Nothing = p.f
53+
gradient(p::OptimizationProblem{P}) where P<:Nothing = p.g!
54+
objective_gradient(p::OptimizationProblem{P}) where P<:Nothing = p.fg!
55+
hessian(p::OptimizationProblem{P}) where P<:Nothing = p.h!
5656

5757
objective(p::OptimizationProblem{P}) where P = x-> p.f(x,p.parameters)
5858
gradient(p::OptimizationProblem{P}) where P = (out,x)-> p.g!(out,x,p.parameters)
5959
objective_gradient(p::OptimizationProblem{P}) where P = (out,x)-> p.fg!(out,x,p.parameters)
6060
hessian(p::OptimizationProblem{P}) where P = (out,x)-> p.h!(out,x,p.parameters)
6161

62-
function objective_gradient(p::OptimizationProblem{P,Tfg}) where P where Tfg <: Void
62+
function objective_gradient(p::OptimizationProblem{P,Tfg}) where P where Tfg <: Nothing
6363
(out,x) -> begin
6464
gradient(p)(out,x)
6565
return objective(p)(x)
6666
end
6767
end
6868

69-
function objective_gradient(p::OptimizationProblem{P,Tfg}) where P <: Void where Tfg <: Void
69+
function objective_gradient(p::OptimizationProblem{P,Tfg}) where P <: Nothing where Tfg <: Nothing
7070
(out,x) -> begin
7171
gradient(p)(out,x)
7272
return objective(p)(x)

src/optim_tests/multivariate/quad_transforms.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ function quad_hessian!(storage::Matrix, x::Vector, param)
2626
storage .= param.mat
2727
end
2828

29-
immutable MatVecHolder{Tv <: AbstractVector,
30-
Tm <: AbstractArray}
29+
struct MatVecHolder{Tv <: AbstractVector,
30+
Tm <: AbstractArray}
3131
mat::Tm
3232
vec::Tv
3333
end
@@ -58,7 +58,7 @@ examples["Quadratic Diagonal"] = _quadraticproblem(100)
5858
# Paraboloid. Similar to Rosenbrock
5959
#######################
6060

61-
immutable ParaboloidStruct{T, Tm <: AbstractArray{T,2},
61+
struct ParaboloidStruct{T, Tm <: AbstractArray{T,2},
6262
Tv <: AbstractArray{T}} <: Any where T<:Number
6363
mat::Tm
6464
vec::Tv

src/optim_tests/univariate/bounded.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ module UnivariateProblems
44
###
55
### [1] http://infinity77.net/global_optimization/test_functions_1d.html
66

7-
immutable UnivariateProblem
7+
struct UnivariateProblem
88
name::AbstractString
99
f::Function
1010
bounds::Vector{Float64}

test/runtests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using OptimTestProblems
22
using OptimTestProblems.MultivariateProblems
33

4-
using Base.Test
4+
using Test
55

66
verbose = false
77

0 commit comments

Comments
 (0)