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

[Feature Addition]: NumPy (Python) datatype for posit #363

Open
anubane opened this issue Oct 18, 2023 · 2 comments
Open

[Feature Addition]: NumPy (Python) datatype for posit #363

anubane opened this issue Oct 18, 2023 · 2 comments

Comments

@anubane
Copy link

anubane commented Oct 18, 2023

I have created a wrapper library to utilize the Posit datatype defined by this project as a custom datatype in NumPy (Python).

In this example file you may observe:

from posit8_2 import posit8_2 as p8    #importing the datatype library in Python

Then the datatype is used as follows:

a = np.array([0.33, 0.25, 0.025, 0.0025, 0.00025], dtype=np.float32)

b = a.astype(p8)    # implicit cast from NumPy float32 to Posit<8,2>

Current problems with the library:

  1. I use an old build procedure
  2. The current vesion is specifically for Posit<8,2>, will need help though, to make it generic

Notwithstanding the above, the library is ready to use, once built (using the present method).

I wanted to inquire the following:

  1. If this is useful for the community
  2. Whether stillwater would want to add this officially
@Ravenwater
Copy link
Contributor

@anubane Thank you for your contribution. We have been looking for a Numpy integration for half a decade, so this work is much appreciated.

We have been looking at cppyy as a mechanism to integrate the full parameterization of the C++ types.

Do you have a reviewer you can suggest to evaluate your approach in the context of upstream integration into the Python ecosystem?

@anubane
Copy link
Author

anubane commented Oct 26, 2023

@Ravenwater, I just wish to place on record that the data type wrapper that I have prepared will work only within the NumPy library for Python. It will not provide native data type support in Python itself.

That being said, I am not sure whom may I recommend to review my work. I was hoping that someone from stillwater will be able to handle that!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Backlog
Development

No branches or pull requests

2 participants