-
-
Notifications
You must be signed in to change notification settings - Fork 482
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tentative of random subset for random matrix #36313
Conversation
src/sage/matrix/special.py
Outdated
use_complement = False | ||
|
||
subset = [] | ||
available = list(range(n)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be better to shuffle the list available
and then to return the first k
items (or complement n - k
items).
Alternatively, if you prefer successive calls to randint
, then instead of calling available.pop(index)
, you can simply do available[index] = available[-1]
.
bonne idée, merci. Mais je soupconne qu'il reste un probleme ailleurs, dans la procedure qui utilise la nouvelle fonction |
src/sage/matrix/special.py
Outdated
""" | ||
Return a random subset of range(n) of size k. | ||
|
||
The distribution law is uniform. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here you use uniform distribution but the original method used a beta distribution with parameters [1.6, 4.3]
. ..
y a un bug avec l'usage de "enumerate" |
Je ne vois vraiment pas pourquoi. C'est vraiment lié à ça ? |
dc1bef3
to
1d36521
Compare
Documentation preview for this PR (built with commit 1d36521; changes) is ready! 🎉 |
faut encore attendre la fin des tests |
Something goes wrong
|
this is a problem in size 0 x 0 |
1d36521
to
c1b7779
Compare
Ca devrait etre ok maintenant. |
return_matrix = copy(parent.zero_matrix()) | ||
|
||
# No harm if no pivots at all. | ||
subset = list(range(1, num_col)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to be on the safe side, you may add a test for num_col > 1
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bah, ca me parait pas indispensable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Parfait.
LGTM.
trying to do something for #35664 ; not yet good
📝 Checklist