matlab - Vectorizing Arithmetic Operations -


I am trying to improve the performance of my code by converting some iterations into Matrix operations in Matlab. One of these is the following code of gamma_ic & I need to figure out how I can avoid using the loop in operation

here Bow is two-dimensional matrix camp; . Z is the set variables with external iterations

 for  z = 1: MAXNUMBER, for c = 1: k, n = 0; = 1 for y2: number_documents, n = n + (gamma_ic (y2, c) * bow (y2, z)); End mu (z, c) = n / 2.3; End end  

Appreciate your assistance.

Edit. Loop for C & Z added Walk up to maximum standards gamma_ic & amp; Bow. Another two-dimensional matrix has been added to show the use of N.

This should work for you mu , which is getting the desired output -

  Mu = bow (1: number_documents, 1: MAXNUMBER) '* gamma_ic (1: number_documents, 1: k) ./ 2.3  

Comments