def bsgs_direct_product(base1, gens1, base2, gens2, signed=True):
 s = (2 if signed else 0)
 n1 = (gens1[0].size - s)
 base = list(base1)
 base += [(x + n1) for x in base2]
 gens1 = [h._array_form for h in gens1]
 gens2 = [h._array_form for h in gens2]
 gens = perm_af_direct_product(gens1, gens2, signed)
 size = len(gens[0])
 id_af = list(range(size))
 gens = [h for h in gens if (h != id_af)]
 if (not gens):
  gens = [id_af]
 return (base, [_af_new(h) for h in gens])

def bsgs_direct_product ( base1 , gens1 , base2 , gens2 , signed = True ) : s = ( 2 if signed else 0 ) n1 = ( gens1 [ 0 ] . size - s ) base = list ( base1 ) base += [ ( x + n1 ) for x in base2 ] gens1 = [ h . _array_form for h in gens1 ] gens2 = [ h . _array_form for h in gens2 ] gens = perm_af_direct_product ( gens1 , gens2 , signed ) size = len ( gens [ 0 ] ) id_af = list ( range ( size ) ) gens = [ h for h in gens if ( h != id_af ) ] if ( not gens ) : gens = [ id_af ] return ( base , [ _af_new ( h ) for h in gens ] )
direct product of two bsgs base1 base of the first bsgs .