mirror of
https://github.com/boostorg/python.git
synced 2026-01-25 06:22:15 +00:00
ndarray.shape(k),strides(k) act more like their python counterparts (negative indexing, bounds checking) (issue #157)
This commit is contained in:
committed by
Stefan Seefeld
parent
00b7ed03a7
commit
ecf05c4a90
@@ -31,6 +31,9 @@ np::ndarray transpose(np::ndarray arr) { return arr.transpose();}
|
||||
np::ndarray squeeze(np::ndarray arr) { return arr.squeeze();}
|
||||
np::ndarray reshape(np::ndarray arr,p::tuple tup) { return arr.reshape(tup);}
|
||||
|
||||
Py_intptr_t shape_index(np::ndarray arr,int k) { return arr.shape(k); }
|
||||
Py_intptr_t strides_index(np::ndarray arr,int k) { return arr.strides(k); }
|
||||
|
||||
BOOST_PYTHON_MODULE(ndarray_ext)
|
||||
{
|
||||
np::initialize();
|
||||
@@ -43,4 +46,6 @@ BOOST_PYTHON_MODULE(ndarray_ext)
|
||||
p::def("transpose", transpose);
|
||||
p::def("squeeze", squeeze);
|
||||
p::def("reshape", reshape);
|
||||
p::def("shape_index", shape_index);
|
||||
p::def("strides_index", strides_index);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user