Array containing dimensions for new array

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

Moderator: pavanky

Array containing dimensions for new array

Postby xiongtx » Fri Jul 06, 2012 10:43 am

I have an array that contains the dimensions for a new array I'd like to create.

Code: Select all
int dimensions[] = {2, 4, 3};
array dimensions = array(1, 3, dimensions);

array new_array = zeros(...);


Problem is I'd like this to work for arbitrary dimensions (from 1 to 4), so I don't want to access the elements of dimensions directly. Is there a way to convert an array object into a dim4 object so that it works with zeros()?
xiongtx
 
Posts: 50
Joined: Fri May 04, 2012 3:50 am

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

cron