Math, asked by parthapal5028, 1 year ago

Let a be a 10x10 matrix and x be a 10-element vector. your friend wants to compute the product ax and writes the following code: 1 2 3 4 5 6 v = zeros(10, 1); for i = 1:10 for j = 1:10 v(i) = v(i) + a(i, j) * x(j); end end how would you vectorize this code to run without any for loo

Answers

Answered by aqibkincsem
13
Let a be a 10x10 matrix and x be a 10-element vector. your friend wants to compute the product ax and writes the following code: 1 2 3 4 5 6 v = zeros(10, 1); for i = 1:10 for j = 1:10 v(i) = v(i) + a(i, j) * x(j); end end how would you vectorize this code to run without any for loo

knightanand: Where's the answer? why it is marked as ANSWERED
Similar questions