Skip to content

Quaternion algebra inner_product_matrix implementation does not match docstring #40134

@Eloitor

Description

@Eloitor

Docstring:

diagonal matrix with diagonal entries 2, 2a, 2b, 2ab

Implementation: diagonal_matrix(self.base_ring(), [2, -2 * a, -2 * b, 2 * a * b])

def inner_product_matrix(self):
"""
Return the inner product matrix associated to ``self``.
This is the
Gram matrix of the reduced norm as a quadratic form on ``self``.
The standard basis `1`, `i`, `j`, `k` is orthogonal, so this matrix
is just the diagonal matrix with diagonal entries `2`, `2a`, `2b`,
`2ab`.
EXAMPLES::
sage: Q.<i,j,k> = QuaternionAlgebra(-5,-19)
sage: Q.inner_product_matrix()
[ 2 0 0 0]
[ 0 10 0 0]
[ 0 0 38 0]
[ 0 0 0 190]
"""
a, b = self._a, self._b
M = diagonal_matrix(self.base_ring(), [2, -2 * a, -2 * b, 2 * a * b])
M.set_immutable()
return M

Checklist

  • I have searched the existing issues for a bug report that matches the one I want to file, without success.
  • I have read the documentation and troubleshoot guide

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions