Skip to content

Commit 31243d4

Browse files
committed
fix ambiguity, improve test
1 parent 30a497b commit 31243d4

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/plans/box_plan.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@ to_coordinate_index(::AbstractManifold, b::UnitVector{Int}, ::AbstractBasis) = b
521521
Get the index of coordinate equal to 1 of [`UnitVector`](@ref) `b` with respect to
522522
`AbstractBasis` `B`.
523523
"""
524-
function to_coordinate_index(M::ProductManifold, b::UnitVector, B::AbstractBasis)
524+
function to_coordinate_index(M::ProductManifold, b::UnitVector{Tuple{Int, Int}}, B::AbstractBasis)
525525
i, j = b.index
526526
offset = sum(k -> number_of_coordinates(M.manifolds[k], B), 1:(i - 1); init = 0)
527527
return offset + j

test/solvers/test_quasi_Newton_box.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -296,13 +296,13 @@ using RecursiveArrayTools
296296
@testset "Sphere × Hyperrectangle" begin
297297
S2 = Sphere(2)
298298
px = [0.0, 1.0, 0.0]
299-
Mbox = Hyperrectangle([-1.0, 2.0, -Inf], [2.0, Inf, 2.0])
299+
Mbox = Hyperrectangle([-1.0 2.0; -Inf -Inf], [2.0 Inf; 2.0 Inf])
300300
M = S2 × Mbox
301301
f(M, p) = sum(p.x[2] .^ 4) + 0.5 * distance(S2, p.x[1], px)^2
302302
grad_f(M, p) = ArrayPartition(-log(S2, p.x[1], px), project(Mbox, p.x[2], 4 .* (p.x[2] .^ 3)))
303-
p0 = ArrayPartition([1.0, 0.0, 0.0], [0.0, 4.0, 1.0])
303+
p0 = ArrayPartition([1.0, 0.0, 0.0], [0.0 4.0; 1.0 1.0])
304304

305305
p_opt = quasi_Newton(M, f, grad_f, p0; stopping_criterion = StopWhenProjectedNegativeGradientNormLess(1.0e-6) | StopAfterIteration(100))
306-
@test distance(M, p_opt, ArrayPartition(px, [0, 2, 0])) < 0.1
306+
@test distance(M, p_opt, ArrayPartition(px, [0 2; 0 0])) < 0.1
307307
end
308308
end

0 commit comments

Comments
 (0)