|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r72882 - sandbox/numpy/libs/numpy/test
From: seefeld_at_[hidden]
Date: 2011-07-03 16:36:56
Author: stefan
Date: 2011-07-03 16:36:55 EDT (Sun, 03 Jul 2011)
New Revision: 72882
URL: http://svn.boost.org/trac/boost/changeset/72882
Log:
Fix indexing tests.
Text files modified:
sandbox/numpy/libs/numpy/test/indexing.py | 6 +++---
sandbox/numpy/libs/numpy/test/indexing_mod.cpp | 8 ++++----
2 files changed, 7 insertions(+), 7 deletions(-)
Modified: sandbox/numpy/libs/numpy/test/indexing.py
==============================================================================
--- sandbox/numpy/libs/numpy/test/indexing.py (original)
+++ sandbox/numpy/libs/numpy/test/indexing.py 2011-07-03 16:36:55 EDT (Sun, 03 Jul 2011)
@@ -33,16 +33,16 @@
y = numpy.array([0,1])
z = numpy.array([0,2])
chk = numpy.array([0,5])
- #numpy.testing.assert_equal(indexing_mod.indexarray(x,y,z),chk) # This throws an assertion error, indicates shape mismatch
+ numpy.testing.assert_equal(indexing_mod.indexarray(x,y,z),chk)
x = numpy.arange(0,10)
b = x>4
chk = numpy.array([5,6,7,8,9])
numpy.testing.assert_equal(indexing_mod.indexarray(x,b),chk)
x = numpy.arange(9).reshape(3,3)
b = numpy.array([0,2])
- sl = slice(0,2)
+ sl = slice(0,3)
chk = numpy.array([[0,1,2],[6,7,8]])
- #numpy.testing.assert_equal(indexing_mod.indexslice(x,b,sl),chk)
+ numpy.testing.assert_equal(indexing_mod.indexslice(x,b,sl),chk)
if __name__=="__main__":
unittest.main()
Modified: sandbox/numpy/libs/numpy/test/indexing_mod.cpp
==============================================================================
--- sandbox/numpy/libs/numpy/test/indexing_mod.cpp (original)
+++ sandbox/numpy/libs/numpy/test/indexing_mod.cpp 2011-07-03 16:36:55 EDT (Sun, 03 Jul 2011)
@@ -7,8 +7,8 @@
p::object single(np::ndarray ndarr, int i) { return ndarr[i];}
p::object slice(np::ndarray ndarr, p::slice sl) { return ndarr[sl];}
p::object indexarray(np::ndarray ndarr, np::ndarray d1) { return ndarr[d1];}
-//p::object indexarray_2d(np::ndarray ndarr, np::ndarray d1,np::ndarray d2) { return ndarr[d1,d2];}
-//p::object indexslice(np::ndarray ndarr, np::ndarray d1, p::slice sl) { return ndarr[d1][sl];}
+p::object indexarray_2d(np::ndarray ndarr, np::ndarray d1,np::ndarray d2) { return ndarr[p::make_tuple(d1,d2)];}
+p::object indexslice(np::ndarray ndarr, np::ndarray d1, p::slice sl) { return ndarr[p::make_tuple(d1, sl)];}
BOOST_PYTHON_MODULE(indexing_mod)
{
@@ -16,7 +16,7 @@
p::def("single", single);
p::def("slice", slice);
p::def("indexarray", indexarray);
- // p::def("indexarray", indexarray_2d);
- // p::def("indexslice", indexslice);
+ p::def("indexarray", indexarray_2d);
+ p::def("indexslice", indexslice);
}
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk