From: Rob <ro...@py...> - 2001-12-22 16:10:43
|
Problem solved. I had one last for loop in there. Its odd that as I gradually got rid of the for loops, the speed went down, but when I got rid of the last on, bingo! That routine now runs at a 1/10 of its original time. Rob. Rob wrote: > > Rob wrote: > > > > I have a number of thse routines in some EM code. I've tried to > > Numpyize them, but end up with code that runs even slower. > > > > Here is the old indexed routing: > > > > ----------------- > > for JJ in range(0,TotExtMetalEdgeNum): > > > > McVector+=Ccc[0:TotExtMetalEdgeNum,JJ] * VcVector[JJ] > > ---------------- > > > > Here is the Numpy version: > > > > --------------------- > > McVector= add.reduce(transpose(Ccc[...] * VcVector[...])) > > --------------------- > > > > I wonder if there is another faster way to do this? Thanks, Rob. > > > > -- > > I did speed things up just a tiny bit by using: > > add.reduce(Ccc*VcVector,1) instead of > add.reduce(transpose(Ccc*VcVector). > > But I'm still running way slower than an indexed array scheme. Rob. > > The Numeric Python EM Project > > > > www.pythonemproject.com > > -- > The Numeric Python EM Project > > www.pythonemproject.com > > _______________________________________________ > Numpy-discussion mailing list > Num...@li... > https://lists.sourceforge.net/lists/listinfo/numpy-discussion -- The Numeric Python EM Project www.pythonemproject.com |