Skip to content

Commit

Permalink
make tests green
Browse files Browse the repository at this point in the history
  • Loading branch information
bvdmitri committed Jun 10, 2024
1 parent 5e74d19 commit 2337aad
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 2 deletions.
25 changes: 25 additions & 0 deletions test/manopt_setuptests.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
using Manopt

# Non allocating version of the same `StopWhenGradientNormLess` from `Manopt.jl`
struct StopWhenGradientNormLessNonAllocating{F} <: StoppingCriterion
threshold::F
end

function (sc::StopWhenGradientNormLessNonAllocating)(mp, s, i)
M = get_manifold(mp)
if (i > 0)
grad_norm = norm(M, get_iterate(s), get_gradient(s))
if grad_norm < sc.threshold
return true
end
end
return false
end

# Non allocating version of the same `ConstantStepsize` from `Manopt.jl`
struct ConstantStepsizeNonAllocating{T} <: Stepsize
stepsize::T
end
function (cs::ConstantStepsizeNonAllocating)(args...; kwargs...)
return cs.stepsize
end
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ end

import ExponentialFamilyManifolds: ShiftedNegativeNumbers

include("../manopt_setuptests.jl")
include("manopt_setuptests.jl")

a = 2.0
b = 10.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ end

import ExponentialFamilyManifolds: ShiftedPositiveNumbers

include("../manopt_setuptests.jl")
include("manopt_setuptests.jl")

a = 2.0
b = -10.0
Expand Down

0 comments on commit 2337aad

Please sign in to comment.