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

Commit 02c1f6d

Browse files
author
David Lucas
committed
Shortcut for method encode
1 parent edcb48a commit 02c1f6d

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/sage/coding/encoder.py

+7
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,10 @@ def encode(self, word):
124124
One should use the exception :class:`EncodingError` to catch attempts
125125
to encode words that are outside of the message space.
126126
127+
One can use the following shortcut to encode a word with an encoder ``E``::
128+
129+
E(word)
130+
127131
INPUT:
128132
129133
- ``word`` -- a vector of the message space of the ``self``.
@@ -154,6 +158,9 @@ def encode(self, word):
154158
raise ValueError("The value to encode must be in %s" % M)
155159
return vector(word) * self.generator_matrix()
156160

161+
#Alias for encode method
162+
__call__ = encode
163+
157164
def unencode(self, c, nocheck=False):
158165
r"""
159166
Returns the message corresponding to the codeword ``c``.

0 commit comments

Comments
 (0)