Continuous SO(3) Probability Model for PFTC Assignment¶
Date: May 10, 2026
Status: Rejected (filed 2026-10-20). Never implemented; no continuous SO(3) candidate generator was adopted, and the continuous pose route is refine=cont (see ../completed/continuous_3D_refinement_on_pcg_operator.md). Kept as the record of the idea. Original status: design note / first-draft implementation plan.
Purpose¶
The current eul_prob classes define a probabilistic model over discrete reference points on SO(3). In practice, they build particle-reference score tables over an Euler-space grid, optionally sparsify the grid through neighborhoods, then perform global stochastic assignment from those evaluated entries.
This note explores a continuous alternative: represent the particle-local orientation uncertainty as a proposal distribution on SO(3), sample a small set of trial orientations from that distribution, extract polar central sections from the current reference volume on the fly, evaluate those sections with the existing PFTC objective, and feed the evaluated trials into a global sparse assignment step.
The immediate goal is not to analytically integrate over SO(3). The recommended first goal is a continuous sparse candidate generator whose outputs are evaluated and assigned using the same objective semantics SIMPLE already trusts.
Current Code Shape¶
The relevant existing implementation is concentrated in:
src/main/strategies/search/probabilistic/simple_eul_prob_tab.f90- dense probability-table construction over active discrete projection references
fill_tabref_assignref_score_tabread_tab_to_globwrite_assignmentsrc/main/strategies/search/probabilistic/simple_eul_prob_tab_neigh.f90- sparse neighborhood probability-table construction
fill_tab_neighrecord_sparse_evalwrite_tab_neighread_sparse_tab_to_globref_assign_neighsrc/main/strategies/search/probabilistic/simple_eul_prob_tab_utils.f90- distance/correlation conversion
- bounded and power sampling utilities
- seeded shift materialization
src/main/pftc/simple_polarft_corr.f90- exact PFTC objective evaluation once a reference PFT exists
src/main/image/simple_projector_pft_batch.f90- batched extraction of discrete reference polar sections
src/main/pftc/simple_polarft_core.f90- production
vol_pad2ref_pftsownership of reference-section extraction src/main/strategies/search/probabilistic/simple_strategy3D_prob.f90- consumption of probability-table assignments during search/update
src/main/strategies/search/simple_strategy3D_matcher.f90- partition-level probabilistic assignment use and matcher integration
The dense class stores candidates as loc_tab(ri,i), where ri maps to a fixed (state, iproj) reference. The neighborhood class keeps this same reference identity but stores only touched entries using eval_touched_refs.
A continuous candidate cannot be represented fully by only ri, because its orientation may not coincide with any fixed iproj. It may still need a nearest iproj for legacy bookkeeping, but its actual orientation must be carried explicitly.
Proposed Model¶
For particle i, define a proposal distribution on SO(3):
q_i(R, s) = mixture of local orientation kernels
where:
Ris a continuous orientation.sis the state.- mixture centers come from previous assignments, coarse discrete candidates, sparse neighborhood representatives, or random exploration.
- mixture widths describe current uncertainty in projection direction and optionally in-plane angle.
The continuous proposal is used to generate a small candidate set:
C_i = { (state, R_sample, proposal_weight) }
Each sampled candidate is then evaluated exactly:
- Extract a polar central section from the current state volume at
R_sample. - Evaluate all in-plane rotations using the existing PFTC objective.
- Optionally sample or maximize the in-plane rotation using the existing probabilistic in-plane policy.
- Optionally run existing continuous shift refinement for top candidates.
- Store the evaluated candidate in a sparse table.
- Perform global assignment over sparse evaluated candidates.
This makes the continuous distribution a candidate-generation model first. A later implementation can use proposal-density correction to approximate a true posterior over SO(3).
Proposal Parameterization¶
Avoid Euler-space Gaussians. They are singular and geometry-dependent.
The recommended first parameterization is a local tangent-plane distribution around one or more orientation centers:
R_sample = exp([delta]x) * R_center
delta = a*u + b*v
where u and v are tangent directions for the local projection direction. In-plane rotation can remain discrete through the current PFTC all-rotation evaluation.
Reasonable first kernels:
- tangent-plane Gaussian around previous orientation
- tangent-plane Gaussian around top coarse discrete references
- wider heavy-tailed tangent proposal for exploration
- state-specific mixtures built from top candidates per state
Longer-term kernels could include:
- von Mises-Fisher or Kent-like distributions on projection direction
- Bingham-like antipodal kernels where projection-direction sign or mirror symmetry matters
- a factorized
S2 projection direction x S1 in-planemodel - a full SO(3) kernel if an implementation need emerges
For a first implementation, keep in-plane rotation discrete and let PFTC select or probabilistically sample it.
Assignment Semantics¶
There are two possible interpretations.
Proposal Model First¶
The continuous distribution only proposes candidates. Final assignment uses evaluated distances exactly as current sparse assignment does.
This is the recommended first path because:
- it preserves SIMPLE's current hard-assignment workflow
- it avoids requiring correct SO(3) quadrature weights immediately
- it is easier to compare directly against
eul_prob_tab_neigh - it keeps global sparse assignment conceptually intact
True Posterior Approximation Later¶
Candidate weights can later include proposal-density correction:
weight(R) proportional to likelihood(X_i | R, s) * prior(R, s) / q_i(R, s)
This would move the code closer to importance sampling on SO(3). It is more statistically complete, but it introduces new responsibilities:
- evaluate or approximate
q_i(R,s) - define orientation/state priors
- handle repeated or nearby samples
- normalize candidate weights without biasing states or proposal centers
This should not be the first implementation.
Sparse Candidate Representation¶
The current ptcl_ref structure stores:
pind, istate, iproj, inpl, dist, x, y, has_sh
A continuous candidate needs at least:
pind
istate
nearest_iproj or source_iproj
continuous orientation, preferably e1/e2/e3 or a rotation representation
inpl
dist
x, y, has_sh
proposal metadata, optional
There are two implementation options.
Option A: Sidecar Orientation Arrays¶
Keep ptcl_ref for most existing assignment data and add parallel arrays in a new continuous sparse class:
loc_tab-like ptcl_ref candidate values
candidate_eulers(3, max_candidates, nptcls)
candidate_weights(max_candidates, nptcls)
candidate_source(max_candidates, nptcls)
This is less invasive and is preferred for a prototype.
Option B: New Candidate Type¶
Define a sibling type, for example:
type :: ptcl_cont_ref
integer :: pind = 0
integer :: istate = 0
integer :: iproj_nearest = 0
integer :: inpl = 0
real :: eul(3) = 0.
real :: dist = huge(1.0)
real :: x = 0.
real :: y = 0.
real :: proposal_logw = 0.
logical :: has_sh = .false.
end type
This is cleaner long term but touches more I/O and assignment code.
First-Draft Algorithm¶
For each particle:
- Read previous orientation and state from
spproj_field. - Estimate a seed shift using the previous assignment, as current
fill_tabandfill_tab_neighalready do. - Build proposal centers:
- previous orientation
- top coarse discrete references from a cheap sweep or subspace sweep
- optional random global orientations for exploration
- optional state-specific centers
- For each proposal center:
- sample
mtangent-plane perturbations - convert each perturbation to a full orientation
- reject or fold through symmetry if needed
- For each sampled orientation:
- extract a temporary polar central section from the current state volume
- evaluate all in-plane rotations using existing PFTC scoring
- sample or select in-plane rotation
- store distance and orientation in a sparse candidate list
- Refine shifts for the top candidates per particle/state using existing
pftc_shsrch_gradlogic when possible. - Write sparse candidate files for partitions.
- Read all sparse candidate files into a global object.
- Perform global sparse assignment over evaluated continuous candidates.
- Write an assignment map carrying the accepted continuous orientation, in-plane rotation, state, shift, and distance.
The first version should only use continuous candidates after a coarse discrete or sparse neighborhood pass. That preserves global coverage while testing whether continuous SO(3) sampling can reduce the number of exact section evaluations.
Integration Strategy¶
The least risky implementation path is a sibling class:
simple_eul_prob_tab_cont
or, if the first version is explicitly neighborhood-driven:
simple_eul_prob_tab_neigh_cont
Recommended ownership:
eul_prob_tab_contowns sampled candidate lists, candidate I/O, and global assignment.- A small SO(3) proposal helper owns tangent sampling and mixture-center generation.
projector/PFTC remain numerical engines and should not own probabilistic policy.- Existing matcher/strategy code should consume the final assignment map without caring whether the candidate came from a grid point or a continuous sample.
The new class can reuse:
- seed-shift handling from
eul_prob_tab - sparse touched-candidate concepts from
eul_prob_tab_neigh - sparse graph assignment structure from
ref_assign_neigh - distance conversion utilities from
simple_eul_prob_tab_utils
It should avoid reusing:
rias the sole candidate identitynrefsas the number of candidate alternatives- global arrays shaped as
(nrefs,nptcls)for continuous candidate data
Normalization and Bias Control¶
Continuous candidates create a new normalization issue: each particle may have a different number and distribution of sampled orientations.
For the first proposal-model implementation:
- Convert raw objective to distance exactly as now.
- Normalize only over candidates evaluated for the same particle.
- Keep state assignment from being biased by unequal candidate counts across states.
- If sampling per state is unequal, assign state priors or normalize the best candidates per state before global assignment.
For later importance-sampling semantics:
score = objective_distance - log_prior + log_proposal
or an equivalent likelihood-weight form could be introduced. This should be deferred until the proposal-model path is validated.
First-Draft Implementation Plan¶
Draft 0: Continuous Candidate Data Model Only¶
Purpose: make the assignment pipeline capable of carrying continuous orientations without changing how candidates are generated.
Implementation:
- Add a prototype continuous sparse candidate type or sidecar orientation arrays.
- Generate candidates at exact existing grid orientations.
- Write/read sparse candidate files.
- Assign globally.
- Confirm output assignments match or closely reproduce the discrete sparse path.
Expected result:
- The continuous assignment representation should be able to emulate current sparse grid assignment.
Draft 1: Tangent Samples Around Previous Orientation¶
Purpose: test on-the-fly sampled section extraction without needing a coarse proposal mixture.
Implementation:
- For each particle/state, sample a small number of orientations around the previous orientation.
- Extract polar sections on-the-fly.
- Evaluate with PFTC.
- Assign from the sampled candidate list.
Expected result:
- On synthetic data with small pose perturbations, sampled candidates should improve or preserve assignment quality.
- On broad uncertainty cases, performance may be poor; this is expected because the proposal is too local.
Draft 2: Coarse-Discrete Mixture Proposal¶
Purpose: combine global discrete coverage with continuous local exploration.
Implementation:
- Use a cheap discrete sweep or existing neighborhood/subspace sweep to identify
Kcenters per particle/state. - Around each center, sample
mtangent perturbations. - Keep total exact section evaluations bounded by
K*m. - Optionally include previous orientation as a persistent mixture center.
Expected result:
- For the same number of evaluated candidates, continuous samples should outperform fixed neighborhood grid candidates when the true orientation lies between grid points.
- This draft is the first serious comparison against
eul_prob_tab_neigh.
Draft 3: Sparse Global Assignment Over Continuous Candidates¶
Purpose: replace ref -> particle sparse graph assumptions with candidate-based sparse assignment.
Implementation:
- Build a candidate graph where each particle has
M_ievaluated candidates. - If global balancing by reference is still desired, define candidate groups by nearest projection reference or state.
- Otherwise perform per-particle stochastic assignment with optional state balancing.
- Preserve fallbacks for particles with no valid candidates.
Expected result:
- Assignments should remain robust when candidate sets differ per particle.
- The accepted orientation must be the continuous sampled orientation, not only the nearest grid reference.
Draft 4: Optional Proposal-Density Correction¶
Purpose: move from candidate-generation semantics toward true continuous probabilistic inference.
Implementation:
- Track mixture component and proposal log-density for each sample.
- Define a prior over state/orientation.
- Adjust candidate weights by
prior / proposal. - Compare assignments with and without correction.
Expected result:
- Correction should matter only when proposal densities are highly nonuniform.
- If it destabilizes assignment, keep it disabled until the proposal model is better calibrated.
Tests and Validation¶
Unit-Level Tests¶
- Tangent sampler geometry
- Sample many perturbations around a known orientation.
- Verify angular displacement distribution matches requested width.
-
Verify no Euler singularity behavior near poles.
-
Symmetry folding
- For cyclic/dihedral/symmetric cases, verify equivalent orientations are handled consistently.
-
Confirm nearest-grid bookkeeping remains stable.
-
Grid-emulation test
- Create continuous candidates exactly at grid orientations.
-
Verify assignment output matches the sparse discrete path within expected stochastic variation.
-
Sparse candidate I/O
- Write and read continuous candidate files.
-
Verify particle ids, states, continuous Euler angles, in-plane indices, shifts, and distances survive round-trip.
-
Candidate normalization
- Test equal and unequal candidate counts per state.
- Verify assignment is not biased simply because one state has more samples.
Synthetic Integration Tests¶
- Known orientation, between grid points
- Generate particles from known orientations deliberately placed between discrete projection directions.
- Compare:
- discrete
eul_prob - sparse neighborhood
eul_prob - continuous proposal samples
- discrete
-
Measure angular error and objective score.
-
Fixed evaluation budget
- Hold the number of exact PFTC evaluations constant.
-
Compare fixed grid neighborhood candidates versus continuous samples around coarse centers.
-
Coarse grid plus continuous proposal
- Run a coarse global grid with continuous local sampling.
- Compare against the normal dense grid.
-
Measure runtime, orientation accuracy, and reconstruction quality.
-
Multimodal ambiguity
- Construct or select particles with ambiguous orientations.
-
Verify mixture proposals preserve multiple modes rather than collapsing immediately to previous assignment.
-
State movement
- In a multi-state case, verify continuous proposal assignment can move particles between states without being dominated by sample-count imbalance.
Performance Measurements¶
Measure:
- number of on-the-fly section extractions per particle
- cost per extracted continuous section
- cost per PFTC all-in-plane evaluation
- cost of shift refinement per accepted/top candidate
- total assignment-table I/O size
- global sparse assignment time
- accuracy/runtime tradeoff versus
eul_prob_tab_neigh
The important comparison is:
same or lower evaluation count, better orientation accuracy
not simply higher score after adding more candidates.
Design Risks¶
- Proposal collapse
- If samples are drawn only near the previous orientation, the model may fail to escape bad assignments.
-
Mitigation: use mixture centers from coarse discrete candidates and include occasional broad exploration.
-
Sample-count bias across states
- More samples in one state can create unfair assignment opportunities.
-
Mitigation: equalize candidate budgets per state or normalize state candidates carefully.
-
Loss of global sparse assignment semantics
- Existing
ref_assign_neighuses active references as graph anchors. -
Continuous candidates need a candidate-based graph or a well-defined grouping by nearest reference/state.
-
I/O and assignment-map compatibility
- Downstream code expects assignment records that can be converted into
orifields. -
Mitigation: keep nearest
iprojfor compatibility but store and apply actual continuous Euler angles. -
Symmetry ambiguity
- Continuous sampling near symmetry-equivalent orientations can duplicate candidates.
-
Mitigation: fold or deduplicate samples under the point group where possible.
-
On-the-fly extraction cost
- Continuous candidates cannot rely on precomputed full reference banks.
- Mitigation: sample small candidate sets and compare against reduced discrete grids, not against zero-cost references.
Recommended First Milestone¶
The first useful milestone is:
- Add a continuous sparse candidate representation that can emulate current sparse grid candidates.
- Run a grid-emulation assignment test.
- Add tangent sampling around previous orientation for a synthetic known-orientation case.
- Compare orientation error before and after continuous sampled candidates.
Only after this works should we add coarse-discrete mixture centers and performance comparisons against eul_prob_tab_neigh.
Long-Term Direction¶
If validated, the eul_prob family could evolve from:
probability table over fixed projection references
to:
particle-local SO(3) proposal model -> sparse exact PFTC evaluations -> global assignment
This would keep SIMPLE's current strengths:
- exact PFTC evaluation once a polar section exists
- stochastic hard assignment
- compatibility with state and shift refinement workflows
- sparse global assignment for distributed execution
while introducing a true continuum over SO(3) where it matters: candidate generation.