Skip to content

Commit 4473045

Browse files
authored
Merge pull request #1750 from JuliaRobotics/23Q3/fix/priorispart
fix ispartial case on AbstractPrior
2 parents ab63b31 + b3c625e commit 4473045

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

src/services/EvalFactor.jl

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -454,11 +454,16 @@ function evalPotentialSpecific(
454454
ret
455455
end
456456

457+
# TODO consider improving isPartial(ccwl<:AbstractPrior) to also check dimensions since we know pretty well what varDim is.
458+
# TODO workaround until partial manifold approach is standardized, see #1492
459+
Msrc = getManifold(fnc)
460+
asPartial = isPartial(ccwl) || manifold_dimension(Msrc) < manifold_dimension(mani)
461+
457462
# view on elements marked for nullhypo
458463
addEntrNH = view(addEntr, nhmask)
459464
spreadDist = spreadNH * calcStdBasicSpread(getVariableType(variables[sfidx]), addEntr)
460465
# partials are treated differently
461-
ipc = if !isPartial(ccwl) #ccwl.partial
466+
ipc = if !asPartial # isPartial(ccwl) #ccwl.partial
462467
# TODO for now require measurements to be coordinates too
463468
# @show typeof(ccwl.measurement[1])
464469
for m in (1:length(addEntr))[ahmask]
@@ -473,7 +478,12 @@ function evalPotentialSpecific(
473478
ones(getDimension(variables[sfidx]))
474479
else
475480
# FIXME but how to add partial factor info only on affected dimensions fro general manifold points?
476-
pvec = [fnc.partial...]
481+
# pvec
482+
partialCoords = if hasfield(typeof(fnc), :partial)
483+
ccwl.partialDims # [fnc.partial...]
484+
else
485+
collect(1:manifold_dimension(Msrc))
486+
end
477487

478488
if !hasmethod(getManifold, (typeof(fnc),))
479489
@debug "No method getManifold for $(typeof(fnc)), using getManifoldPartial"
@@ -484,13 +494,13 @@ function evalPotentialSpecific(
484494
# addEntr is no longer in coordinates, these are now general manifold points!!
485495
# for (i,dimnum) in enumerate(fnc.partial)
486496
# FIXME, need ability to replace partial points
487-
partialCoords = ccwl.partialDims
497+
# partialCoords = ccwl.partialDims
488498

489499
#FIXME check if getManifold is defined otherwise fall back to getManifoldPartial, JT: I would like to standardize to getManifold
490500
if hasmethod(getManifold, (typeof(fnc),))
491-
Msrc = getManifold(fnc)
492-
# TODO workaround until partial manifold approach is standardized, see #1492
493-
asPartial = isPartial(fnc) || manifold_dimension(Msrc) < manifold_dimension(mani)
501+
# Msrc = getManifold(fnc)
502+
# # TODO workaround until partial manifold approach is standardized, see #1492
503+
# asPartial = isPartial(fnc) || manifold_dimension(Msrc) < manifold_dimension(mani)
494504

495505
setPointPartial!(
496506
mani,
@@ -520,10 +530,10 @@ function evalPotentialSpecific(
520530
# null hypo mask that needs to be perturbed by "noise"
521531
addEntrNHp = view(addEntr, nhmask)
522532
# ongoing part of RoME.jl #244
523-
addEntropyOnManifold!(mani, addEntrNHp, 1:getDimension(mani), spreadDist, pvec)
533+
addEntropyOnManifold!(mani, addEntrNHp, 1:getDimension(mani), spreadDist, partialCoords) # pvec
524534
# do info per coords
525535
ipc_ = zeros(getDimension(variables[sfidx]))
526-
ipc_[pvec] .= 1.0
536+
ipc_[partialCoords] .= 1.0 # pvec
527537
ipc_
528538
end
529539

0 commit comments

Comments
 (0)