close all; clear all; clc;
%% Initialize 
dimG = 20;
dimQ = 14;

n = (dimG-1)*(dimG)/2;
nQ = 2^dimQ - 1;
nEnt = n*(n-1)/2;
basis = zeros(n,dimQ);

%% Generate Random Q-basis with zeros
qBasisT = randperm(nQ);
qBasis = zeros(nEnt,1);
Loc = randperm(nEnt,nEnt-nQ);
qBasis(1:nQ) = qBasisT;
qBasis([Loc nQ+1:nEnt]) = [zeros(size(Loc)),qBasis(Loc)'];
% basis(1,1) = 1; basis(1,2) = 0;
% basis(2,1) = 0; basis(2,2) = 1;
% basis(3,1) = 1; basis(3,2) = 1;

%% Generate table
nTab = (2^dimG - 1)*(2^dimG - 2)/2;
%table = zeros(nTab,dimQ);
% for i = 1:nTab
%     for j = i+1:nTab
%     end
% end
table = triu(ones(n),1);
table(table == 1) = qBasis;
sTable = sparse(table);

%%