What are the dimensions (i.e. sizes) of these 9 dimensions? You might be interested in trying the tensorcontract routine from TensorOperations.jl and compare the method=:BLAS vs method=:native approach. Although I do assume that for a specific case like this (where basically every dimension is individually contracted with a matrix) there might be better approaches.
Op maandag 18 augustus 2014 22:35:25 UTC+2 schreef Florian Oswald: > > Hi! > > yes. I find that > > 37 % of time spent at line 26 > 51 % of time spent at line 29 > > in the gist. > > line 26 is > > idx1 = idx9(is1,iz1,iy1,ip1,itau1,ia,ih,ij,age,p) > > > line 29 is > > @inbounds tmp += m.vbar[idx1] * Gz[iz + p.nz * (iz1 + p.nz * (ij-1)-1)] * > Gyp[iy + p.ny * ((ip-1) + p.np * ((iy1-1) + p.ny * ((ip1-1) + p.np * > (ij-1)))) ] * Gs[is + p.ns * (is1-1)] * Gtau[itau1] > > > > > > > > On 18 August 2014 19:13, Kevin Squire <kevin....@gmail.com <javascript:>> > wrote: > >> Have you run it through the profiler already? >> >> >> On Monday, August 18, 2014, Florian Oswald <florian...@gmail.com >> <javascript:>> wrote: >> >>> Hi all, >>> >>> i'm trying to improve the performance of this function: >>> >>> https://gist.github.com/floswald/9e79f6f51c276becbd74 >>> >>> In a nutshell, I have got a high-dimensional array vbar (in this >>> instance it is 9D), and I want to obtain another array EV (also 9D), by >>> matrix-multiplying several dimensions of vbar with transition matrices - >>> they are prefixed with "G..." in the function. The G's are square matrices, >>> where row i has the probability of moving from state i to state j. (some of >>> those matrices are actually 3D because they depend on an additional state, >>> but that doesn't matter.) >>> >>> I devectorized it already but wanted to see whether anyone out there has >>> a suggestion. >>> >>> thanks! >>> florian >>> >> >