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

add .basis_matrix() wrapper to quaternion orders #35767

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions src/sage/algebras/quatalg/quaternion_algebra.py
Original file line number Diff line number Diff line change
Expand Up @@ -1793,6 +1793,42 @@ def unit_ideal(self):
else:
raise NotImplementedError("ideal only implemented for quaternion algebras over QQ")

def basis_matrix(self):
r"""
Return the basis matrix of this quaternion order, for the
specific basis returned by :meth:`basis()`.

OUTPUT: matrix over `\QQ`

EXAMPLES::

sage: O = QuaternionAlgebra(-11,-1).maximal_order()
sage: O.basis()
(1/2 + 1/2*i, 1/2*j - 1/2*k, i, -k)
sage: O.basis_matrix()
[ 1/2 1/2 0 0]
[ 0 0 1/2 -1/2]
[ 0 1 0 0]
[ 0 0 0 -1]

Note that the returned matrix is *not* necessarily the same as
the basis matrix of the :meth:`unit_ideal()`::

sage: Q.<i,j,k> = QuaternionAlgebra(-1,-11)
sage: O = Q.quaternion_order([j,i,-1,k])
sage: O.basis_matrix()
[ 0 0 1 0]
[ 0 1 0 0]
[-1 0 0 0]
[ 0 0 0 1]
sage: O.unit_ideal().basis_matrix()
[1 0 0 0]
[0 1 0 0]
[0 0 1 0]
[0 0 0 1]
"""
return matrix(QQ, map(list, self.__basis))

def __mul__(self, other):
"""
Every order equals its own unit ideal. Overload ideal multiplication
Expand Down