[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## Vectorization quiz

**From**: |
Daniel Arteaga |

**Subject**: |
Vectorization quiz |

**Date**: |
Thu, 21 Apr 2011 10:49:03 +0200 |

**User-agent**: |
Mozilla/5.0 (X11; U; Linux i686; ca-ES; rv:1.9.2.14) Gecko/20110223 Thunderbird/3.1.8 |

Hi,
How could I vectorize the following piece of code?
P = zeros(size(fInf));
for i = 1:length(fInf)
P(i) = sum( S2( fLin > fInf(i) & fLin < fSup(i) ) );
endfor
where
fInf is a vector of length 1000
fSup is a vector of length 1000
P is a vector of length 1000
S2 is a vector of length 50000
fLin is a vector of length 50000
Thank you very much in advance,
Daniel

**Vectorization quiz**,
*Daniel Arteaga* **<=**