
514 Accelerating MATLAB
®
Performance
An alternative technique is to reshape the data using higher dimensions, such that the
subblocks will occupy dimensions that can be operated on in a vectorized manner. For
example, reshape data(X,Y) to data(N, X/N, M, Y/M) and then operate on the subblocks of
size N×M:
1542
data2 = reshape(A, N, size(A,1)/N, M, size(A,2)/M);
y = squeeze(sum(sum(data2,1),3))/(N*M); % mean values of all sub-blocks
Splitting up a large data set into separate independent data subblocks enables parallel-
ization, if we have the relevant hardware and software support for this. Parallelizing such
independent subblocks can signicantly ...