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.

cost (arb) of transposition versus matrix size


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -