-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
Add a perm
function into scipy.misc
and an enhancement of comb
#3094
Comments
It already has |
I mean the k-permutations of n. Of course it is feasible to compute it with In [37]: def perm(N, k):
....: if (k > N) or (N < 0) or (k < 0):
....: return 0
....: val = 1
....: for i in xrange(N - k + 1, N + 1):
....: val *= i
....: return val
In [38]: %timeit perm(10000, 10)
1000000 loops, best of 3: 1.2 µs per loop
In [39]: %timeit factorial(10000, True) // factorial(10000 - 10, True)
10 loops, best of 3: 42.3 ms per loop |
This function looks like it belongs to |
The |
I think they can be placed in |
PR merged. |
scipy.misc
has a functioncomb
to compute the numbers of combinations. It may be better to provide aperm
function to compute the numbers of permutations.In addition, we can add an optional parameter
repetition
to makecomb
support the numbers of combinations with repetition.BTW: the docstring says that the type of the
exact
parameter isint
but it should bebool
.The text was updated successfully, but these errors were encountered: