Skip to content
This repository was archived by the owner on Jan 30, 2023. It is now read-only.

Commit 0a115d0

Browse files
committedAug 19, 2019
Removed zero method. Added field extension method.
1 parent bd31704 commit 0a115d0

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed
 

‎src/sage/coding/linear_rank_metric.py

+17-15
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ def __init__(self, base_field, sub_field, length, default_encoder_name,
472472

473473
if not sub_field.is_field():
474474
raise ValueError("'sub_field' must be a field (and {} is not one)".format(sub_field))
475-
if not sub_field.order().divides(base_field.order()):
475+
if not (sub_field.degree().divides(base_field.degree()) and (sub_field.prime_subfield() == base_field.prime_subfield())):
476476
raise ValueError("'sub_field' has to be a subfield of 'base_field'")
477477
m = base_field.degree() // sub_field.degree()
478478
self._extension_degree = m
@@ -511,6 +511,22 @@ def extension_degree(self):
511511

512512
return self._extension_degree
513513

514+
def field_extension(self):
515+
"""
516+
Returns the field extension of ``self``.
517+
518+
Let ``base_field`` be some field `F_{q^m}` and ``sub_field`` `F_{q}`.
519+
This function returns the vector space of dimension `m` over `F_{q}`.
520+
521+
EXAMPLES:
522+
523+
sage: G = Matrix(GF(64), [[1,1,0], [0,0,1]])
524+
sage: C = codes.LinearRankMetricCode(G, GF(4))
525+
sage: C.field_extension()
526+
Vector space of dimension 3 over Finite Field in z2 of size 2^2
527+
"""
528+
return self.base_field().vector_space(self.sub_field())
529+
514530
def rank_distance_between_vectors(self, left, right):
515531
"""
516532
Returns the rank of the matrix of ``left`` - ``right``.
@@ -613,20 +629,6 @@ def vector_form_of_matrix(self, word):
613629
"""
614630
return from_matrix_representation(word, self.base_field())
615631

616-
@cached_method
617-
def zero(self):
618-
r"""
619-
Returns the zero vector of ``self``.
620-
621-
EXAMPLES::
622-
623-
sage: G = Matrix(GF(64), [[1,1,0], [0,0,1]])
624-
sage: C = codes.LinearRankMetricCode(G, GF(4))
625-
sage: C.zero()
626-
(0, 0, 0)
627-
"""
628-
return self.ambient_space().zero()
629-
630632

631633
class LinearRankMetricCode(AbstractLinearRankMetricCode):
632634
r"""

0 commit comments

Comments
 (0)
This repository has been archived.