4 ms·
Last year I had to multiply a nxn matrix by another nxn matrix that has only one row. I lost like a week to write the correct @guvectorize spell in numpy to mak
by gus_massa 10mo ago
Last year I had to multiply a nxn matrix by another nxn matrix that has only one row. I lost like a week to write the correct @guvectorize spell in numpy to make that multiplication faster than the usual multiplication.
- northlondoner 10mo agoInteresting. Maybe this was due to matrix-matrix, matrix-vector and vector-vector separation in BLAS/LAPACK routines.
- gus_massa 10mo agoWe were using einsum from numpy. We have some 2 and 4 (and perhaps 6) dimensional arrays. I'm not sure what happens under the hood, but trying to replicate it explicitly to make some tweaks requires a lot of magic. It was like two year ago, I forgot the details. Protip: "optimize=True" is equivalent to "optimize='greedy'", but you may prefer "optimize='optimal'" for big cases or use a list precalculated by einsum_path.