Write an assembly program in MIPS that for a given two vectors, as arrays of integers, will calculate their sum and their scalar product.
Example:
π£1 = (1; 3; β7)
π£2 = (4; β2; β1)
sum of vectors β π£1 + π£2 = [1 + 4; 3 + (β2); (β7) + (β1)] = (5; 1; β8)
scalar product β π£1 β π£2 = 1 β 4 + 3 β (β2) + (β7) β (β1) = 4 - 6 + 7 = 5
Example (for index number 123456):
Input: 268501280 3 1 3 -7 4 -2 -1
memory address for storing the vector of the sum | Size of vectors | vector 1 | vector 2 |
---|---|---|---|
268501280 | 3 | - 1, 3, -7 | 4, -2, -1 |