From 5efed8df5bf07ad5ecd78dc6a1900c5edf7e0126 Mon Sep 17 00:00:00 2001 From: dehann Date: Sun, 3 Sep 2023 19:41:24 -0700 Subject: [PATCH] tweaks and updates Mtree --- src/ApproxManifoldProducts.jl | 2 +- src/services/ManellicTree.jl | 18 ++++++++++-------- test/manellic/testManellicTree.jl | 5 ++++- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/src/ApproxManifoldProducts.jl b/src/ApproxManifoldProducts.jl index 853247b..dd7f32c 100644 --- a/src/ApproxManifoldProducts.jl +++ b/src/ApproxManifoldProducts.jl @@ -29,7 +29,7 @@ using Distributions import Random: rand -import Base: *, isapprox, convert +import Base: *, isapprox, convert, show import LinearAlgebra: rotate! import Statistics: mean, std, cov, var import KernelDensityEstimate: getPoints, getBW diff --git a/src/services/ManellicTree.jl b/src/services/ManellicTree.jl index 0308d86..e4b5ed0 100644 --- a/src/services/ManellicTree.jl +++ b/src/services/ManellicTree.jl @@ -18,27 +18,29 @@ # Short for Manifold Ellipse Metric Tree # starting as a balanced tree, relax to unbalanced in future. -struct ManellicTree{M,H,D<:AbstractVector,N} +struct ManellicTree{M,D<:AbstractVector,N,HL,HT} manifold::M data::D permute::MVector{N,Int} - leaf_kernels::MVector{N,H} - tree_kernels::MVector{N,H} + leaf_kernels::MVector{N,HL} + tree_kernels::MVector{N,HT} left_idx::MVector{N,Int} right_idx::MVector{N,Int} end -function Base.show(io::IO, mt::ManellicTree{M,H,D,N}) where {M,H,D,N} +function Base.show(io::IO, mt::ManellicTree{M,D,N,HL,HT}) where {M,D,N,HL,HT} printstyled(io, "ManellicTree{"; bold=true,color = :blue) println(io) - printstyled(io, " M = ", M, color = :magenta) + printstyled(io, " M = ", M, color = :magenta) println(io) - printstyled(io, " H = ", H, color = :magenta) + printstyled(io, " D = ", D, color = :magenta) println(io) - printstyled(io, " D = ", D, color = :magenta) + printstyled(io, " N = ", N, color = :magenta) println(io) - printstyled(io, " N = ", N, color = :magenta) + printstyled(io, " HL = ", HL, color = :magenta) + println(io) + printstyled(io, " HT = ", HT, color = :magenta) println(io) printstyled(io, "}", bold=true, color = :blue) println(io, "(") diff --git a/test/manellic/testManellicTree.jl b/test/manellic/testManellicTree.jl index 705fac2..d86297a 100644 --- a/test/manellic/testManellicTree.jl +++ b/test/manellic/testManellicTree.jl @@ -38,10 +38,13 @@ end ## M = TranslationGroup(2) -r_CC, R, pidx, r_CV = testEigenCoords(pi/3); +α = pi/3 +r_CC, R, pidx, r_CV = testEigenCoords(α); ax_CCp, mask, knl = splitPointsEigen(M, r_CC) @test sum(mask) == (length(r_CC) ÷ 2) @test knl isa MvNormal +Mr = SpecialOrthogonal(2) +@test isapprox( α, vee(Mr, Identity(Mr), log_lie(Mr, R))[1] ; atol=0.1) # using GLMakie # fig = Figure()