Skip to content

Commit

Permalink
Fix only_fghv! and add some aliases. (#130)
Browse files Browse the repository at this point in the history
  • Loading branch information
pkofod committed Aug 16, 2020
1 parent 8affba4 commit 45f0306
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/objective_types/incomplete.jl
Expand Up @@ -14,7 +14,9 @@ struct InplaceObjective{DF, FDF, FGH, Hv, FGHv}
fghv::FGHv
end
InplaceObjective(;df=nothing, fdf=nothing, fgh=nothing, hv=nothing, fghv=nothing) = InplaceObjective(df, fdf, fgh, hv, fghv)
const InPlaceObjectiveFGH = InplaceObjective{<:Nothing, <:Nothing, <:Any, <:Any, <:Any}
const InPlaceObjectiveFGH = InplaceObjective{<:Nothing, <:Nothing, <:Any, <:Nothing, <: Nothing}
const InPlaceObjectiveFG_Hv = InplaceObjective{<:Nothing, <:Any, <:Nothing, <:Any, <:Nothing}
const InPlaceObjectiveFGHv = InplaceObjective{<:Nothing, <:Nothing, <:Nothing, <:Any, <:Any}
struct NotInplaceObjective{DF, FDF, FGH}
df::DF
fdf::FDF
Expand Down Expand Up @@ -42,13 +44,16 @@ fdf(t::Union{InplaceObjective, NotInplaceObjective}) = t.fdf
make_f(t::InplaceObjective, x, F::Real) = x -> fdf(t)(F, nothing, x)
make_f(t::InplaceObjective, x, F) = (F, x) -> fdf(t)(F, nothing, x)
make_f(t::InPlaceObjectiveFGH, x, F::Real) = x -> t.fgh(F, nothing, nothing, x)
make_f(t::InPlaceObjectiveFGHv, x, F::Real) = x -> t.fghv(F, nothing, nothing, x, nothing)


make_df(t::InplaceObjective, x, F) = (DF, x) -> fdf(t)(nothing, DF, x)
make_df(t::InPlaceObjectiveFGH, x, F) = (DF, x) -> t.fgh(nothing, DF, nothing, x)
make_df(t::InPlaceObjectiveFGHv, x, F) = (DF, x) -> t.fghv(nothing, DF, nothing, x, nothing)

make_fdf(t::InplaceObjective, x, F::Real) = (G, x) -> fdf(t)(F, G, x)
make_fdf(t::InPlaceObjectiveFGH, x, F::Real) = (G, x) -> t.fgh(F, G, nothing, x)
make_fdf(t::InPlaceObjectiveFGHv, x, F::Real) = (G, x) -> t.fghv(F, G, nothing, x, nothing)
make_fdf(t::InplaceObjective, x, F) = fdf(t)

# Non-mutating version
Expand Down

0 comments on commit 45f0306

Please sign in to comment.