0001
0002
0003
0004
0005 function subs = makeOmegaSet( n, sizeOmega )
0006
0007 if sizeOmega > prod(n)
0008 error('makeOmegaSet:sizeOmegaTooHigh', 'Requested size of Omega is bigger than the tensor itself!')
0009 end
0010
0011 idx = randi( prod(n), sizeOmega, 1 );
0012 Omega = unique(idx);
0013
0014 while length(Omega) < sizeOmega
0015 idx = [ Omega; randi( prod(n) , sizeOmega-length(Omega), 1 )];
0016 Omega = unique(idx);
0017 end
0018
0019 Omega = sort( Omega(1:sizeOmega) );
0020
0021
0022 d = length(n);
0023
0024
0025
0026 c = cell(1,d);
0027 [c{:}] = ind2sub( n, Omega );
0028
0029 subs = [c{:}];
0030 end