From a052a1f0aa30285b91927b3d1019656ecb9932cf Mon Sep 17 00:00:00 2001 From: Camille Garnier Date: Thu, 13 Feb 2025 11:51:30 +0100 Subject: [PATCH 1/9] add of the function rank_support_of_vector --- src/sage/coding/linear_rank_metric.py | 104 +++++++++++++++++++++----- 1 file changed, 86 insertions(+), 18 deletions(-) diff --git a/src/sage/coding/linear_rank_metric.py b/src/sage/coding/linear_rank_metric.py index 97a37e96c9b..e45b1b1b0f7 100644 --- a/src/sage/coding/linear_rank_metric.py +++ b/src/sage/coding/linear_rank_metric.py @@ -91,6 +91,7 @@ AUTHORS: - Marketa Slukova (2019-08-16): initial version +- Camille Garnier and Rubén Muñoz--Bertrand (2024-02-13): added rank_support_of_vector, and corrected the documentation TESTS:: @@ -146,9 +147,9 @@ def to_matrix_representation(v, sub_field=None, basis=None): specified, it is the prime subfield `\GF{p}` of `\GF{q^m}` - ``basis`` -- (default: ``None``) a basis of `\GF{q^m}` as a vector space over - ``sub_field``. If not specified, given that `q = p^s`, let - `1,\beta,\ldots,\beta^{sm}` be the power basis that SageMath uses to - represent `\GF{q^m}`. The default basis is then `1,\beta,\ldots,\beta^{m-1}`. + ``sub_field``. If not specified, given that `q = p^s`, let `\beta` be a generator + of the multiplicative group of `\GF{q^m}`. + The default basis is then `1,\beta,\ldots,\beta^{m-1}`. EXAMPLES:: @@ -198,9 +199,9 @@ def from_matrix_representation(w, base_field=None, basis=None): ``w``. - ``basis`` -- (default: ``None``) a basis of `\GF{q^m}` as a vector space over - `\GF{q}`. If not specified, given that `q = p^s`, let - `1,\beta,\ldots,\beta^{sm}` be the power basis that SageMath uses to - represent `\GF{q^m}`. The default basis is then `1,\beta,\ldots,\beta^{m-1}`. + `\GF{q}`. If not specified, given that `q = p^s`, let `\beta` be a generator + of the multiplicative group of `\GF{q^m}`. + The default basis is then `1,\beta,\ldots,\beta^{m-1}`. EXAMPLES:: @@ -230,7 +231,7 @@ def rank_weight(c, sub_field=None, basis=None): Return the rank of ``c`` as a matrix over ``sub_field``. If ``c`` is a vector over some field `\GF{q^m}`, the function converts it - into a matrix over `\GF{q}`. + into a matrix over ``sub_field```. INPUT: @@ -241,8 +242,8 @@ def rank_weight(c, sub_field=None, basis=None): - ``basis`` -- (default: ``None``) a basis of `\GF{q^m}` as a vector space over ``sub_field``. If not specified, given that `q = p^s`, let - `1,\beta,\ldots,\beta^{sm}` be the power basis that SageMath uses to - represent `\GF{q^m}`. The default basis is then `1,\beta,\ldots,\beta^{m-1}`. + `1,\beta,\ldots,\beta^{sm-1}` be the basis that SageMath uses to + represent `\GF{q^m}`. The default basis is then `1,\beta,\ldots,\beta^{m-1}` EXAMPLES:: @@ -278,9 +279,9 @@ def rank_distance(a, b, sub_field=None, basis=None): specified, it is the prime subfield `\GF{p}` of `\GF{q^m}` - ``basis`` -- (default: ``None``) a basis of `\GF{q^m}` as a vector space over - ``sub_field``. If not specified, given that `q = p^s`, let - `1,\beta,\ldots,\beta^{sm}` be the power basis that SageMath uses to - represent `\GF{q^m}`. The default basis is then `1,\beta,\ldots,\beta^{m-1}`. + ``sub_field``. If not specified, given that `q = p^s`, let `\beta` be a generator + of the multiplicative group of `\GF{q^m}`. + The default basis is then `1,\beta,\ldots,\beta^{m-1}`. EXAMPLES:: @@ -379,9 +380,9 @@ def __init__(self, base_field, sub_field, length, default_encoder_name, - ``default_decoder_name`` -- the name of the default decoder of ``self`` - ``basis`` -- (default: ``None``) a basis of `\GF{q^m}` as a vector space over - ``sub_field``. If not specified, given that `q = p^s`, let - `1,\beta,\ldots,\beta^{sm}` be the power basis that SageMath uses to - represent `\GF{q^m}`. The default basis is then `1,\beta,\ldots,\beta^{m-1}`. + ``sub_field``. If not specified, given that `q = p^s`, let `\beta` be a generator + of the multiplicative group of `\GF{q^m}`. + The default basis is then `1,\beta,\ldots,\beta^{m-1}`. EXAMPLES: @@ -587,6 +588,73 @@ def rank_weight_of_vector(self, word): 2 """ return rank_weight(word, self.sub_field()) + + def rank_support_of_vector(self, word, sub_field=None, basis=None): + r""" + Return the rank support of ``word`` over ``sub_field``, i.e. the vector space over + ``sub_field`` generated by its coefficients. + If ``word`` is a vector over some field `\GF{q^m}`, and ``sub_field`` is a subfield of + `\GF{q^m}`, the function converts it into a matrix over ``sub_field``, with + respect to the basis ``basis``. + + + INPUT: + + - ``word`` -- a vector over the ``base_field`` of ``self`` + + - ``sub_field`` -- (default: ``None``) a sub field of the ``base_field`` of ``self``; if not + specified, it is the prime subfield `\GF{p}` of the ``base_field`` of ``self`` + + - ``basis`` -- (default: ``None``) a basis of ``base_field`` of ``self`` as a vector space over + ``sub_field``. + + If not specified, given that `q = p^s`, let `\beta` be a generator of the multiplicative group + of `\GF{q^m}`. The default basis is then `1,\beta,\ldots,\beta^{m-1}`. + + EXAMPLES:: + + sage: G = Matrix(GF(64), [[1,1,0], [0,0,1]]) + sage: C = codes.LinearRankMetricCode(G, GF(4)) + sage: a = GF(64).gen() + sage: c = vector([a^4 + a^3 + 1, a^4 + a^3 + 1, a^4 + a^3 + a^2 + 1]) + sage: c in C + True + sage: C.rank_support_of_vector(c) + Vector space of degree 6 and dimension 2 over Finite Field of size 2 + Basis matrix: + [1 0 0 1 1 0] + [0 0 1 0 0 0] + + An example with a non canonical basis:: + + sage: K. = GF(2^3) + sage: G = Matrix(K, [[1,1,0], [0,0,1]]) + sage: C = codes.LinearRankMetricCode(G) + sage: c = vector([a^2, a^2, 0]) + sage: basis = [a, a+1, a^2] + sage: C.rank_support_of_vector(c, basis=basis) + Vector space of degree 3 and dimension 1 over Finite Field of size 2 + Basis matrix: + [0 0 1] + + TESTS:: + + sage: C.rank_support_of_vector(a) + Traceback (most recent call last): + ... + TypeError: input must be a vector + + sage: C.rank_support_of_vector(c, GF(2^4)) + Traceback (most recent call last): + ... + TypeError: the input subfield Finite Field in z4 of size 2^4 is not a subfield of Finite Field in a of size 2^3 + """ + if not isinstance(word, Vector): + raise TypeError("input must be a vector") + if sub_field != None: + if self.base_field().degree() % sub_field.degree() != 0: + raise TypeError(f"the input subfield {sub_field} is not a subfield of {self.base_field()}") + return to_matrix_representation(word, sub_field, basis).column_module() def matrix_form_of_vector(self, word): r""" @@ -679,9 +747,9 @@ def __init__(self, generator, sub_field=None, basis=None): specified, it is the prime field of ``base_field`` - ``basis`` -- (default: ``None``) a basis of `\GF{q^m}` as a vector space over - ``sub_field``. If not specified, given that `q = p^s`, let - `1,\beta,\ldots,\beta^{sm}` be the power basis that SageMath uses to - represent `\GF{q^m}`. The default basis is then `1,\beta,\ldots,\beta^{m-1}`. + ``sub_field``. If not specified, given that `q = p^s`, let `\beta` be a generator + of the multiplicative group of `\GF{q^m}`. + The default basis is then `1,\beta,\ldots,\beta^{m-1}`. EXAMPLES:: From d270b3f28b1ae03ac7d7371cc2b13a741faff1bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Mu=C3=B1oz--Bertrand?= Date: Thu, 13 Feb 2025 14:25:08 +0100 Subject: [PATCH 2/9] Update documentation and condition --- src/sage/coding/linear_rank_metric.py | 72 +++++++++++++-------------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/src/sage/coding/linear_rank_metric.py b/src/sage/coding/linear_rank_metric.py index e45b1b1b0f7..62a1deb4b86 100644 --- a/src/sage/coding/linear_rank_metric.py +++ b/src/sage/coding/linear_rank_metric.py @@ -147,9 +147,9 @@ def to_matrix_representation(v, sub_field=None, basis=None): specified, it is the prime subfield `\GF{p}` of `\GF{q^m}` - ``basis`` -- (default: ``None``) a basis of `\GF{q^m}` as a vector space over - ``sub_field``. If not specified, given that `q = p^s`, let `\beta` be a generator - of the multiplicative group of `\GF{q^m}`. - The default basis is then `1,\beta,\ldots,\beta^{m-1}`. + ``sub_field``. If not specified, the default basis is + `1,\beta,\ldots,\beta^{m-1}` where `\beta` is the generator of the + multiplicative group of `\GF{q^m}` given by Sage. EXAMPLES:: @@ -199,9 +199,9 @@ def from_matrix_representation(w, base_field=None, basis=None): ``w``. - ``basis`` -- (default: ``None``) a basis of `\GF{q^m}` as a vector space over - `\GF{q}`. If not specified, given that `q = p^s`, let `\beta` be a generator - of the multiplicative group of `\GF{q^m}`. - The default basis is then `1,\beta,\ldots,\beta^{m-1}`. + `\GF{q}`. If not specified, the default basis is + `1,\beta,\ldots,\beta^{m-1}` where `\beta` is the generator of the + multiplicative group of `\GF{q^m}` given by Sage. EXAMPLES:: @@ -241,9 +241,9 @@ def rank_weight(c, sub_field=None, basis=None): specified, it is the prime subfield `\GF{p}` of `\GF{q^m}` - ``basis`` -- (default: ``None``) a basis of `\GF{q^m}` as a vector space over - ``sub_field``. If not specified, given that `q = p^s`, let - `1,\beta,\ldots,\beta^{sm-1}` be the basis that SageMath uses to - represent `\GF{q^m}`. The default basis is then `1,\beta,\ldots,\beta^{m-1}` + ``sub_field``. If not specified, the default basis is + `1,\beta,\ldots,\beta^{m-1}` where `\beta` is the generator of the + multiplicative group of `\GF{q^m}` given by Sage. EXAMPLES:: @@ -279,9 +279,9 @@ def rank_distance(a, b, sub_field=None, basis=None): specified, it is the prime subfield `\GF{p}` of `\GF{q^m}` - ``basis`` -- (default: ``None``) a basis of `\GF{q^m}` as a vector space over - ``sub_field``. If not specified, given that `q = p^s`, let `\beta` be a generator - of the multiplicative group of `\GF{q^m}`. - The default basis is then `1,\beta,\ldots,\beta^{m-1}`. + ``sub_field``. If not specified, the default basis is + `1,\beta,\ldots,\beta^{m-1}` where `\beta` is the generator of the + multiplicative group of `\GF{q^m}` given by Sage. EXAMPLES:: @@ -380,9 +380,9 @@ def __init__(self, base_field, sub_field, length, default_encoder_name, - ``default_decoder_name`` -- the name of the default decoder of ``self`` - ``basis`` -- (default: ``None``) a basis of `\GF{q^m}` as a vector space over - ``sub_field``. If not specified, given that `q = p^s`, let `\beta` be a generator - of the multiplicative group of `\GF{q^m}`. - The default basis is then `1,\beta,\ldots,\beta^{m-1}`. + ``sub_field``. If not specified, the default basis is + `1,\beta,\ldots,\beta^{m-1}` where `\beta` is the generator of the + multiplicative group of `\GF{q^m}` given by Sage. EXAMPLES: @@ -588,29 +588,29 @@ def rank_weight_of_vector(self, word): 2 """ return rank_weight(word, self.sub_field()) - + def rank_support_of_vector(self, word, sub_field=None, basis=None): r""" - Return the rank support of ``word`` over ``sub_field``, i.e. the vector space over - ``sub_field`` generated by its coefficients. - If ``word`` is a vector over some field `\GF{q^m}`, and ``sub_field`` is a subfield of - `\GF{q^m}`, the function converts it into a matrix over ``sub_field``, with - respect to the basis ``basis``. + Return the rank support of ``word`` over ``sub_field``, i.e. the vector space over + ``sub_field`` generated by its coefficients. + If ``word`` is a vector over some field `\GF{q^m}`, and ``sub_field`` is a subfield of + `\GF{q^m}`, the function converts it into a matrix over ``sub_field``, with + respect to the basis ``basis``. INPUT: - - ``word`` -- a vector over the ``base_field`` of ``self`` + - ``word`` -- a vector over the ``base_field`` of ``self``. - - ``sub_field`` -- (default: ``None``) a sub field of the ``base_field`` of ``self``; if not - specified, it is the prime subfield `\GF{p}` of the ``base_field`` of ``self`` + - ``sub_field`` -- (default: ``None``) a sub field of the + ``base_field`` of ``self``; if not specified, it is the prime + subfield `\GF{p}` of the ``base_field`` of ``self``. + + - ``basis`` -- (default: ``None``) a basis of ``base_field`` of + ``self`` as a vector space over ``sub_field``. If not specified, + the default basis is `1,\beta,\ldots,\beta^{m-1}`, where `\beta` is + the generator of the multiplicative group of `\GF{q^m}` given by Sage. - - ``basis`` -- (default: ``None``) a basis of ``base_field`` of ``self`` as a vector space over - ``sub_field``. - - If not specified, given that `q = p^s`, let `\beta` be a generator of the multiplicative group - of `\GF{q^m}`. The default basis is then `1,\beta,\ldots,\beta^{m-1}`. - EXAMPLES:: sage: G = Matrix(GF(64), [[1,1,0], [0,0,1]]) @@ -636,9 +636,9 @@ def rank_support_of_vector(self, word, sub_field=None, basis=None): Vector space of degree 3 and dimension 1 over Finite Field of size 2 Basis matrix: [0 0 1] - + TESTS:: - + sage: C.rank_support_of_vector(a) Traceback (most recent call last): ... @@ -651,7 +651,7 @@ def rank_support_of_vector(self, word, sub_field=None, basis=None): """ if not isinstance(word, Vector): raise TypeError("input must be a vector") - if sub_field != None: + if sub_field is not None: if self.base_field().degree() % sub_field.degree() != 0: raise TypeError(f"the input subfield {sub_field} is not a subfield of {self.base_field()}") return to_matrix_representation(word, sub_field, basis).column_module() @@ -747,9 +747,9 @@ def __init__(self, generator, sub_field=None, basis=None): specified, it is the prime field of ``base_field`` - ``basis`` -- (default: ``None``) a basis of `\GF{q^m}` as a vector space over - ``sub_field``. If not specified, given that `q = p^s`, let `\beta` be a generator - of the multiplicative group of `\GF{q^m}`. - The default basis is then `1,\beta,\ldots,\beta^{m-1}`. + ``sub_field``. If not specified, the default basis is + `1,\beta,\ldots,\beta^{m-1}` where `\beta` is the generator of the + multiplicative group of `\GF{q^m}` given by Sage. EXAMPLES:: From e2e9491f87def8a42f3c42ac74f5a6baef8369e2 Mon Sep 17 00:00:00 2001 From: Camille Garnier Date: Thu, 13 Feb 2025 15:05:42 +0100 Subject: [PATCH 3/9] correction of indentation --- src/sage/coding/linear_rank_metric.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/sage/coding/linear_rank_metric.py b/src/sage/coding/linear_rank_metric.py index 62a1deb4b86..46a71a2c64f 100644 --- a/src/sage/coding/linear_rank_metric.py +++ b/src/sage/coding/linear_rank_metric.py @@ -600,16 +600,17 @@ def rank_support_of_vector(self, word, sub_field=None, basis=None): INPUT: - - ``word`` -- a vector over the ``base_field`` of ``self``. + - ``word`` -- a vector over the ``base_field`` of ``self``. - - ``sub_field`` -- (default: ``None``) a sub field of the - ``base_field`` of ``self``; if not specified, it is the prime - subfield `\GF{p}` of the ``base_field`` of ``self``. + - ``sub_field`` -- (default: ``None``) a sub field of the + ``base_field`` of ``self``; if not specified, it is the prime + subfield `\GF{p}` of the ``base_field`` of ``self``. + + - ``basis`` -- (default: ``None``) a basis of ``base_field`` of + ``self`` as a vector space over ``sub_field``. If not specified, + the default basis is `1,\beta,\ldots,\beta^{m-1}`, where `\beta` is + the generator of the multiplicative group of `\GF{q^m}` given by Sage. - - ``basis`` -- (default: ``None``) a basis of ``base_field`` of - ``self`` as a vector space over ``sub_field``. If not specified, - the default basis is `1,\beta,\ldots,\beta^{m-1}`, where `\beta` is - the generator of the multiplicative group of `\GF{q^m}` given by Sage. EXAMPLES:: From 5f68d0baa289cfe4781ce18d892a5683adad0893 Mon Sep 17 00:00:00 2001 From: Camille Garnier Date: Thu, 13 Feb 2025 17:13:33 +0100 Subject: [PATCH 4/9] correction of documentation --- src/sage/coding/linear_rank_metric.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/sage/coding/linear_rank_metric.py b/src/sage/coding/linear_rank_metric.py index 46a71a2c64f..897275a17e3 100644 --- a/src/sage/coding/linear_rank_metric.py +++ b/src/sage/coding/linear_rank_metric.py @@ -603,14 +603,13 @@ def rank_support_of_vector(self, word, sub_field=None, basis=None): - ``word`` -- a vector over the ``base_field`` of ``self``. - ``sub_field`` -- (default: ``None``) a sub field of the - ``base_field`` of ``self``; if not specified, it is the prime - subfield `\GF{p}` of the ``base_field`` of ``self``. + ``base_field`` of ``self``; if not specified, it is the prime + subfield of `\GF{p}` the ``base_field`` of ``self``. - ``basis`` -- (default: ``None``) a basis of ``base_field`` of - ``self`` as a vector space over ``sub_field``. If not specified, - the default basis is `1,\beta,\ldots,\beta^{m-1}`, where `\beta` is - the generator of the multiplicative group of `\GF{q^m}` given by Sage. - + ``self`` as a vector space over ``sub_field``. If not specified, + the default basis is `1,\beta,\ldots,\beta^{m-1}`, where `\beta` is + the generator of the multiplicative group of `\GF{q^m}` given by Sage. EXAMPLES:: From a99b6a365af29a5951ffcd1563f1403bc087e11d Mon Sep 17 00:00:00 2001 From: Camille Garnier Date: Fri, 14 Feb 2025 09:39:44 +0100 Subject: [PATCH 5/9] correction of documentation --- src/sage/coding/linear_rank_metric.py | 30 +++++++++++++-------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/sage/coding/linear_rank_metric.py b/src/sage/coding/linear_rank_metric.py index 897275a17e3..8ab3f611e7c 100644 --- a/src/sage/coding/linear_rank_metric.py +++ b/src/sage/coding/linear_rank_metric.py @@ -91,7 +91,7 @@ AUTHORS: - Marketa Slukova (2019-08-16): initial version -- Camille Garnier and Rubén Muñoz--Bertrand (2024-02-13): added rank_support_of_vector, and corrected the documentation +- Camille Garnier and Rubén Muñoz-\-Bertrand (2024-02-13): added rank_support_of_vector, and corrected the documentation TESTS:: @@ -148,8 +148,8 @@ def to_matrix_representation(v, sub_field=None, basis=None): - ``basis`` -- (default: ``None``) a basis of `\GF{q^m}` as a vector space over ``sub_field``. If not specified, the default basis is - `1,\beta,\ldots,\beta^{m-1}` where `\beta` is the generator of the - multiplicative group of `\GF{q^m}` given by Sage. + `1,\beta,\ldots,\beta^{m-1}` where `\beta` is the generator of `\GF{q^m}` + given by SageMath. EXAMPLES:: @@ -200,9 +200,9 @@ def from_matrix_representation(w, base_field=None, basis=None): - ``basis`` -- (default: ``None``) a basis of `\GF{q^m}` as a vector space over `\GF{q}`. If not specified, the default basis is - `1,\beta,\ldots,\beta^{m-1}` where `\beta` is the generator of the - multiplicative group of `\GF{q^m}` given by Sage. - + `1,\beta,\ldots,\beta^{m-1}` where `\beta` is the generator + of `\GF{q^m}` given by SageMath. + EXAMPLES:: sage: from sage.coding.linear_rank_metric import from_matrix_representation @@ -242,8 +242,8 @@ def rank_weight(c, sub_field=None, basis=None): - ``basis`` -- (default: ``None``) a basis of `\GF{q^m}` as a vector space over ``sub_field``. If not specified, the default basis is - `1,\beta,\ldots,\beta^{m-1}` where `\beta` is the generator of the - multiplicative group of `\GF{q^m}` given by Sage. + `1,\beta,\ldots,\beta^{m-1}` where `\beta` is the generator + of `\GF{q^m}` given by SageMath. EXAMPLES:: @@ -280,8 +280,8 @@ def rank_distance(a, b, sub_field=None, basis=None): - ``basis`` -- (default: ``None``) a basis of `\GF{q^m}` as a vector space over ``sub_field``. If not specified, the default basis is - `1,\beta,\ldots,\beta^{m-1}` where `\beta` is the generator of the - multiplicative group of `\GF{q^m}` given by Sage. + `1,\beta,\ldots,\beta^{m-1}` where `\beta` is the generator + of `\GF{q^m}` given by SageMath. EXAMPLES:: @@ -381,8 +381,8 @@ def __init__(self, base_field, sub_field, length, default_encoder_name, - ``basis`` -- (default: ``None``) a basis of `\GF{q^m}` as a vector space over ``sub_field``. If not specified, the default basis is - `1,\beta,\ldots,\beta^{m-1}` where `\beta` is the generator of the - multiplicative group of `\GF{q^m}` given by Sage. + `1,\beta,\ldots,\beta^{m-1}` where `\beta` is the generator + of `\GF{q^m}` given by SageMath. EXAMPLES: @@ -609,7 +609,7 @@ def rank_support_of_vector(self, word, sub_field=None, basis=None): - ``basis`` -- (default: ``None``) a basis of ``base_field`` of ``self`` as a vector space over ``sub_field``. If not specified, the default basis is `1,\beta,\ldots,\beta^{m-1}`, where `\beta` is - the generator of the multiplicative group of `\GF{q^m}` given by Sage. + the generator of `\GF{q^m}` given by SageMath. EXAMPLES:: @@ -748,8 +748,8 @@ def __init__(self, generator, sub_field=None, basis=None): - ``basis`` -- (default: ``None``) a basis of `\GF{q^m}` as a vector space over ``sub_field``. If not specified, the default basis is - `1,\beta,\ldots,\beta^{m-1}` where `\beta` is the generator of the - multiplicative group of `\GF{q^m}` given by Sage. + `1,\beta,\ldots,\beta^{m-1}` where `\beta` is the generator `\GF{q^m}` + given by SageMath. EXAMPLES:: From d44d4794142b1c7fb2dbf3d3a240f44021863480 Mon Sep 17 00:00:00 2001 From: Camille Garnier Date: Fri, 14 Feb 2025 09:46:13 +0100 Subject: [PATCH 6/9] correction of documentation --- src/sage/coding/linear_rank_metric.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/coding/linear_rank_metric.py b/src/sage/coding/linear_rank_metric.py index 8ab3f611e7c..1f85664f5c0 100644 --- a/src/sage/coding/linear_rank_metric.py +++ b/src/sage/coding/linear_rank_metric.py @@ -202,7 +202,7 @@ def from_matrix_representation(w, base_field=None, basis=None): `\GF{q}`. If not specified, the default basis is `1,\beta,\ldots,\beta^{m-1}` where `\beta` is the generator of `\GF{q^m}` given by SageMath. - + EXAMPLES:: sage: from sage.coding.linear_rank_metric import from_matrix_representation From f66a0053e089cbd05f33f6c2b85778e3e0b7d780 Mon Sep 17 00:00:00 2001 From: camille-garnier Date: Fri, 14 Feb 2025 11:05:45 +0100 Subject: [PATCH 7/9] Update src/sage/coding/linear_rank_metric.py Co-authored-by: Xavier Caruso --- src/sage/coding/linear_rank_metric.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/sage/coding/linear_rank_metric.py b/src/sage/coding/linear_rank_metric.py index 1f85664f5c0..99865a3ef44 100644 --- a/src/sage/coding/linear_rank_metric.py +++ b/src/sage/coding/linear_rank_metric.py @@ -649,8 +649,7 @@ def rank_support_of_vector(self, word, sub_field=None, basis=None): ... TypeError: the input subfield Finite Field in z4 of size 2^4 is not a subfield of Finite Field in a of size 2^3 """ - if not isinstance(word, Vector): - raise TypeError("input must be a vector") + word = self.ambient_space()(word) if sub_field is not None: if self.base_field().degree() % sub_field.degree() != 0: raise TypeError(f"the input subfield {sub_field} is not a subfield of {self.base_field()}") From fc04aab0d294ec7dda33cca3d784c93e9763e6f6 Mon Sep 17 00:00:00 2001 From: Camille Garnier Date: Fri, 14 Feb 2025 11:26:11 +0100 Subject: [PATCH 8/9] correction of documentation --- src/sage/coding/linear_rank_metric.py | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/sage/coding/linear_rank_metric.py b/src/sage/coding/linear_rank_metric.py index 99865a3ef44..f7ce79c822c 100644 --- a/src/sage/coding/linear_rank_metric.py +++ b/src/sage/coding/linear_rank_metric.py @@ -638,12 +638,7 @@ def rank_support_of_vector(self, word, sub_field=None, basis=None): [0 0 1] TESTS:: - - sage: C.rank_support_of_vector(a) - Traceback (most recent call last): - ... - TypeError: input must be a vector - + sage: C.rank_support_of_vector(c, GF(2^4)) Traceback (most recent call last): ... From b8c384a1142376169ab19e1addf4f68abfdd302a Mon Sep 17 00:00:00 2001 From: Camille Garnier Date: Fri, 14 Feb 2025 11:35:49 +0100 Subject: [PATCH 9/9] correction of documentation --- src/sage/coding/linear_rank_metric.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sage/coding/linear_rank_metric.py b/src/sage/coding/linear_rank_metric.py index f7ce79c822c..e25d326cc8b 100644 --- a/src/sage/coding/linear_rank_metric.py +++ b/src/sage/coding/linear_rank_metric.py @@ -638,7 +638,7 @@ def rank_support_of_vector(self, word, sub_field=None, basis=None): [0 0 1] TESTS:: - + sage: C.rank_support_of_vector(c, GF(2^4)) Traceback (most recent call last): ...