[Scipy-svn] r2116 - in trunk/Lib/weave: examples scxx

scipy-svn at scipy.org scipy-svn at scipy.org
Fri Jul 21 09:56:27 EDT 2006


Author: stefan
Date: 2006-07-21 08:56:13 -0500 (Fri, 21 Jul 2006)
New Revision: 2116

Modified:
   trunk/Lib/weave/examples/binary_search.py
   trunk/Lib/weave/examples/dict_sort.py
   trunk/Lib/weave/examples/object.py
   trunk/Lib/weave/scxx/object.h
   trunk/Lib/weave/scxx/sequence.h
Log:
Fixes in weave, contributed by Pierre Barbier.


Modified: trunk/Lib/weave/examples/binary_search.py
===================================================================
--- trunk/Lib/weave/examples/binary_search.py	2006-07-20 06:15:12 UTC (rev 2115)
+++ trunk/Lib/weave/examples/binary_search.py	2006-07-21 13:56:13 UTC (rev 2116)
@@ -19,7 +19,7 @@
 sys.path.insert(0,'..')
 #from compiler import inline_tools
 import scipy.weave.inline_tools as inline_tools
-from bisect import bisect
+from bisect import bisect_left as bisect
 import types
 
 def c_int_search(seq,t,chk=1):

Modified: trunk/Lib/weave/examples/dict_sort.py
===================================================================
--- trunk/Lib/weave/examples/dict_sort.py	2006-07-20 06:15:12 UTC (rev 2115)
+++ trunk/Lib/weave/examples/dict_sort.py	2006-07-21 13:56:13 UTC (rev 2116)
@@ -46,7 +46,9 @@
            keys.sort();
            int N = keys.length();
            for(int i = 0; i < N;i++)
-              items[i] = adict[keys[i]];
+           {
+              items[i] = adict[int( keys[i] )];
+           }
            return_val = items;
            """
     return inline_tools.inline(code,['adict'],verbose=1)

Modified: trunk/Lib/weave/examples/object.py
===================================================================
--- trunk/Lib/weave/examples/object.py	2006-07-20 06:15:12 UTC (rev 2115)
+++ trunk/Lib/weave/examples/object.py	2006-07-21 13:56:13 UTC (rev 2116)
@@ -41,7 +41,7 @@
        // find obj length and accesss each of its items
        std::cout << "UserList items: ";
        for(i = 0; i < obj.length(); i++)
-           std::cout << obj[i] << " ";
+           std::cout << obj[i].str() << " ";
        std::cout << std::endl;
        // assign new values to each of its items
        for(i = 0; i < obj.length(); i++)

Modified: trunk/Lib/weave/scxx/object.h
===================================================================
--- trunk/Lib/weave/scxx/object.h	2006-07-20 06:15:12 UTC (rev 2115)
+++ trunk/Lib/weave/scxx/object.h	2006-07-21 13:56:13 UTC (rev 2116)
@@ -726,7 +726,7 @@
   };
   
   object is_tuple() const {
-    return PyDict_Check(_obj) == 1;
+    return PyTuple_Check(_obj) == 1;
   };
   
   object is_dict() const {

Modified: trunk/Lib/weave/scxx/sequence.h
===================================================================
--- trunk/Lib/weave/scxx/sequence.h	2006-07-20 06:15:12 UTC (rev 2115)
+++ trunk/Lib/weave/scxx/sequence.h	2006-07-21 13:56:13 UTC (rev 2116)
@@ -257,6 +257,10 @@
     object oth = other;
     return operator=(oth);
   };
+  indexed_ref& operator=( const indexed_ref& other ) {
+    object oth = other;
+    return operator=( oth );
+  }
 };
 
 




More information about the Scipy-svn mailing list