ufunc.cpp
Go to the documentation of this file.
00001 // Copyright Jim Bosch 2010-2012.
00002 // Distributed under the Boost Software License, Version 1.0.
00003 //    (See accompanying file LICENSE_1_0.txt or copy at
00004 //          http://www.boost.org/LICENSE_1_0.txt)
00005 
00006 #define BOOST_NUMPY_INTERNAL
00007 #include <boost/numpy/internal.hpp>
00008 #include <boost/numpy/ufunc.hpp>
00009 
00010 namespace boost 
00011 {
00012 namespace python 
00013 {
00014 namespace converter 
00015 {
00016 NUMPY_OBJECT_MANAGER_TRAITS_IMPL(PyArrayMultiIter_Type, numpy::multi_iter)
00017 } // namespace boost::python::converter
00018 } // namespace boost::python
00019 
00020 namespace numpy 
00021 {
00022 
00023 multi_iter make_multi_iter(python::object const & a1) 
00024 {
00025   return multi_iter(python::detail::new_reference(PyArray_MultiIterNew(1, a1.ptr())));
00026 }
00027 
00028 multi_iter make_multi_iter(python::object const & a1, python::object const & a2) 
00029 {
00030   return multi_iter(python::detail::new_reference(PyArray_MultiIterNew(2, a1.ptr(), a2.ptr())));
00031 }
00032 
00033 multi_iter make_multi_iter(python::object const & a1, python::object const & a2, python::object const & a3) 
00034 {
00035   return multi_iter(python::detail::new_reference(PyArray_MultiIterNew(3, a1.ptr(), a2.ptr(), a3.ptr())));
00036 }
00037 
00038 void multi_iter::next() 
00039 {
00040   PyArray_MultiIter_NEXT(ptr());
00041 }
00042 
00043 bool multi_iter::not_done() const 
00044 {
00045   return PyArray_MultiIter_NOTDONE(ptr());
00046 }
00047 
00048 char * multi_iter::get_data(int i) const 
00049 {
00050   return reinterpret_cast<char*>(PyArray_MultiIter_DATA(ptr(), i));
00051 }
00052 
00053 int const multi_iter::get_nd() const 
00054 {
00055   return reinterpret_cast<PyArrayMultiIterObject*>(ptr())->nd;
00056 }
00057 
00058 Py_intptr_t const * multi_iter::get_shape() const 
00059 {
00060   return reinterpret_cast<PyArrayMultiIterObject*>(ptr())->dimensions;
00061 }
00062 
00063 Py_intptr_t const multi_iter::shape(int n) const 
00064 {
00065   return reinterpret_cast<PyArrayMultiIterObject*>(ptr())->dimensions[n];
00066 }
00067 
00068 }
00069 }


boost_numpy
Author(s): Jim Bosch, Ankit Daftery
autogenerated on Fri Aug 28 2015 10:10:40