Improving the running speed...

asked 2021-03-19 05:32:44 +0200

phcosta gravatar image

updated 2021-03-19 13:45:01 +0200

Is it possible to get faster running if one applies a kind of multiprocessing to the example below?

L = Permutations(10)
K = factorial(10)
C = matrix(ZZ, 0, K)
d = []
for k in range(1, 10):
    B = Arrangements([1 .. 10], k)
    A = matrix(ZZ, [[all(p[i - 1] == u for i, u in zip(ii, uu))
                     for p in L] for ii in B for uu in B])
    C = C.stack(A)
    d.append(N-C.rank())
return d
edit retag flag offensive close merge delete

Comments

2

The matrix A has size $\left(\frac{10!}{(10-k)!}\right)^2\times 10!$. For example, when $k=9$, it has $10!^3\approx 2^{65}$ elements, and there is no way you can fit it into memory

Max Alekseyev gravatar imageMax Alekseyev ( 2021-03-19 16:39:50 +0200 )edit

Thank you.

phcosta gravatar imagephcosta ( 2021-03-19 17:28:44 +0200 )edit