Skip to content
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

Partitions(n).random_element() is extremely slow #7409

Closed
hivert opened this issue Nov 8, 2009 · 6 comments
Closed

Partitions(n).random_element() is extremely slow #7409

hivert opened this issue Nov 8, 2009 · 6 comments

Comments

@hivert
Copy link

hivert commented Nov 8, 2009

It is currently implemented by building the list !
Here are some suggestions: Look at

http://www.site.uottawa.ca/~ivan/F49-int-part.pdf

Thanks to #7408 we have a fast algorithm for generating partitions with Plancherel measure. So I suggest the following interface:

Paritions(n).random_element()

default to

Partitions(n).random_element_uniform()

and to implement

Partitions(n).random_element_Plancherel()

Any comment about the interface ?

Cheers,

Florent

CC: @sagetrac-sage-combinat

Component: combinatorics

Keywords: random integer partition, placherel measure

Author: Florent Hivert

Reviewer: Mike Hansen

Merged: sage-4.3.alpha1

Issue created by migration from https://trac.sagemath.org/ticket/7409

@hivert hivert added this to the sage-4.3 milestone Nov 8, 2009
@mwhansen
Copy link
Contributor

mwhansen commented Nov 8, 2009

comment:1

I would think something like

Partitions(n).random_element(distribution='uniform') #default
Partitions(n).random_element(distribution='plancherel')

@hivert hivert assigned hivert and unassigned mwhansen Nov 13, 2009
@hivert
Copy link
Author

hivert commented Nov 24, 2009

comment:3

Attachment: trac_7409_random_partitions.patch.gz

I implemented an algorithm from "Nijenhuis, Wilf, Combinatorial Algorithms" which looks reasonably fast. There is certainly room for improvement. However, It will be done later if needed.

@hivert
Copy link
Author

hivert commented Nov 24, 2009

Author: Florent Hivert

@mwhansen
Copy link
Contributor

mwhansen commented Dec 1, 2009

comment:4

Looks good.

@mwhansen
Copy link
Contributor

mwhansen commented Dec 1, 2009

Merged: sage-4.3.alpha1

@mwhansen
Copy link
Contributor

mwhansen commented Dec 1, 2009

Reviewer: Mike Hansen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants