Skip to content

Optimize DnonDn forward pass and increase test coverage to 96%#38

Merged
johmathe merged 1 commit intomainfrom
johmathe/optimize-dnondn-and-coverage
May 7, 2026
Merged

Optimize DnonDn forward pass and increase test coverage to 96%#38
johmathe merged 1 commit intomainfrom
johmathe/optimize-dnondn-and-coverage

Conversation

@johmathe
Copy link
Copy Markdown
Collaborator

@johmathe johmathe commented May 7, 2026

Summary

  • DnonDn optimization: Eliminated the Python for-loop in DnonDn.forward by precomputing Fplus gather indices, using a single einsum for Kronecker products, and a batched matmul chain. Achieves 4.4x speedup (2.41ms → 0.55ms).
  • Test coverage: Added tests/test_coverage_gaps.py with 39 edge-case tests targeting _bessel, _cg, dn_on_dn, so3_on_s2, octa_on_octa, rotation, and torus_on_torus. Overall coverage: 91% → 96%.
  • Minor fix in so3_on_s2.py for selective bispectrum edge case.

Test plan

  • All pre-commit hooks pass
  • pytest tests/ -x passes on CI
  • Coverage report confirms ≥96%

Made with Cursor

- Eliminate Python for-loop in DnonDn.forward by batching all CG-transformed
  bispectrum computations: precomputed Fplus gather indices, single einsum for
  kron products, batched matmul chain. Speedup: 2.41ms -> 0.55ms (4.4x).
- Add test_coverage_gaps.py with 39 edge-case tests covering _bessel, _cg,
  dn_on_dn, so3_on_s2, octa_on_octa, rotation, and torus_on_torus modules.
- Overall test coverage: 91% -> 96%.

Co-authored-by: Cursor <cursoragent@cursor.com>
@johmathe johmathe merged commit 5d19af1 into main May 7, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant