[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: help with vectorizing a for loop
From: |
Martin Helm |
Subject: |
Re: help with vectorizing a for loop |
Date: |
Wed, 05 Oct 2011 20:33:13 +0200 |
Am Mittwoch, den 05.10.2011, 08:11 -1000 schrieb Rick T:
> inner_freq = rand(8193,3);
> t = rand(1,15679);
> aa_sig_combined = 0;
>
> tic,
> for ii=1:1:length(inner_freq)-1
> aa_sig_rebuilt = inner_freq(ii, 2)*cos (2*pi*t*inner_freq(ii, 1) +
> inner_freq(ii, 3));
> aa_sig_combined = aa_sig_combined + aa_sig_rebuilt;
> end;
> toc
>
Ok - sorry, so I simply completely misunderstood your last mail, that's
reasonable and sounds good to me. I tested that now on a i7-2600 3,4 GHz
with 16GB RAM (openSUSE 11.4 x86_64, octave 3.4.2) where this takes 2.89
seconds.
I don't think you can improve that much more except you manage to make
some use of multiple cores.
I could not test the idea from Jordi with the bsxfun, since I did not
quite understand how exactly he want's to apply that here, maybe that is
faster.
- Re: help with vectorizing a for loop, (continued)
- Re: help with vectorizing a for loop, Martin Helm, 2011/10/03
- Re: help with vectorizing a for loop, Thomas Weber, 2011/10/03
- Re: help with vectorizing a for loop, Rick T, 2011/10/04
- Re: help with vectorizing a for loop, Martin Helm, 2011/10/04
- Re: help with vectorizing a for loop, Rick T, 2011/10/04
- Re: help with vectorizing a for loop, Martin Helm, 2011/10/04
- Re: help with vectorizing a for loop, Martin Helm, 2011/10/04
- Re: help with vectorizing a for loop, Rick T, 2011/10/04
- Re: help with vectorizing a for loop, Martin Helm, 2011/10/05
- Re: help with vectorizing a for loop, Rick T, 2011/10/05
- Re: help with vectorizing a for loop,
Martin Helm <=
Re: help with vectorizing a for loop, Jordi GutiƩrrez Hermoso, 2011/10/04