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

Commit 6587ad8

Browse files
author
David Lucas
committed
Merge with public branch
2 parents 3ac3d64 + f7a8d03 commit 6587ad8

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/sage/coding/linear_code.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -717,20 +717,23 @@ def __init__(self, base_field, length):
717717
We first create a new LinearCode subclass::
718718
719719
sage: class CodeExample(sage.coding.linear_code.AbstractLinearCode):
720-
....: def __init__(self, field, length, dimension):
720+
....: def __init__(self, field, length, dimension, generator_matrix):
721721
....: sage.coding.linear_code.AbstractLinearCode.__init__(self,field, length)
722722
....: self._dimension = dimension
723+
....: self._generator_matrix = generator_matrix
723724
....: def generator_matrix(self):
724-
....: return matrix(self.base_field(), self.dimension(), self.length(), {(i,i):1 for i in range(self.dimension())})
725+
....: return self._generator_matrix
725726
....: def _repr_(self):
726727
....: return "Dummy code of length %d, dimension %d over %s" % (self.length(), self.dimension(), self.base_field())
727728
728729
We now create a member of our newly made class::
729730
730-
sage: C = CodeExample(GF(17), 10, 5)
731+
sage: generator_matrix = matrix(GF(17), 5, 10,
732+
....: {(i,i):1 for i in range(5)})
733+
sage: C = CodeExample(GF(17), 10, 5, generator_matrix)
731734
732735
We can check its existence and parameters::
733-
736+
734737
sage: C
735738
Dummy code of length 10, dimension 5 over Finite Field of size 17
736739

0 commit comments

Comments
 (0)