Home > manopt > manifolds > ttfixedrank > TTeMPS_1.1 > algorithms > completion > makeOmegaSet_slice.m

# makeOmegaSet_slice

TTeMPS Toolbox.

## SYNOPSIS

function Omega = makeOmegaSet_slice( n, numSlice, cross )

## DESCRIPTION

```   TTeMPS Toolbox.
Michael Steinlechner, 2013-2016
Questions and contact: michael.steinlechner@epfl.ch

## CROSS-REFERENCE INFORMATION

This function calls:
This function is called by:

## SOURCE CODE

```0001 %   TTeMPS Toolbox.
0002 %   Michael Steinlechner, 2013-2016
0003 %   Questions and contact: michael.steinlechner@epfl.ch
0005 function Omega = makeOmegaSet_slice( n, numSlice, cross )
0006
0007     d = length(n);
0008
0009     if cross
0010         subs_slice = zeros( numSlice, d );
0011
0012         for i = 1:d
0013             subs_slice(:,i) = randi( n(i), numSlice, 1 );
0014         end
0015
0016         Omega = unique( subs_slice, 'rows' );
0017         m = size(Omega, 1);
0018
0019         while m < numSlice
0020             subs_slice(1:m,:) = Omega;
0021             for i=1:d
0022                  subs_slice(m+1:numSlice, i) = randi( n(i), numSlice-m, 1 );
0023             end
0024             Omega = unique( subs_slice, 'rows' );
0025             m = size(Omega, 1);
0026         end
0027
0028         subs_slice = Omega;
0029
0030         subs = [];
0031         for j = 1:numSlice
0032             for i = 1:d
0033                 sub_new = repmat( subs_slice(j,:), n(i), 1 );
0034                 subs = [subs; [sub_new(:,1:i-1), (1:n(i))', sub_new(:,i+1:end)]];
0035             end
0036         end
0037
0038         Omega = subs;
0039         %Omega = unique( subs, 'rows' );
0040     else
0041         sizeOmega = numSlice*d;
0042         subs_slice = zeros( sizeOmega, d );
0043
0044         for i = 1:d
0045             subs_slice(:,i) = randi( n(i), sizeOmega, 1 );
0046         end
0047
0048         Omega = unique( subs_slice, 'rows' );
0049         m = size(Omega, 1);
0050
0051         while m < sizeOmega
0052             subs_slice(1:m,:) = Omega;
0053             for i=1:d
0054                  subs_slice(m+1:sizeOmega, i) = randi( n(i), sizeOmega-m, 1 );
0055             end
0056             Omega = unique( subs_slice, 'rows' );
0057             m = size(Omega, 1);
0058         end
0059
0060         subs_slice = Omega;
0061
0062         subs = [];
0063         for j = 1:numSlice
0064             for i = 1:d
0065                 sub_new = repmat( subs_slice((j-1)*d+i,:), n(i), 1 );
0066                 subs = [subs; [sub_new(:,1:i-1), (1:n(i))', sub_new(:,i+1:end)]];
0067             end
0068         end
0069
0070         %Omega = subs;
0071         Omega = unique( subs, 'rows' );
0072
0073     end
0074
0075 end```

Generated on Fri 30-Sep-2022 13:18:25 by m2html © 2005