diff --git a/src/Deprecated.jl b/src/Deprecated.jl index 4a11d7f..d9cb80a 100644 --- a/src/Deprecated.jl +++ b/src/Deprecated.jl @@ -4,6 +4,8 @@ ## Remove below before v0.6 ## ====================================================================================================== +@deprecate sample(x::ManifoldKernelDensity, N::Int) [sample(x, identity_element(x.manifold, x._u0), false)[1] for _ in 1:N] + export productbelief """ @@ -45,7 +47,7 @@ end # end -@deprecate calcVariableCovarianceBasic(M::AbstractManifold, vecP::Vector{P}) where P calcCovarianceBasic(M, vecP) +@deprecate calcVariableCovarianceBasic(M::AbstractManifold, vecP::AbstractVector{P}) where P calcCovarianceBasic(M, vecP) ## ====================================================================================================== ## Remove below before v0.5 diff --git a/src/Interface.jl b/src/Interface.jl index 6b98455..46a2a02 100644 --- a/src/Interface.jl +++ b/src/Interface.jl @@ -33,6 +33,8 @@ function makeCoordsFromPoint( M::MB.AbstractManifold, pt::P ) where P # # only works for manifold which have an identity (eg groups) + # @show M + # @show pt ϵ = identity_element(M, pt) vee(M, ϵ, log(M, ϵ, pt)) end diff --git a/src/services/ManifoldKernelDensity.jl b/src/services/ManifoldKernelDensity.jl index c34bd44..10a9997 100644 --- a/src/services/ManifoldKernelDensity.jl +++ b/src/services/ManifoldKernelDensity.jl @@ -228,17 +228,17 @@ end # TODO check that partials / marginals are sampled correctly -function sample(x::ManifoldKernelDensity{M,B,L,P}, N::Int) where {M,B,L,P} +function sample(x::ManifoldKernelDensity{M,B,L,P}, p::T=mean(x), as_tangent::Bool=true) where {M,B,L,P,T} # get legacy matrix of coordinates and selected labels - coords, lbls = sample(x.belief, N) + coords, lbls = sample(x.belief,1) - # pack samples into vector of point type P - vecP = Vector{P}(undef, N) - for j in 1:N - vecP[j] = makePointFromCoords(x.manifold, view(coords, :, j), x._u0) + X = hat(x.manifold, p, coords) + if as_tangent + return X, lbls end - vecP, lbls + # or return full point + return exp(x.manifold, p, X), lbls end Random.rand(mkd::ManifoldKernelDensity, N::Integer=1) = sample(mkd, N)[1]