[SOLVED] Arbitrary dimension extraction

[Old posts from the commercial version of ArrayFire] Discussion of ArrayFire using CUDA or OpenCL.

Moderator: pavanky

[SOLVED] Arbitrary dimension extraction

Postby wigen » Tue Aug 19, 2014 10:58 am

Hi!
I'm have a setup where I either process 2D, 3D or 4D arrays. The variation in the dimensionality depends on the number of direction I have in space(1D, 2D or 3D), but always includes the time dimension(space dimensions + time dimension).
I want to make a general framework to process these data, without the need to have specified functions depending on the number of dimensions.
I do however find it difficult to extract one time frame from an arbitrary data set.

So here is my question; is there an easy way to extract all data elements from an arbitrary array dimension?
For 1D you use:
af_array.row(index)/column(index).
2D: af_array.slice(index),
but how do you do this with higher dimensions, without doing af_array(span1, span2,..., spanN, index)?

Thanks,
Morten Wigen
Last edited by wigen on Tue Aug 19, 2014 11:53 am, edited 1 time in total.
wigen
 
Posts: 6
Joined: Wed Jun 04, 2014 4:31 am

Re: Arbitrary dimension extraction

Postby shehzan » Tue Aug 19, 2014 11:43 am

Hi

ArrayFire only supports upto 4 dimensions. This limits the usage to
row (array(index, span, span, span))
column (array(span, index, span, span))
slice (array(span, span, index, span))

And to get volumes (3D), you would do
array(span, span, span, index).

We do not support higher dimensions.

Row/Column/Slice internally call the () operator. So these are just wrappers for indexing functions.
----
Shehzan
Developer
AccelerEyes
User avatar
shehzan
 
Posts: 121
Joined: Tue Feb 12, 2013 7:20 pm

Re: Arbitrary dimension extraction

Postby wigen » Tue Aug 19, 2014 11:53 am

Okey. Thank you for clarifying!

Morten

Ps: It would be very convenient to have the possibility to use the end parameter also for this functionality :)
wigen
 
Posts: 6
Joined: Wed Jun 04, 2014 4:31 am

Re: [SOLVED] Arbitrary dimension extraction

Postby shehzan » Tue Aug 19, 2014 12:49 pm

span is equivalent to seq(0, end).
index is equivalent to seq(index, index).
----
Shehzan
Developer
AccelerEyes
User avatar
shehzan
 
Posts: 121
Joined: Tue Feb 12, 2013 7:20 pm

Re: [SOLVED] Arbitrary dimension extraction

Postby wigen » Wed Aug 20, 2014 4:12 am

yes, I know.. What I meant was that it could be convienient to choose which dimension you want to extract with end. Say that you want to extract the last dimension(either array(index), array(span, index), array(span, span, index) or array(span, span, span, index) with something like array.dim(end, index) instead of column(index), row(index), slice(index) or array(span, span, span, index).

:)
wigen
 
Posts: 6
Joined: Wed Jun 04, 2014 4:31 am

Re: [SOLVED] Arbitrary dimension extraction

Postby shehzan » Wed Aug 20, 2014 11:12 am

Well even if we do it, it would be similar to row/col, whereing they are wrappers for () operator.
We will take into account your suggestion and see if we can include it in the next release.
If you really want these function, you can implement them in the header files and they should work just fine.
----
Shehzan
Developer
AccelerEyes
User avatar
shehzan
 
Posts: 121
Joined: Tue Feb 12, 2013 7:20 pm

Re: [SOLVED] Arbitrary dimension extraction

Postby wigen » Thu Aug 21, 2014 5:46 am

will do..
Thanks again!
wigen
 
Posts: 6
Joined: Wed Jun 04, 2014 4:31 am


Return to [archive-commercial] Programming & Development with ArrayFire

cron