Update main - #12
Merged
Merged
Conversation
… blocks and improve stability
Contributor
☂️ Python Coverage
Overall Coverage
New FilesNo new covered files... Modified Files
|
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.
Description
This pull request introduces significant enhancements to the Rust backend and the PyTorch interface for computing the Pfaffian, primarily by adding support for half-precision (float16) and complex (complex64/complex128) matrix types, improving numerical stability and flexibility. The build workflow is also refactored to better separate versioning, building, and publishing steps. Additionally, the PyTorch block determinant strategy now computes correct gradients for singular blocks, ensuring differentiability for all inputs.
Rust backend: extended precision and type support
float16(half-precision) and complex (complex64,complex128) types to the Pfaffian computation, including trait implementations, new kernel functions (signed_pfaffian_f16,signed_pfaffian_c64,signed_pfaffian_c128), and tests for correctness and edge cases. [1] [2] [3] [4] [5] [6] [7] [8]Build and CI workflow improvements
PyTorch interface and documentation
Block determinant strategy: improved gradient for singular blocks
PfaffianBlockDetto compute the correct gradient for singular blocks using the cofactor matrix (adjugate), ensuring finite and accurate derivatives even when the block is not invertible. Added a helper method_cofactor_matrixfor this computation.These changes collectively increase the precision, robustness, and usability of the Pfaffian computation library across a wider range of input types and edge cases.
Checklist
Please complete the following checklist when submitting a PR. The PR will not be reviewed until all items are checked.
Make sure that the tests passed and the coverage is
sufficient by running
uv run pytest --session-timeout=600.You can do this by running
uvx pre-commit run --all-files.You can do this by running
uv run mypy src tests.