Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Corrections in .normalize_basis_at_p and .maximal_order() of quaternion_algebra.py #37644

Merged
merged 5 commits into from
Apr 12, 2024

Conversation

S17A05
Copy link
Member

@S17A05 S17A05 commented Mar 21, 2024

  • Corrected in .normalize_basis_at_p the wrong assignments of f0, f1: The idea is to replace f0 by f0 + f1 and f1 by f0 simultaneously - the original code, however, first replaced f0 by f0 + f1 and then copied the value to f1, hence causing a decrease in dimension
  • Corrected an index error just before the recursive call of normalize_basis_at_p in the off-diagnonal case for p = 2 (the else-block)
  • In .maximal_order() the intermediate basis e_n might not define an order anymore (as seen in the comments, this was known to the author(s) of the method) - therefore we need to manually compute the discriminant in the loop instead of relying on the .discriminant()-method of quaternion orders
  • Adapted an example in .maximal_order() to use the new method .is_maximal()

Fixes #37217 (both parts) and #37417.

Disclaimer:
I am aware of #37239, but since progress on that PR seems to have halted, I took the liberty to fix the issues myself :)

... and additional fix in `.maximal_order()`.

Amend: Added a space in docstring
@S17A05
Copy link
Member Author

S17A05 commented Mar 22, 2024

The two failures in the Conda Build & Test are unrelated, see #36939 and #37426.

... plus small refactoring of code
S17A05 and others added 2 commits April 5, 2024 21:20
- Blank spaces in error warning
- Matrix definition
- List comprehension for discriminant computation, also updated in `.discriminant()` of an order
Copy link

github-actions bot commented Apr 5, 2024

Documentation preview for this PR (built with commit 792a98c; changes) is ready! 🎉

Copy link
Contributor

@mkoeppe mkoeppe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@vbraun vbraun merged commit adb7605 into sagemath:develop Apr 12, 2024
15 of 16 checks passed
@S17A05 S17A05 deleted the normalize_maximal_fix branch April 12, 2024 23:04
@mkoeppe mkoeppe added this to the sage-10.4 milestone Apr 12, 2024
vbraun pushed a commit to vbraun/sage that referenced this pull request Apr 20, 2024
… to extend a given order

    
1. Added an optional argument `order_basis` to `.maximal_order()` to
allow for extension of orders: If `order_basis` defines an order of the
given quaternion algebra, then the method now returns a maximal order
that contains the order specified by the given basis.
~~2. Added comparison functions `__le__`, `__ge__`, `__lt__` and
`__gt__` for quaternion orders.~~
~~3. Small edits of the comparison functions `__eq__` and `__ne__` for
quaternion orders.~~
2.  Added a general comparison function `__richcmp__` for quaternion
orders and removed the explicit implementation of `__eq__` and `__ne__`.

More details on 1.:
The algorithm used in `.maximal_order()` currently uses the standard
basis `(1,i,j,k)` as a starting basis, but it extends to any starting
basis whose first entry is equal to `1`. Using the helper method
`basis_for_quaternion_lattice`, we transform any quaternion order basis
input by the user to a basis of this form.

Depends on sagemath#37644: Naturally, the extended algorithm can only work
correctly if the base algorithm works correctly in the first place.
    
URL: sagemath#37675
Reported by: Sebastian A. Spindler
Reviewer(s): Sebastian A. Spindler, Travis Scrimshaw
vbraun pushed a commit to vbraun/sage that referenced this pull request Apr 25, 2024
… to extend a given order

    
1. Added an optional argument `order_basis` to `.maximal_order()` to
allow for extension of orders: If `order_basis` defines an order of the
given quaternion algebra, then the method now returns a maximal order
that contains the order specified by the given basis.
~~2. Added comparison functions `__le__`, `__ge__`, `__lt__` and
`__gt__` for quaternion orders.~~
~~3. Small edits of the comparison functions `__eq__` and `__ne__` for
quaternion orders.~~
2.  Added a general comparison function `__richcmp__` for quaternion
orders and removed the explicit implementation of `__eq__` and `__ne__`.

More details on 1.:
The algorithm used in `.maximal_order()` currently uses the standard
basis `(1,i,j,k)` as a starting basis, but it extends to any starting
basis whose first entry is equal to `1`. Using the helper method
`basis_for_quaternion_lattice`, we transform any quaternion order basis
input by the user to a basis of this form.

Depends on sagemath#37644: Naturally, the extended algorithm can only work
correctly if the base algorithm works correctly in the first place.
    
URL: sagemath#37675
Reported by: Sebastian A. Spindler
Reviewer(s): Sebastian A. Spindler, Travis Scrimshaw
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Quaternion algebra: bugs in maximal_order and normalize_basis_at_p
3 participants