how to vectorize this for loops?
이전 댓글 표시

댓글 수: 4
Stephen23
2018년 1월 10일
@ Siddhesh Karbhari: please delete the screen shot and give us proper text code. A screen shot is useless to us: we cannot edit it, we cannot run it, we cannot copy-and-paste it into the editor, we cannot do anything with it at all. Please give us real code.
Adam
2018년 1월 10일
We could type it all out into our editor character by character, hoping we don't make a mistake and that we don't have more useful things to do with our lives :)
Siddhesh Karbhari
2018년 1월 10일
편집: per isakson
2018년 1월 13일
Jan
2018년 1월 10일
By the way:
% Simpler:
% sigma0 * sqrt(2) ^ (1/level) ^ ((i-1)*level+j)
sigma0 * sqrt(2) ^ (i - 1 + j / level)
With a proper indentation the code looks cleaner: Ctrl-A Ctrl-I
답변 (1개)
Jan
2018년 1월 10일
1 개 추천
Neither the inner nor the outer loop can be vectorized. The two imshow commands are impossible to vectorize. Do you really need them? Do you want a vectorization to increase the speed? Then start with using the profiler to find the most time consuming part of the code.
댓글 수: 3
Siddhesh Karbhari
2018년 1월 10일
Jan
2018년 1월 10일
What do you want to implement on GPU exactly? imshow, subplot, fspecial are not suitable for this, but conv2 will be fine.
Siddhesh Karbhari
2018년 1월 10일
편집: Siddhesh Karbhari
2018년 1월 10일
카테고리
도움말 센터 및 File Exchange에서 Image Arithmetic에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!