1

Grettings, i'm starting to learn about arrayfire and parallel computing and have a question about Gfors and the seq method.

The syntax for the Gfor is something like

Gfor( seq ii, N) 

In a regular for loop, there is (usually) a int value , so inside the for i can access data in an array like V[0][i] and use that values in the computations. The question is how can i do the same ( get the integer values saved in some array ) in the GFor , obviuslly V[0][seq] not work.

Thanks for your answers :D !! /* sorry for my bad english / / edit the for is

for( int i = 0; i < q ; i++ ){ 
    f(span,span,i) =shift( f(span,span,i) , V[1][i] , V[0][i], 0); 
}

in the array V are the shifts i need for each slice.

Pavan Yalamanchili
  • 12,021
  • 2
  • 35
  • 55
RolandDeschain
  • 483
  • 1
  • 4
  • 17
  • GFOR is intended to be used with af::arrays only. You can not use it with other types of arrays. – Pavan Yalamanchili Sep 15 '15 at 14:11
  • mmmm i understand, the thing that i want to do involves the shift function for arrayfire, Basically i want to take an slice from an array and shift it in certain amount acording to wich slice is. the code i currently have is : `code` f(span,span,i) =shift( f(span,span,i) , V[1][i] , V[0][i], 0) , in a for. The question is how put it in a gfor ? `code` Thanks!! – RolandDeschain Sep 16 '15 at 03:47
  • I saw your other question. You can not have custom shift for each slice. It is only possible to have the same shift for all the slices because of the way it is designed right now. There is perhaps a work around. Can you put the for loop version of what you are doing with the necessary sizes and we can see if there is an alternative for it. – Pavan Yalamanchili Sep 16 '15 at 06:31
  • Hi ! and thanks again. what i have is : for( int i = 0; i < q ; i++ ){ f(span,span,i) =shift( f(span,span,i) , V[1][i] , V[0][i], 0); } In the array V i have the shifts i need for each case. there is some other way to do this? – RolandDeschain Sep 16 '15 at 15:12
  • The point is that q in this case q is 9, but in the future i need to extend de size up to 27 and this is the bottleneck in my code. – RolandDeschain Sep 16 '15 at 15:23
  • Edit the original question and put the code in there please. The comments are not intended for putting code. – Pavan Yalamanchili Sep 16 '15 at 18:36

0 Answers0