Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix identity to identity_element for Manifolds 0.6 #139

Merged
merged 2 commits into from
Aug 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Unicode = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"
CoordinateTransformations = "0.5, 0.6, 0.8, 0.9"
DocStringExtensions = "0.7, 0.8, 0.9"
KernelDensityEstimate = "0.5.6"
Manifolds = "0.5, 0.6"
Manifolds = "0.6"
ManifoldsBase = "0.11, 0.12"
NLsolve = "3, 4"
Optim = "0.16, 0.17, 0.18, 0.19, 0.20, 0.21, 0.22, 0.23, 1"
Expand Down
2 changes: 1 addition & 1 deletion src/API.jl
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ function manifoldProduct( ff::AbstractVector{<:ManifoldKernelDensity},
ndims::Int=maximum(Ndim.(ff)),
N::Int = maximum(Npts.(ff)),
u0 = getPoints(ff[1], false)[1],
oldPoints::AbstractVector{P}= [identity(mani, u0) for i in 1:N],
oldPoints::AbstractVector{P}= [identity_element(mani, u0) for i in 1:N],
addEntropy::Bool=true,
recordLabels::Bool=false,
selectedLabels::Vector{Vector{Int}}=Vector{Vector{Int}}(),
Expand Down
12 changes: 6 additions & 6 deletions src/Interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ export makeCoordsFromPoint, makePointFromCoords, getNumberCoords
export identity
export replace

# Deprecate in favor of TranslationGroup instead
ManifoldsBase.identity(::Euclidean{Tuple{N}}, val::AbstractVector{T}) where {N, T <: Number} = zeros(T, N)
ManifoldsBase.identity(::Circle, val::AbstractVector{T}) where {T <: Real} = zeros(T, 1)
# Deprecate in favor of TranslationGroup instead, also type piracy
Manifolds.identity_element(::Euclidean{Tuple{N}}, val::AbstractVector{T}) where {N, T <: Number} = zeros(T, N)
Manifolds.identity_element(::Circle, val::AbstractVector{T}) where {T <: Real} = zeros(T, 1)

"""
$SIGNATURES
Expand All @@ -23,15 +23,15 @@ Notes
makePointFromCoords(M::MB.AbstractManifold,
coords::AbstractVector{<:Real},
u0=zeros(manifold_dimension(M)),
ϵ=identity(M,u0),
ϵ=identity_element(M,u0),
retraction_method::AbstractRetractionMethod=ExponentialRetraction() ) = retract(M, ϵ, hat(M, ϵ, coords), retraction_method)
#

function makeCoordsFromPoint( M::MB.AbstractManifold,
pt::P ) where P
#
# only works for manifold which have an identity (eg groups)
ϵ = identity(M, pt)
ϵ = identity_element(M, pt)
vee(M, ϵ, log(M, ϵ, pt))
end

Expand All @@ -57,7 +57,7 @@ end

function _pointsToMatrixCoords(M::MB.AbstractManifold, pts::AbstractVector{P}) where P
mat = zeros(manifold_dimension(M), length(pts))
ϵ = identity(M, pts[1])
ϵ = identity_element(M, pts[1])
for (j,pt) in enumerate(pts)
mat[:,j] = vee(M, ϵ, log(M, ϵ, pt))
end
Expand Down
2 changes: 1 addition & 1 deletion src/services/ManifoldKernelDensity.jl
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function ManifoldKernelDensity( M::MB.AbstractManifold,
#
# FIXME obsolete
arr = Matrix{Float64}(undef, dims, length(vecP))
ϵ = identity(M, vecP[1])
ϵ = identity_element(M, vecP[1])

for j in 1:length(vecP)
arr[:,j] = vee(M, ϵ, log(M, ϵ, vecP[j]))
Expand Down
2 changes: 1 addition & 1 deletion src/services/ManifoldPartials.jl
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ M_x, _ = getManifoldPartial(M,[1;])
u0 = ProductRepr([0.0;0],[1 0; 0 1.0])

# known coordinates are [x,y,θ], eg
# vee(M,identity(M,u0),log(M,identity(M,u0),u0))
# vee(M,identity_element(M,u0),log(M,identity_element(M,u0),u0))
# [0;0;0] in this example

# make another new partial of only the rotation component
Expand Down
2 changes: 1 addition & 1 deletion test/basic_se3.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ using Test

M = SpecialEuclidean(3)
u0 = ProductRepr(zeros(3),[1 0 0; 0 1 0; 0 0 1.0])
ϵ = identity(M, u0)
ϵ = identity_element(M, u0)
N = 50

pts1 = [exp(M, ϵ, hat(M, ϵ, [0.5*randn(3);0.1*randn(3)])) for i in 1:N]
Expand Down
2 changes: 1 addition & 1 deletion test/testBasicManiProduct.jl
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pts = AMP._pointsToMatrixCoords(P12.manifold, pts_)

M = SpecialEuclidean(2)
u0 = ProductRepr(zeros(2),[1 0; 0 1.0])
ϵ = identity(M, u0)
ϵ = identity_element(M, u0)

pts1 = [exp(M, ϵ, hat(M, ϵ, [0.05*randn(2);0.75*randn()])) for i in 1:N]
pts2 = [exp(M, ϵ, hat(M, ϵ, [0.05*randn(2);0.75*randn()])) for i in 1:N]
Expand Down
2 changes: 1 addition & 1 deletion test/testManiProductBigSmall.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ using TensorCast
M = SpecialEuclidean(2)
N = 100
u0 = ProductRepr([0;0.0],[1 0; 0 1.0])
ϵ = identity(M, u0)
ϵ = identity_element(M, u0)

X1 = [exp(M, ϵ, hat(M, ϵ, randn(3))) for i in 1:N]
X2 = [exp(M, ϵ, hat(M, ϵ, 0.1.*randn(3))) for i in 1:N]
Expand Down