[Numpy-svn] r3052 - in trunk/numpy/core: src tests

numpy-svn at scipy.org numpy-svn at scipy.org
Tue Aug 22 11:30:14 CDT 2006


Author: oliphant
Date: 2006-08-22 11:30:10 -0500 (Tue, 22 Aug 2006)
New Revision: 3052

Modified:
   trunk/numpy/core/src/arraytypes.inc.src
   trunk/numpy/core/tests/test_regression.py
Log:
Fix copyswapn for complex data-types

Modified: trunk/numpy/core/src/arraytypes.inc.src
===================================================================
--- trunk/numpy/core/src/arraytypes.inc.src	2006-08-22 16:02:52 UTC (rev 3051)
+++ trunk/numpy/core/src/arraytypes.inc.src	2006-08-22 16:30:10 UTC (rev 3052)
@@ -1041,7 +1041,8 @@
         }
 
         if (swap) {
-                _strided_byte_swap(dst, dstride, n, sizeof(@type@));
+                _strided_byte_swap(dst, dstride, n, SIZEOF_ at fsize@);
+                _strided_byte_swap(dst + SIZEOF_ at fsize@, dstride, n, SIZEOF_ at fsize@);
         }
 }
 

Modified: trunk/numpy/core/tests/test_regression.py
===================================================================
--- trunk/numpy/core/tests/test_regression.py	2006-08-22 16:02:52 UTC (rev 3051)
+++ trunk/numpy/core/tests/test_regression.py	2006-08-22 16:30:10 UTC (rev 3052)
@@ -353,5 +353,12 @@
         v = N.array([1,2,3,4,5,6,7,8,9,10])
         assert_equal(N.lexsort(v),0)
 
+    def check_swap_real(self, level=rlevel):
+        """Ticket #265"""
+        assert_equal(N.arange(4,dtype='>c8').imag.max(),0.0)
+        assert_equal(N.arange(4,dtype='<c8').imag.max(),0.0)
+        assert_equal(N.arange(4,dtype='>c8').real.max(),3.0)
+        assert_equal(N.arange(4,dtype='<c8').real.max(),3.0)
+
 if __name__ == "__main__":
     NumpyTest().run()



More information about the Numpy-svn mailing list