1 | initial version |
To find the error in such a case, try to execute the function step by step.
We start by defining:
sage: n = 17
and then run the code inside the function one by one.
sage: C = codes.QuadraticResidueCode(n, GF(2))
sage: D = C.dual_code()
No problem up to that point. But when we execute the next line:
sage: G = C.gen_mat()
we get the following error:
Traceback (most recent call last)
...
AttributeError: 'CyclicCode_with_category' object has no attribute 'gen_mat'
This is telling us that we can't do .gen_mat
to C
.
So we try tab-completion to see what methods starting with gen
are available for the object C
sage: C.gen<TAB>
(here <TAB>
means "press the TAB key).
We see that there is a method called generator_matrix
.
Oh, okay, so probably a previous version of Sage (used by the authors of the paper you refer to)
had a method gen_mat
, but it has now been renamed generator_matrix
.
So all you have to do is change the two lines
G = C.gen_mat()
H = D.gen_mat()
to
G = C.generator_matrix()
H = D.generator_matrix()
in your function definition, and all works well!
2 | No.2 Revision |
To find the error in such a case, try to execute the function step by step.
We start by defining:
sage: n = 17
and then run the code inside the function one by one.
sage: C = codes.QuadraticResidueCode(n, GF(2))
sage: D = C.dual_code()
No problem up to that point. But when we execute the next line:
sage: G = C.gen_mat()
we get the following error:
Traceback (most recent call last)
...
AttributeError: 'CyclicCode_with_category' object has no attribute 'gen_mat'
This is telling us that we can't do .gen_mat
to C
.
So we try tab-completion to see what methods starting with gen
are available for the object C
sage: C.gen<TAB>
(here <TAB>
means "press the TAB key).
We see that there is a method called generator_matrix
.
Oh, okay, so probably a previous version of Sage (used by the authors of the paper you refer to)
had a method gen_mat
, but it has now been renamed generator_matrix
.
So all you have to do is change the two lines
G = C.gen_mat()
H = D.gen_mat()
to
G = C.generator_matrix()
H = D.generator_matrix()
in your function definition, and all works well!
Alternatively, if you like the name gen_mat
a lot, you could define it as follows:
sage: from sage.coding.cyclic_code import CyclicCode
sage: gen_mat = CyclicCode.generator_matrix
and then write
G = gen_mat(C)
H = gen_mat(D)
but there is probably not much point in doing that.
3 | No.3 Revision |
To find the error in such a case, try to execute the function step by step.
We start by defining:
sage: n = 17
and then run try to execute the code inside the function one function, line by one.line. The first two lines:
sage: C = codes.QuadraticResidueCode(n, GF(2))
sage: D = C.dual_code()
No problem up to that point. execute without problem. But when we execute the next line:
sage: G = C.gen_mat()
we get the following error:
Traceback (most recent call last)
...
AttributeError: 'CyclicCode_with_category' object has no attribute 'gen_mat'
This is telling us that we can't do .gen_mat
to C
.
So we try tab-completion to see what methods starting with gen
are available for the object C
sage: C.gen<TAB>
(here <TAB>
means "press the TAB key).
We see that there is a method called generator_matrix
.
Oh, okay, so probably a previous version of Sage (used by the authors of the paper you refer to)
had a method gen_mat
, but it has now been renamed generator_matrix
.
So all you have to do is change the two lines
G = C.gen_mat()
H = D.gen_mat()
to
G = C.generator_matrix()
H = D.generator_matrix()
in your function definition, and all works well!
Alternatively, if you like the name gen_mat
a lot, you could define it as follows:
sage: from sage.coding.cyclic_code import CyclicCode
sage: gen_mat = CyclicCode.generator_matrix
and then write
G = gen_mat(C)
H = gen_mat(D)
but there is probably not much point in doing that.
4 | No.4 Revision |
To find the error in such a case, try to execute the function step by step.
We start by defining:
sage: n = 17
and then try to execute the code inside the function, line by line. The first two lines:
sage: C = codes.QuadraticResidueCode(n, GF(2))
sage: D = C.dual_code()
execute without problem. But when we execute the next line:
sage: G = C.gen_mat()
we get the following error:
Traceback (most recent call last)
...
AttributeError: 'CyclicCode_with_category' object has no attribute 'gen_mat'
This is telling us that we can't do .gen_mat
to C
.
So we try tab-completion to see what methods starting with gen
are available for the object C
sage: C.gen<TAB>
(here <TAB>
means "press the TAB key).
We see that there is a method called generator_matrix
.
Oh, okay, so probably a previous version of Sage (used by the authors of the paper you refer to)
had a method gen_mat
, but it has now been renamed generator_matrix
.
So all you have to do is change the two lines
G = C.gen_mat()
H = D.gen_mat()
to
G = C.generator_matrix()
H = D.generator_matrix()
in your function definition, and all works well!
gen_mat
Alternatively, if you like the name gen_mat
a lot, you could define it as follows:
sage: from sage.coding.cyclic_code import CyclicCode
sage: gen_mat = CyclicCode.generator_matrix
and then write
G = gen_mat(C)
H = gen_mat(D)
but there is probably not much point in doing that.
gen_mat
to generator_matrix
If you are curious when the change was made, you can visit SageMath's git repository on GitHub:
In the search box, type gen_mat
, and then click on "Commits". You get this page:
And sure enough, here is a commit "Replaced gen_mat by generator_matrix" from Mar 17, 2015.
If you click on the box with "80770c5", you can see the full commit.
Instead of visiting GitHub, you could also visit Sage's Trac server, which is the main place for the development activity and discussion (discussion also happens on the "sage-devel" mailing list). There you will find not only the commit that made the change, but the surrounding discussion.
Visiting
and typing "gen_mat" in the search box, you get to
you will see that the first result listed is
17973: enhancement: Better Sage consistency for naming and calling in linear_code (closed: fixed)
with the following excerpt
... Most importantly, the
gen_mat
method will be renamedgenerator_matrix
and thecheck_mat
methodparity_check_matrix
. Besides, some getter methods to access the private fields of linear codes exist but are not used internally in the class. To support s ...
and information about the author and the date
By dlucas — 2015-03-17T14:04:54Z
If you click on the ticket number, you get to the ticket's page
which has a summary and a fuller description giving the reason for making the change, and is followed by the whole discussion, with trials and errors, successive improvements, all the iterations until the code is finally good to go, gets positive review, and is finally included in the next version of Sage.
If you search for "17973" among the changelogs at
you will find at
that it was merged in sage-6.6.beta6.
5 | No.5 Revision |
To find the error in such a case, try to execute the function step by step.
We start by defining:
sage: n = 17
and then try to execute the code inside the function, line by line. The first two lines:
sage: C = codes.QuadraticResidueCode(n, GF(2))
sage: D = C.dual_code()
execute without problem. But when we execute the next line:
sage: G = C.gen_mat()
we get the following error:
Traceback (most recent call last)
...
AttributeError: 'CyclicCode_with_category' object has no attribute 'gen_mat'
This is telling us that we can't do .gen_mat
to C
.
So we try tab-completion to see what methods starting with gen
are available for the object C
sage: C.gen<TAB>
(here <TAB>
means "press the TAB key).
We see that there is a method called generator_matrix
.
Oh, okay, so probably a previous version of Sage (used by the authors of the paper you refer to)
had a method gen_mat
, but it has now been renamed generator_matrix
.
So all you have to do is change the two lines
G = C.gen_mat()
H = D.gen_mat()
to
G = C.generator_matrix()
H = D.generator_matrix()
in your function definition, and all works well!
gen_mat
Alternatively, if you like the name gen_mat
a lot, you could define it as follows:
sage: from sage.coding.cyclic_code import CyclicCode
sage: gen_mat = CyclicCode.generator_matrix
and then write
G = gen_mat(C)
H = gen_mat(D)
but there is probably not much point in doing that.
gen_mat
to generator_matrix
If you are curious when the change was made, you can visit SageMath's git repository on GitHub:
In the search box, type gen_mat
, and then click on "Commits". You get this page:
And sure enough, here is a commit "Replaced gen_mat by generator_matrix" from Mar 17, 2015.
If you click on the box with "80770c5", you can see the full commit.
Instead of visiting GitHub, you could also visit Sage's Trac server, which is the main place for the development activity and discussion (discussion also happens on the "sage-devel" mailing list). There you will find not only the commit that made the change, but the surrounding discussion.
Visiting
and typing "gen_mat" in the search box, you get to
you will see that the first result listed is
enhancement: Better Sage consistency for naming and calling in linear_code (closed: fixed)17973:
with the following excerpt
... Most importantly, the
gen_mat
method will be renamedgenerator_matrix
and thecheck_mat
methodparity_check_matrix
. Besides, some getter methods to access the private fields of linear codes exist but are not used internally in the class. To support s ...
and information about the author and the date
By dlucas — 2015-03-17T14:04:54Z
If you click on the ticket number, you get to the ticket's page
which has a summary and a fuller description giving the reason for making the change, and is followed by the whole discussion, with trials and errors, successive improvements, all the iterations until the code is finally good to go, gets positive review, and is finally included in the next version of Sage.
If you search for "17973" among the changelogs at
you will find at
that it was merged in sage-6.6.beta6.
6 | No.6 Revision |
To find the error in such a case, try to execute the function step by step.
We start by defining:
sage: n = 17
and then try to execute the code inside the function, line by line. The first two lines:
sage: C = codes.QuadraticResidueCode(n, GF(2))
sage: D = C.dual_code()
execute without problem. But when we execute the next line:
sage: G = C.gen_mat()
we get the following error:
Traceback (most recent call last)
...
AttributeError: 'CyclicCode_with_category' object has no attribute 'gen_mat'
This is telling us that we can't do .gen_mat
to C
.
So we try tab-completion to see what methods starting with gen
are available for the object C
sage: C.gen<TAB>
(here <TAB>
means "press the TAB key).
We see that there is a method called generator_matrix
.
Oh, okay, so probably a previous version of Sage (used by the authors of the paper you refer to)
had a method gen_mat
, but it has now been renamed generator_matrix
.
So all you have to do is change the two lines
G = C.gen_mat()
H = D.gen_mat()
to
G = C.generator_matrix()
H = D.generator_matrix()
in your function definition, and all works well!
Alternatively, if you like the name gen_mat
a lot, you could define it as follows:
sage: from sage.coding.cyclic_code import CyclicCode
sage: gen_mat = CyclicCode.generator_matrix
and then write
G = gen_mat(C)
H = gen_mat(D)
but there is probably not much point in doing that.
gen_mat
to generator_matrix
If you are curious when the change was made, you can visit SageMath's git repository on GitHub:
In the search box, type gen_mat
, and then click on "Commits". You get this page:
And sure enough, here is a commit "Replaced gen_mat by generator_matrix" from Mar 17, 2015.
If you click on the box with "80770c5", you can see the full commit.
Instead of visiting GitHub, you could also visit Sage's Trac server, which is the main place for the development activity and discussion (discussion also happens on the "sage-devel" mailing list). There you will find not only the commit that made the change, but the surrounding discussion.
Visiting
and typing "gen_mat" in the search box, you get to
you will see that the first result listed is
#17973: enhancement: Better Sage consistency for naming and calling in linear_code (closed: fixed)
with the following excerpt
... Most importantly, the
gen_mat
method will be renamedgenerator_matrix
and thecheck_mat
methodparity_check_matrix
. Besides, some getter methods to access the private fields of linear codes exist but are not used internally in the class. To support s ...
and information about the author and the date
By dlucas — 2015-03-17T14:04:54Z
If you click on the ticket number, you get to the ticket's page
which has a summary and a fuller description giving the reason for making the change, and is followed by the whole discussion, with trials and errors, successive improvements, all the iterations until the code is finally good to go, gets positive review, and is finally included in the next version of Sage.
If you search for "17973" among the changelogs at
you will find at
that it was merged in sage-6.6.beta6.