arrayfire-dotnet icon indicating copy to clipboard operation
arrayfire-dotnet copied to clipboard

af_index_t

Open shanedidona opened this issue 5 years ago • 3 comments
trafficstars

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.

shanedidona avatar Apr 22 '20 17:04 shanedidona

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.

  • af_create_indexers
  • af_set_array_indexer
  • af_set_seq_indexer
  • af_set_seq_param_indexer
  • af_release_indexers

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

9prady9 avatar Apr 23 '20 10:04 9prady9

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?

umar456 avatar Apr 23 '20 16:04 umar456

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.

9prady9 avatar Apr 23 '20 16:04 9prady9