What can be the vectorization of this code?
Información
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
Mostrar comentarios más antiguos
I am trying to vectorize this code.. what can be the vectorization of this code with input data
function hat_y=omp(s,T,N)
Size=size(T);
M=Size(1);
hat_y=zeros(1,N);
Aug_t=[];
r_n=s;
for times=1:M;
for col=1:N;
product(col)=abs(T(:,col)'*r_n);
end
[val,pos]=max(product);
Aug_t=[Aug_t,T(:,pos)];
T(:,pos)=zeros(M,1);
aug_y=(Aug_t'*Aug_t)^(-1)*Aug_t'*s;
r_n=s-Aug_t*aug_y;
pos_array(times)=pos;
if (abs(aug_y(end))^2/norm(aug_y)<0.05)
break;
end
end
hat_y(pos_array)=aug_y;
5 comentarios
Geoff Hayes
el 18 de Abr. de 2015
Abeera - why do you wan to vectorize this function? Is the performance too slow (only takes a couple of seconds for me)?
James Tursa
el 19 de Abr. de 2015
Is this yet another function that you are going to implement on a GPU?
Abeera Tariq
el 19 de Abr. de 2015
Editada: Abeera Tariq
el 19 de Abr. de 2015
Abeera Tariq
el 19 de Abr. de 2015
Editada: Abeera Tariq
el 19 de Abr. de 2015
Abeera Tariq
el 19 de Abr. de 2015
Editada: Abeera Tariq
el 19 de Abr. de 2015
Respuestas (0)
La pregunta está cerrada.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!