Skip to content
Draft
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
4 changes: 3 additions & 1 deletion src/Deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

"""
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/Interface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 7 additions & 7 deletions src/services/ManifoldKernelDensity.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down