Skip to content

Commit c03e9cc

Browse files
authored
min compat Manopt v0.4.40 and ManifoldsBase v0.15 fixes (#1798)
* min compat Manopt v0.4.40 * Fixes for MBv0.15
1 parent 4637ec6 commit c03e9cc

File tree

8 files changed

+31
-21
lines changed

8 files changed

+31
-21
lines changed

Project.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ FunctionalStateMachine = "0.2.9"
7979
JSON3 = "1"
8080
KernelDensityEstimate = "0.5.6"
8181
ManifoldDiff = "0.3"
82-
Manifolds = "0.8.15, 0.9"
83-
ManifoldsBase = "0.13.12, 0.14, 0.15"
84-
Manopt = "0.4.27"
82+
Manifolds = "0.9"
83+
ManifoldsBase = "0.15"
84+
Manopt = "0.4.40"
8585
MetaGraphs = "0.7"
8686
Optim = "1"
8787
OrderedCollections = "1"

src/Deprecated.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,14 @@ end
128128
## Deprecate code below before v0.36
129129
##==============================================================================
130130

131+
# function Base.isapprox(a::ProductRepr, b::ProductRepr; atol::Real = 1e-6)
132+
# #
133+
# for (i, a_) in enumerate(a.parts)
134+
# isapprox(a_, b.parts[i]; atol = atol) || (return false)
135+
# end
136+
# return true
137+
# end
138+
131139
# exportimg(pl) = error("Please do `using Gadfly` to allow image export.")
132140

133141
# function _perturbIfNecessary(

src/IncrementalInference.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ using StructTypes
5050
using StaticArrays
5151

5252
using ManifoldsBase
53-
53+
using ManifoldsBase: TypeParameter
5454
# for BayesTree
5555
using MetaGraphs
5656
using Logging

src/Serialization/services/SerializationMKD.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
# this step actually occurs separate from the actual variables or factors (with their own manifolds)
55
# relies on later use of getManifold to give back the same <:AbstractManifold
66
# NOTE added to DFG.@defVariable
7-
getVariableType(M::Euclidean{Tuple{N}}) where {N} = ContinuousEuclid(N)
8-
getVariableType(M::TranslationGroup{Tuple{N}}) where {N} = ContinuousEuclid(N)
7+
getVariableType(M::Euclidean{TypeParameter{Tuple{N}}}) where {N} = ContinuousEuclid(N)
8+
getVariableType(M::TranslationGroup{TypeParameter{Tuple{N}}}) where {N} = ContinuousEuclid(N)
99

1010
# getVariableType(M::RealCircleGroup) = Circular()
1111
# getVariableType(M::Circle) = error("Circle manifold is deprecated use RealCircleGroup, will come back when we generalize to non-group Riemannian")

src/manifolds/services/ManifoldsExtentions.jl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,12 +136,15 @@ function DFG.getPointIdentity(G::SemidirectProductGroup, ::Type{T} = Float64) wh
136136
return ArrayPartition(np, hp)
137137
end
138138

139-
function DFG.getPointIdentity(G::SpecialOrthogonal{N}, ::Type{T} = Float64) where {N, T <: Real}
139+
function DFG.getPointIdentity(
140+
G::SpecialOrthogonal{TypeParameter{Tuple{N}}},
141+
::Type{T} = Float64
142+
) where {N, T <: Real}
140143
return SMatrix{N, N, T}(I)
141144
end
142145

143146
function DFG.getPointIdentity(
144-
G::TranslationGroup{Tuple{N}},
147+
G::TranslationGroup{TypeParameter{Tuple{N}}},
145148
::Type{T} = Float64,
146149
) where {N, T <: Real}
147150
return zeros(SVector{N,T})

src/parametric/services/ParametricUtils.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,10 +494,15 @@ function initPoints!(p, gsc, fg::AbstractDFG, solveKey = :parametric)
494494
end
495495
end
496496

497+
function _get_dim_ranges(dims::NTuple{N,Any}) where {N}
498+
dims_acc = accumulate(+, vcat(1, SVector(dims)))
499+
return ntuple(i -> (dims_acc[i]:(dims_acc[i] + dims[i] - 1)), Val(N))
500+
end
501+
497502
#NOTE this only works with a product of power manifolds
498503
function getComponentsCovar(@nospecialize(PM::ProductManifold), Σ::AbstractMatrix)
499504
dims = manifold_dimension.(PM.manifolds)
500-
dim_ranges = Manifolds._get_dim_ranges(dims)
505+
dim_ranges = _get_dim_ranges(dims)
501506

502507
subsigmas = map(zip(dim_ranges, PM.manifolds)) do v
503508
r = v[1]

src/services/CompareUtils.jl

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,7 @@ function Base.isapprox(
1717
return mmd(p1, p2) < atol
1818
end
1919

20-
function Base.isapprox(a::ProductRepr, b::ProductRepr; atol::Real = 1e-6)
21-
#
22-
for (i, a_) in enumerate(a.parts)
23-
isapprox(a_, b.parts[i]; atol = atol) || (return false)
24-
end
25-
return true
26-
end
20+
2721

2822
## FIXME, FIGURE OUT HOW TO DEPRECATE BELOW ==============================================
2923

test/testSphereMani.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ import Manifolds: identity_element
1313

1414
# NOTE Sphere{2} is not a lie group so the identity element does not exits.
1515
# this is for testing only and will be removed once upgraded to support any Riemannian Manifold.
16-
DFG.getPointIdentity(::Sphere{2, ℝ}) = SVector(1.0, 0.0, 0.0)
16+
DFG.getPointIdentity(::typeof(Sphere(2))) = SVector(1.0, 0.0, 0.0)
1717
#FIXME REMOVE! this is type piracy and not a good idea, for testing only!!!
18-
Manifolds.identity_element(::Sphere{2, ℝ}) = SVector(1.0, 0.0, 0.0)
19-
Manifolds.identity_element(::Sphere{2, ℝ}, p::AbstractVector) = SVector(1.0, 0.0, 0.0) # Float64[1,0,0]
18+
Manifolds.identity_element(::typeof(Sphere(2))) = SVector(1.0, 0.0, 0.0)
19+
Manifolds.identity_element(::typeof(Sphere(2)), p::AbstractVector) = SVector(1.0, 0.0, 0.0) # Float64[1,0,0]
2020

21-
Base.convert(::Type{<:Tuple}, M::Sphere{2, ℝ}) = (:Euclid, :Euclid)
22-
Base.convert(::Type{<:Tuple}, ::IIF.InstanceType{Sphere{2, ℝ}}) = (:Euclid, :Euclid)
21+
Base.convert(::Type{<:Tuple}, M::typeof(Sphere(2))) = (:Euclid, :Euclid)
22+
Base.convert(::Type{<:Tuple}, ::IIF.InstanceType{typeof(Sphere(2))}) = (:Euclid, :Euclid)
2323

2424
@defVariable Sphere2 Sphere(2) SVector(1.0, 0.0, 0.0)
2525
M = getManifold(Sphere2)

0 commit comments

Comments
 (0)