1. vector component duplication

Hi,

I need to make a vector B from vector A but with possibly duplicating some of the elements (i.e. arbitrary sampling and not a permutation)

does

float8 A,B;
B=shuffle(A,(int 8)(0,0,0,1,1,2,3,3));

makes sense for all (or any) OpenCL implementation for accomplishing:

B.s0=A.s0;
B.s1=A.s0;
B.s2=A.s0;
B.s3=A.s1;
B.s4=A.s1;
B.s5=A.s2;
B.s6=A.s3;
B.s7=A.s3;

i.e. is it strictly necessary to have in mask variable entries all the numbers from 0 to pow2(vec_step)-1 or could we assume that duplicate (hence also missing) numbers are accepted

2. Re: vector component duplication

I find this syntax somewhat easier:

B = A.s00011233;

You can create arbitrary permutations this way, each side just has to have the right number of elements.

e.g.
B.s05 = A.s23;
is also valid.

(how efficiently such operations are implemented on a given machine are another matter).

On your last question, any valueN taking things need to take the same sized value. Casting up pads the higher elements with zero.

Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•