Skip to content

refactor(linalg): Make Matrix and PSDMatrix public#673

Open
ValerianRey wants to merge 8 commits intomainfrom
public-linalg
Open

refactor(linalg): Make Matrix and PSDMatrix public#673
ValerianRey wants to merge 8 commits intomainfrom
public-linalg

Conversation

@ValerianRey
Copy link
Copy Markdown
Contributor

@ValerianRey ValerianRey commented May 8, 2026

Summary

  • Introduces a new public torchjd.linalg package exposing Matrix and PSDMatrix (the rest of _linalg stays protected)
  • Makes MatrixWeighting and GramianWeighting protected. These classes are still used to specify the docstring of the __call__ methods of the aggregators, but the user only sees those aggregators as Weighting[Matrix] and Weighting[PSDMatrix], respectively. The MatrixWeighting and GramianWeighting classes really just bring updated docstrings, that's all.
  • Makes the public type of the gramian_weighting of GramianWeightedAggregator be Weighting[PSDMatrix] instead of GramianWeighting, so that feat(aggregation): Add CRMOGMWeighting #669 can work. Similar with weighting of WeightedAggregator being Weighting[Matrix].
  • Expands docstrings on Matrix and PSDMatrix with Jacobian and Gramian examples; adds Sphinx documentation under a new linalg section in the API Reference

ValerianRey and others added 5 commits May 8, 2026 17:19
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…Weighting[Matrix]/Weighting[PSDMatrix]

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@ValerianRey
Copy link
Copy Markdown
Contributor Author

We either need to have both _linalg (protected) and linalg (public), or we could have _linalg and types, or _linalg and export those types to the torchjd package itself. @PierreQuinton I'd love your opinion on that.

…as private bases

These private intermediate classes give the `__call__` method a properly
named parameter (`matrix` or `gramian`) instead of the generic `stat`,
improving documentation for all concrete weighting subclasses.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@ValerianRey ValerianRey added cc: refactor Conventional commit type for any refactoring, not user-facing, and not typing or perf improvements package: linalg labels May 8, 2026
@ValerianRey ValerianRey changed the title feat(linalg): Make Matrix and PSDMatrix public, replace MatrixWeighting/GramianWeighting feat(linalg): Make Matrix and PSDMatrix public May 8, 2026
@ValerianRey ValerianRey marked this pull request as ready for review May 8, 2026 17:21
@ValerianRey ValerianRey requested review from a team and PierreQuinton as code owners May 8, 2026 17:21
@github-actions github-actions Bot changed the title feat(linalg): Make Matrix and PSDMatrix public refactor(linalg): Make Matrix and PSDMatrix public May 8, 2026
ValerianRey and others added 2 commits May 8, 2026 19:30
…oval and Matrix/PSDMatrix addition

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…the codebase

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cc: refactor Conventional commit type for any refactoring, not user-facing, and not typing or perf improvements package: linalg

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant