[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: loops vs vectorization
From: |
Joan Picanyol i Puig |
Subject: |
Re: loops vs vectorization |
Date: |
Fri, 7 Jul 2006 09:56:11 +0200 |
User-agent: |
Mutt/1.5.11 |
* Paul Kienzle <address@hidden> [20060707 04:22]:
> > %XXX this shouldn't be hard to vectorize
> > for lp = 1:lnechoes
> > ltmp(lp,llags(lp):ln_t + llags(lp) - 1) = ltmps(lp,:) *
> >lvalues(lp),
> > end
>
> The right hand side is easy enough:
> diag(lvalues)*ltmps
> The left hand side is harder:
> ltmp(sub2ind(size(ltmp),i,j))
> where
> i=repmat([1:lnechoes],ln_t,1)
> j=repmat([1:ln_t]',1,lnechoes)+repmat(llags(:)',ln_t,1)
Thanks for the tip, I hope I remember it next time I'm scratching my
head.
> If what you want is really an attenuated echo, though, then you should
> be able to use filter. E.g., the following is a lag 5 echo attenuated
> by 40%:
>
> x=zeros(1,40); x(1:2)=1; plot(filter(1,[1,0,0,0,-0.6],x))
Doh! That's what I get for sharing code: lessons on KISS. Surely filter
handles the complex case as well...
> >Any tips for this one? I have a harder one too, and this one is
> >killing me:
[...]
> >The only reason I haven't rewritten it in C++ (besides the proverbial
> >lack of time) is that I believe most time is spent on the svd() call,
> >and thus there's not much to be gained.
>
> Check if repeating the svd doubles the amount of running time. This
> will confirm that it is the bottleneck, and that the only improvement
> you will get is by changing your algorithm or using parallelism.
That sound like a plan, and easier than tic()/toc()'ing all over the
place.
Many thanks for your insight.
--
pica
- Re: profiler and/or debugger, loops vs vectorization, (continued)
- Re: profiler and/or debugger, loops vs vectorization, David Grohmann, 2006/07/05
- Message not available
- Re: profiler and/or debugger, loops vs vectorization, Jordi Gutierrez Hermoso, 2006/07/05
- Re: loops vs vectorization, Robert A.Macy, 2006/07/05
- Re: loops vs vectorization, Rafael Almeida, 2006/07/05
- Re: loops vs vectorization, Robert A.Macy, 2006/07/05
- Re: loops vs vectorization, Ozzy Lash, 2006/07/05
- Re: loops vs vectorization, Robert A.Macy, 2006/07/05
- Re: loops vs vectorization, Ozzy Lash, 2006/07/06
- Re: loops vs vectorization, Joan Picanyol i Puig, 2006/07/06
- Re: loops vs vectorization, Paul Kienzle, 2006/07/06
- Re: loops vs vectorization,
Joan Picanyol i Puig <=
- Tics, Graupner, Achim Dr., 2006/07/07
- Re: profiler and/or debugger, loops vs vectorization, Michael Creel, 2006/07/06
- Re: profiler and/or debugger, loops vs vectorization, Javier Fernández Baldomero, 2006/07/06