qldpc.abstract.linalg
Module for linear algebra with matrices over rings and bimodules.
!!! WARNINGS !!!
This module does not promise to be performant. If you need to do heavy numerical abstract algebra, you’re probably better served by GAP or MAGMA (or maybe SageMath).
Functions
|
Stack the two matrices into a block-diagonal matrix. |
|
Map a group algebra |
|
Build the "dual" of a matrix in Howell normal form. |
|
Take the Kronecker product of two matrices over a ring. |
|
Multiply two matrices over a ring. |
Module Contents
- qldpc.abstract.linalg.block_diag(matrix_a: qldpc.abstract.rings.RingArray | numpy.typing.NDArray[numpy.int_], matrix_b: qldpc.abstract.rings.RingArray | numpy.typing.NDArray[numpy.int_]) qldpc.abstract.rings.RingArray[source]
Stack the two matrices into a block-diagonal matrix.
- qldpc.abstract.linalg.get_bimodule(ring: qldpc.abstract.rings.GroupRing) qldpc.abstract.rings.GroupRing[source]
Map a group algebra
F[G]to its induced bimoduleF[G ⨂ G].Elements
r ⨂ s ∈ F[G ⨂ G]of the bimodule act on elements of the base ring as:(r ⨂ s)(t) = r·t·s⁻¹.
(The right sector lifts to an anti-representation of the inverse, hence
s⁻¹rather thans.)When lifting a RingArray matrix over a bimodule, the “left” entries of
G ⨂ Gget lifted to an ordinary representation, while the “right” entries get lifted to an anti-representation.
- qldpc.abstract.linalg.get_howell_dual(matrix_hnf: qldpc.abstract.rings.RingArray, *, transformer: qldpc.abstract.wedderburn_artin.WedderburnArtinTransformer | None = None, right: bool | None = None, skip_validation: bool | None = None) qldpc.abstract.rings.RingArray[source]
Build the “dual” of a matrix in Howell normal form.
The dual matrix provides a pseudoinverse of matrix_hnf in the following sense. Below,
@denotes the orientation-aware productabstract.matmul(..., right=right)(ordinary matrix multiplication whenright=False). IfD = matrix_hnf @ dual_matrix.T,then
D is diagonal,
D @ matrix_hnf = matrix_hnf,D.T @ dual_matrix = dual_matrix, andD = transformer.transpose_array(D).
Note that we have two different notions of a transpose at play:
D.T…
swaps the matrix indices of D, and
takes group members
g -> ~g = g**-1, which transposes their regular representation.
transformer.transpose_array(D)…
swaps the matrix indices of D (identically to D.T), and
for each entry of D, transposes its matrix representation within each Wedderburn-Artin component of the ring.
The
transformermust be the one used to build matrix_hnf, since the dual is built in that transformer’s basis. By default it is read from matrix_hnf (the transformer recorded when the Howell form was built).Likewise, the
rightflag must match the orientation used to build matrix_hnf (therightpassed tonull_space/howell_normal_form_semisimple). For a non-commutative ring the dual is orientation-specific: the dual built for the wrong orientation does not satisfy it. By default (right=None) it is read from matrix_hnf, liketransformer; an explicit value is cross-checked against what matrix_hnf was built with.skip_validationcontrols whether the returned dual is checked against properties 1-4:False: always check, raising an error if the dual is not valid.True: never check (fastest; trusts that matrix_hnf is a Howell form and thatrightmatches its orientation).None(default): if matrix_hnf carries Howell-form provenance (attached byhowell_normal_form_semisimple/howell_normal_form_poly), trust it – but raise an error if its recorded orientation disagrees withright. Otherwise, check as forFalse.
WARNINGS: Any
transformerpassed in must be the one used to build matrix_hnf; otherwise the dual is built in the wrong basis and may be wrong. By default the transformer recorded on matrix_hnf is used. Separately, withskip_validation=Truethis method verifies nothing else: it trusts that matrix_hnf is in Howell normal form and thatrightmatches the orientation used to build it, so a wrongrightmay raise an error but may also silently return a wrong dual.
- qldpc.abstract.linalg.kron(matrix_a: qldpc.abstract.rings.RingArray | numpy.typing.NDArray[numpy.int_], matrix_b: qldpc.abstract.rings.RingArray | numpy.typing.NDArray[numpy.int_]) qldpc.abstract.rings.RingArray[source]
Take the Kronecker product of two matrices over a ring.
If the base ring R is commutative, this is the ordinary Kronecker product. Otherwise, matrix entries of the Kronecker product live in the bimodule of R. See get_bimodule for additional information.
- qldpc.abstract.linalg.matmul(matrix_a: qldpc.abstract.rings.RingArray | numpy.typing.NDArray[numpy.int_], matrix_b: qldpc.abstract.rings.RingArray | numpy.typing.NDArray[numpy.int_], *, right: bool = False) qldpc.abstract.rings.RingArray[source]
Multiply two matrices over a ring.
This method exists to handle two different cases: 1. ‘right is False’ (default): Ordinary matrix multiplication, or simply ‘matrix_a @ matrix_b’. 2. ‘right is True’: matrix multiplication with a reversed order of multiplication in the ring.