Originally posted by Phil Of Mac
In the end, yes, but[ Altivec is] not directly designed for that. It's *directly* designed to process vectors. Vectors are numbers with directions, whereas normal numbers without directions are called scalars. A direct application of vectors is in physics.[/B]
Whoa! This is almost like saying that derivatives are mathematical representations of slopes of a curve when we are talking about options and futures.
The vector we are really talking about in Altivec is a nx1 matrix of numbers. In the case of computers n is 128 and the numbers are bits (1 and 0)--or an exchange of these values as we'll see in an example below. Now a vector in physics is a nx1 matrix of numbers. In the case of your example, n is 3 (1 magnitude and 2 direction if in three dimensions). But it can also be 4 (adding time to position, or energy to momentum for Special Relativity), or 6 (3 position and 3 momentum values in advanced classical mechanics), or perhaps 10 (I'm told String Theory uses this, I guess that's the number of dimensions you need so that everything gets symmetric), or sometimes infinity (a "wave function" in Quantum Mechanics is an infinitely-dense, infinite-dimensional "vector" in something called a Hilbert Space). The fact that both physics and computational "vectors" are representable by a nx1 matrix is the only reason they're both called vectors.
The aspect of "vector computing" that is interesting is SIMD, or the ability to apply a single operation on multiple sets of data (in parallel). Lets say we are talking about integers (typically 32 bits) we can perform the same operation of 4 of them at once--a 4x1 "vector" of numbers. If that represents 4 pixels that we are applying some filter to... you see the advantage of being able to perform that operation on 4 pixels of data at a time instead of one at a time: "vector computation". In the case of Velocity/Altivec/VMX (all brand names for the same thing) we can do this processing without cost; in the case of 3DNow/MMX/SSE, we lose the floating point unit to do so (we also have a smaller register space because we have to combine 2 floating point register into a single vector register)--I think you can intuit that vector processing likes a lot of registers to drop intermediate results into.
A program is "vectorizable" to the extent that it can be mapped onto this sort of computing. For example, if the next action the program depends on the result of the previous action, then what is the advantage of being able to perform the same action on multiple sets of data simultaneously? Software which deals with manipulating large data sets (scientific computation, photo editing, video editing, audio processing, rendering) is usually what sees the biggest gain. Deciding whether or not the user clicked on the "OK" or "Cancel" button in Word is not going to see any benefit by vectorization.
In other words, some software we use today (iTunes, iMovie, Photoshop, rendering windows in Mac OS X, etc.) runs faster with such a unit available, but not so for Office and our database-based web application--the last case deals with large amount data, but not manipulating it.
Where physics "magnitude and direction" enters into it... I fail to see.
Take care,
terry