performance - Speed up reshape/ not use reshape Matlab -
i have operation called multiple times:
longrowvector; matrix = reshape(longrowvector, n, n)'; answer = matrix(:);
this operation using reshape slow. there way answer without using reshape.
there no easy way speed up. if n exceeds number (defined relevant cache size), way in memory accesses ordered during transpose operator. cost create in transpose operation. below plot cost different matrix sizes. there jump @ around 360, consistent cache size on processor.
if want avoid hit, need create "cache-optimized" reordering strategy, i.e. perform reordering in m*m tiles both of vectors fit in cache.
Comments
Post a Comment