From 4b110aa20032e2637055f3e8f237a206d249ae84 Mon Sep 17 00:00:00 2001 From: dehann Date: Wed, 4 Oct 2023 22:29:13 -0700 Subject: [PATCH] mini cleanup --- src/API.jl | 19 ++++++++++--------- src/services/ManifoldKernelDensity.jl | 9 +++++++-- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/API.jl b/src/API.jl index 2c61f0d..7757de2 100644 --- a/src/API.jl +++ b/src/API.jl @@ -112,18 +112,19 @@ function manifoldProduct( ff::AbstractVector{<:ManifoldKernelDensity}, ## TODO check both _ff and inplace use a matrix of coordinates (columns) # expects Matrix with columns as samples and rows are coordinate dimensions pGM, = prodAppxMSGibbsS(inplace, _ff, - nothing, nothing, Niter=Niter, - partialDimMask=partialDimMask, + nothing, nothing; + Niter, + partialDimMask, addop=addopT, diffop=diffopT, getMu=getManiMu, - glbs=glbs, - addEntropy=addEntropy, - ndims=ndims, - Ndens=Ndens, - Np=Np, - maxNp=maxNp, - Nlevels=Nlevels, + glbs, + addEntropy, + ndims, + Ndens, + Np, + maxNp, + Nlevels, randU=_randU, randN=_randN ); # diff --git a/src/services/ManifoldKernelDensity.jl b/src/services/ManifoldKernelDensity.jl index b6e4bf6..ae5ae03 100644 --- a/src/services/ManifoldKernelDensity.jl +++ b/src/services/ManifoldKernelDensity.jl @@ -187,7 +187,12 @@ Random.rand(mkd::ManifoldKernelDensity, N::Integer=1) = sample(mkd, N)[1] function resample(x::ManifoldKernelDensity, N::Int) - pts, = sample(x, N) + pts = if N < Npts(x) + shuffle(getPoints(x))[1:N] + else + _pts, = sample(x, N) + _pts + end ManifoldKernelDensity(x.manifold, pts, x._u0, partial=x._partial, infoPerCoord=x.infoPerCoord) end @@ -296,7 +301,7 @@ function antimarginal(newM::AbstractManifold, ipc = zeros(manifold_dimension(newM)) ipc[finalpartial] .= getInfoPerCoord(mkd, true) - manikde!(newM, nPts, u0, bw=bw, partial=finalpartial, infoPerCoord=ipc) + manikde!(newM, nPts, u0; bw, partial=finalpartial, infoPerCoord=ipc) end