Repository navigation
Conversation
Points the feectools submodule to the kron-stencil-matmul branch (KroneckerStencilMatrix @, factors on groups of axes, factor_ndims in KroneckerLinearSolver; feectools 0.6.0). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Split the construction of the Kronecker approximation into module-level helpers (boundary conditions, MPI weight gathering, 1d weight, 1d mass matrix + bcs, 1d solver, process-local 1d factor, block-diagonal assembly, operator to invert); MassMatrixDiagonalPreconditioner reuses them instead of a copy of the same code. - Vectorized copy into the process-local 1d stencil matrix; block-diagonal operators no longer hard-coded to 3 components. - Docstrings, comments and type annotations. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- New option weight_reduction="midpoint" (default, unchanged results) or "average" (mean of the weight over the other two directions; Gauss quadrature of the derham for array weights, 16-point Gauss-Legendre for callables). Array weights are reduced with a single Allreduce instead of a subcommunicator + Bcast. - Locate the mass matrix in the composed operator by identity and apply the approximate inverse exactly there (shared _apply_composed for both preconditioners); previously a left-most mass matrix was applied instead of inverted. - FFTSolver: copy the column (it was a view of the matrix used for the stencil factor) and stabilize a singular matrix once at construction. - Vectorized is_circulant. - Tests: weight_reduction in the transpose and MPI array-weight tests, new test of the reduced 1d weights against analytic values. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Rename uses of ComposedLinearOperator.multiplicants to multiplicands (preconditioner, projectors, multigrid coarsening, comments). - linop_nbytes: sum over all child attributes, so that the factors of a ComposedKroneckerStencilMatrix (multiplicands and mats) are counted. - Bump feectools to the commit with ComposedKroneckerStencilMatrix. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Points the
feectoolssubmodule to the branch of struphy-hub/feectools#100, so that the struphy test suite runs against it before that PR is merged.struphy-hub/feectools#100 changes
KroneckerStencilMatrixandKroneckerLinearSolver:A @ Breturns a newComposedKroneckerStencilMatrix(operands inmultiplicands, exact Kronecker factors of the product inmats);ComposedLinearOperator.multiplicants→multiplicands, with a deprecated alias;factor_ndimsinKroneckerLinearSolver;Existing calls are unchanged, so struphy needs no code changes. struphy builds these objects in
feec/preconditioner.py(MassMatrixPreconditioner) andfeec/projectors.py.multiplicants→multiplicandsmultiplicands.linop_nbytesinfeec/memory.pyadds up all child attributes, so aComposedKroneckerStencilMatrixcounts both its operands and the factors of the product.Refactor of
MassMatrixPreconditionerfeec/preconditioner.py. They cover the boundary conditions, gathering array weights over MPI, the 1d weight, the 1d mass matrix and its BCs, the 1d solver, the process-local 1d factor, the block-diagonal assembly and the operator to invert.MassMatrixDiagonalPreconditionernow calls these helpers instead of repeating the same ~200 lines.MassMatrixPreconditioner: new option and fixesweight_reduction="midpoint" | "average"sets how the weight is reduced to 1d in the directions other thandim_reduce. The default"midpoint"gives the same results as before, verified for M0, M1, M2, Mv, M1n and array weights, serially and on 2 ranks."average"uses the mean over those directions: Gauss quadrature of the Derham for array weights, 16-point Gauss–Legendre for callables.Allreduce, instead of a subcommunicator plusBcast._apply_composed). Before, a mass matrix in the left-most position was applied instead of inverted.FFTSolvercopies its column, which was a view of the dense matrix also used for the stencil factor. It now stabilises a singular matrix once, at construction.is_circulantis vectorized.PCG iterations (tolerance 1e-8) on HollowTorus, grid 12×16×6, degree (2,3,2), as a reference for choosing
weight_reduction:On HollowCylinder both need 2 iterations for every matrix.
Tests
Run locally with the submodule branch: the
MassMatrixPreconditionertests (test_preconditioner_transpose.py,test_mass_matrices.py::test_mass_preconditioner*, the newtest_reduced_weight_1d) pass serially and on 2 ranks (24 passed each). The rest is left to CI.Don't raise the
feectoolspin inpyproject.tomluntil 0.6.0 is on PyPI. Before merging, the submodule pointer should move to the mergeddevel-tinycommit.🤖 Generated with Claude Code