how many FP op`s you need to calculate a dot product?

well the xbox360 can do 9 billion dot/scalar product`s operations per second so it trying to figure out how many flops does it takes.
 
Five. (for 3-vectors). Doesn't matter many ops you can do per cycle, it's five FLOPs. If you count MADDs as one FLOP, it's maybe three, but everyone counts MADDs as two FLOPs for marketing purposes as far as I'm aware ('cos it makes for bigger floppage numbers). FLOPs per dot-product and cycles per dot-product aren't the same thing of course.
 
Nope, 6 is the correct number....in cylindrical coordinates! :devilish:

(r1, z1, t1) . (r2, z2, t2) = r1*r2*cos(t1-t2) + z1*z2
 
DemoCoder said:
Nope, 6 is the correct number....in cylindrical coordinates! :devilish:

(r1, z1, t1) . (r2, z2, t2) = r1*r2*cos(t1-t2) + z1*z2
Cylindrical?!

How to you encode a vector parallel to the cylinder's axis? Use IEEE's INF??? 8)
 
Simon F on Hols said:
DemoCoder said:
Nope, 6 is the correct number....in cylindrical coordinates! :devilish:

(r1, z1, t1) . (r2, z2, t2) = r1*r2*cos(t1-t2) + z1*z2
Cylindrical?!

How to you encode a vector parallel to the cylinder's axis? Use IEEE's INF??? 8)

either that or the r component (i.e. radius) = 0 8)

btw, i'm not sure what Demo wrote is a correct dot product in cylindrical space ;)
 
If V1 = (r1, theta1, z1)
and V2 = (r2, theta2, z2)

lets define
Code:
X1 = r1 cos(theta1)
X2  = r2 cos(theta2)
Y1 = r1 sin(theta1)
Y2 = r2 sin(theta2)

then V1.V2 in cartesian is

X1 * X2 + Y1*Y2 + Z1*Z2 =

r1*r2*cos(theta1)*cos(theta2) + r1*r2*sin(theta1)*sin(theta2) + Z1*Z2

simplifying

Code:
r1*r2 * (cos(theta1)*cos(theta2) + sin(theta1)*sin(theta2)) + Z1*Z2

Then then using the well known trig identity COS(A-B) = COS(A)COS(B)+SIN(A)SIN(B)

Code:
r1*r2 * cos(theta1-theta2) + z1*z2

QED :)

Proof of the trig identity left as an exercise to the reader. Of course, it still takes more ops than cartesian (5 ops)
 
Simon F on Hols said:
Cylindrical?!

How to you encode a vector parallel to the cylinder's axis? Use IEEE's INF??? 8)
Nah, no reason to have an infinity. If the theta read back isn't a real number, just make it any number (since when this happens the vector will be parallel to the axis, and thus the angle is immaterial).

This is only really a problem if you're working in differential geometry and want to prove that the surface you're working on is a manifold (the undefined coordinate theta when on the z-axis means it's not).
 
Back
Top