|
9 | 9 | """ |
10 | 10 | function sampleTangent end |
11 | 11 |
|
12 | | -# Sampling MKD |
13 | | -# function sampleTangent(M::AbstractDecoratorManifold, x::ManifoldKernelDensity, p = mean(x)) |
14 | | -# # get legacy matrix of coordinates and selected labels |
15 | | -# #TODO make sure that when `sample` is replaced in MKD, coordinates is a vector |
16 | | -# coords, lbls = sample(x.belief, 1) |
17 | | -# X = hat(x.manifold, p, coords[:]) |
18 | | -# return X |
19 | | -# end |
20 | | - |
21 | 12 | function sampleTangent(x::ManifoldKernelDensity, p = mean(x)) |
22 | | - Base.depwarn( |
23 | | - "sampleTangent(x::ManifoldKernelDensity, p) should be replaced by sampleTangent(M<:AbstractManifold, x::ManifoldKernelDensity, p)", |
24 | | - :sampleTangent, |
25 | | - ) |
26 | | - return sampleTangent(x.manifold, x, p) |
| 13 | + error("sampleTangent(x::ManifoldKernelDensity, p) should be replaced by sampleTangent(M<:AbstractManifold, x::ManifoldKernelDensity, p)") |
27 | 14 | end |
28 | 15 |
|
29 | 16 | # Sampling Distributions |
30 | 17 | # assumes M is a group and will break for Riemannian, but leaving that enhancement as TODO |
31 | 18 | function sampleTangent( |
32 | 19 | M::AbstractManifold, |
33 | | - z::Distribution, |
34 | | - p = getPointIdentity(M), |
| 20 | + z, |
| 21 | + p, |
35 | 22 | basis::AbstractBasis = DefaultOrthogonalBasis(), |
36 | 23 | ) |
37 | 24 | return get_vector(M, p, rand(z), basis) |
38 | 25 | end |
39 | 26 |
|
40 | | -# function sampleTangent( |
41 | | -# M::AbstractDecoratorManifold, |
42 | | -# z::Distribution, |
43 | | -# p = getPointIdentity(M), |
44 | | -# ) |
45 | | -# return hat(M, p, SVector{length(z)}(rand(z))) #TODO make sure all Distribution has length, |
46 | | -# # if this errors maybe fall back no next line |
47 | | -# # return convert(typeof(p), hat(M, p, rand(z, 1)[:])) #TODO find something better than (z,1)[:] |
48 | | -# end |
49 | | - |
50 | | -function sampleTangent(M::AbstractLieGroup, z::Distribution, p = getPointIdentity(M)) |
51 | | - return hat(LieAlgebra(M), SVector{length(z)}(rand(z)), typeof(p)) |
| 27 | +function sampleTangent(M::AbstractLieGroup, z, p = getPointIdentity(M)) |
| 28 | + return hat(LieAlgebra(M), SVector{manifold_dimension(M)}(rand(z)), typeof(p)) |
52 | 29 | end |
53 | 30 |
|
54 | 31 | function sampleTangent(M::typeof(LieGroups.CircleGroup()), z::Distribution, p = getPointIdentity(M)) |
55 | 32 | return hat(LieAlgebra(M), rand(z)) |
56 | 33 | end |
57 | 34 |
|
58 | | -function sampleTangent(M::AbstractLieGroup, z, p = getPointIdentity(M)) |
59 | | - return hat(LieAlgebra(M), rand(z), typeof(p)) |
60 | | -end |
61 | | - |
62 | 35 | function sampleTangent(M::AbstractLieGroup, x::ManifoldKernelDensity, p = mean(x)) |
63 | 36 | # get legacy matrix of coordinates and selected labels |
64 | 37 | #TODO make sure that when `sample` is replaced in MKD, coordinates is a vector |
65 | 38 | coords, lbls = sample(x.belief, 1) |
66 | | - X = hat(LieAlgebra(x.manifold), coords[:], typeof(p)) |
| 39 | + X = hat(LieAlgebra(M), coords[:], typeof(p)) |
67 | 40 | return X |
68 | 41 | end |
69 | 42 |
|
|
0 commit comments