> restart:

>

> with(combinat):

> with(linalg):

Warning, the protected name Chi has been redefined and unprotected

Warning, the previous binding of the name fibonacci has been removed and it now has an assigned value

Warning, the protected names norm and trace have been redefined and unprotected

> n:=6:

> k:=40:

>

> M:=matrix(k,k+n,0):

> for i from 1 to k do

> for j from 1 to k do

> if i=j then M[i,j]:=1:fi:

> od:od:

> for i from 1 to k do M[i,k+1]:=1:od:

> M[1,k+2]:=1:M[2,k+2]:=1:

> print(M);

> steps:=0:numtests:=0:flagvec:=vector(n,0):lastspot:=n+1:

> for r from k to 2^n-1 do st:=time():

> print(r);

> for a from 2 to r do lastspot:=n+1:

> for i from 1 to a do M[i,r+3]:=0:od:

> for b1 from 0 to a do

> for i from a+1 to r do M[i,r+3]:=0:od:

> for b2 from a to r do

>

> checkb:=b1+b2-a:

>

> if b2<r and (checkb=0 or checkb=1 or checkb=a) then steps:=steps+1:M[b2+1,r+3]:=1:next:fi:

> if b1+b2-a=r then next:fi:

>

> lastspot:=n+1:

>

> for c1 from 0 to b1 do

> for i from b1+1 to a do M[i,r+4]:=0:od:

> for c2 from b1 to a do

> for i from a+1 to b2 do M[i,r+4]:=0:od:

> for c3 from a to b2 do

> for i from b2+1 to r do M[i,r+4]:=0:od:

>

> if a=2 and b1=0 and b2=5 and c1=0 and c2=0 and c3=2 then st:=11 else st:=b2:fi:

> for c4 from st to r do print(time()-st,time()-mst,steps,numtests,a,b1,b2,c1,c2,c3);

>

> checkc:=c1+c2-b1+c3-a+c4-b2:

> if c4<r and (checkc=a or checkc=checkb or checkc=0 or checkc=1) then steps:=steps+1:M[c4+1,r+4]:=1:next:fi:

>

> if checkc=r then steps:=steps+1:next:fi:

>

> if lastspot<=3 then next:next:next:next:fi:

>

> lastspot:=n+1:

>

> for i from 1 to c1 do M[i,r+5]:=0:od:

> for d1 from 0 to c1 do

>

> for i from c1+1 to b1 do M[i,r+5]:=0:od:

> for d2 from c1 to b1 do

> for i from b1+1 to c2 do M[i,r+5]:=0:od:

> for d3 from b1 to c2 do

> for i from c2+1 to a do M[i,r+5]:=0:od:

> for d4 from c2 to a do

> for i from a+1 to c3 do M[i,r+5]:=0:od:

> for d5 from a to c3 do

> for i from c3+1 to b2 do M[i,r+5]:=0:od:

> for d6 from c3 to b2 do

> for i from b2+1 to c4 do M[i,r+5]:=0:od:

> for d7 from b2 to c4 do

> for i from c4+1 to r do M[i,r+5]:=0:od:

> for d8 from c4 to r do

>

>

> checkd:=d1+d2-c1+d3-b1+d4-c2+d5-a+d6-c3+d7-b2+d8-c4:

> if d8<r and (checkd=0 or checkd=1 or checkd=a or checkd=checkb or checkd=checkc) then steps:=steps+1:M[d8+1,r+5]:=1:next:fi:

>

>

>

> if checkd=r then next:fi:

>

>

>

> if lastspot<=4 then next:next:next:next:next:next:next:next:fi:

> lastspot:=n+1:

>

> for i from 1 to d1 do M[i,r+6]:=0:od:for e1 from 0 to d1 do

> for i from d1+1 to c1 do M[i,r+6]:=0:od:for e2 from d1 to c1 do

> for i from c1+1 to d2 do M[i,r+6]:=0:od:for e3 from c1 to d2 do

> for i from d2+1 to b1 do M[i,r+6]:=0:od:for e4 from d2 to b1 do

> for i from b1+1 to d3 do M[i,r+6]:=0:od:for e5 from b1 to d3 do

> for i from d3+1 to c2 do M[i,r+6]:=0:od:for e6 from d3 to c2 do

> for i from c2+1 to d4 do M[i,r+6]:=0:od:for e7 from c2 to d4 do

> for i from d4+1 to a do M[i,r+6]:=0:od:for e8 from d4 to a do

>

> for i from a+1 to d5 do M[i,r+6]:=0:od:for e9 from a to d5 do

> for i from d5+1 to c3 do M[i,r+6]:=0:od:for e10 from d5 to c3 do

> for i from c3+1 to d6 do M[i,r+6]:=0:od:for e11 from c3 to d6 do

> for i from d6+1 to b2 do M[i,r+6]:=0:od:for e12 from d6 to b2 do

> for i from b2+1 to d7 do M[i,r+6]:=0:od:for e13 from b2 to d7 do

> for i from d7+1 to c4 do M[i,r+6]:=0:od:for e14 from d7 to c4 do

> for i from c4+1 to d8 do M[i,r+6]:=0:od:for e15 from c4 to d8 do

> for i from d8+1 to r do M[i,r+6]:=0:od:for e16 from d8 to r do

>

> steps:=steps+1:

> checke:=e1+e2-d1+e3-c1+e4-d2+e5-b1+e6-d3+e7-c2+e8-d4+e9-a+e10-d5+e11-c3+e12-d6+e13-b2+e14-d7+e15-c4+e16-d8:

> if e16<r and (checke=0 or checke=1 or checke=a or checke=checkb or checke=checkc or checke=checkd) then M[e16+1,r+6]:=1:next:fi:

>

> if checke=r then next:fi:

>

> if lastspot<=n-1 then next:next:next:next:next:next:next:next:next:next:next:next:next:next:next:next:fi:

>

>

> matroid(r,n,M);

>

> if e16<r then M[e16+1,r+6]:=1:fi:od:

> if e15<d8 then M[e15+1,r+6]:=1:fi:od:

> if e14<c4 then M[e14+1,r+6]:=1:fi:od:

> if e13<d7 then M[e13+1,r+6]:=1:fi:od:

> if e12<b2 then M[e12+1,r+6]:=1:fi:od:

> if e11<d6 then M[e11+1,r+6]:=1:fi:od:

> if e10<c3 then M[e10+1,r+6]:=1:fi:od:

> if e9<d5 then M[e9+1,r+6]:=1:fi:od:

> if e8<a then M[e8+1,r+6]:=1:fi:od:

> if e7<d4 then M[e7+1,r+6]:=1:fi:od:

> if e6<c2 then M[e6+1,r+6]:=1:fi:od:

> if e5<d3 then M[e5+1,r+6]:=1:fi:od:

> if e4<b1 then M[e4+1,r+6]:=1:fi:od:

> if e3<d2 then M[e3+1,r+6]:=1:fi:od:

> if e2<c1 then M[e2+1,r+6]:=1:fi:od:

> if e1<d1 then M[e1+1,r+6]:=1:fi:od:

>

>

> if d8<r then M[d8+1,r+5]:=1:fi:od:

> if d7<c4 then M[d7+1,r+5]:=1:fi:od:

> if d6<b2 then M[d6+1,r+5]:=1:fi:od:

> if d5<c3 then M[d5+1,r+5]:=1:fi:od:

> if d4<a then M[d4+1,r+5]:=1:fi:od:

> if d3<c2 then M[d3+1,r+5]:=1:fi:od:

> if d2<b1 then M[d2+1,r+5]:=1:fi:od:

> if d1<c1 then M[d1+1,r+5]:=1:fi:od:

>

> if c4<r then M[c4+1,r+4]:=1:fi:od:

> if c3<b2 then M[c3+1,r+4]:=1:fi:od:

> if c2<a then M[c2+1,r+4]:=1:fi:od:

> if c1<b1 then M[c1+1,r+4]:=1:fi:od:

>

> if b2<r then M[b2+1,r+3]:=1:fi:od:

> if b1<a then M[b1+1,r+3]:=1:fi:od:

>

> if a<r then M[a+1,r+2]:=1:fi:od:

>

>

>

>

>

>

Grow M: (above)

> N1:=delcols(M,r+1..r+n):N2:=vector(r+1,1):N3:=matrix(r+1,n-1,0):

> N1:=extend(N1,1,1,0):

> N1[r+1,r+1]:=1:

> M:=concat(N1,N2,N3):print(r,time()-st);

> od:

40

0.47e-1, 37.267-mst, 3, 0, 2, 0, 5, 0, 0, 2

Warning, computation interrupted

> print(d1,d2,d3,d4,d5,d6,d7,d8);

0, 0, 0, 0, 2, 2, 5, 23

> print(steps,a,b1,b2,c1,c2,c3,c4,d1,d2,d3,d4,d5,d6,d7,d8);

60580673, 2, 0, 5, 0, 0, 2, 11, 0, 0, 0, 0, 2, 2, 5, 23

> print(e1,e2,e3,e4,e5,e6,e7,e8,e9,e10,e11,e12,e13,e14,e15,e16);

0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 5, 7, 13, 27

>

> print(numtests);

5413072

61.906

> print(M);

matrix([[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...matrix([[1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0], [0, 1, 0, 0, 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, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ...

>

>

>

> matroid:=proc(r,n,M) local A,AA,i,j,k,l,m,z,v,S,test,bad,floop,T,V,W,dun,dup,sum1,sum2,modsum,ind,findind,total,prob1,prob2:

> global mst,numtests,flagmat,lastspot:numtests:=numtests+1:#flagvec:=vector(n,0):

> mst:=time():flagmat:=matrix(n,r-1,0):

> ind:=0:S:={}:A:={}:dup:={}:AA:=vector(2^n,0):

> #for i from 1 to r+1 do dup:=dup union{col(M,i)}:od:

>

> for i from 1 to n do

> v[i]:=col(M,r+i):#if v[i] in dup or v[i] in S or v[i]=vector(r,0) then return:fi:

> S:=S union {v[i]}:

> od:

>

> test:=vector(r-1,0):

>

testing and measuring subsets

> bad:=matrix(n,binomial(n,floor(n/2)),0):

>

>

> for j from 1 to n do

> ind:=ind+1:if ind >= r then return: fi:test[ind]:=dotprod(v[1],v[j])+1:flagmat[j,ind]:=1:

> if test[ind] in A then flagvec[j]:=1:return:fi:

> A:=A union {test[ind]}:

> if 1 in A or 2 in A then return:fi:

> od:

>

> for i from 2 to n do

>

> T[i]:=convert(choose(S,i),list):#print(T[i]);

>

> for j from 1 to binomial(n,i) do

>

>

I need to now analyze each subset for compatibility.  j becomes the leading index.

> dun:={}:

> for k from 1 to floor(i/2) do

>

> V[i,j,k]:=convert(choose(T[i][j],k),list):

>

Vijk is the list of k element subsets of Tij.  I need to compare each of these to its complement in Tij.

> for l from 1 to binomial(i,k) do

> W[i,j,k,l]:=convert(T[i][j] minus V[i,j,k][l],list):

> V[i,j,k,l]:=convert(V[i,j,k][l],list):

>

Wijk is the set of complements of the Vijk in Tij.

> if V[i,j,k,l] in dun or W[i,j,k,l] in dun then next:next:next:fi:

> dun:=dun union {V[i,j,k,l],W[i,j,k,l]}:

>

> sum1:=vector(r,0):sum2:=vector(r,0):

> for m from 1 to k do

> sum1:=matadd(sum1,V[i,j,k,l][m]):

> od:

>

> for m from 1 to i-k do

> sum2:=matadd(sum2,W[i,j,k,l][m]):

> od:

>

>

>

This tests for incompatible subsets.

> for z from 1 to r do sum1[z]:=irem(sum1[z],2): sum2[z]:=irem(sum2[z],2): od:

> modsum:=matadd(sum1,sum2):

> for z from 1 to r do modsum[z]:=irem(modsum[z],2):od:

> if dotprod(v[1],sum1)+dotprod(v[1],sum2)=dotprod(v[1],modsum) then bad[i,j]:=1:next:next:next:

> fi:

>

> od:

> od:

>

>

> if bad[i,j]=0 then total:=vector(r,0):

> for m from 1 to i do

> total:=matadd(total,T[i][j][m]):

> od:

> for z from 1 to r do

> total[z]:=irem(total[z],2):

> od:

> ind:=ind+1:if ind=r then return;fi;#print(r, `is too low a rank`); return;fi;

> test[ind]:=dotprod(v[1],total)+i:#T[i][j]:

>

>

>

> for floop from 1 to n do

> if v[floop] in T[i][j] then flagmat[floop,ind]:=1:fi:od:

>

>

> if test[ind] in A then

> for findind from 1 to ind-1 do

> if test[findind]=test[ind] then prob1:=col(flagmat,findind):prob2:=col(flagmat,ind):fi:

> od:

> for floop from 1 to n do

> if prob1[floop]=1 or prob2[floop]=1 then lastspot:=floop:fi:

> od:

>

> #print(T[i][j],lastspot,flagmat,test,prob1,prob2,M);

>

> return:fi:

>

>

> if 1 in A or 2 in A then return:fi:

> A:=A union {test[ind]}:#flagvec[ind]:=test[ind]:

> fi:

>

>

> od:od:if test[r-1]=0 then return;fi;#print(r, `is too high a rank`); return;fi;

>

>

> print(r,test,M);

> end proc:

Warning, `flagvec` is implicitly declared local to procedure `matroid`

>

>

> matroid(24,5,B);

> print(lastspot);

5

>