Borrar filtros
Borrar filtros

Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

How to convert this code in vectorize form to be faster?

1 visualización (últimos 30 días)
khan
khan el 6 de Mzo. de 2015
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
The code below is correct, but I want to vectorize it (and may convert to GPU) to increase the speed.
How can I convert it to vector form?
RF = 4;
inhibatory = 0;
overlap=3;
gap = RF-overlap;
Image1 = rand(30,22);
Image2 = rand(27,19);
Image3 = rand(30,22);
for u=1:size(Image1,1)
for v=1:size(Image1,2)
sum_val=0;
iLowMax=max(ceil((u-(receptiveFieldSize+inhibatory))/(gap-inhibatory)),1);
iHighMax=min(floor((u-1)/(gap-inhibatory))+1, UpperLayerSize(1));
jLowMax=max(ceil((v-(receptiveFieldSize+inhibatory))/(gap-inhibatory)),1);
jHighMax = min(floor((v-1)/(gap-inhibatory))+1, UpperLayerSize(2));
sum_sens = sum(sum(Image2(iLowMax:iHighMax,jLowMax:jHighMax)));
sum_val = sum_sens(:,:) .* Image3(u,v);
act_output = Image1(u,v);
result(u,v) = de_activate_Mat(act_output,act_funct) .* sum_val;
end
end

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!

Translated by