Assume I have an expression for an matrix initialization, for example the following:
A[i,i-2*j+k] = B[i-k] * C[i] * D[i+j+k]
In order to execute such a process, I could loop over all i, j and k. The problem is that loops are slow in python, compared to e.g. loops in C.
Is there some way to use compiled packages for operations such as the one above? This should improve performance a lot I would guess.
map
function to vectorize the operation. Alternatively, trycython
. $\endgroup$ – Biswajit Banerjee Dec 10 '15 at 20:50