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 |