Thanks but it still doesn't work: import numpy import scipy.weave from scipy.weave import converters
def my_sum(a): n=int(len(a)) code=""" int i; long int counter; counter =0; for(i=0;i<n;i++){ counter=counter+a(i); } return_val=counter; """ err=scipy.weave.inline(code,['a','n'],type_converters=scipy.weave.converters.blitz,compiler='gcc') return err a=numpy.array(range(60000)) time my_sum(a) time sum(range(60000)) (I needed to use scipy.weave instead of weave everywhere, sage ignored the "import scipy.weave" hm.....) gives: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/sage/sagenb/sage_notebook/worksheets/Ch4os/17/code/42.py", line 9, in <module> __time__=misc.cputime(); __wall__=misc.walltime(); my_sum(a); print "Time: CPU %.2f s, Wall: %.2f s"%(misc.cputime(__time__), misc.walltime(__wall__)) File "/home/sage/sagenb/sage_notebook/worksheets/Ch4os/17/code/41.py", line 18, in my_sum err=scipy.weave.inline(code,['a','n'],type_converters=converters.blitz,compiler='gcc') File "/home/sage/sage_install/sage/local/lib/python2.6/site-packages/scipy/weave/inline_tools.py", line 321, in inline results = attempt_function_call(code,local_dict,global_dict) File "/home/sage/sage_install/sage/local/lib/python2.6/site-packages/scipy/weave/inline_tools.py", line 389, in attempt_function_call function_list = function_catalog.get_functions(code,module_dir) File "/home/sage/sage_install/sage/local/lib/python2.6/site-packages/scipy/weave/catalog.py", line 612, in get_functions function_list = self.get_cataloged_functions(code) File "/home/sage/sage_install/sage/local/lib/python2.6/site-packages/scipy/weave/catalog.py", line 526, in get_cataloged_functions if cat is not None and code in cat: File "/home/sage/sage_install/sage/local/lib/python/shelve.py", line 110, in __contains__ return key in self.dict File "/home/sage/sage_install/sage/local/lib/python2.6/site-packages/scipy/io/dumbdbm_patched.py", line 73, in __getitem__ pos, siz = self._index[key] # may raise KeyError KeyError: 0 > Date: Mon, 7 Sep 2009 10:02:40 -0700 > Subject: [sage-support] Re: weave corrupt > From: fe...@neuro.uni-bremen.de > To: sage-support@googlegroups.com > > > Hi, > > What about: > > import scipy.weave > from scipy.weave import converters > > ? > > - Felix > > On 4 Sep., 21:56, Patrick Hammer <patrickhamm...@hotmail.com> wrote: > > Hi! > > > > import weave > > from weave import converters > > > > gives: > > > > Traceback (most recent call last): > > File "<stdin>", line 1, in <module> > > File "/home/sage/sagenb/sage_notebook/worksheets/Ch4os/17/code/6.py", > > line 6, in <module> > > import weave > > File > > "/home/sage/sage_install/sage/local/lib/python2.6/site-packages/weave/__ini > > t__.py", line 21, in <module> > > from numpy.testing import ScipyTest > > ImportError: cannot import name ScipyTest > > so the weave-examples do not work. > > Is there some solution for this? > > > > _________________________________________________________________ > > With Windows Live, you can organize, edit, and share your > > photos.http://www.microsoft.com/middleeast/windows/windowslive/products/phot... > > _________________________________________________________________ Show them the way! Add maps and directions to your party invites. http://www.microsoft.com/windows/windowslive/products/events.aspx --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---