From: <vi...@id...> - 2002-07-30 15:28:59
|
Sorry, I had a typo in the program. It should be: # M is n by k, and represents a sparse n by n matrix A # the non-zero entries of row i of A start in column loc[i] # and are the i-th row of M in locations loc[i]:loc[i]+k # loc is the location vector n,k = M.shape mm = reshape(v,(-1,1))*M w = zeros((n+m),v.typecode()) # is there a trick to replace the loop below? for i in range(mm.shape[0]): w[loc[i]:loc[i]+k] += mm[i] w = w[:n] -- Victor S. Miller | " ... Meanwhile, those of us who can compute can hardly vi...@id... | be expected to keep writing papers saying 'I can do the CCR, Princeton, NJ | following useless calculation in 2 seconds', and indeed 08540 USA | what editor would publish them?" -- Oliver Atkin |