Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accessing PyArray_GETITEM and PyArray_SETITEM #1181

Open
m-chaturvedi opened this issue Nov 13, 2017 · 4 comments
Open

Accessing PyArray_GETITEM and PyArray_SETITEM #1181

m-chaturvedi opened this issue Nov 13, 2017 · 4 comments

Comments

@m-chaturvedi
Copy link

Issue description

In order to pass PR #1152 on CI, I need to access PyArray_GETITEM and PyArray_SETITEM. These functions are not a part of the limited Python API Pybind11 seems to give access to. I was wondering how I could go about using them?

Initially, Jason suggested reimplementing the functions like they are in ndarraytypes.h, but then realized that the object types like PyArray_ArrFuncs is something we can't have access to. Is there a way around this? I guess, creating proxies doesn't make sense as well since the types are not exposed in Numpy's API, correct?

As per Jason's suggestion, I've asked the question on numpy-discussion as well, about why aren't these functions exposed like the rest of them in numpy_api.py.

Any help would be appreciated! Thanks!

@m-chaturvedi
Copy link
Author

m-chaturvedi commented Nov 14, 2017

For now I called the Python methods item and itemset and cast the object back to C++ object.

@m-chaturvedi
Copy link
Author

@jagerman
Copy link
Member

Any thoughts on the suggestions in the numpy-discussion thread?

@m-chaturvedi
Copy link
Author

I could get PySequence_(Get / Set)Item to work with 1D matrices, but what would be a way to make it work for 2D arrays, like for here?
(On gitter)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants