Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

This a rather dumb approach but it seems to work for small arguments. The idea is to use a growing number of random elements of the target group as generators until the target group size is matched:

def mygroup(s):
    n = sum(s)
    k = len(s)

    # matrix spaces from blocks
    spaces = [GL(s[i],GF(2)) if i==j else MatrixSpace(GF(2),s[i],s[j]) if i>j else Set([Matrix(GF(2),zero_matrix(GF(2),s[i],s[j]),immutable=True)]) for i in range(k) for j in range(k)]

    # target group cardinality
    mycard = prod( GL(s[i],GF(2)).cardinality() if i==j else 2**(s[i]*s[j]) if i>j else 1 for i in range(k) for j in range(k) )
    for t in range(GL(n,GF(2)).cardinality()):
        # print(f'Tring {t+1} random generators')
        S = GL(n,GF(2)).subgroup( block_matrix([[Matrix(GF(2),spaces[i*k+j].random_element()) for j in range(k)] for i in range(k)]) for _ in range(t+1) ) 
        if S.cardinality() == mycard:
            return S

For example, mygroup([3,2]) gives:

Subgroup with 4 generators (
[0 1 1 0 0]  [0 1 0 0 0]  [1 0 1 0 0]  [0 1 1 0 0]
[1 0 1 0 0]  [0 1 1 0 0]  [0 1 0 0 0]  [1 1 0 0 0]
[1 0 0 0 0]  [1 1 1 0 0]  [1 0 0 0 0]  [1 1 1 0 0]
[0 0 1 0 1]  [1 1 1 1 1]  [0 0 1 1 0]  [0 1 1 1 0]
[1 1 1 1 0], [0 0 1 0 1], [0 1 0 0 1], [1 1 0 1 1]
) of General Linear Group of degree 5 over Finite Field of size 2

This a rather dumb approach but it seems to work for small arguments. The idea is to use a growing number of random elements of the target group as generators until the target group size is matched:

def mygroup(s):
    n = sum(s)
    k = len(s)

    # matrix spaces from blocks
for the blocks of target matrices
    spaces = [GL(s[i],GF(2)) if i==j else MatrixSpace(GF(2),s[i],s[j]) if i>j else Set([Matrix(GF(2),zero_matrix(GF(2),s[i],s[j]),immutable=True)]) for i in range(k) for j in range(k)]

    # target group cardinality
    mycard = prod( GL(s[i],GF(2)).cardinality() if i==j else 2**(s[i]*s[j]) if i>j else 1 for i in range(k) for j in range(k) )

    # trying random generators
    for t in range(GL(n,GF(2)).cardinality()):
        # print(f'Tring {t+1} random generators')
        S = GL(n,GF(2)).subgroup( block_matrix([[Matrix(GF(2),spaces[i*k+j].random_element()) for j in range(k)] for i in range(k)]) for _ in range(t+1) ) 
        if S.cardinality() == mycard:
            return S

For example, mygroup([3,2]) gives:

Subgroup with 4 generators (
[0 1 1 0 0]  [0 1 0 0 0]  [1 0 1 0 0]  [0 1 1 0 0]
[1 0 1 0 0]  [0 1 1 0 0]  [0 1 0 0 0]  [1 1 0 0 0]
[1 0 0 0 0]  [1 1 1 0 0]  [1 0 0 0 0]  [1 1 1 0 0]
[0 0 1 0 1]  [1 1 1 1 1]  [0 0 1 1 0]  [0 1 1 1 0]
[1 1 1 1 0], [0 0 1 0 1], [0 1 0 0 1], [1 1 0 1 1]
) of General Linear Group of degree 5 over Finite Field of size 2

This a rather dumb approach but it seems to work for small arguments. The idea is to use a growing number of random elements of the target group as generators until the target group size is matched:

def mygroup(s):
    n = sum(s)
    k = len(s)

    # matrix spaces for the blocks of target matrices
    spaces = [GL(s[i],GF(2)) if i==j else MatrixSpace(GF(2),s[i],s[j]) if i>j else Set([Matrix(GF(2),zero_matrix(GF(2),s[i],s[j]),immutable=True)]) for i in range(k) for j in range(k)]

    # target group cardinality
    mycard = prod( GL(s[i],GF(2)).cardinality() if i==j else 2**(s[i]*s[j]) if i>j else 1 for i in range(k) for j in range(k) T.cardinality() for T in spaces )

    # trying random generators
    for t in range(GL(n,GF(2)).cardinality()):
        # print(f'Tring {t+1} random generators')
        S = GL(n,GF(2)).subgroup( block_matrix([[Matrix(GF(2),spaces[i*k+j].random_element()) for j in range(k)] for i in range(k)]) for _ in range(t+1) ) 
        if S.cardinality() == mycard:
            return S

For example, mygroup([3,2]) gives:

Subgroup with 4 generators (
[0 1 1 0 0]  [0 1 0 0 0]  [1 0 1 0 0]  [0 1 1 0 0]
[1 0 1 0 0]  [0 1 1 0 0]  [0 1 0 0 0]  [1 1 0 0 0]
[1 0 0 0 0]  [1 1 1 0 0]  [1 0 0 0 0]  [1 1 1 0 0]
[0 0 1 0 1]  [1 1 1 1 1]  [0 0 1 1 0]  [0 1 1 1 0]
[1 1 1 1 0], [0 0 1 0 1], [0 1 0 0 1], [1 1 0 1 1]
) of General Linear Group of degree 5 over Finite Field of size 2

This a rather dumb approach but it seems to work for small arguments. The idea is to use a growing number of random elements of the target group as generators until the target group size is matched:

def mygroup(s):
    n = sum(s)
    k = len(s)

    # matrix spaces for the blocks of target matrices
    spaces = [GL(s[i],GF(2)) if i==j else MatrixSpace(GF(2),s[i],s[j]) if i>j else Set([Matrix(GF(2),zero_matrix(GF(2),s[i],s[j]),immutable=True)]) Set([Matrix(GF(2),s[i],s[j],immutable=True)]) for i in range(k) for j in range(k)]

    # target group cardinality
    mycard = prod( T.cardinality() for T in spaces )

    # trying random generators
    for t in range(GL(n,GF(2)).cardinality()):
        # print(f'Tring {t+1} random generators')
        S = GL(n,GF(2)).subgroup( block_matrix([[Matrix(GF(2),spaces[i*k+j].random_element()) for j in range(k)] for i in range(k)]) for _ in range(t+1) ) 
        if S.cardinality() == mycard:
            return S

For example, mygroup([3,2]) gives:

Subgroup with 4 generators (
[0 1 1 0 0]  [0 1 0 0 0]  [1 0 1 0 0]  [0 1 1 0 0]
[1 0 1 0 0]  [0 1 1 0 0]  [0 1 0 0 0]  [1 1 0 0 0]
[1 0 0 0 0]  [1 1 1 0 0]  [1 0 0 0 0]  [1 1 1 0 0]
[0 0 1 0 1]  [1 1 1 1 1]  [0 0 1 1 0]  [0 1 1 1 0]
[1 1 1 1 0], [0 0 1 0 1], [0 1 0 0 1], [1 1 0 1 1]
) of General Linear Group of degree 5 over Finite Field of size 2

This a rather dumb approach but it seems to work for small arguments. The idea is to use a growing number of random elements of the target group as generators until the target group size is matched:

def mygroup(s):
    n = sum(s)
    k = len(s)

    # matrix spaces for the blocks of target matrices
    spaces = [GL(s[i],GF(2)) if i==j else MatrixSpace(GF(2),s[i],s[j]) if i>j else Set([Matrix(GF(2),s[i],s[j],immutable=True)]) for i in range(k) for j in range(k)]

    # target group cardinality
    mycard = prod( T.cardinality() for T in spaces )

    # trying random generators
    for t in range(GL(n,GF(2)).cardinality()):
range(mycard):
        # print(f'Tring {t+1} random generators')
        S = GL(n,GF(2)).subgroup( block_matrix([[Matrix(GF(2),spaces[i*k+j].random_element()) for j in range(k)] for i in range(k)]) for _ in range(t+1) ) 
        if S.cardinality() == mycard:
            return S

For example, mygroup([3,2]) gives:

Subgroup with 4 generators (
[0 1 1 0 0]  [0 1 0 0 0]  [1 0 1 0 0]  [0 1 1 0 0]
[1 0 1 0 0]  [0 1 1 0 0]  [0 1 0 0 0]  [1 1 0 0 0]
[1 0 0 0 0]  [1 1 1 0 0]  [1 0 0 0 0]  [1 1 1 0 0]
[0 0 1 0 1]  [1 1 1 1 1]  [0 0 1 1 0]  [0 1 1 1 0]
[1 1 1 1 0], [0 0 1 0 1], [0 1 0 0 1], [1 1 0 1 1]
) of General Linear Group of degree 5 over Finite Field of size 2