summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTravis Oliphant <oliphant@enthought.com>2006-08-22 16:30:10 +0000
committerTravis Oliphant <oliphant@enthought.com>2006-08-22 16:30:10 +0000
commit877df472355e1953c4437f1f6c9bff8acab15658 (patch)
tree86eadf16dcd79e92991ac6d1c6f232febc8a685f
parent548412cf07237e1f6578f0754398d3318d60fed6 (diff)
downloadnumpy-877df472355e1953c4437f1f6c9bff8acab15658.tar.gz
Fix copyswapn for complex data-types
-rw-r--r--numpy/core/src/arraytypes.inc.src3
-rw-r--r--numpy/core/tests/test_regression.py7
2 files changed, 9 insertions, 1 deletions
diff --git a/numpy/core/src/arraytypes.inc.src b/numpy/core/src/arraytypes.inc.src
index 8a2d69d4b..af2ddf026 100644
--- a/numpy/core/src/arraytypes.inc.src
+++ b/numpy/core/src/arraytypes.inc.src
@@ -1041,7 +1041,8 @@ static void
}
if (swap) {
- _strided_byte_swap(dst, dstride, n, sizeof(@type@));
+ _strided_byte_swap(dst, dstride, n, SIZEOF_@fsize@);
+ _strided_byte_swap(dst + SIZEOF_@fsize@, dstride, n, SIZEOF_@fsize@);
}
}
diff --git a/numpy/core/tests/test_regression.py b/numpy/core/tests/test_regression.py
index e5affb104..faf0dcd3b 100644
--- a/numpy/core/tests/test_regression.py
+++ b/numpy/core/tests/test_regression.py
@@ -353,5 +353,12 @@ class test_regression(NumpyTestCase):
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()