accumdim with sparse output

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

accumdim with sparse output

Nir Krakauer-3
Is it possible to keep the output of accumdim sparse, similar to
accumarray with issparse=true? If not, is there a way to use
accumarray to get the same result?


I'm thinking of an application like

n = 1E3;
S = sprand (n, n, 1E-3);
inds = repmat(1:(n/2), 1, 2);
Snew = accumdim(inds, accumdim(inds, S, 1, [], @max), 2, [], @max);
#should be sparse