arrayfire / arrayfire-dotnet

.NET wrapper for ArrayFire
BSD 3-Clause "New" or "Revised" License
78 stars 21 forks source link

af_index_t #31

Open shanedidona opened 4 years ago

shanedidona commented 4 years ago

The struct af_index_t is not yet present in the ArrayFire wrapper. The use of C-style unions has confused our efforts to add this. Right now we are exploring shucking data back and forth between the CPU and GPU to emulate this functionality but this not as fast as using methods/structs which keep data on the GPU.

9prady9 commented 4 years ago

That is precisely the reason we provided helper API to create and manage the af_index_t structure without having to deal with it at the wrapper level. Please look at the below functions at http://arrayfire.org/docs/group__index__func__index.htm defined in af/index.h header.

If it is of any help, you can also look at how rust wrapper uses the same functions to expose indexing based functionality. https://github.com/arrayfire/arrayfire-rust/blob/master/src/index.rs

umar456 commented 4 years ago

It looks like you can use af_seq objects but not af_index_t which allows you to index with array objects. Is that correct? Can you give me an example of what operation you are trying to do?

9prady9 commented 4 years ago

Well, if it is always going to be sequences, yeah, no need to touch af_index_t structure. But to write a generic wrapper than can handle af_array for indexing, the wrapper has to handle af_index_t struct.