[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 00:16:46 +0200 |
User-agent: |
Mutt/1.5.11 |
'k, so let's turn this into "I wish I'd know how to vectorize this".
* Robert A.Macy <address@hidden> [20060706 01:11]:
> for example, the simple act of replacing every item that is
> less than negative with the value zero.
Indexing with find should fit your needs.
I just found this in some code of mine:
%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
Any tips for this one? I have a harder one too, and this one is killing me:
for i = 1:ln_t
[u,s,v] = svd(Rx(:,:,i)),
w = 1./diag(s + 1000*eps),
m = (abs(u.'*conj(a_s))).^2,
pow_density = 1 ./ (sum(diag(w)*m)),
k = find(pow_density == max(pow_density)),
%check for aliasing
if (length(k) ~= 1)
msg = sprintf('capon_doa_est found %d out of %d possible DoAs\n',...
k, length(theta_s))
warning(msg)
k = k(1)
end
ldoa(i) = theta_s(k),
end
For those in signal processing, this is supposed to be a Capon DoA
estimator. 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. It is also svd()
that I wouldn't know how to vectorize.
tks
--
pica
- Re: profiler and/or debugger, loops vs vectorization, (continued)
- Re: profiler and/or debugger, loops vs vectorization, John W. Eaton, 2006/07/05
- Re: profiler and/or debugger, loops vs vectorization, Andy Adler, 2006/07/05
- 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 <=
- Re: loops vs vectorization, Paul Kienzle, 2006/07/06
- Re: loops vs vectorization, Joan Picanyol i Puig, 2006/07/07
- 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