Rewrite LinearCode.random_element()
No description provided.
Comments (5)
-
reporter -
I would vote that
random_element()
takes no arguments at all. I can't see what those arguments should be good for...Generically, I don't see a way of creating random elements of a vector space without a basis for it. But your solution uses our own
Encoder
structure. This makes the most sense, since a subclass might provide as standard encoder something that doesn't create a generator matrix (e.g.ConcatenatedCode
). -
reporter I would vote that random_element() takes no arguments at all. I can't see what those arguments should be good for...
Well, generic arguments seemed to be passed to any
random_element
method, likeprob
ordistribution
. As usual in Sage, I assume we have to keep these.This makes the most sense, since a subclass might provide as standard encoder something that doesn't create a generator matrix
I wrote everywhere in the user documentation that one should always set an encoder which can build a generator matrix as default encoder, to be able to use all the generic methods which come from
AbstractLinearCode
.ConcatenatedCode
has the same behaviour, I set the encoder which builds a generator matrix as its default encoder.I any case, I cannot picture another way to do it. But usually, I'm not the one who comes with the best solutions so I thought one of you would have a smartest way to do this...
-
Well, generic arguments seemed to be passed to any
random_element
method, likeprob
ordistribution
. As usual in Sage, I assume we have to keep these.Hmm, you seem to be right. But that's totally misleading and bizarre in our case. I have no idea what those parameters are and what they would do!
I wrote everywhere in the user documentation that one should always set an encoder which can build a generator matrix as default encoder, to be able to use all the generic methods which come from
AbstractLinearCode
.ConcatenatedCode
has the same behaviour, I set the encoder which builds a generator matrix as its default encoder.I any case, I cannot picture another way to do it. But usually, I'm not the one who comes with the best solutions so I thought one of you would have a smartest way to do this...
I don't understand. Your implementation: 1) creates a random message
m
inF^k
. 2) encodes this message usingself.encoder().encode(m)
. No generator matrix is explicitly built! If the default encoder uses a generator matrix then, yes, one is built. If it encodes in another way, such as (I presume) your implementation ofConcatenatedCode
, then no generator matrix is built. -
reporter - changed status to resolved
Yes, you're right. What I proposed in #19653 seems sufficient. Closing.
- Log in to comment
1st rewriting proposed in #19653, see #19653, comments 43 to 45, related to passing of arguments.
1) If one manages to find a list of optional arguments for
random_element
in Sage, I'd be more than happy to have it. I did looked, even traced down the different calls torandom_element
over different constructions and it's not that easy to find.2) What I meant when I said "not the best way to do it", it's because it forces to create an encoder and encode, so it forces to create a generator matrix from time to time - which we might like to avoid.