Add more export symbols.

This commit is contained in:
Stefan Seefeld 2017-03-16 20:14:39 -04:00
parent 47faef65ee
commit 352792c90a
7 changed files with 55 additions and 39 deletions

View File

@ -70,7 +70,7 @@ public:
};
bool equivalent(dtype const & a, dtype const & b);
BOOST_NUMPY_DECL bool equivalent(dtype const & a, dtype const & b);
namespace detail
{

View File

@ -19,7 +19,7 @@ namespace boost { namespace python { namespace numpy {
namespace detail
{
struct add_pointer_meta
struct BOOST_NUMPY_DECL add_pointer_meta
{
template <typename T>
struct apply
@ -29,8 +29,8 @@ struct add_pointer_meta
};
struct dtype_template_match_found {};
struct nd_template_match_found {};
struct BOOST_NUMPY_DECL dtype_template_match_found {};
struct BOOST_NUMPY_DECL nd_template_match_found {};
template <typename Function>
struct dtype_template_invoker

View File

@ -61,7 +61,7 @@ public:
* return a numpy.matrix instead.
*/
template <typename Base = default_call_policies>
struct BOOST_NUMPY_DECL as_matrix : Base
struct as_matrix : Base
{
static PyObject * postcall(PyObject *, PyObject * result)
{

View File

@ -142,32 +142,32 @@ public:
/**
* @brief Construct a new array with the given shape and data type, with data initialized to zero.
*/
ndarray zeros(python::tuple const & shape, dtype const & dt);
ndarray zeros(int nd, Py_intptr_t const * shape, dtype const & dt);
BOOST_NUMPY_DECL ndarray zeros(python::tuple const & shape, dtype const & dt);
BOOST_NUMPY_DECL ndarray zeros(int nd, Py_intptr_t const * shape, dtype const & dt);
/**
* @brief Construct a new array with the given shape and data type, with data left uninitialized.
*/
ndarray empty(python::tuple const & shape, dtype const & dt);
ndarray empty(int nd, Py_intptr_t const * shape, dtype const & dt);
BOOST_NUMPY_DECL ndarray empty(python::tuple const & shape, dtype const & dt);
BOOST_NUMPY_DECL ndarray empty(int nd, Py_intptr_t const * shape, dtype const & dt);
/**
* @brief Construct a new array from an arbitrary Python sequence.
*
* @todo This does't seem to handle ndarray subtypes the same way that "numpy.array" does in Python.
*/
ndarray array(object const & obj);
ndarray array(object const & obj, dtype const & dt);
BOOST_NUMPY_DECL ndarray array(object const & obj);
BOOST_NUMPY_DECL ndarray array(object const & obj, dtype const & dt);
namespace detail
{
ndarray from_data_impl(void * data,
dtype const & dt,
std::vector<Py_intptr_t> const & shape,
std::vector<Py_intptr_t> const & strides,
object const & owner,
bool writeable);
BOOST_NUMPY_DECL ndarray from_data_impl(void * data,
dtype const & dt,
std::vector<Py_intptr_t> const & shape,
std::vector<Py_intptr_t> const & strides,
object const & owner,
bool writeable);
template <typename Container>
ndarray from_data_impl(void * data,
@ -183,12 +183,12 @@ ndarray from_data_impl(void * data,
return from_data_impl(data, dt, shape_, strides_, owner, writeable);
}
ndarray from_data_impl(void * data,
dtype const & dt,
object const & shape,
object const & strides,
object const & owner,
bool writeable);
BOOST_NUMPY_DECL ndarray from_data_impl(void * data,
dtype const & dt,
object const & shape,
object const & strides,
object const & owner,
bool writeable);
} // namespace boost::python::numpy::detail
@ -250,39 +250,53 @@ inline ndarray from_data(void const * data,
* @param[in] nd_max Maximum number of dimensions.
* @param[in] flags Bitwise OR of flags specifying additional requirements.
*/
ndarray from_object(object const & obj, dtype const & dt,
int nd_min, int nd_max, ndarray::bitflag flags=ndarray::NONE);
BOOST_NUMPY_DECL ndarray from_object(object const & obj,
dtype const & dt,
int nd_min,
int nd_max,
ndarray::bitflag flags=ndarray::NONE);
inline ndarray from_object(object const & obj, dtype const & dt,
int nd, ndarray::bitflag flags=ndarray::NONE)
BOOST_NUMPY_DECL inline ndarray from_object(object const & obj,
dtype const & dt,
int nd,
ndarray::bitflag flags=ndarray::NONE)
{
return from_object(obj, dt, nd, nd, flags);
}
inline ndarray from_object(object const & obj, dtype const & dt, ndarray::bitflag flags=ndarray::NONE)
BOOST_NUMPY_DECL inline ndarray from_object(object const & obj,
dtype const & dt,
ndarray::bitflag flags=ndarray::NONE)
{
return from_object(obj, dt, 0, 0, flags);
}
ndarray from_object(object const & obj, int nd_min, int nd_max,
ndarray::bitflag flags=ndarray::NONE);
BOOST_NUMPY_DECL ndarray from_object(object const & obj,
int nd_min,
int nd_max,
ndarray::bitflag flags=ndarray::NONE);
inline ndarray from_object(object const & obj, int nd, ndarray::bitflag flags=ndarray::NONE)
BOOST_NUMPY_DECL inline ndarray from_object(object const & obj,
int nd,
ndarray::bitflag flags=ndarray::NONE)
{
return from_object(obj, nd, nd, flags);
}
inline ndarray from_object(object const & obj, ndarray::bitflag flags=ndarray::NONE)
BOOST_NUMPY_DECL inline ndarray from_object(object const & obj,
ndarray::bitflag flags=ndarray::NONE)
{
return from_object(obj, 0, 0, flags);
}
inline ndarray::bitflag operator|(ndarray::bitflag a, ndarray::bitflag b)
BOOST_NUMPY_DECL inline ndarray::bitflag operator|(ndarray::bitflag a,
ndarray::bitflag b)
{
return ndarray::bitflag(int(a) | int(b));
}
inline ndarray::bitflag operator&(ndarray::bitflag a, ndarray::bitflag b)
BOOST_NUMPY_DECL inline ndarray::bitflag operator&(ndarray::bitflag a,
ndarray::bitflag b)
{
return ndarray::bitflag(int(a) & int(b));
}

View File

@ -7,6 +7,8 @@
#ifndef boost_python_numpy_numpy_object_mgr_traits_hpp_
#define boost_python_numpy_numpy_object_mgr_traits_hpp_
#include <boost/python/numpy/config.hpp>
/**
* @brief Macro that specializes object_manager_traits by requiring a
* source-file implementation of get_pytype().
@ -14,7 +16,7 @@
#define NUMPY_OBJECT_MANAGER_TRAITS(manager) \
template <> \
struct object_manager_traits<manager> \
struct BOOST_NUMPY_DECL object_manager_traits<manager> \
{ \
BOOST_STATIC_CONSTANT(bool, is_specialized = true); \
static inline python::detail::new_reference adopt(PyObject* x) \

View File

@ -22,7 +22,7 @@ namespace boost { namespace python { namespace numpy {
*
* @todo This could have a lot more functionality.
*/
class void_ : public object
class BOOST_NUMPY_DECL void_ : public object
{
static python::detail::new_reference convert(object_cref arg, bool align);
public:

View File

@ -62,13 +62,13 @@ public:
};
/// @brief Construct a multi_iter over a single sequence or scalar object.
multi_iter make_multi_iter(object const & a1);
BOOST_NUMPY_DECL multi_iter make_multi_iter(object const & a1);
/// @brief Construct a multi_iter by broadcasting two objects.
multi_iter make_multi_iter(object const & a1, object const & a2);
BOOST_NUMPY_DECL multi_iter make_multi_iter(object const & a1, object const & a2);
/// @brief Construct a multi_iter by broadcasting three objects.
multi_iter make_multi_iter(object const & a1, object const & a2, object const & a3);
BOOST_NUMPY_DECL multi_iter make_multi_iter(object const & a1, object const & a2, object const & a3);
/**
* @brief Helps wrap a C++ functor taking a single scalar argument as a broadcasting ufunc-like