"manu" wrote in message <email@example.com>... > Thank you very much. > > Unfortunately, this is approach is a bit too slow. > > I need to work with vector multiplication as I have several millions of iterations and the matrix is also a bit bigger. > > But thank you very much for your thoughts and your work!!!
I don't have MATLAB installed on this computer, so I can't test this out, but it seems to me you should be able to use bsxfun in some clever way. Look at the last example in:
Perhaps something like this will work for your example:
A = 1:5; B = (0:3).'; C = bsxfun(@plus,A,B)
Like I said, I can't test the above, but you should get the idea. Also, even if it works, I don't know if it will be any faster than an efficient for loop version. It will depend on the size of your array and the memory you have available.