Skip to content

reg_field/reg_flow: diag_bending omits fold-back term under folding boundary conditions #132

Description

@balbasty

Summary

diag_bending's (and diag_membrane's) computed diagonal does not equal the true M[i][i] of the materialized operator matrix under a folding boundary condition (e.g. DCT2): the diag_* family computes b00 - Σ m_k·f_k and omits the fold-back term +Σ_{k: n(k)=i} m_k that should apply when a folded neighbour lands back on the centre voxel.

Measured discrepancy: ~13.6 (2D, DCT2) / ~49.4 (3D, DCT2) for diag_bending; ~11.0 (2D, DCT2) / ~1.1 (3D?) for diag_membrane. Exact under DFT (diff ~3.6e-15), where no folding onto the centre occurs for the grid sizes tested.

Scope

This is pre-existing and general — it affects the plain (unweighted) diag_bending/diag_membrane, not something introduced by the RLS/JRLS work or by the fastfields/fastfields-kernels#38 self-adjointness fix. diag_bending_rls/_jrls inherit the identical mismatch (no better, no worse) from the plain operator.

Is this actually a bug?

Possibly intentional — diag_* is documented/used as a preconditioner diagonal for relaxation solvers, where an approximate diagonal (ignoring the fold-back correction) is a common and acceptable simplification, not a correctness requirement in the same sense as self-adjointness. Needs someone with more context on the original design intent to decide whether:

  1. This is a deliberate approximation (document it as such and close), or
  2. diag_* is meant to expose the exact matrix diagonal (e.g. for direct solvers or diagnostics) and needs the fold-back term added.

Reproduction

Materialize the full matvec_bending/matvec_membrane operator (unit impulses, no weight map) under DCT2 boundary on a small grid, compare M[i][i] against diag_bending(i)/diag_membrane(i) at boundary voxels where a neighbour folds back onto the centre.

Surfaced during the investigation for fastfields/fastfields-kernels#34 (bending RLS/JRLS self-adjointness); not folded into that fix (#38) since it's unrelated to self-adjointness and pre-dates the RLS/JRLS work entirely.

Workstream: claude-jitfields-to-fastfields

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions