There was also weather forecast applications that require speedy computations
|
+- -+
| 1 |
v = | 1 |
| 1 |
+- -+
|
+- -+
| 1 0 0 |
A = | 1 0 0 |
| 1 0 0 |
+- -+
|
|
|
Effect of adding 2 vectors:
|
Input: float A[N] // vector 1 in array A
float B[N] // vector 2 in array B
Output: float C[N]
for (i = 0; i < N; i++)
C[i] = A[i] + B[i]; // We must perform N addition operations
|
|
Example:
|
Input: float A[N] // vector 1 in array A
float B[N] // vector 2 in array B
Output: float C[N]
for (i = 0; i < N; i++)
C[i] = A[i] * B[i]; // We must perform N multiply operations
|
|
Example:
|
|
Example:
M68000: add R0, R1 inputs: values in R0 and R1 output: one value that is equal to the sum of the values in R0 and R1 |
|
Example:
|
|
|
|
+- -+
|A11 A12 A13|
A = |A21 A22 A23|
|A31 A32 A33|
+- -+
Then:
|
+- -+ +- -+ +- -+
| 2 3 1 | | 3 6 2 | | 2*3 + 3*2 + 1*1 2*6 + 3*2 + 1*1 ... |
| 6 2 3 | * | 2 2 4 | = | 6*3 + 3*2 + 3*1 |
| 4 7 1 | | 1 1 3 | | 4*3 + 7*2 + 1*1 |
+- -+ +- -+ +- -+
+- -+
| 13 19 19 |
= | 25 43 29 |
| 27 39 39 |
+- -+
|
|
While going through the example, make a note that the vector operations are performed on multiple values simultaneously
|
|