qldpc.abstract.rings
Module for abstract algebra: rings and ring-valued numpy arrays.
!!! 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).
Classes
Deprecated alias for RingMember. |
|
A finite group algebra over a finite field. |
|
Deprecated alias for RingArray. |
|
Array whose entries are members of a GroupRing. |
|
An element of the algebra of a group G over a finite field |
Module Contents
- class qldpc.abstract.rings.Element(ring: GroupRing | qldpc.abstract.groups.Group, *terms: qldpc.abstract.groups.GroupMember | tuple[int | galois.FieldArray, qldpc.abstract.groups.GroupMember])[source]
Bases:
RingMemberDeprecated alias for RingMember.
- class qldpc.abstract.rings.GroupRing(group: qldpc.abstract.groups.Group, field: int | type[galois.FieldArray] | None = None)[source]
A finite group algebra over a finite field.
The base field is
GF(2)by default.- eval(expression: sympy.Basic | int | numpy.int_, symbols: dict[sympy.Symbol, qldpc.abstract.groups.GroupMember]) RingMember[source]
Convert a SymPy expression (such as a polynomial) into a member of this ring.
- get_primitive_central_idempotents() tuple[RingMember, ...][source]
Get the primitive central idempotents of this ring.
Primitive central idempotents of a ring are nonzero elements that: - square to themselves (they are idempotent), - commute with all other elements of the ring (they lie in the ring’s center), and - cannot be decomposed into a sum of two nonzero orthogonal idempotents. Two idempotents g, h are orthogonal if
g * h = h * g = 0.Intuitively, primitive central idempotents idempotents act like projectors onto orthogonal simple components of a ring.
- get_transformer(seed: int | None = None, *, skip_validation: bool = False) qldpc.abstract.wedderburn_artin.WedderburnArtinTransformer[source]
Instrument for the Wedderburn-Artin decomposition of this ring.
By default each component’s primitive central idempotent is validated; pass
skip_validation=Trueto skip the check (see WedderburnArtinComponentTransformer).
- group_trace_matrix() galois.FieldArray
Construct the matrix for a trace over the group:
r -> sum_{g in G} g r g^{-1}.
- is_semisimple() bool
Is this ring semisimple?
- lift(member: qldpc.abstract.groups.GroupMember, *, right: bool = False) galois.FieldArray[source]
Lift a group member to a representation by a matrix.
A representation satisfies
self.lift(g·h) = self.lift(g) @ self.lift(h).If right=True, lift to an anti-representation, for which
self.lift(g·h) = self.lift(h) @ self.lift(g).
- regular_lift(member: qldpc.abstract.groups.GroupMember, *, right: bool = False) galois.FieldArray[source]
Lift a group member to its regular representation.
See help(qldpc.abstract.Group.regular_lift) for more information.
- property field: type[galois.FieldArray]
Base field of this ring.
- property generators: list[RingMember]
Generators of this ring’s base group.
- property group: qldpc.abstract.groups.Group
Base group of this ring.
- property is_abelian: bool
Is this ring abelian?
All rings are abelian with respect to addition, so this question concerns multiplication. GroupRing.is_abelian method is therefore an alias for GroupRing.is_commutative.
- property is_commutative: bool
Is this ring commutative?
- property name: str
A name for this ring, which is not required to uniquely identify the ring.
- property one: RingMember
One (multiplicative identity) element.
- property zero: RingMember
Zero (additive identity) element.
- class qldpc.abstract.rings.Protograph(shape, dtype=float, buffer=None, offset=0, strides=None, order=None)[source]
Bases:
RingArrayDeprecated alias for RingArray.
- class qldpc.abstract.rings.RingArray(shape, dtype=float, buffer=None, offset=0, strides=None, order=None)[source]
Bases:
numpy.ndarray[Any,numpy.dtype[numpy.object_]]Array whose entries are members of a GroupRing.
- static build(data: numpy.typing.NDArray[numpy.int_] | numpy.typing.NDArray[numpy.object_] | qldpc.abstract.groups.NestedSequence, ring: GroupRing | qldpc.abstract.groups.Group | None = None) RingArray[source]
Construct a RingArray.
The constructed array is built from:
An array populated by
ring members,
group members, or
integers.
A ring (or group, inducing a group algebra over GF(2)).
Integers and group members are cast into members of the ring.
- classmethod from_field_array(array: numpy.typing.NDArray[numpy.int_], ring: GroupRing | qldpc.abstract.groups.Group) RingArray[source]
Construct a RingArray from an array of coefficients (in a finite field) for each entry.
This method is the inverse of RingArray.to_field_array.
- classmethod from_field_vector(vector: numpy.typing.NDArray[numpy.int_], ring: GroupRing | qldpc.abstract.groups.Group) RingArray[source]
Construct a 1-D RingArray from a vector of coefficients.
This method is the inverse of RingArray.to_field_vector.
- howell_normal_form(*, poly: bool = False) RingArray[source]
Compute a Howell normal form of this RingArray.
- Alias for:
RingArray.howell_normal_form_semisimple (if poly is False, the default), or
RingArray.howell_normal_form_poly (if poly is True).
See the documentation of those methods for additional information.
- howell_normal_form_poly() RingArray[source]
Compute a Howell normal form of a RingArray using polynomial division.
If the base ring of a RingArray is a cyclic group algebra, then it can be interpreted as a univariate polynomial ring, allowing us to compute greatest common divisors and perform row reduction with polynomial division.
References:
- howell_normal_form_semisimple(transformer: qldpc.abstract.wedderburn_artin.WedderburnArtinTransformer | None = None, *, right: bool = False) RingArray[source]
Compute a Howell normal form (HNF) of a RingArray over a semisimple ring.
This method first puts a RingArray into a generalized reduced row echelon form (see RingArray.row_reduce), then further post-processes the rows to satisfy the Howell property, whereby an element v that is…
in the row span of the matrix, and
has j leading zeros, meaning
= (0_1, 0_2, ..., 0_j, v_{j+1}, ...),
can be written as a linear combinations of rows whose pivots are at position
k >= j.The Howell property is enforced as follows: if a row r has a pivot p with a nontrivial left annihilator α, meaning:
α != 0, α·p = 0, α·r != 0,
then the row r is replaced by
(1-α)·r, and the rowα·ris appended to the matrix.If right is True, the Howell property is instead enforced for nontrivial right annihilators:
α != 0, p·α = 0, r·α != 0,
for which the row r is replaced by
(1-α)·r, and the rowα·ris appended to the matrix. The ordinary HNF and right-HNF are equal for a RingArray over a commutative ring.The HNF of a RingArray over a commutative ring is unique. For non-commutative rings, the HNF is only unique up to a choice of matrix basis for simple components of the ring.
References:
- lift(*, right: bool = False) galois.FieldArray[source]
Block matrix obtained by lifting each entry of this RingArray.
- null_space(*, right: bool = False) RingArray[source]
Construct a matrix of null-space row vectors for this RingArray.
The transpose of the null-space matrix is annihilated by this RingArray, such that np.any(self @ self.null_space().T) is
np.False_.If right is True, this method constructs a null space over the opposite ring, in which the order of multiplication is reversed.
Due to the subtleties of defining row reduction for a matrix over a ring, this method does not row-reduce the matrix of null-space row vectors. The rows of the matrix returned by this method are therefore generally an overcomplete basis for the null space of this RingArray.
- reduced_groebner_basis() RingArray[source]
Compute a reduced Groebner basis for this RingArray.
At least, that’s the plan. This method is not yet implemented.
- regular_lift(*, right: bool = False) galois.FieldArray[source]
Block matrix obtained by a regular lift of each entry of this RingArray.
- row_reduce(transformer: qldpc.abstract.wedderburn_artin.WedderburnArtinTransformer | None = None) RingArray[source]
Compute a generalized reduced row echelon form of a RingArray over a semisimple ring.
This method relies on the Wedderburn-Artin decomposition:
Decompose the matrix over a ring into matrices over simple components.
Put the matrices over simple components into RREF.
Re-combine the simple components into a matrix over the original ring.
The RREF of a RingArray over a commutative ring is unique. For non-commutative rings, the RREF is only unique up to a choice of matrix basis for simple components of the ring.
- to_field_array() galois.FieldArray[source]
Convert a RingArray into an array of coefficients (in a finite field) for each entry.
This method expands every entry of a RingArray into a vector of length ring.group.order. If ring_array is two-dimensional, for example, then ring_array.to_field_array()[a, b, :] is the vector of coefficients for the RingMember at ring_array[a, b].
- to_field_vector() galois.FieldArray[source]
Convert RingArray into a flattened 1-D vector of coefficients for each RingMember.
- property T: RingArray
Conjugate-transpose of a matrix over a ring.
In addition to transposing the first two indices of the array, this method “conjugates” or “transposes” each array element, which takes group members
g -> ~g = g**-1.
- property field: type[galois.FieldArray]
Base field of this RingArray.
- property group: qldpc.abstract.groups.Group
Base group of this RingArray.
- class qldpc.abstract.rings.RingMember(ring: GroupRing | qldpc.abstract.groups.Group, *terms: qldpc.abstract.groups.GroupMember | tuple[int | galois.FieldArray, qldpc.abstract.groups.GroupMember])[source]
An element of the algebra of a group G over a finite field
F_q.Each RingMember x is a sum of group members with coefficients in the field:
x = sum_{g in G} x_g g, with eachx_g in F_q.- copy() RingMember[source]
Copy of self.
- classmethod from_vector(vector: numpy.typing.NDArray[numpy.int_], ring: GroupRing | qldpc.abstract.groups.Group) RingMember[source]
Construct a group algebra element from vector of coefficients,
(x_g : g in G).
- inverse() RingMember | None[source]
The inverse of this RingMember, if it exists.
- lift(*, right: bool = False) galois.FieldArray[source]
Lift this ring member to a representation by a matrix.
A representation satisfies
self.lift(g·h) = self.lift(g) @ self.lift(h).If right=True, lift to an anti-representation, for which
self.lift(g·h) = self.lift(h) @ self.lift(g).
- regular_lift(*, right: bool = False) galois.FieldArray[source]
Lift a ring member to its regular representation.
By default, this method lifts a ring member to the regular representation induced by multiplication from the left. Specifically, if r and s are ring members, then:
r.regular_lift() @ s.to_vector() = (r * s).to_vector().
If right is True, this method lifts a ring member to its regular representation in the opposite ring, such that matrix multiplication corresponds to ring multiplication from the right:
r.regular_lift(right=True) @ s.to_vector() = (s * r).to_vector().
- to_vector() galois.FieldArray[source]
Convert this group algebra element into a vector of coefficients,
(x_g : g in G).
- property T: RingMember
Transpose of this element.
If this element is
x = sum_{g in G) x_g g, returnx.T = sum_{g in G} x_g g.T, whereg.T = ~g = g**-1. For an orthogonal lift this matches the matrix transpose,L(g.T) = L(g).T; for non-orthogonal lifts the group inverse~gis still used, but it no longer corresponds to a matrix transpose.
- property field: type[galois.FieldArray]
Base field of this algebra.
- property group: qldpc.abstract.groups.Group
Base group of this algebra.