Decoders.connected_encoder not done anywhere
Issue #35
resolved
No description provided.
Comments (3)
-
repo owner -
reporter Why don't you just call
self.code.encoder(name=self._connected_encoder_name)
? Then the check and possible caching will be done for you.It is important that the connected encoder can be returned without the user having created it, since he might have encoded using a different encoder, but decodes using this. For instance, this is relevant for the Gao GRS decoder, since
decode_to_code
will itself calldecode_to_message
and use the connected encoder to retrieve the corresponding codeword. This is because Gao naturally retrieves the message polynomialf
. -
repo owner - changed status to resolved
- Log in to comment
First proposal in commit : 54cb3e0
For now, it looks for the specified key (hardcoded : "EvaluationVector" for GRS codes and "GeneratorMatrix" for linear codes) of the
_cached_encoders
dictionnary, and returns the associated encoder.Of course, if the user creates the decoder before the encoder, and tries to call connected_encoder, it returns a
KeyError
. I think it makes sense to consider that you will always try to encode before decoding, especially when it comes to connected encoders. But I can change the code in a way that, if I attempt to access the connected_encoder before it was created, I create it, cache it and return it.By the way, I used a direct call to
code._cached_encoders
for now, but I'd prefer use a helper function to access_cached_encoders
. Becausecached_encoders()
does not sound as a nice name (to me), can you imagine something better?