[Numpy-discussion] another seemingly unNumpyizeable routine

Rob europax at home.com
Sat Sep 1 11:58:08 CDT 2001


I hate to bother you guys, but this is how I learn.  I have had some
success using the take() and add.reduce() routines all by myself. 
However this one seems intractable:

for IEdge in range(0,a.HybrdBoundEdgeNum):  
    for JEdge in range(0,a.HybrdBoundEdgeNum):  
        AVec[IEdge+a.TotInnerEdgeNum] +=
a.Cdd[IEdge,JEdge]*XVec[JEdge+a.TotInnerEdgeNum]

## below is my attempt at this, but it doesn't
work                        
## h=a.TotInnerEdgeNum
## for IEdge in range(0,a.HybrdBoundEdgeNum):
##     AVec[IEdge+h] = add.reduce(a.Cdd[IEdge,0:a.HybrdBoundEdgeNum] *
XVec[h:(h+a.HybrdBoundEdgeNum)])
                              
I think the problem lies in that add.reduce is using the slice
0:a.HybridBoundEdgeNum for Cdd, but then has to contend with XVec slice
which is offset by h.  Is there any elegant way to deal with this.  This
routine is part of a sparse matrix multiply routine.  If I could find
SparsePy, maybe I could eliminate it altogether.

Thanks,  Rob.



-- 
The Numeric Python EM Project

www.members.home.net/europax




More information about the Numpy-discussion mailing list