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

Object dtype #98

Open
Ivorforce opened this issue Oct 3, 2024 · 1 comment
Open

Object dtype #98

Ivorforce opened this issue Oct 3, 2024 · 1 comment
Labels
feature New feature or request

Comments

@Ivorforce
Copy link
Owner

Ivorforce commented Oct 3, 2024

A Variant dtype NDArray would hold Object instead of floats, ints and whatnot.
For the moment, it would not support any mathematical operations (though they can be added in through the Variant interface).

The main reason to have such a dtype is:

@Ivorforce Ivorforce added the feature New feature or request label Oct 3, 2024
@Ivorforce Ivorforce changed the title Variant dtype Object dtype Oct 3, 2024
@Ivorforce
Copy link
Owner Author

Ivorforce commented Nov 17, 2024

The 'shared vatensor' way would be to create an "Object" dtype is to have the elements be unique_ptr (or shared_ptr) to virtual structs. The objects would need to implement each of the supported functions on other single-objects, returning a unique_ptr on success, much like how a + b takes in two ints and returns an int.
Unfortunately, this would de-pack the arrays, making it very slow, and still defer all the actual work to the object implementations.

A better way would be to allow NumDot to 'inject' a dtype into vatensor, holding a VariantWrapper, and simply define all the required operations on it statically. Unfortunately, this breaks the 'perfect' separation of the two modules. But it makes a lot more sense for an embedded library, since we don't expect to find objects from other vatensor users in our arrays.

I'm gonna have to think about if there's any other ways.

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

No branches or pull requests

1 participant