#############################################################################
##
#W    matgrp4.gi                                                Karel Dekimpe
#W                                                               Bettina Eick
##
##    This file contains the 4-dimensional almost crystallographic groups
##    as integral matrix groups. There are 95 types of groups.
##
ACDim4Nr001 := function ( k1, k2, k3)
local a, b, c, d;
a :=[[1, 0, -k1/2, -k2/2, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0],
   [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];
b :=[[1, k1/2, 0, -k3/2, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1],
   [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];
c :=[[1, k2/2, k3/2, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0],
   [0, 0, 0, 1, 1], [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
return Group( [a, b, c, d] , IdentityMat(5) );
end;

ACDim4Nr002 := function ( k1, k2, k3, k4, k5, k6, k7)
local a, b, c, d, alfa;
a :=[[1, 0, -k1/2, -k2/2, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0],
   [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];
b :=[[1, k1/2, 0, -k3/2, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1],
   [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];
c :=[[1, k2/2, k3/2, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0],
   [0, 0, 0, 1, 1], [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[1, k4, k5, k6, k7/2], [0, -1, 0, 0, 0], [0, 0, -1, 0, 0],
   [0, 0, 0, -1, 0], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa] , IdentityMat(5) );
end;

ACDim4Nr003 := function ( k1, k2, k3, k4)
local a, b, c, d, alfa;
a :=[[1, 0, 0, -k1/2, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, k1/2, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1],
   [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[1, k2, 0, k3, k4/2], [0, -1, 0, 0, 0], [0, 0, 1, 0, 0],
   [0, 0, 0, -1, 0], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa] , IdentityMat(5) );
end;

ACDim4Nr004 := function ( k1, k2, k3, k4)
local a, b, c, d, alfa;
a :=[[1, 0, 0, - k1/2, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0],
   [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];
b :=[[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, k1/2, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1],
   [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[1, k2, 0, k3, k4/2], [0, -1, 0, 0, 0], [0, 0, 1, 0, 1/2],
   [0, 0, 0, -1, 0], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa] , IdentityMat(5) );
end;

ACDim4Nr004b := function ( k1, k2, k3)
local a, b, c, d, alfa;
a :=[[1, 0, -k1, 0, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, k1, 0, -k2, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, 0, k2, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1],
   [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[-1, -k1/2, 2*k3, k2/2,  0], [0, -1, 0, 0, 0], [0, 0, 1, 0, 1/2],
   [0, 0, 0, -1, 0], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa] , IdentityMat(5) );
end;

ACDim4Nr005 := function ( k1, k2, k3, k4)
local a, b, c, d, alfa;
a :=[[1, 0, 0, -k1/2, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, 0, 0, -k1/2, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, k1/2, k1/2, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0],
   [0, 0, 0, 1, 1], [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[1, k2, k2, k3, k4/2], [0, 0, -1, 0, 0], [0, -1, 0, 0, 0],
   [0, 0, 0, -1, 0], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa] , IdentityMat(5) );
end;

ACDim4Nr006 := function ( k1, k2, k3)
local a, b, c, d, alfa;
a :=[[1, 0, 0, -k1/2, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, k1/2, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1],
   [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[1, 0, k2, 0, k3/2], [0, 1, 0, 0, 0], [0, 0, -1, 0, 0],
   [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa] , IdentityMat(5) );
end;

ACDim4Nr007 := function ( k1, k2, k3)
local a, b, c, d, alfa;
a :=[[1, 0, 0, -k1, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, k1, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1],
   [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[1, k1/2, k2, 0, k3/2], [0, 1, 0, 0, 0], [0, 0, -1, 0, 0],
   [0, 0, 0, 1, 1/2], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa] , IdentityMat(5) );
end;

ACDim4Nr007b := function ( k1, k2, k3, k4)
local a, b, c, d, alfa;
a :=[[1, 0, -k1/2, 0, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, k1/2, 0, -k2, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, 0, k2, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1],
   [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[-1, -k3, -k2/2, 2*k4,  0], [0, 1, 0, 0, 0], [0, 0, -1, 0, 0],
   [0, 0, 0, 1, 1/2], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa] , IdentityMat(5) );
end;

ACDim4Nr008 := function ( k1, k2, k3)
local a, b, c, d, alfa;
a :=[[1, 0, 0, -k1/2, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, 0, 0, -k1/2, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, k1/2, k1/2, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0],
   [0, 0, 0, 1, 1], [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[1, k2, -k2, 0, k3/2], [0, 0, 1, 0, 0], [0, 1, 0, 0, 0],
   [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa] , IdentityMat(5) );
end;

ACDim4Nr009 := function ( k1, k2, k3)
local a, b, c, d, alfa;
a :=[[1, 0, 0, -k1/2, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, 0, 0, -k1/2, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, k1/2, k1/2, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0],
   [0, 0, 0, 1, 1], [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[1, -k1/4 + k2, (3*k1)/4 - k2, 0, k3/2], [0, 0, 1, 0, 0],
   [0, 1, 0, 0, 0], [0, 0, 0, 1, 1/2], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa] , IdentityMat(5) );
end;

ACDim4Nr009b := function ( k1, k2, k3, k4)
local a, b, c, d, alfa;
a :=[[1, 0, -k1/2, -k2/2, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0],
   [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];
b :=[[1, k1/2, 0, k2/2, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1],
   [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];
c :=[[1, k2/2, -k2/2, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0],
   [0, 0, 0, 1, 1], [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[-1, k2/4 - k3, (3*k2)/4 - k3, 2*k4,  0], [0, 0, 1, 0, 0],
   [0, 1, 0, 0, 0], [0, 0, 0, 1, 1/2], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa] , IdentityMat(5) );
end;

ACDim4Nr010 := function ( k1, k2, k3, k4, k5, k6)
local a, b, c, d, alfa, beta;
a :=[[1, 0, 0, -k1/2, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, k1/2, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1],
   [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[1, k2, 0, k3, k4/2], [0, -1, 0, 0, 0], [0, 0, 1, 0, 0],
   [0, 0, 0, -1, 0], [0, 0, 0, 0, 1]];
beta :=[[1, k2, k5, k3, k6/2], [0, -1, 0, 0, 0], [0, 0, -1, 0, 0],
   [0, 0, 0, -1, 0], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa, beta] , IdentityMat(5) );
end;

ACDim4Nr011 := function ( k1, k2, k3, k4, k5, k6)
local a, b, c, d, alfa, beta;
a :=[[1, 0, 0, -k1/2, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, k1/2, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1],
   [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[1, k2, 0, k3, k4/2], [0, -1, 0, 0, 0], [0, 0, 1, 0, 1/2],
   [0, 0, 0, -1, 0], [0, 0, 0, 0, 1]];
beta :=[[1, k2, -2*k6, k3, k5/2], [0, -1, 0, 0, 0], [0, 0, -1, 0, 0],
   [0, 0, 0, -1, 0], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa, beta] , IdentityMat(5) );
end;

ACDim4Nr012 := function ( k1, k2, k3, k4, k5, k6)
local a, b, c, d, alfa, beta;
a :=[[1, 0, 0, -k1/2, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, 0, 0, -k1/2, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, k1/2, k1/2, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0],
   [0, 0, 0, 1, 1], [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[1, k2, k2, k3, k4/2], [0, 0, -1, 0, 0], [0, -1, 0, 0, 0],
   [0, 0, 0, -1, 0], [0, 0, 0, 0, 1]];
beta :=[[1, k5, 2*k2 - k5, k3, k6/2], [0, -1, 0, 0, 0], [0, 0, -1, 0, 0],
   [0, 0, 0, -1, 0], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa, beta] , IdentityMat(5) );
end;

ACDim4Nr013 := function ( k1, k2, k3, k4, k5, k6)
local a, b, c, d, alfa, beta;
a :=[[1, 0, 0, -k1, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, k1, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1],
   [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[1, k1/2 + k2, 0, -2*k6, k3/2 + k6/2], [0, -1, 0, 0, 0],
   [0, 0, 1, 0, 0], [0, 0, 0, -1, 1/2], [0, 0, 0, 0, 1]];
beta :=[[1, k1 + k2, k4, -2*k6, k5/2], [0, -1, 0, 0, 0], [0, 0, -1, 0, 0],
   [0, 0, 0, -1, 0], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa, beta] , IdentityMat(5) );
end;

ACDim4Nr014 := function ( k1, k2, k3, k4, k5, k6)
local a, b, c, d, alfa, beta;
a:=[[1, 0, 0, -k1, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
 [0, 0, 0, 0, 1]];
b:=[[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
 [0, 0, 0, 0, 1]];
c:=[[1, k1, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1],
 [0, 0, 0, 0, 1]];
d:=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa:=[[1, k1/2+ k2, 0, k3, -k3/4 + k4/2], [0, -1, 0, 0, 0], [0, 0, 1, 0, 1/2],
 [0, 0, 0, -1, 1/2], [0, 0, 0, 0, 1]];
beta:=[[1, k1 + k2, -k3 - 2*k6, k3, k5/2], [0, -1, 0, 0, 0], [0, 0, -1, 0, 0],
 [0, 0, 0, -1, 0], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa, beta] , IdentityMat(5) );
end;

ACDim4Nr014b := function ( k1, k2, k3, k4, k5, k6)
local a, b, c, d, alfa, beta;
a :=[[1, 0, -k1, 0, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, k1, 0, -k2, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, 0, k2, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1],
   [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[-1, -k1/2, -k2/2 + 2*k3, k2/2,  0], [0, -1, 0, 0, 0],
   [0, 0, 1, 0, 1/2], [0, 0, 0, -1, 1/2], [0, 0, 0, 0, 1]];
beta :=[[1, k4, k2 - 2*k3, k2 + 2*k3 - 2*k5 + 2*k6, k5/2], [0, -1, 0, 0, 0],
   [0, 0, -1, 0, 0], [0, 0, 0, -1, 0], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa, beta] , IdentityMat(5) );
end;

ACDim4Nr015 := function ( k1, k2, k3, k4, k5, k6)
local a, b, c, d, alfa, beta;
a :=[[1, 0, 0, -k1/2, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, 0, 0, -k1/2, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, k1/2, k1/2, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0],
   [0, 0, 0, 1, 1], [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[1, k1/4 + k2, k1/4 + k2, -2*k6, k3/2 + k6/2], [0, 0, -1, 0, 0],
   [0, -1, 0, 0, 0], [0, 0, 0, -1, 1/2], [0, 0, 0, 0, 1]];
beta :=[[1, k4, k1 + 2*k2 - k4, -2*k6, k5/2], [0, -1, 0, 0, 0],
   [0, 0, -1, 0, 0], [0, 0, 0, -1, 0], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa, beta] , IdentityMat(5) );
end;

ACDim4Nr018 := function ( k1, k2, k3, k4)
local a, b, c, d, alfa, beta;
a :=[[1, 0, -k1, 0, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, k1, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1],
   [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[1, -k1 + 2*k2 - 2*k3 + 2*k4, k1/2 - 2*k3, 0,
    k2/2 - (-k1 + 2*k2 - 2*k3 + 2*k4)/4], [0, -1, 0, 0, 1/2],
   [0, 0, -1, 0, 0], [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];
beta :=[[-1, -k1/2, 2*k3, 0,  0], [0, -1, 0, 0, 0], [0, 0, 1, 0, 1/2],
   [0, 0, 0, -1, 0], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa, beta] , IdentityMat(5) );
end;

ACDim4Nr019 := function ( k1, k2, k3, k4)
local a, b, c, d, alfa, beta;
a :=[[1, 0, 0, -k1, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, k1, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1],
   [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[-1, -k1/2, 0, k1/2 + 2*k2,  0], [0, -1, 0, 0, 1/2],
   [0, 0, -1, 0, 0], [0, 0, 0, 1, 1/2], [0, 0, 0, 0, 1]];
beta :=[[1, 3*k1 + 2*k2 - 2*k3 + 2*k4, 0, -k1 - 2*k2, k3/2],
   [0, -1, 0, 0, 0], [0, 0, 1, 0, 1/2], [0, 0, 0, -1, 0], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa, beta] , IdentityMat(5) );
end;

ACDim4Nr019b := function ( k1, k2, k3, k4)
local a, b, c, d, alfa, beta;
a :=[[1, 0, -k1, 0, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, k1, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1],
   [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[1, -k1 + 2*k2 - 2*k3 + 2*k4, k1/2 - 2*k3, 0,
    k2/2 - (-k1 + 2*k2 - 2*k3 + 2*k4)/4], [0, -1, 0, 0, 1/2],
   [0, 0, -1, 0, 0], [0, 0, 0, 1, 1/2], [0, 0, 0, 0, 1]];
beta :=[[-1, -k1/2, 2*k3, 0,  0], [0, -1, 0, 0, 0], [0, 0, 1, 0, 1/2],
   [0, 0, 0, -1, 0], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa, beta] , IdentityMat(5) );
end;

ACDim4Nr019c := function ( k1, k2, k3, k4)
local a, b, c, d, alfa, beta;
a :=[[1, 0, 0, 0, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, 0, 0, -k1, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, 0, k1, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1],
   [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[-1, 0, -k1/2, 2*k2, -(- (3*k1)/2 - k4)/2], [0, -1, 0, 0, 1/2],
   [0, 0, -1, 0, 0], [0, 0, 0, 1, 1/2], [0, 0, 0, 0, 1]];
beta :=[[-1, 0, 2*k3, k1/2,  0], [0, -1, 0, 0, 0], [0, 0, 1, 0, 1/2],
   [0, 0, 0, -1, 0], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa, beta] , IdentityMat(5) );
end;

ACDim4Nr026 := function ( k1, k2, k3, k4)
local a, b, c, d, alfa, beta;
a :=[[1, 0, 0, -k1, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, k1, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1],
   [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[-1, -k1/2, 0, 2*k2,  0], [0, -1, 0, 0, 0], [0, 0, -1, 0, 0],
   [0, 0, 0, 1, 1/2], [0, 0, 0, 0, 1]];
beta :=[[1, 0, k3, 0, k4/2], [0, 1, 0, 0, 0], [0, 0, -1, 0, 0],
   [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa, beta] , IdentityMat(5) );
end;

ACDim4Nr027 := function ( k1, k2, k3, k4, k5)
local a, b, c, d, alfa, beta;
a :=[[1, 0, -k1/2, 0, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, k1/2, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1],
   [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[1, k2, k3, 0, k4/2], [0, -1, 0, 0, 0], [0, 0, -1, 0, 0],
   [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];
beta :=[[-1, -k2, 0, 2*k5,  0], [0, 1, 0, 0, 0], [0, 0, -1, 0, 0],
   [0, 0, 0, 1, 1/2], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa, beta] , IdentityMat(5) );
end;

ACDim4Nr029 := function ( k1, k2, k3, k4)
local a, b, c, d, alfa, beta;
a :=[[1, 0, 0, -k1, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, k1, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1],
   [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[-1, -k1/2, 0, 2*k2,  0], [0, -1, 0, 0, 0], [0, 0, -1, 0, 1/2],
   [0, 0, 0, 1, 1/2], [0, 0, 0, 0, 1]];
beta :=[[1, k1/2, 2*k2 - 2*k3 + 2*k4, 0, k3/2], [0, 1, 0, 0, 0],
   [0, 0, -1, 0, 0], [0, 0, 0, 1, 1/2], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa, beta] , IdentityMat(5) );
end;

ACDim4Nr029b := function ( k1, k2, k3, k4, k5)
local a, b, c, d, alfa, beta;
a :=[[1, 0, -k1, 0, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, k1, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1],
   [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[1, k1/2 + k2, 2*k3 - 2*k4 + 2*k5, 0, k3/2 - (2*k3 - 2*k4 + 2*k5)/4],
   [0, -1, 0, 0, 0], [0, 0, -1, 0, 1/2], [0, 0, 0, 1, 1/2], [0, 0, 0, 0, 1]];
beta :=[[-1, -k1 - k2, 0, 2*k4,  0], [0, 1, 0, 0, 0], [0, 0, -1, 0, 0],
   [0, 0, 0, 1, 1/2], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa, beta] , IdentityMat(5) );
end;

ACDim4Nr029c := function ( k1, k2, k3, k4)
local a, b, c, d, alfa, beta;
a :=[[1, 0, 0, 0, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, 0, 0, -2*k1, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, 0, 2*k1, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1],
   [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[-1, 0, -k1, -k1 + 2*(k1 + k2), -k1], [0, -1, 0, 0, 0],
   [0, 0, -1, 0, 1/2], [0, 0, 0, 1, 1/2], [0, 0, 0, 0, 1]];
beta :=[[-1, -k3, -k1, 2*(k1 + k2), -k4/2], [0, 1, 0, 0, 0],
   [0, 0, -1, 0, 0], [0, 0, 0, 1, 1/2], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa, beta] , IdentityMat(5) );
end;

ACDim4Nr030 := function ( k1, k2, k3, k4, k5)
local a, b, c, d, alfa, beta;
a :=[[1, 0, -k1, 0, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, k1, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1],
   [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[1, k1/2 + k2, 2*k3 + 2*k5, 0, k3/2 - (2*k3 + 2*k5)/4],
   [0, -1, 0, 0, 0], [0, 0, -1, 0, 1/2], [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];
beta :=[[-1, -k1 - k2, 0, 2*k4,  0], [0, 1, 0, 0, 0], [0, 0, -1, 0, 0],
   [0, 0, 0, 1, 1/2], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa, beta] , IdentityMat(5) );
end;

ACDim4Nr031 := function ( k1, k2, k3, k4)
local a, b, c, d, alfa, beta;
a :=[[1, 0, 0, -k1, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, k1, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1],
   [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[-1, -k1/2, 0, 2*k2,  0], [0, -1, 0, 0, 0], [0, 0, -1, 0, 1/2],
   [0, 0, 0, 1, 1/2], [0, 0, 0, 0, 1]];
beta :=[[1, 0, -2*k3 + 2*k4, 0, k3/2], [0, 1, 0, 0, 0], [0, 0, -1, 0, 0],
   [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa, beta] , IdentityMat(5) );
end;

ACDim4Nr032 := function ( k1, k2, k3, k4, k5)
local a, b, c, d, alfa, beta;
a :=[[1, 0, -k1, 0, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, k1, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1],
   [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[1, -k1/2 - 2*k4, -3*k1 + 2*k2 - 2*k4 + 2*k5, 0,
    k2/2 - (-3*k1 + 2*k2 - 2*k4 + 2*k5)/4], [0, -1, 0, 0, 0],
   [0, 0, -1, 0, 1/2], [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];
beta :=[[-1, 2*k4, k1/2, -k3,  0], [0, 1, 0, 0, 1/2], [0, 0, -1, 0, 0],
   [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa, beta] , IdentityMat(5) );
end;

ACDim4Nr033 := function ( k1, k2, k3, k4)
local a, b, c, d, alfa, beta;
a :=[[1, 0, 0, -k1, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, k1, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1],
   [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[-1, -k1/2, 0, 2*k2,  0], [0, -1, 0, 0, 0], [0, 0, -1, 0, 1/2],
   [0, 0, 0, 1, 1/2], [0, 0, 0, 0, 1]];
beta :=[[1, 0, -k1 - 2*k3 + 2*k4, -k1/2, k3/2], [0, 1, 0, 0, 1/2],
   [0, 0, -1, 0, 0], [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa, beta] , IdentityMat(5) );
end;

ACDim4Nr033b := function ( k1, k2, k3, k4, k5)
local a, b, c, d, alfa, beta;
a :=[[1, 0, -k1, 0, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, k1, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1],
   [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[1, -k1/2 - 2*k4, -3*k1 + 2*k2 + k3 - 2*k4 + 2*k5, 0,
    k2/2 - (-3*k1 + 2*k2 + k3 - 2*k4 + 2*k5)/4], [0, -1, 0, 0, 0],
   [0, 0, -1, 0, 1/2], [0, 0, 0, 1, 1/2], [0, 0, 0, 0, 1]];
beta :=[[-1, 2*k4, k1/2, -k3,  0], [0, 1, 0, 0, 1/2], [0, 0, -1, 0, 0],
   [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa, beta] , IdentityMat(5) );
end;

ACDim4Nr033c := function ( k1, k2, k3, k4)
local a, b, c, d, alfa, beta;
a :=[[1, 0, 0, 0, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, 0, 0, -k1, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, 0, k1, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1],
   [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[-1, 0, -k1/2, k1/2 + 2*k2, k2/2], [0, -1, 0, 0, 0],
   [0, 0, -1, 0, 1/2], [0, 0, 0, 1, 1/2], [0, 0, 0, 0, 1]];
beta :=[[-1, 2*k3, 0, k1 + 2*k2, -k4/2], [0, 1, 0, 0, 1/2], [0, 0, -1, 0, 0],
   [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa, beta] , IdentityMat(5) );
end;

ACDim4Nr034 := function ( k1, k2, k3, k4, k5)
local a, b, c, d, alfa, beta;
a :=[[1, 0, -k1, 0, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, k1, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1],
   [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[1, k1/2 + k2, -2*k1 + k2 + 2*k3 + 2*k5, 0,
    k3/2 - (-2*k1 + k2 + 2*k3 + 2*k5)/4], [0, -1, 0, 0, 0],
   [0, 0, -1, 0, 1/2], [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];
beta :=[[-1, -k1 - k2, k1/2, k1 + k2 + 2*k4,  0], [0, 1, 0, 0, 1/2],
   [0, 0, -1, 0, 0], [0, 0, 0, 1, 1/2], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa, beta] , IdentityMat(5) );
end;

ACDim4Nr036 := function ( k1, k2, k3, k4)
local a, b, c, d, alfa, beta;
a :=[[1, 0, 0, -k1, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, 0, 0, -k1, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, k1, k1, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1],
   [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[-1, -k1/2, -k1/2, 2*k2,  0], [0, -1, 0, 0, 0], [0, 0, -1, 0, 0],
   [0, 0, 0, 1, 1/2], [0, 0, 0, 0, 1]];
beta :=[[1, k3, -k3, 0, k4/2], [0, 0, 1, 0, 0], [0, 1, 0, 0, 0],
   [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa, beta] , IdentityMat(5) );
end;

ACDim4Nr037 := function ( k1, k2, k3, k4, k5)
local a, b, c, d, alfa, beta;
a :=[[1, 0, -k1/2, 0, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, k1/2, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1],
   [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[1, k2, -k2 + 2*k4, 0, k3/2], [0, -1, 0, 0, 0], [0, 0, -1, 0, 0],
   [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];
beta :=[[-1, -k4, -k4, 2*k5,  0], [0, 0, 1, 0, 0], [0, 1, 0, 0, 0],
   [0, 0, 0, 1, 1/2], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa, beta] , IdentityMat(5) );
end;

ACDim4Nr041 := function ( k1, k2, k3, k4, k5)
local a, b, c, d, alfa, beta;
a :=[[1, 0, 0, -k1, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, 0, 0, -k1, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, k1, k1, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1],
   [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[1, k2, k2, k1 - 2*k5, -k2/2 + k3/2], [0, 0, -1, 0, 1/2],
   [0, -1, 0, 0, 1/2], [0, 0, 0, -1, 0], [0, 0, 0, 0, 1]];
beta :=[[-1, k1/2 - k4, (-3*k1)/2 + k4, 2*k5,  0], [0, 0, -1, 0, 0],
   [0, -1, 0, 0, 0], [0, 0, 0, 1, 1/2], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa, beta] , IdentityMat(5) );
end;

ACDim4Nr043 := function ( k1, k2, k3, k4, k5)
local a, b, c, d, alfa, beta;
a :=[[1, 0, -k1/2, -k1/2, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0],
   [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];
b :=[[1, k1/2, 0, k1/2, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1],
   [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];
c :=[[1, k1/2, -k1/2, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0],
   [0, 0, 0, 1, 1], [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[1, -k1/4 + k2 + 2*k3 + 2*k5, k1/4 + k2, 2*k2 + 2*k3 + 2*k5,
    k3/2 - (2*k2 + 2*k3 + 2*k5)/4], [0, 0, 1, 0, 0], [0, 1, 0, 0, 0],
   [0, -1, -1, -1, 1/2], [0, 0, 0, 0, 1]];
beta :=[[-1, -k1/4 + k2 + 2*k4, 2*k4, -k1/4 - k2,  0], [0, 0, 0, -1, 0],
   [0, 1, 1, 1, 1/2], [0, -1, 0, 0, 0], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa, beta] , IdentityMat(5) );
end;

ACDim4Nr045 := function ( k1, k2, k3, k4, k5)
local a, b, c, d, alfa, beta;
a:=[[1, 0, 0, -k1/2, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
 [0, 0, 0, 0, 1]];
b:=[[1, 0, 0, k1/2, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
 [0, 0, 0, 0, 1]];
c:=[[1, k1/2, -k1/2, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1],
 [0, 0, 0, 0, 1]];
d:=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa:=[[1,k2, -k2, k2 - 2*k4 - 2*k5, k3/2], [0, 0, 1, -1, 0], [0, 1, 0, -1, 0],
 [0, 0, 0, -1, 0], [0, 0, 0, 0, 1]];
beta:=[[-1, -k4, k4 + 2*k5, k4, 0], [0, 0, 1, -1, 1/2], [0, 0, 1, 0, 1/2],
 [0, -1, 1, 0, 0], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa, beta] , IdentityMat(5) );
end;

ACDim4Nr055 := function ( k1, k2, k3, k4, k5, k6)
local a, b, c, d, alfa, beta, gamma;
a :=[[1, 0, -k1, 0, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, k1, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1],
   [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[1, -k1 - 2*k2 + 2*k3 - 2*k4, -k1 - 2*k3, 0, k2/2], [0, -1, 0, 0, 0],
   [0, 0, -1, 0, 0], [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];
beta :=[[-1, -k1/2, k1/2 + 2*k3, 0,  0], [0, -1, 0, 0, 1/2],
   [0, 0, 1, 0, 1/2], [0, 0, 0, -1, 0], [0, 0, 0, 0, 1]];
gamma :=[[1, -k1 - 2*k2 + 2*k3 - 2*k4, -k1 - 2*k3, k5,
    (2*k1 + k2 + k4 + k6)/2], [0, -1, 0, 0, 0], [0, 0, -1, 0, 0],
   [0, 0, 0, -1, 0], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa, beta, gamma] , IdentityMat(5) );
end;

ACDim4Nr056 := function ( k1, k2, k3, k4, k5, k6)
local a, b, c, d, alfa, beta, gamma;
a :=[[1, 0, -k1, 0, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, k1, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1],
   [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[1, -k1/2 + 2*k2 - 2*k3 + 2*(k1 - k2 + 2*k3 - k4), k1/2 - 2*k3, 0,
    k2/2 - (k1 - 2*k3)/4 - (-k1 + 2*k2 - 2*k3 + 2*(k1 - k2 + 2*k3 - k4))/4],
   [0, -1, 0, 0, 1/2], [0, 0, -1, 0, 1/2], [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];
beta :=[[-1, -k1/2, 2*k3, 0,  0], [0, -1, 0, 0, 0], [0, 0, 1, 0, 1/2],
   [0, 0, 0, -1, 1/2], [0, 0, 0, 0, 1]];
gamma :=[[1, 2*k2 - 2*k3 + 2*(k1 - k2 + 2*k3 - k4), -2*k3,
    2*k3 + 2*k5 - 2*k6, k6/2], [0, -1, 0, 0, 0], [0, 0, -1, 0, 0],
   [0, 0, 0, -1, 0], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa, beta, gamma] , IdentityMat(5) );
end;

ACDim4Nr058 := function ( k1, k2, k3, k4, k5, k6)
local a, b, c, d, alfa, beta, gamma;
a :=[[1, 0, -k1, 0, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, k1, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1],
   [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[1, -k1 - 2*k2 + 2*k3 - 2*k4, -k1 - 2*k3, 0, k2/2], [0, -1, 0, 0, 0],
   [0, 0, -1, 0, 0], [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];
beta :=[[-1, -k1/2, k1/2 + 2*k3, 0,  0], [0, -1, 0, 0, 1/2],
   [0, 0, 1, 0, 1/2], [0, 0, 0, -1, 1/2], [0, 0, 0, 0, 1]];
gamma :=[[1, -k1 - 2*k2 + 2*k3 - 2*k4, -k1 - 2*k3,
    4*k1 + 2*k2 + 2*k4 + 2*k5 - 2*k6, k6/2], [0, -1, 0, 0, 0],
   [0, 0, -1, 0, 0], [0, 0, 0, -1, 0], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa, beta, gamma] , IdentityMat(5) );
end;

ACDim4Nr060 := function ( k1, k2, k3, k4, k5, k6)
local a, b, c, d, alfa, beta, gamma;
a :=[[1, 0, -2*k1, 0, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, 2*k1, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1],
   [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[1, -2*(k1 - k2 + k3 - k4), k1 - 2*k3, 0,
    k2/2 + (k1 - k2 + k3 - k4)/2], [0, -1, 0, 0, 1/2], [0, 0, -1, 0, 0],
   [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];
beta :=[[-1, -k1, 2*k3, 0,  0], [0, -1, 0, 0, 0], [0, 0, 1, 0, 1/2],
   [0, 0, 0, -1, 1/2], [0, 0, 0, 0, 1]];
gamma :=[[1, -2*(k1 - k2 + k3 - k4), -2*k3, 2*k3 + 2*k5 - 2*k6, k6/2],
   [0, -1, 0, 0, 0], [0, 0, -1, 0, 0], [0, 0, 0, -1, 0], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa, beta, gamma] , IdentityMat(5) );
end;

ACDim4Nr061 := function ( k1, k2, k3, k4, k5, k6)
local a, b, c, d, alfa, beta, gamma;
a :=[[1, 0, 0, -2*k1, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, 2*k1, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1],
   [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[-1, -k1, 0, k1 + 2*k2,  0], [0, -1, 0, 0, 1/2], [0, 0, -1, 0, 0],
   [0, 0, 0, 1, 1/2], [0, 0, 0, 0, 1]];
beta :=[[1, 7*k1 + 2*k2 - 2*k3 + 2*k4, 0, -2*k1 - 2*k2,
    -(-2*k1 - 2*k2)/4 + k3/2], [0, -1, 0, 0, 0], [0, 0, 1, 0, 1/2],
   [0, 0, 0, -1, 1/2], [0, 0, 0, 0, 1]];
gamma :=[[1, 8*k1 + 2*k2 - 2*k3 + 2*k4, 2*k1 + 2*k2 - 2*k6, -2*k1 - 2*k2,
    (-k1 + k3 - k4 + k5)/2], [0, -1, 0, 0, 0], [0, 0, -1, 0, 0],
   [0, 0, 0, -1, 0], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa, beta, gamma] , IdentityMat(5) );
end;

ACDim4Nr061b := function ( k1, k2, k3, k4, k5, k6)
local a, b, c, d, alfa, beta, gamma;
a :=[[1, 0, -2*k1, 0, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, 2*k1, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1],
   [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[1, -2*k3 - 2*k5 - 2*k6 + 2*(-k1 + k2 + k4 + k5 + k6), k1 - 2*k3, 0,
    k2/2 - (-2*k3 - 2*k5 - 2*k6 + 2*(-k1 + k2 + k4 + k5 + k6))/4],
   [0, -1, 0, 0, 1/2], [0, 0, -1, 0, 0], [0, 0, 0, 1, 1/2], [0, 0, 0, 0, 1]];
beta :=[[-1, -k1, 2*k3, 0,  0], [0, -1, 0, 0, 0], [0, 0, 1, 0, 1/2],
   [0, 0, 0, -1, 1/2], [0, 0, 0, 0, 1]];
gamma :=[[1, -2*k3 - 2*k5 - 2*k6 + 2*(-k1 + k2 + k4 + k5 + k6), -2*k3,
    2*k3 + 2*k6 - 2*(-k1 + k2 + k4 + k5 + k6), (-k1 + k2 + k4 + k5 + k6)/2],
   [0, -1, 0, 0, 0], [0, 0, -1, 0, 0], [0, 0, 0, -1, 0], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa, beta, gamma] , IdentityMat(5) );
end;

ACDim4Nr061c := function ( k1, k2, k3, k4, k5, k6)
local a, b, c, d, alfa, beta, gamma;
a :=[[1, 0, 0, 0, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, 0, 0, -2*k1, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, 0, 2*k1, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1],
   [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[-1, 0, -k1, 2*k2, 2*k1 - k2/2], [0, -1, 0, 0, 1/2],
   [0, 0, -1, 0, 0], [0, 0, 0, 1, 1/2], [0, 0, 0, 0, 1]];
beta :=[[-1, 0, -3*k1 - 2*k2 - 2*k6 + 2*(k1 + k2 + k3 + k6), k1, -k4/2],
   [0, -1, 0, 0, 0], [0, 0, 1, 0, 1/2], [0, 0, 0, -1, 1/2], [0, 0, 0, 0, 1]];
gamma :=[[1, 2*k2 + 2*k5 - 2*(k1 + k2 + k3 + k6),
    4*k1 + 2*k2 + 2*k6 - 2*(k1 + k2 + k3 + k6), -2*k2, (k1 + k2 + k3 + k6)/2],
    [0, -1, 0, 0, 0], [0, 0, -1, 0, 0], [0, 0, 0, -1, 0], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa, beta, gamma] , IdentityMat(5) );
end;

ACDim4Nr062 := function ( k1, k2, k3, k4, k5, k6)
local a, b, c, d, alfa, beta, gamma;
a :=[[1, 0, 0, -k1, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, k1, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1],
   [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[-1, -k1/2, 0, k1/2 + 2*k2,  0], [0, -1, 0, 0, 1/2],
   [0, 0, -1, 0, 0], [0, 0, 0, 1, 1/2], [0, 0, 0, 0, 1]];
beta :=[[1, 3*k1 + 2*k2 - 2*k3 + 2*k4, 0, -k1 - 2*k2, k3/2],
   [0, -1, 0, 0, 0], [0, 0, 1, 0, 1/2], [0, 0, 0, -1, 0], [0, 0, 0, 0, 1]];
gamma :=[[1, 3*k1 + 2*k2 - 2*k3 + 2*k4, -2*k6, -k1 - 2*k2, (k3 - k4 + k5)/2],
   [0, -1, 0, 0, 0], [0, 0, -1, 0, 0], [0, 0, 0, -1, 0], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa, beta, gamma] , IdentityMat(5) );
end;

ACDim4Nr075 := function ( k1, k2, k3, k4)
local a, b, c, d, alfa;
a :=[[1, 0, -k1/2, 0, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, k1/2, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1],
   [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[1, k2, k3, 0, k4/4], [0, 0, -1, 0, 0], [0, 1, 0, 0, 0],
   [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa] , IdentityMat(5) );
end;

ACDim4Nr076 := function ( k1, k2, k3, k4)
local a, b, c, d, alfa;
a :=[[1, 0, -k1/2, 0, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, k1/2, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1],
   [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[1, k2, k3, 0, k4/4], [0, 0, -1, 0, 0], [0, 1, 0, 0, 0],
   [0, 0, 0, 1, 1/4], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa] , IdentityMat(5) );
end;

ACDim4Nr077 := function ( k1, k2, k3, k4)
local a, b, c, d, alfa;
a :=[[1, 0, -k1/2, 0, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, k1/2, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1],
   [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[1, k2, k3, 0, k4/4], [0, 0, -1, 0, 0], [0, 1, 0, 0, 0],
   [0, 0, 0, 1, 1/2], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa] , IdentityMat(5) );
end;

ACDim4Nr079 := function ( k1, k2, k3, k4)
local a, b, c, d, alfa;
a :=[[1, 0, 0, -k1/2, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, 0, 0, k1/2, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, k1/2, -k1/2, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0],
   [0, 0, 0, 1, 1], [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[1, k2, -k2, k3, k4/4], [0, 0, 1, 0, 0], [0, 0, 1, -1, 0],
   [0, -1, 1, 0, 0], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa] , IdentityMat(5) );
end;

ACDim4Nr080 := function ( k1, k2, k3, k4)
local a, b, c, d, alfa;
a :=[[1, 0, 0, -k1/2, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, 0, 0, k1/2, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, k1/2, -k1/2, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0],
   [0, 0, 0, 1, 1], [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[1, -k1/4 + k2, k1/4 - k2, k3, k1/16 - k2/4 + k3/4 + k4/4],
   [0, 0, 1, 0, 1/2], [0, 0, 1, -1, 0], [0, -1, 1, 0, 0], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa] , IdentityMat(5) );
end;

ACDim4Nr081 := function ( k1, k2, k3, k4, k5)
local a, b, c, d, alfa;
a :=[[1, 0, -k1/2, 0, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, k1/2, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1],
   [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[1, k2, k3, k4, k5/4], [0, 0, 1, 0, 0], [0, -1, 0, 0, 0],
   [0, 0, 0, -1, 0], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa] , IdentityMat(5) );
end;

ACDim4Nr082 := function ( k1, k2, k3, k4, k5)
local a, b, c, d, alfa;
a :=[[1, 0, 0, -k1/2, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, 0, 0, k1/2, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, k1/2, -k1/2, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0],
   [0, 0, 0, 1, 1], [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[1, k2, k3, k4, k5/4], [0, 0, -1, 0, 0], [0, 0, -1, 1, 0],
   [0, 1, -1, 0, 0], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa] , IdentityMat(5) );
end;

ACDim4Nr083 := function ( k1, k2, k3, k4, k5, k6)
local a, b, c, d, alfa, beta;
a :=[[1, 0, -k1/2, 0, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, k1/2, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1],
   [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[1, k2, k3, 0, k4/4], [0, 0, -1, 0, 0], [0, 1, 0, 0, 0],
   [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];
beta :=[[1, k2 + k3, -k2 + k3, k5, k6/2], [0, -1, 0, 0, 0], [0, 0, -1, 0, 0],
   [0, 0, 0, -1, 0], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa, beta] , IdentityMat(5) );
end;

ACDim4Nr084 := function ( k1, k2, k3, k4, k5, k6)
local a, b, c, d, alfa, beta;
a :=[[1, 0, -k1/2, 0, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, k1/2, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1],
   [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[1, k2, k3, 0, k4/4], [0, 0, -1, 0, 0], [0, 1, 0, 0, 0],
   [0, 0, 0, 1, 1/2], [0, 0, 0, 0, 1]];
beta :=[[1, k2 + k3, -k2 + k3, -2*k6, k5/2], [0, -1, 0, 0, 0],
   [0, 0, -1, 0, 0], [0, 0, 0, -1, 0], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa, beta] , IdentityMat(5) );
end;

ACDim4Nr085 := function ( k1, k2, k3, k4, k5, k6)
local a, b, c, d, alfa, beta;
a :=[[1, 0, -k1, 0, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, k1, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1],
   [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[1, k2, -k1/2 + k2 - 2*k6, 0,
    -k1/8 + k2/4 + k3/4 - (-k1 + k2 - 2*k6)/4], [0, 0, -1, 0, 0],
   [0, 1, 0, 0, 1/2], [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];
beta :=[[1, 2*k2 - 2*k6, -2*k6, k4, k5/2], [0, -1, 0, 0, 0],
   [0, 0, -1, 0, 0], [0, 0, 0, -1, 0], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa, beta] , IdentityMat(5) );
end;

ACDim4Nr086 := function ( k1, k2, k3, k4, k5, k6)
local a, b, c, d, alfa, beta;
a :=[[1, 0, -k1, 0, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, k1, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1],
   [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[1, k2, k1/2 + k3, 0, -k1/8 + k2/4 - k3/4 + k4/4], [0, 0, -1, 0, 0],
   [0, 1, 0, 0, 1/2], [0, 0, 0, 1, 1/2], [0, 0, 0, 0, 1]];
beta :=[[1, k1 + k2 + k3, k1 - k2 + k3, -k1 + k2 - k3 - 2*k6, k5/2],
   [0, -1, 0, 0, 0], [0, 0, -1, 0, 0], [0, 0, 0, -1, 0], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa, beta] , IdentityMat(5) );
end;

ACDim4Nr087 := function ( k1, k2, k3, k4, k5, k6)
local a, b, c, d, alfa, beta;
a :=[[1, 0, 0, -k1/2, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, 0, 0, k1/2, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, k1/2, -k1/2, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0],
   [0, 0, 0, 1, 1], [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[1, k2, -k2, k3, k4/4], [0, 0, 1, 0, 0], [0, 0, 1, -1, 0],
   [0, -1, 1, 0, 0], [0, 0, 0, 0, 1]];
beta :=[[1, k5, -2*k2 + 2*k3 + k5, 2*k2 - k5, k6/2], [0, -1, 0, 0, 0],
   [0, 0, -1, 0, 0], [0, 0, 0, -1, 0], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa, beta] , IdentityMat(5) );
end;

ACDim4Nr088 := function ( k1, k2, k3, k4, k5, k6)
local a, b, c, d, alfa, beta;
a :=[[1, 0, 0, -k1/2, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, 0, 0, k1/2, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, k1/2, -k1/2, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0],
   [0, 0, 0, 1, 1], [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[1, k2, -k2, -k1/4 + k3, -(-k1/4 + k2 + k3 - k4)/4], [0, 0, 1, 0, 0],
   [0, 0, 1, -1, 0], [0, -1, 1, 0, 1/2], [0, 0, 0, 0, 1]];
beta :=[[1, 2*k2 + 2*k6, -k1 + 2*k3 + 2*k6, -2*k6, k5/2], [0, -1, 0, 0, 0],
   [0, 0, -1, 0, 0], [0, 0, 0, -1, 0], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa, beta] , IdentityMat(5) );
end;

ACDim4Nr103 := function ( k1, k2, k3, k4, k5)
local a, b, c, d, alfa, beta;
a :=[[1, 0, -k1/2, 0, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, k1/2, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1],
   [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[1, k2, k3, 0, k4/4], [0, 0, -1, 0, 0], [0, 1, 0, 0, 0],
   [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];
beta :=[[-1, -k2 - k3, 0, 2*k5,  0], [0, 1, 0, 0, 0], [0, 0, -1, 0, 0],
   [0, 0, 0, 1, 1/2], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa, beta] , IdentityMat(5) );
end;

ACDim4Nr104 := function ( k1, k2, k3, k4, k5)
local a, b, c, d, alfa, beta;
a :=[[1, 0, -k1, 0, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, k1, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1],
   [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[1, k1/2 + k2, -k1 + k2 + 2*k3 + 2*k5, 0,
    -k1/8 - k2/4 + k3/4 - (-k1 + k2 + 2*k3 + 2*k5)/4], [0, 0, -1, 0, 1/2],
   [0, 1, 0, 0, 0], [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];
beta :=[[-1, -2*k2 - 2*k3 - 2*k5, k1/2, 2*k2 + 2*k3 + 2*k4 + 2*k5,  0],
   [0, 1, 0, 0, 1/2], [0, 0, -1, 0, 0], [0, 0, 0, 1, 1/2], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa, beta] , IdentityMat(5) );
end;

ACDim4Nr106 := function ( k1, k2, k3, k4, k5)
local a, b, c, d, alfa, beta;
a :=[[1, 0, -k1, 0, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, k1, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1],
   [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[1, k1/2 + k2, -k1 - k2 - 2*k5, 0,
    -k1/8 - k2/4 + k3/4 - (-k1 - k2 - 2*k5)/4], [0, 0, -1, 0, 1/2],
   [0, 1, 0, 0, 0], [0, 0, 0, 1, 1/2], [0, 0, 0, 0, 1]];
beta :=[[-1, 2*k5, k1/2, -2*k4,  0], [0, 1, 0, 0, 1/2], [0, 0, -1, 0, 0],
   [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa, beta] , IdentityMat(5) );
end;

ACDim4Nr110 := function ( k1, k2, k3, k4, k5)
local a, b, c, d, alfa, beta;
a :=[[1, 0, 0, -k1, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, 0, 0, k1, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, k1, -k1, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1],
   [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[1, 4*k1 - 4*k2 + 2*k3 - 3*k4 + 2*k5,
    -4*k1 + 4*k2 - 2*k3 + 3*k4 - 2*k5, -k1/2 + k2,
    -(-k1/2 + k2 - k3 - (3*(-4*k1 + 4*k2 - 2*k3 + 3*k4 - 2*k5))/2 -
        (4*k1 - 4*k2 + 2*k3 - 3*k4 + 2*k5)/2)/4], [0, 0, 1, 0, 0],
   [0, 0, 1, -1, 0], [0, -1, 1, 0, 1/2], [0, 0, 0, 0, 1]];
beta :=[[-1, -k4, 2*(k1 - k2 - k4) + k4, k4,  0], [0, 0, 1, -1, 1/2],
   [0, 0, 1, 0, 1/2], [0, -1, 1, 0, 0], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa, beta] , IdentityMat(5) );
end;

ACDim4Nr114 := function ( k1, k2, k3, k4, k5)
local a, b, c, d, alfa, beta;
a :=[[1, 0, -k1, 0, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, k1, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1],
   [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[1, -k1/2 + k2, k1 - k2 - 2*k4, 2*k1 - 2*k2 + 2*k3 - 2*k4 + 2*k5,
    -(k1/2 + k3 + 2*k5)/4], [0, 0, 1, 0, 1/2], [0, -1, 0, 0, 0],
   [0, 0, 0, -1, 1/2], [0, 0, 0, 0, 1]];
beta :=[[-1, -k1/2, 2*k4, 0,  0], [0, -1, 0, 0, 0], [0, 0, 1, 0, 1/2],
   [0, 0, 0, -1, 0], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa, beta] , IdentityMat(5) );
end;

ACDim4Nr143 := function ( k1, k2, k3, k4)
local a, b, c, d, alfa;
a:= [[1, 0, -k1/2, 0, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b:= [[1, k1/2, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c:= [[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1],
   [0, 0, 0, 0, 1]];
d:= [[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa:= [[1, k2, -k1/2 + k3, 0, k4/3], [0, 0, -1, 0, 0], [0, 1, -1, 0, 0],
   [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa] , IdentityMat(5) );
end;

ACDim4Nr144 := function ( k1, k2, k3, k4)
local a, b, c, d, alfa;
a :=[[1, 0, -k1/2, 0, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, k1/2, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1],
   [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[1, k2, -k1/2 + k3, 0, k4/3], [0, 0, -1, 0, 0], [0, 1, -1, 0, 0],
   [0, 0, 0, 1, 1/3], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa] , IdentityMat(5) );
end;

ACDim4Nr146 := function ( k1, k2, k3, k4)
local a, b, c, d, alfa;
a :=[[1, 0, -k1/2, k1/2, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0],
   [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];
b :=[[1, k1/2, 0, -k1/2, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1],
   [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];
c :=[[1, -k1/2, k1/2, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0],
   [0, 0, 0, 1, 1], [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[1, k2, k3, -k2 - k3, k4/3], [0, 0, 0, 1, 0], [0, 1, 0, 0, 0],
   [0, 0, 1, 0, 0], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa] , IdentityMat(5) );
end;

ACDim4Nr147 := function ( k1, k2, k3, k4, k5)
local a, b, c, d, alfa;
a :=[[1, 0, -k1/2, 0, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, k1/2, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1],
   [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[1, k2, -k1/2 + k3, k4, k5/6], [0, 0, 1, 0, 0], [0, -1, 1, 0, 0],
   [0, 0, 0, -1, 0], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa] , IdentityMat(5) );
end;

ACDim4Nr148 := function ( k1, k2, k3, k4, k5)
local a, b, c, d, alfa;
a :=[[1, 0, -k1/2, k1/2, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0],
   [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];
b :=[[1, k1/2, 0, -k1/2, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1],
   [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];
c :=[[1, -k1/2, k1/2, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0],
   [0, 0, 0, 1, 1], [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[1, k2, k3, k4, k5/6], [0, 0, 0, -1, 0], [0, -1, 0, 0, 0],
   [0, 0, -1, 0, 0], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa] , IdentityMat(5) );
end;

ACDim4Nr158 := function ( k1, k2, k3, k4, k5)
local a, b, c, d, alfa, beta;
a :=[[1, 0, -k1/2, 0, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, k1/2, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1],
   [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[1, k2, -k1/2 + k3, 0, k4/3], [0, 0, -1, 0, 0], [0, 1, -1, 0, 0],
   [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];
beta :=[[-1, -k2, k2, 2*k5,  0], [0, 0, -1, 0, 0], [0, -1, 0, 0, 0],
   [0, 0, 0, 1, 1/2], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa, beta] , IdentityMat(5) );
end;

ACDim4Nr159 := function ( k1, k2, k3, k4, k5)
local a, b, c, d, alfa, beta;
a :=[[1, 0, -k1/2, 0, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, k1/2, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1],
   [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[1, k1 - 2*k2 + 3*k4, -k1/2 + k2, 0, k3/3], [0, 0, -1, 0, 0],
   [0, 1, -1, 0, 0], [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];
beta :=[[-1, -k4, -k4, 2*k5,  0], [0, 0, 1, 0, 0], [0, 1, 0, 0, 0],
   [0, 0, 0, 1, 1/2], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa, beta] , IdentityMat(5) );
end;

ACDim4Nr161 := function ( k1, k2, k3, k4, k5)
local a, b, c, d, alfa, beta;
a :=[[1, 0, -k1/2, k1/2, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0],
   [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];
b :=[[1, k1/2, 0, -k1/2, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1],
   [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];
c :=[[1, -k1/2, k1/2, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0],
   [0, 0, 0, 1, 1], [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[1, k1/4 + k2, k3, -k1/4 - k2 - k3,
    -((5*k1)/8 + k2 + (-k2 - k3)/2 + (3*k3)/2 - k4)/3], [0, 0, 0, 1, 1/2],
   [0, 1, 0, 0, 1/2], [0, 0, 1, 0, 0], [0, 0, 0, 0, 1]];
beta :=[[-1, -k1/4 - k2 - 2*k3 + 2*k5, (-3*k1)/4 - k2 - 2*k3 + 2*k5, 2*k5,
     0], [0, 0, 1, 0, 0], [0, 1, 0, 0, 0], [0, 0, 0, 1, 1/2], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa, beta] , IdentityMat(5) );
end;

ACDim4Nr168 := function ( k1, k2, k3, k4)
local a, b, c, d, alfa;
a :=[[1, 0, -k1/2, 0, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, k1/2, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1],
   [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[1, k2, -k1/2 + k3, 0, k4/6], [0, 0, 1, 0, 0], [0, -1, 1, 0, 0],
   [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa] , IdentityMat(5) );
end;

ACDim4Nr169 := function ( k1, k2, k3, k4)
local a, b, c, d, alfa;
a :=[[1, 0, -k1/2, 0, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, k1/2, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1],
   [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[1, k2, -k1/2 + k3, 0, k4/6], [0, 0, 1, 0, 0], [0, -1, 1, 0, 0],
   [0, 0, 0, 1, 5/6], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa] , IdentityMat(5) );
end;

ACDim4Nr172 := function ( k1, k2, k3, k4)
local a, b, c, d, alfa;
a :=[[1, 0, -k1/2, 0, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, k1/2, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1],
   [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[1, k2, -k1/2 + k3, 0, k4/6], [0, 0, 1, 0, 0], [0, -1, 1, 0, 0],
   [0, 0, 0, 1, 1/3], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa] , IdentityMat(5) );
end;

ACDim4Nr173 := function ( k1, k2, k3, k4)
local a, b, c, d, alfa;
a :=[[1, 0, -k1/2, 0, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, k1/2, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1],
   [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[1, k2, -k1/2 + k3, 0, k4/6], [0, 0, 1, 0, 0], [0, -1, 1, 0, 0],
   [0, 0, 0, 1, 1/2], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa] , IdentityMat(5) );
end;

ACDim4Nr174 := function ( k1, k2, k3, k4, k5)
local a, b, c, d, alfa;
a :=[[1, 0, -k1/2, 0, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, k1/2, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1],
   [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[1, k2, -k1/2 + k3, k4, k5/6], [0, 0, -1, 0, 0], [0, 1, -1, 0, 0],
   [0, 0, 0, -1, 0], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa] , IdentityMat(5) );
end;

ACDim4Nr175 := function ( k1, k2, k3, k4, k5, k6)
local a, b, c, d, alfa, beta;
a :=[[1, 0, -k1/2, 0, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, k1/2, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1],
   [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[1, k2, -k1/2 + k3, 0, k4/6], [0, 0, 1, 0, 0], [0, -1, 1, 0, 0],
   [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];
beta :=[[1, k1 - 2*k3, -k1 + 2*k2 + 2*k3, k5, k6/2], [0, -1, 0, 0, 0],
   [0, 0, -1, 0, 0], [0, 0, 0, -1, 0], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa, beta] , IdentityMat(5) );
end;

ACDim4Nr176 := function ( k1, k2, k3, k4, k5, k6)
local a, b, c, d, alfa, beta;
a :=[[1, 0, -k1/2, 0, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, k1/2, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1],
   [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[1, k2, -k1/2 + k3, 0, k4/6], [0, 0, 1, 0, 0], [0, -1, 1, 0, 0],
   [0, 0, 0, 1, 1/2], [0, 0, 0, 0, 1]];
beta :=[[1, k1 - 2*k3, -k1 + 2*k2 + 2*k3, 2*k6, k5/2], [0, -1, 0, 0, 0],
   [0, 0, -1, 0, 0], [0, 0, 0, -1, 0], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa, beta] , IdentityMat(5) );
end;

ACDim4Nr184 := function ( k1, k2, k3, k4, k5)
local a, b, c, d, alfa, beta;
a :=[[1, 0, -k1/2, 0, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
b :=[[1, k1/2, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
c :=[[1, 0, 0, 0, 0], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1],
   [0, 0, 0, 0, 1]];
d :=[[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
   [0, 0, 0, 0, 1]];
alfa :=[[1, k2, -k1/2 + k3, 0, k4/6], [0, 0, 1, 0, 0], [0, -1, 1, 0, 0],
   [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];
beta :=[[-1, -k1 + k2 + 2*k3, k1 - k2 - 2*k3, 2*k5,  0], [0, 0, -1, 0, 0],
   [0, -1, 0, 0, 0], [0, 0, 0, 1, 1/2], [0, 0, 0, 0, 1]];
return Group( [a, b, c, d, alfa, beta] , IdentityMat(5) );
end;

ACDim4NrB1 := function ( k, k1, k2, k3)
local a, b, c, d;
a:= [[1, (-2*k2)/3, 0, -k1/2 - (2*k*k3)/3 + (2*k*(k2 + k3))/3, 0],
     [0, 1, 0, -k/2, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];
b:= [[1, (-2*k3)/3, k1/2 - (2*k*k3)/3, 0, 0], [0, 1, k/2, 0, 0],
     [0, 0, 1, 0, 0], [0, 0, 0, 1, 1], [0, 0, 0, 0, 1]];
c:= [[1, 0, k2/3, k3/3, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0],
     [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];
d:= [[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
     [0, 0, 0, 0, 1]];
return Group( [a , b, c, d] , IdentityMat(5) );
end;

ACDim4NrB2 := function ( k, k1, k2, k3)
local a, b, c, d, alfa;
a:= [[1, (-4*k1)/3, 0, (2*k*k1)/3 + (2*k*k2)/3 - 2*k*k3 +
       (-4*k*k1 - (16*k*k2)/3 - 2*k*k3 + 2*(2*k*k1 + 2*k*k2 + 2*k*k3))/2, 0],
     [0, 1, 0, -k, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];
b:= [[1, (-4*k2)/3, (-4*k*k1 - (16*k*k2)/3 - 2*k*k3 +
        2*(2*k*k1 + 2*k*k2 + 2*k*k3))/2, 0, 0], [0, 1, k, 0, 0],
     [0, 0, 1, 0, 0], [0, 0, 0, 1, 1], [0, 0, 0, 0, 1]];
c:= [[1, 0, (2*k1)/3, (2*k2)/3, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0],
     [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];
d:= [[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
     [0, 0, 0, 0, 1]];
alfa:= [[-1, 2*k3, -k1/3, -k2/3, 0], [0, 1, 0, 0, 1/2], [0, 0, -1, 0, 0],
     [0, 0, 0, -1, 0], [0, 0, 0, 0, 1]];
return Group( [a , b, c, d, alfa] , IdentityMat(5) );
end;

ACDim4NrB3c := function (l, k1, k2, k3, k4)
local a, b, c, d, alfa;
a:= [[1, 0, 0, (k1*l)/3 + k3*l + ((-8*k1*l)/3 + k3*l + 2*(k1*l - k3*l))/2,
      0], [0, 1, 0, -l, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];
b:= [[1, (-2*k1)/3, ((-8*k1*l)/3 + k3*l + 2*(k1*l - k3*l))/2, -k2, 0],
     [0, 1, l, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1], [0, 0, 0, 0, 1]];
c:= [[1, 0, 0, k1/3, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
     [0, 0, 0, 0, 1]];
d:= [[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
     [0, 0, 0, 0, 1]];
alfa:= [[1, k3, 0, 0, k4/2], [0, -1, 0, 0, 0], [0, 0, 1, 0, 0],
     [0, 0, 0, -1, 0], [0, 0, 0, 0, 1]];
return Group( [a , b, c, d, alfa] , IdentityMat(5) );
end;

ACDim4NrB3b := function (l, k1, k2, k3, k4)
local a, b, c, d, alfa;
a:= [[1, 0, 0, k1 + (2*k1*l)/3 - 2*k2*l + ((2*k1)/3 - (16*k1*l)/3 - 2*k2*l +
         2*(-k1 + 2*k1*l + 2*k2*l))/2, 0], [0, 1, 0, -l, 0], [0, 0, 1, 0, 1],
     [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];
b:= [[1, (-4*k1)/3, ((2*k1)/3 - (16*k1*l)/3 - 2*k2*l +
        2*(-k1 + 2*k1*l + 2*k2*l))/2, -k3, 0], [0, 1, l, 0, 0],
     [0, 0, 1, 0, 0], [0, 0, 0, 1, 1], [0, 0, 0, 0, 1]];
c:= [[1, 0, 0, (2*k1)/3, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0],
     [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];
d:= [[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
     [0, 0, 0, 0, 1]];
alfa:= [[1, -2*k2, -k2, 0, k4/2], [0, -1, -1, 0, 0], [0, 0, 1, 0, 0],
     [0, 0, 0, -1, 0], [0, 0, 0, 0, 1]];
return Group( [a , b, c, d, alfa] , IdentityMat(5) );
end;

ACDim4NrB3 := function (l, k1, k2, k3, k4)
local a, b, c, d, alfa;
a:= [[1, 0, 0, (2*k1)/3 + (k1*l)/3 + (-k1 - (2*k1*l)/3)/2, 0],
     [0, 1, 0, (-1 - 2*l)/2, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0],
     [0, 0, 0, 0, 1]];
b:= [[1, (-2*k1)/3, (-k1 - (2*k1*l)/3)/2, -k3, 0], [0, 1, (1 + 2*l)/2, 0, 0],
     [0, 0, 1, 0, 0], [0, 0, 0, 1, 1], [0, 0, 0, 0, 1]];
c:= [[1, 0, 0, k1/3, -k2], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
     [0, 0, 0, 0, 1]];
d:= [[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
     [0, 0, 0, 0, 1]];
alfa:= [[1, 0, 0, 0, k4/2], [0, -1, -1, 0, 0], [0, 0, 1, 0, 0],
     [0, 0, 0, -1, 0], [0, 0, 0, 0, 1]];
return Group( [a , b, c, d, alfa] , IdentityMat(5) );
end;

ACDim4NrB4 := function (k, k1, k2, k3, k4)
local a, b, c, d, alfa, beta;
a:= [[1, 0, 0, (k*k1)/3 + k*k3 + ((-2*k*k1)/3 - k*k3)/2, -k4],
     [0, 1, 0, -k, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];
b:= [[1, (-2*k1)/3, ((-2*k*k1)/3 - k*k3)/2, -(k*k1)/2 - k2 + (3*k*k3)/4, 0],
     [0, 1, k, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1], [0, 0, 0, 0, 1]];
c:= [[1, 0, 0, k1/3, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
     [0, 0, 0, 0, 1]];
d:= [[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
     [0, 0, 0, 0, 1]];
alfa:= [[1, k3, 0, 0, 0], [0, -1, 0, k/2, 0], [0, 0, 1, 0, 1/2],
     [0, 0, 0, -1, 0], [0, 0, 0, 0, 1]];
return Group( [a , b, c, d, alfa] , IdentityMat(5) );
end;

ACDim4NrB4b := function (k, k1, k2, k3)
local a, b, c, d, alfa;
a:= [[1, (4*k1)/3, 0, (-5*k*k1)/3 + 2*k2 - 2*((-2*k*k1)/3 + k2), -k3],
     [0, 1, 0, -k, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];
b:= [[1, 0, -2*((-2*k*k1)/3 + k2), 0, 0], [0, 1, k, 0, 0], [0, 0, 1, 0, 0],
     [0, 0, 0, 1, 1], [0, 0, 0, 0, 1]];
c:= [[1, 0, (-2*k1)/3, 0, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0],
     [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];
d:= [[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
     [0, 0, 0, 0, 1]];
alfa:= [[-1, (-2*k1)/3, 0, 0, 0], [0, -1, 0, k/2, 0], [0, 0, 1, 0, 1/2],
     [0, 0, 0, -1, 0], [0, 0, 0, 0, 1]];
return Group( [a , b, c, d, alfa] , IdentityMat(5) );
end;

ACDim4NrB5 := function (l, k1, k2, k3, k4)
local a, b, c, d, alfa;
a:= [[1, (-2*k1)/3, 0, k3*l, k2], [0, 1, 0, -l, 0], [0, 0, 1, 0, 1],
     [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];
b:= [[1, (2*k1)/3, 0, 0, 0], [0, 1, l, 0, 0], [0, 0, 1, 0, 0],
     [0, 0, 0, 1, 1], [0, 0, 0, 0, 1]];
c:= [[1, 0, k1/3, -k1/3, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0],
     [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];
d:= [[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
     [0, 0, 0, 0, 1]];
alfa:= [[1, k3, 0, 0, k4/2], [0, -1, 0, 0, 0], [0, 0, 0, 1, 0],
     [0, 0, 1, 0, 0], [0, 0, 0, 0, 1]];
return Group( [a , b, c, d, alfa] , IdentityMat(5) );
end;

ACDim4NrB5b := function (l, k1, k2, k3, k4)
local a, b, c, d, alfa;
a:= [[1, (-2*k1)/3, 0, k3*(1 + 2*l), k2], [0, 1, 0, (-1 - 2*l)/2, 0],
     [0, 0, 1, 0, 1], [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];
b:= [[1, (2*k1)/3, 0, 0, 0], [0, 1, (1 + 2*l)/2, 0, 0], [0, 0, 1, 0, 0],
     [0, 0, 0, 1, 1], [0, 0, 0, 0, 1]];
c:= [[1, 0, k1/3, -k1/3, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0],
     [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];
d:= [[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
     [0, 0, 0, 0, 1]];
alfa:= [[1, 2*k3, 0, 0, k4/2], [0, -1, 0, 0, 0], [0, 0, 0, 1, 0],
     [0, 0, 1, 0, 0], [0, 0, 0, 0, 1]];
return Group( [a , b, c, d, alfa] , IdentityMat(5) );
end;

ACDim4NrB7 := function (l, k1, k2, k3, k4)
local a, b, c, d, alfa, beta;
a:= [[1, 0, 0, (4*k1*l)/3 - 4*k2*l + ((-8*k1*l)/3 + 4*k2*l)/2, 0],
     [0, 1, 0, -2*l, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];
b:= [[1, (-4*k1)/3, ((-8*k1*l)/3 + 4*k2*l)/2, 0, (5*k1)/6 - 2*k2 +
       ((-2*k1)/3 + 2*k2)/2 - k4], [0, 1, 2*l, 0, 0], [0, 0, 1, 0, 0],
     [0, 0, 0, 1, 1], [0, 0, 0, 0, 1]];
c:= [[1, 0, 0, (2*k1)/3, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0],
     [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];
d:= [[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
     [0, 0, 0, 0, 1]];
alfa:= [[-1, 2*k2, 0, -k1/3, 0], [0, 1, 0, 0, 1/2], [0, 0, -1, 0, 0],
     [0, 0, 0, -1, 0], [0, 0, 0, 0, 1]];
beta:= [[1, (2*k1)/3 - 2*k2, -(((2*k1)/3 - 2*k2)*l)/2, 2*k3, 0],
     [0, -1, l, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, -1, 1/2], [0, 0, 0, 0, 1]];
return Group( [a , b, c, d, alfa, beta] , IdentityMat(5) );
end;

ACDim4NrB7b := function (l, k1, k2, k3, k4)
local a, b, c, d, alfa, beta;
a:= [[1, 0, 0, (4*k1*(1 + 2*l))/3 - 2*k2*(1 + 2*l) +
       ((-8*k1*(1 + 2*l))/3 + 2*k2*(1 + 2*l))/2, 0], [0, 1, 0, -1 - 2*l, 0],
     [0, 0, 1, 0, 1], [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];
b:= [[1, (-8*k1)/3, ((-8*k1*(1 + 2*l))/3 + 2*k2*(1 + 2*l))/2, 0,
      (5*k1)/3 - 2*k2 + ((-4*k1)/3 + 2*k2)/2 - k4], [0, 1, 1 + 2*l, 0, 0],
     [0, 0, 1, 0, 0], [0, 0, 0, 1, 1], [0, 0, 0, 0, 1]];
c:= [[1, 0, 0, (4*k1)/3, 0], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0],
     [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];
d:= [[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
     [0, 0, 0, 0, 1]];
alfa:= [[-1, 2*k2, 0, (-2*k1)/3, 0], [0, 1, 0, 0, 1/2], [0, 0, -1, 0, 0],
     [0, 0, 0, -1, 0], [0, 0, 0, 0, 1]];
beta:= [[1, (4*k1)/3 - 2*k2, -(((4*k1)/3 - 2*k2)*(1 + 2*l))/4, 2*k3, 0],
     [0, -1, (1 + 2*l)/2, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, -1, 1/2],
     [0, 0, 0, 0, 1]];
return Group( [a , b, c, d, alfa, beta] , IdentityMat(5) );
end;

ACDim4NrB8 := function (k, k1, k2, k3, k4)
local a, b, c, d, alfa, beta;
a:= [[1, 0, 0, -2*k*(k1 - 2*k2) - 8*k*k2 + (8*k*(2*(k1 - 2*k2) + 4*k2))/3 +
       (-4*k*k2 - (14*k*(2*(k1 - 2*k2) + 4*k2))/3 +
         2*(2*k*(k1 - 2*k2) + 8*k*k2))/2,
      (k*(k1 + (-2*(k1 - 2*k2) - 4*k2)/6 - 2*k2))/4 - k3 +
       (k1 + (17*k*(k1 - 2*k2))/3 - 3*k2 + (34*k*k2)/3 + (-k1 + 2*k2)/2 +
         (-2*k*(k1 - 2*k2) - 8*k*k2)/2 + (k1 - 2*k*(k1 - 2*k2) - 6*k*k2)/2 +
         2*k3 - 2*k4)/2], [0, 1, 0, -2*k, 0], [0, 0, 1, 0, 1],
     [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];
b:= [[1, (-2*(2*(k1 - 2*k2) + 4*k2))/3,
      (-4*k*k2 - (14*k*(2*(k1 - 2*k2) + 4*k2))/3 +
        2*(2*k*(k1 - 2*k2) + 8*k*k2))/2, k1 + (-2*(k1 - 2*k2) - 4*k2)/3 -
       2*k*(k1 - 2*k2) - 2*k*k2 + (4*k*(2*(k1 - 2*k2) + 4*k2))/3 +
       ((-2*(k1 - 2*k2) - 4*k2)/3 - 4*k*k2)/2, 0], [0, 1, 2*k, 0, 0],
     [0, 0, 1, 0, 0], [0, 0, 0, 1, 1], [0, 0, 0, 0, 1]];
c:= [[1, 0, 0, (2*(k1 - 2*k2) + 4*k2)/3, 0], [0, 1, 0, 0, 1],
     [0, 0, 1, 0, 0], [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];
d:= [[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
     [0, 0, 0, 0, 1]];
alfa:= [[-1, 2*k2, 2*k*k2, ((-2*(k1 - 2*k2) - 4*k2)/3 - 4*k*k2)/2, 0],
     [0, 1, 2*k, -2*k, 1/2], [0, 0, -1, 0, 0], [0, 0, 0, -1, 0],
     [0, 0, 0, 0, 1]];
beta:= [[1, k1 + (-2*(k1 - 2*k2) - 4*k2)/6 - 2*k2,
      (k*(k1 + (-2*(k1 - 2*k2) - 4*k2)/6 - 2*k2))/2,
      k1 + (17*k*(k1 - 2*k2))/3 - 3*k2 + (34*k*k2)/3 + (-k1 + 2*k2)/2 +
       (-2*k*(k1 - 2*k2) - 8*k*k2)/2 + (k1 - 2*k*(k1 - 2*k2) - 6*k*k2)/2 +
       2*k3 - 2*k4, 0], [0, -1, -k, k, 0], [0, 0, 1, 0, 1/2],
     [0, 0, 0, -1, 1/2], [0, 0, 0, 0, 1]];
return Group( [a , b, c, d, alfa, beta] , IdentityMat(5) );
end;

ACDim4NrB8b := function (k, k1, k2, k3, k4)
local a, b, c, d, alfa, beta;
a:= [[1, (4*k1)/3, (-2*k1)/3 + (4*k*k1)/3 +
       ((-16*k*k1)/3 + 8*k*k2 - 2*(-2*k*k1 + 4*k*k2))/2 +
       2*(k1/3 - (2*k*k1)/3 + ((16*k*k1)/3 - 8*k*k2 +
       2*(-2*k*k1 + 4*k*k2))/ 2), (-10*k*k1)/3 + ((16*k*k1)/3 - 8*k*k2 +
       2*(-2*k*k1 + 4*k*k2))/2,
      ((8*k*k1)/3 - 2*k*k2 + (-2*k*k1 + 4*k*k2)/2 +
         ((-16*k*k1)/3 + 8*k*k2 - 2*(-2*k*k1 + 4*k*k2))/2)/2 - k3],
     [0, 1, 0, -2*k, 0], [0, 0, 1, 0, 1], [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];
b:= [[1, 0, ((16*k*k1)/3 - 8*k*k2 + 2*(-2*k*k1 + 4*k*k2))/2, 0,
      (-2*k1)/3 - (2*k*k1)/3 + k2 + 4*k*k2 + (2*k*k1 - 4*k*k2)/2 +
       ((-16*k*k1)/3 + 8*k*k2 - 2*(-2*k*k1 + 4*k*k2))/4 +
     (k1/3 - (2*k*k1)/3 + ((16*k*k1)/3 - 8*k*k2 + 2*(-2*k*k1 + 4*k*k2))/2)/ 2
     + ((-8*k*k1)/3 + 2*k*k2 + (2*k*k1 - 4*k*k2)/2 +
         ((16*k*k1)/3 - 8*k*k2 + 2*(-2*k*k1 + 4*k*k2))/2)/2 + k3 + k4],
     [0, 1, 2*k, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 1], [0, 0, 0, 0, 1]];
c:= [[1, 0, (-2*k1)/3, 0, -k2], [0, 1, 0, 0, 1], [0, 0, 1, 0, 0],
     [0, 0, 0, 1, 0], [0, 0, 0, 0, 1]];
d:= [[1, 0, 0, 0, 1], [0, 1, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 1, 0],
     [0, 0, 0, 0, 1]];
alfa:= [[-1, 0, k1/3 - (2*k*k1)/3 + ((16*k*k1)/3 - 8*k*k2 +
         2*(-2*k*k1 + 4*k*k2))/2, 0, 0], [0, 1, 2*k, -2*k, 1/2],
     [0, 0, -1, 0, 0], [0, 0, 0, -1, 0], [0, 0, 0, 0, 1]];
beta:= [[-1, (-2*k1)/3, 0, (8*k*k1)/3 - 2*k*k2 + (-2*k*k1 + 4*k*k2)/2 +
       ((-16*k*k1)/3 + 8*k*k2 - 2*(-2*k*k1 + 4*k*k2))/2, 0],
     [0, -1, -k, k, 0], [0, 0, 1, 0, 1/2], [0, 0, 0, -1, 1/2],
     [0, 0, 0, 0, 1]];
return Group( [a , b, c, d, alfa, beta] , IdentityMat(5) );
end;

#############################################################################
##
#V ACDim4Funcs
#V ACDim4Param
#V ACDim4Types
##

#############################################################################
##
## some small helpers
##
ACDim4Funcs := [ ACDim4Nr001, ACDim4Nr002, ACDim4Nr003, ACDim4Nr004,
ACDim4Nr004b, ACDim4Nr005, ACDim4Nr006, ACDim4Nr007, ACDim4Nr007b,
ACDim4Nr008, ACDim4Nr009, ACDim4Nr009b, ACDim4Nr010, ACDim4Nr011,
ACDim4Nr012, ACDim4Nr013, ACDim4Nr014,
ACDim4Nr014b, ACDim4Nr015, ACDim4Nr018, ACDim4Nr019, ACDim4Nr019b,
ACDim4Nr019c, ACDim4Nr026, ACDim4Nr027, ACDim4Nr029, ACDim4Nr029b,
ACDim4Nr029c, ACDim4Nr030, ACDim4Nr031, ACDim4Nr032, ACDim4Nr033,
ACDim4Nr033b, ACDim4Nr033c, ACDim4Nr034, ACDim4Nr036, ACDim4Nr037,
ACDim4Nr041, ACDim4Nr043, ACDim4Nr045, ACDim4Nr055, ACDim4Nr056,
ACDim4Nr058, ACDim4Nr060, ACDim4Nr061, ACDim4Nr061b, ACDim4Nr061c,
ACDim4Nr062, ACDim4Nr075, ACDim4Nr076, ACDim4Nr077, ACDim4Nr079,
ACDim4Nr080, ACDim4Nr081, ACDim4Nr082, ACDim4Nr083, ACDim4Nr084, ACDim4Nr085,
ACDim4Nr086, ACDim4Nr087, ACDim4Nr088, ACDim4Nr103, ACDim4Nr104, ACDim4Nr106,
ACDim4Nr110, ACDim4Nr114, ACDim4Nr143, ACDim4Nr144, ACDim4Nr146, ACDim4Nr147,
ACDim4Nr148, ACDim4Nr158, ACDim4Nr159, ACDim4Nr161, ACDim4Nr168, ACDim4Nr169,
ACDim4Nr172, ACDim4Nr173, ACDim4Nr174, ACDim4Nr175, ACDim4Nr176, ACDim4Nr184,
ACDim4NrB1, ACDim4NrB2, ACDim4NrB3c, ACDim4NrB3b, ACDim4NrB3, ACDim4NrB4,
ACDim4NrB4b, ACDim4NrB5, ACDim4NrB5b, ACDim4NrB7, ACDim4NrB7b, ACDim4NrB8,
ACDim4NrB8b ];
MakeReadOnlyGlobal( "ACDim4Funcs" );

#############################################################################
ACDim4Types := [
"001", "002", "003", "004", "004b", "005", "006", "007", "007b", "008",
"009", "009b", "010", "011", "012", "013", "014", "014b", "015", "018",
"019", "019b", "019c", "026", "027", "029", "029b", "029c", "030", "031",
"032", "033", "033b", "033c", "034", "036", "037", "041", "043", "045",
"055", "056", "058", "060", "061", "061b", "061c", "062", "075", "076",
"077", "079", "080", "081", "082", "083", "084", "085", "086", "087", "088",
"103", "104", "106", "110", "114", "143", "144", "146", "147", "148", "158",
"159", "161", "168", "169", "172", "173", "174", "175", "176", "184", "B1",
"B2", "B3c", "B3b", "B3", "B4", "B4b", "B5", "B5b", "B7", "B7b", "B8", "B8b"
];
MakeReadOnlyGlobal( "ACDim4Types" );

#############################################################################
ACDim4Param :=
[ 3, 7, 4, 4, 3, 4, 3, 3, 4, 3, 3, 4, 6, 6, 6, 6, 6, 6, 6, 4, 4, 4, 4, 4, 5,
  4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 4, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 4, 4,
  4, 4, 4, 5, 5, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 4, 4, 4, 5, 5, 5, 5, 5, 4,
  4, 4, 4, 5, 6, 6, 5, 4, 4, 5, 5, 5, 5, 4, 5, 5, 5, 5, 5, 5 ];
MakeReadOnlyGlobal( "ACDim4Param" );


Eval := function(f, x)
  return f(x);
end;

Eval(x -> x^3, 7);
# 343


# Copyright (c) 2018-2020, Carnegie Mellon University
# See LICENSE for details
#
# Contains the rewrite rulesets for SPL-expression simplification
# After the Breakdown Stage
# Current Demo version focuses on CNOTs, and so we do not cancel single-qubit gates
# Eventually we will convert all gates to generic rotations in Quantum_Format
# Combine rotations in Quantum_Simplify, and convert back into non-generic rotations in Quantum_Terminate
#
# Additionally, Junction steps should be factored out in this stage versus in the unparser to enable a
# few more optimizations. A SWE effort is underway.
#

##
#F CheckIdentitySplit( <a>, <b> )
##
## return true if we can split an Identity transform into smaller matrices
CheckIdentitySplit := function(a, b)
    if(ObjId(a) = I) then
        if a.params[1] > 2 then
            return true;
        fi;
    fi;
    if(ObjId(b) = I) then
        if b.params[1] > 2 then
            return true;
        fi;
    fi;
    return false;
end;

##
#F CheckIdentity( <a>, <b> )
##
## are both objects identity
CheckIdentity := function(a, b)
    if(ObjId(a) = I) then
        if(ObjId(b) = I) then
            return true;
        fi;
    fi;
    return false;
end;

##
#F PullInTensor( <ch1>, <ch2> )
##
## compress two tensor expressions by pulling in symbols wherever sizes align
PullInTensor := function(ch1, ch2)
    local pos1, pos2, e1, e2, up1, up2, siz1, siz2;
    pos1 := 1;
    pos2 := 1;
    siz1 := 0;
    siz2 := 0;
    while pos1 <= Length(ch1) and pos2 <= Length(ch2) do
        e1 := ch1[pos1];
        e2 := ch2[pos2];
        if ( (e1.dims()[1] = e2.dims()[1]) and (pos1 = pos2) ) then
            ch1[pos1] := ch1[pos1] * ch2[pos2];
            ch2[pos2] := I(e2.dims()[1]);
        fi;
        up1 := siz1 + log(e1.dims()[1], 2).v;
        up2 := siz2 + log(e2.dims()[1], 2).v;
        if (up1 <= up2) then
            pos1 := pos1 + 1;
            siz1 := siz1 + log(e1.dims()[1], 2).v;
        fi;
        if (up1 > up2) then
            pos2 := pos2 + 1;
            siz2 := siz2 + log(e2.dims()[1], 2).v;
        fi;
    od;
    return [ch1, ch2];
end;

##
#F CanPullIn( <ch1>, <ch2> )
##
## Similar to PullInTensor, but just checks to see if there is any simplification possible
CanPullIn := function(ch1, ch2)
    local pos1, pos2, e1, e2, up1, up2, siz1, siz2;
    pos1 := 1;
    pos2 := 1;
    siz1 := 0;
    siz2 := 0;
    while pos1 <= Length(ch1) and pos2 <= Length(ch2) do
        e1 := ch1[pos1];
        e2 := ch2[pos2];
        if ( (e1.dims()[1] = e2.dims()[1]) and (pos1 = pos2) and ObjId(e2) <> I) then
            return true;
        fi;
        up1 := siz1 + log(e1.dims()[1], 2).v;
        up2 := siz2 + log(e2.dims()[1], 2).v;
        if (up1 <= up2) then
            pos1 := pos1 + 1;
            siz1 := siz1 + log(e1.dims()[1], 2).v;
        fi;
        if (up1 > up2) then
            pos2 := pos2 + 1;
            siz2 := siz2 + log(e2.dims()[1], 2).v;
        fi;
    od;
    return false;
end;

##
#F ValidTensSimplifyMatch( <e1>, <e2> )
##
## SWrapper function to deterrmine if the tensor rewrite rule can be applied
ValidTensSimplifyMatch := function(e1, e2)
    if ObjId(e1)=Tensor and ObjId(e2)=Tensor then
        if CanPullIn(e1._children, e2._children) then
            return true;
        fi;
    fi;
    return false;
end;

##
#F CombineReord( <ord1>, <dir1>, <ord2>, <dir2>, <arch> )
##
## Combine Reorder steps
CombineReord := function(ord1, dir1, ord2, dir2, arch)
    local idx, adj1, adj2, adj3, start, n, t1, t2, a, b, new_list, o1, o2;
    adj1 := [];
    adj2 := [];
    if dir1 = -1 then
        idx := 0;
        for o1 in ord1 do
            Add(adj1, [idx, o1]);
            idx := idx + 1;
        od;
    fi;
    if dir1 = 1 then
        idx := 0;
        for o1 in ord1 do
            Add(adj1, [o1, idx]);
            idx := idx + 1;
        od;
    fi;
    if dir2 = -1 then
        idx := 0;
        for o2 in ord2 do
            Add(adj2, [idx, o2]);
            idx := idx + 1;
        od;
    fi;
    if dir2 = 1 then
        idx := 0;
        for o2 in ord2 do
            Add(adj2, [o2, idx]);
            idx := idx + 1;
        od;
    fi;
    # now have adj1 and adj2
    adj3 := [];
    for a in adj1 do
        start := a[1];
        t1 := a[2];
        t2 := -1;
        for b in adj2 do
            if b[1] = t1 then
                t2 := b[2];
            fi;
        od;
        Add(adj3, [start, t2]);
    od;
    # full combine, and then check validity. If it isnt valid, then just dont simplify
    # TODO do a partial recombine if the entire reorder cannot be combined and be still implementable
    # not much harder, just a lot of code
    new_list := [0..Length(ord1)-1];
    idx := 1;
    for n in new_list do
        for a in adj3 do
            if n = a[1] then
                new_list[idx] := a[2];
            fi;
        od;
        idx := idx + 1;
    od;
    if VerifyPath(new_list, [0..Length(ord1)-1], arch) = true then
        return Reord(new_list, arch, 1);
    fi;
    return (Reord(ord1, arch, dir1) * Reord(ord2, arch, dir2));
end;

##
#F Quantum_Format ruleset
##
Class(Quantum_Format, RuleSet);
RewriteRules(Quantum_Format, rec(
    # Remove Grp structure
    remove_grp := ARule( Grp, [@(1)], x-> [(@(1).val)] ),

    # Flatten Tensors
    flatten_tensor_asoc := ARule(Tensor, [@(1), @(2).cond(e-> ObjId(@(1).val)=Tensor or ObjId(e)=Tensor)],
	    e -> let(
	           ch1 := Cond(ObjId(@(1).val)=Tensor, @(1).val._children, [@(1).val]),
	           ch2 := Cond(ObjId(@(2).val)=Tensor, @(2).val._children, [@(2).val]),
	           ch1::ch2
	         )),

    #Split identities into I(2)
    split_identity := ARule(Tensor, [@(1),  @(2).cond(e-> (CheckIdentitySplit(@(1).val, e)) )],
	    e -> let(
	           ch1 := Cond(ObjId(@(1).val)=I and @(1).val.params[1] > 2, Tensor(I(2), I(@(1).val.params[1]/2)), [@(1).val]),
	           ch2 := Cond(ObjId(@(2).val)=I and @(2).val.params[1] > 2, Tensor(I(2), I(@(2).val.params[1]/2)), [@(2).val]),
               [ch1]::[ch2]
	         )),
));

##
#F Quantum_Simplify ruleset
##
Class(Quantum_Simplify, RuleSet);
RewriteRules(Quantum_Simplify, rec(

    # Pull-In Tensors
    pull_in_tensor := ARule(Compose, [@(1), @(2).cond(e-> ValidTensSimplifyMatch(@(1).val, e))],
	    e -> let(
               # both 1 ans 2 are tensors, can access a list of arguments via _children
               ch := PullInTensor(@(1).val._children, @(2).val._children),
	           [Tensor(ch[1])]::[Tensor(ch[2])]
	         )),

    # Remove Identity Multiplications
    remove_identity_right := ARule( Compose, [@(1), @(2).cond(e -> ObjId(e)=I)], x-> [(@(1).val)]),
    remove_identity_left := ARule( Compose, [@(1).cond(e -> ObjId(e)=I), @(2)], x-> [(@(2).val)]),

    # Cancel Composition of CNOTS
    cancel_cnot := ARule(Compose, [[CNOT, @(1), @(2)], [CNOT, @(3).cond(x -> (x = @(1).val)), @(4).cond(x -> (x = @(2).val))]], x->[I(2^(@(1).val + 1))] ),

    # Combine Reorder Compositions
    cancel_reorder := ARule(Compose, [[Reord, @(1), @(2), @(3)], [Reord, @(4), @(5), @(6)]], x-> [CombineReord(@(1).val, @(3).val, @(4).val, @(6).val, @(5).val)]),
));

##
#F Quantum_Terminate ruleset
##
Class(Quantum_Terminate, RuleSet);
RewriteRules(Quantum_Terminate, rec(
    # Recombine Identities - Good
    recomb_identity := ARule(Tensor, [@(1),  @(2).cond(e-> (CheckIdentity(@(1).val, e) ))],
	    e -> [I(@(1).val.params[1] * @(2).val.params[1])]),

    # Remove Identity Multiplications - Good
    remove_identity_right := ARule( Compose, [@(1), @(2).cond(e -> ObjId(e)=I)], x-> [(@(1).val)]),
    remove_identity_left := ARule( Compose, [@(1).cond(e -> ObjId(e)=I), @(2)], x-> [(@(2).val)]),

));

##
#F QuantumRewriteInternal( <s>, <opts> )
##
## Rewrites a quantum SPL expression, for internal use
QuantumRewriteInternal := function (s, opts)
    s := ApplyStrategy(s, [Quantum_Format], BUA, opts);
    s := ApplyStrategy(s, [Quantum_Simplify], BUA, opts);
    s := ApplyStrategy(s, [Quantum_Terminate], BUA, opts);
    return s;
end;

##
#F BestCircuitInternal( <t>, <opts> )
##
## Finds the best circuit implementing transform t, for internal use
BestCircuitInternal := function (t, opts)
    local dpopts, best, s;
    dpopts := rec(verbosity := 0, hashTable := HashTableDP());
    dpopts.measureFunction := (rt, opts) ->
        let(c := SPLRuleTree(rt), # generate SPL Ruletree and then run a collect on CNOTs
            c2 := QuantumRewriteInternal(c, opts),
            Length(Collect(c2, @(1,CNOT)))
            );
    best := DP(t, dpopts, opts);
    s := QuantumRewriteInternal(SPLRuleTree(best[1].ruletree), opts);
    return s;
end;

##
#F TerminateReord( <l>, <arch>, <dir> )
##
## Convert a reorder object to CNOTs
TerminateReord := function (l, arch, dir)
    local mats, mat, dir, spl;
    mats := ShiftMat(l, [0..Length(arch)-1], arch, Length(arch));
    if dir = -1 then
        mat := mats[2];
    fi;
    if dir = 1 then
        mat := mats[1];
    fi;
    # now mat in an unreduced Non-terminal expression
    # we need the SPL expression
    spl := BestCircuitInternal(mat, SpiralDefaults);
    return spl;
end;

##
#F Quantum_Reorder ruleset
##
Class(Quantum_Reorder, RuleSet);
RewriteRules(Quantum_Reorder, rec(

    # Combine Reorder Compositions
    reorder_convert := Rule([Reord, @(1), @(2), @(3)], x-> TerminateReord(@(1).val, @(2).val, @(3).val)),
));

# ------------------------- For External Use ----------------------------------------

##
#F QuantumRewrite( <s>, <opts> )
##
## Simplifies an SPL expression representing a quantum circuit (s)
QuantumRewrite := function (s, opts)
    s := ApplyStrategy(s, [Quantum_Format], BUA, opts);
    s := ApplyStrategy(s, [Quantum_Simplify], BUA, opts);
    s := ApplyStrategy(s, [Quantum_Reorder], BUA, opts);
    s := RulesSums(s);
    s := ApplyStrategy(s, [Quantum_Format], BUA, opts);
    s := ApplyStrategy(s, [Quantum_Simplify], BUA, opts);
    s := ApplyStrategy(s, [Quantum_Terminate], BUA, opts);
    return s;
end;

##
#F BestCircuit( <t>, <opts> )
##
## Finds the best circuit implementing transform t
## Hardcoded to count number CNOT gates as the cost function
BestCircuit := function (t, opts)
    local dpopts, best, s, cnot_list;
    dpopts := rec(verbosity := 1, hashTable := HashTableDP());
    dpopts.measureFunction := (rt, opts) ->
        let(c := SPLRuleTree(rt), # generate SPL Ruletree and then run a collect on CNOTs
            c2 := QuantumRewrite(c, opts),
            Length(Collect(c2, @(1,CNOT)))
            );
    best := DP(t, dpopts, opts);
    Print("\n SPL \n");
    Print(SPLRuleTree(best[1].ruletree));
    Print("\n");
    s := QuantumRewrite(SPLRuleTree(best[1].ruletree), opts);
    Print("\ncost :");
    Print(Length(Collect(s, @(1,CNOT))));
    Print("\n");
    Print("---------------- BestCircuit: \n");
    return s;
end;


Enqueue := function(v, x)
   Add(v[1], x);
end;

Dequeue := function(v)
   local n, x;
   n := Size(v[2]);
   if n = 0 then
      v[2] := Reversed(v[1]);
      v[1] := [ ];
      n := Size(v[2]);
      if n = 0 then
         return fail;
      fi;
   fi;
   return Remove(v[2], n);
end;

# a new queue
v := [[], []];

Enqueue(v, 3);
Enqueue(v, 4);
Enqueue(v, 5);
Dequeue(v);
# 3
Enqueue(v, 6);
Dequeue(v);
# 4
Dequeue(v);
# 5
Dequeue(v);
# 6
Dequeue(v);
# fail


################################################################################
##
#W pointed_data.gi              GroupTheoretical Package
##
#W Paul Bruillard, Cesar Galindo, Siu-Hung Ng, Julia Plavnik, Eric Rowell,
#W Zhenghan Wang
##
## Installation file for pointed_data functions of the GroupTheoretical Package
##
#Y Copyright (C) 2016, Battelle Memorial Institute
##
################################################################################

################################################################################
##
#F pointed_data(<group>,<function>,<function>). . . . compute the data of C(G,q,chi)
##
InstallGlobalFunction(pointed_data, function(G,q,chi)
  local S, T, FPdim, FPdimC, GSet, N, g,h,r,g_idx,h_idx,CC,g_cc,h_cc;
  GSet := AsSet(G);
  r:=Size(GSet);
  CC:=ConjugacyClasses(G);
  T:=List(GSet,g->0);
  S:=NullMat(r,r);
  for g_idx in [1..r] do
    g:=GSet[g_idx];
    g_cc:=Position(CC,ConjugacyClass(G,g));
    T[g_idx]:=chi[g_cc]*q(g);
    for h_idx in [g_idx..r] do
      h:=GSet[h_idx];
      h_cc:=Position(CC,ConjugacyClass(G,h));
      S[g_idx][h_idx]:=chi[g_cc]*chi[h_cc]*q(g*h)/(q(g)*q(h));
      S[h_idx][g_idx]:=S[g_idx][h_idx];
    od;
  od;
  FPdimC:=Order(G);
  FPdim:=List(GSet,g->1);
  if S[1] <> FPdim then
    Error("First row of S is not FPdimension\n");
  fi;

  N:=compute_fusion_rules(S,FPdimC);
  return [GSet,S,T,N,FPdim,FPdimC];
end);
#E pointed_data.gi  . . . . . . . . . . . . . . . . . . . . . . . . ends here


NewRulesFor(PrunedMDPRDFT, rec(
    PrunedMDPRDFT_Base := rec(
        applicable     := nt -> Length(nt.params[1]) = 1,

        children       := nt -> [[ PrunedPRDFT(nt.params[1][1], nt.params[2]).withTags(nt.getTags()) ]],

        apply          := (nt, C, Nonterms) -> C[1]
    ),

    PrunedMDPRDFT_RowCol1 := rec(
        applicable := nt -> Length(nt.params[1]) > 1 and not nt.hasTags(),

        children  := nt -> [[ PrunedMDDFT(DropLast(nt.params[1], 1), nt.params[3], 1, DropLast(nt.params[2], 1)),
                              PrunedPRDFT(Last(nt.params[1]), nt.params[3], 1, Last(nt.params[2])) ]],

        apply := (nt, C, cnt) ->  RC(Tensor(C[1], I(C[2].dims()[1]/2))) * Tensor(I(Product(List(cnt[1].params[4], i->Length(i)))), C[2])
    )
));

NewRulesFor(PrunedIMDPRDFT, rec(
    PrunedIMDPRDFT_Base := rec(
        applicable     := nt -> Length(nt.params[1]) = 1,

        children       := nt -> [[ PrunedIPRDFT(nt.params[1][1], nt.params[2]).withTags(nt.getTags()) ]],

        apply          := (nt, C, Nonterms) -> C[1]
    ),

    PrunedIMDPRDFT_RowCol1 := rec(
        applicable := nt -> Length(nt.params[1]) > 1 and not nt.hasTags(),

        children  := nt -> [[ PrunedIPRDFT(Last(nt.params[1]), nt.params[3], 1, Last(nt.params[2])),
                              PrunedIMDDFT(DropLast(nt.params[1], 1), nt.params[3], 1, DropLast(nt.params[2], 1)) ]],

        apply := (nt, C, cnt) -> Tensor(I(Product(List(cnt[2].params[4], i->Length(i)))), C[1]) * RC(Tensor(C[2], I(C[1].dims()[2]/2)))
    )
));


# Built-in
UnorderedTuples(["iced", "jam", "plain"], 2);