i have to reshape a matrix beta of the form (4**N, 4**N, 4**N, 4**N)
into betam like (16**N, 16**N) following:

betam = np.zeros((16**N,16**N), dtype = complex)
for k in xrange(16**N):
    ind1 = np.mod(k,4**N)
    ind2 = k/4**N
    for l in xrange(16**N):
        betam[k,l] = beta[np.mod(l,4**N), l/4**N, ind1 , ind2]

is there a smarter/faster way of getting the above done?

for N=2, that already takes 0.5 seconds but i intend to use it
for N=3 and N=4 ...

thanks for your input,
q

-- 
History consists of nothing more than the lies we tell ourselves
to justify the present.

The king who needs to remind his people of his rank, is no king.

A beggar's mistake harms no one but the beggar. A king's mistake,
however, harms everyone but the king. Too often, the measure of
power lies not in the number who obey your will, but in the number
who suffer your stupidity.
_______________________________________________
NumPy-Discussion mailing list
[email protected]
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to