divij

[solved]dot() geometric built in function

Discussion created by divij on Jul 14, 2011
Latest reply on Jul 14, 2011 by divij
Using dot() built in function

Hey all,

I am currently using dot function as follows: (Code 1)

But I want to calculate sum0 in one go, e.g. (Code 2)

 

Code two isn't working the way I want it. Any ideas as to how to calculate sum0 in one statement itself?

Thanks.

Code1: float4 sum0,a0,b1,b2,b3,b4; for(int =0;i<10;i++){ sum0.x+=dot(a0,b0); sum0.y+=dot(a0,b1); sum0.z+=dot(a0,b2); sum0.w+=dot(a0,b3); } code2: float4 sum0,a0,b1,b2,b3,b4; for(int =0;i<10;i++){ sum0+=(dot(a0,b0),dot(a0,b1),dot(a0,b2),dot(a0,b3)); }

Outcomes