Re: [Numpy-discussion] suggestions on optimising a special matrix reshape

2011-07-05 Thread Christopher Barker
qu...@gmx.at wrote: > 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): >

[Numpy-discussion] suggestions on optimising a special matrix reshape

2011-07-05 Thread qubax
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),