Hadamard Search Package

Victor Alvarez Solano, Jose Andres Armario Sampalo, Maria Dolores Frau Garcia and Pedro Real Jurado
Departamento de Matematica Aplicada I, University of Seville (Spain)
19 August 2006

valvarez@us.es

Determining Hadamard matrices at a desired dimension is a very difficult task. Furthermore, the Hadamard conjecture about the existence of Hadamard matrices at every dimension multiple of 4 is still open. A new insight on the subject was provided by the tandem De Launey-Horadam in the early 90s, in terms of cocyclic Hadamard matrices. The term cocyclic refers to cocycles coming from the second group of cohomology. The main difficulty in this approximation is how to explicitly construct a basis for 2-cocycles. This question is significantly skipped with the use of the so-called homologial reduction method, provided a homological model for the given group is known. This package provides a means of explicitly constructing a basis for 2-cocycles on G from a homological model hG for G. Depending on the choice of the user, an exhaustive (which is only recommended for low dimensions) or heuristic search for cocyclic Hadamard matrices over G is then developed.

Reference

Title

Hadamard Search

Author

Victor Alvarez Solano, Jose Andres Armario Sampalo, Maria Dolores Frau Garcia and Pedro Real Jurado

Summary

This package is designed to find out some cocyclic Hadamard matrices over a finite group G, provided a homological model for G is known.

Copyright

Rights reserved by Victor Alvarez Solano et al, Departamento de Matematica Aplicada I, University of Seville (Spain).

Notebook Version

2.0

Mathematica Version

4.0

History

This package is the implementation in practise of the homological reduction method for constructing a basis for 2-cocycles over a finite group for which a homological model is known. Furthermore, a routine for developing a heuristic search (in terms of a genetic algorithm) is also included. This tool is very useful when exhaustive search is not possible (usually for groups of order equal to or greater than 28).

Keywords

Hadamard matrix, cocyclic Hadamard matrix, homological model, homological reduction method.

Limitation

This package works only on finite groups for which some homological models are known.

Discussion

References:
An algorithm for computing cocyclic matrices developed over some semidirect products. V. Alvarez, J.A. Armario, M.D. Frau and P. Real, LNCS 2227, 287--296 (2001).
A genetic algorithm for cocyclic Hadamard matrices. V. Alvarez, J.A. Armario, M.D. Frau and P. Real, LNCS 3857, 144--153 (2006).
Calculating cocyclic Hadamard matrices in Mathematica: exhaustive and heuristic searches. V. Alvarez, J.A. Armario, M.D. Frau and P. Real, LNCS 4151, 119--122 (2006).
Homological reduction method for constructing cocyclic Hadamard matrices. V. Alvarez, J.A. Armario, M.D. Frau and P. Real (in preparation).

Requirements

Context`HadamardSearch`
uses IntegerSmithNormalForm, due to V. Alvarez et al, 2006;

Interface

This part declares the publicly visible functions, options, and values.

Set up the package context, including public imports

BeginPackage["`HadamardSearch`"]

$ContextPath

Usage messages for the exported functions and the context itself

HadamardSearch::usage="HadamardSearch[PR,M2,M3,F1,F2,method] searches for cocyclic Hadamard matrices over a finite group G of group law given by the square matrix PR. The notebook will assume the ordering implicit in PR for the elements in G. Special care must be taken so that the first element in G is the identity element. The search may be both exhaustive and heuristic, depending on whether method=1 or method !=1. The matrices M2 and M3 represent the differentials d2 and d3 on the homological model hG. The matrices F1 and F2 represent the projection maps from B_1(Z[G]) to hG_1 and B_2(Z[G]) to hG_2, respectively. Let denote the number of elements in G by _order_ (=Length[PR]). The _order_ elements in B_1(Z[G]) are ordered following the natural ordering induced by PR. The _order_^2 elements in B_2(Z[G]) are ordered as the elements of G x G, from the first row to the last one, from left to the right, as {1,1},{1,2},...,{1,_order_},{2,1},...,{2,_order_},...,{_order_,1},...{_order_,_order_}. Of course, the same basis for hG at each degree must be used for M2,M3,F1 and F2. There is an explicit example included as a comment at the end of the package."

Implementation

This part contains the actual definitions and any auxiliary functions that should not be visible outside.

Begin the private context (implementation part)

Begin["`Private`"]
{$Context,$ContextPath}

Definition of auxiliary functions and local (static) variables

\( (*

We\ use\ the\ IntegerSmithNormalForm\ package\ due\ to\ V . \ Alvarez\ et\ al, \ 
      2006. 

*) 
\(M[i_, j_, t_, k_] := 
        ReplacePart[IdentityMatrix[k], 
          t, {i, j}];\)\)
T[i_, j_, k_] := 
        Module[{m, n}, m = IdentityMatrix[k]; n = m[[i]]; 
          m[[i]] = m[[j]]; m[[j]] = n; 
          m];
Completar[C_, m_, n_] := 
        Module[{k, i, j, ii}, i = m - Length[C]; k = {}; 
          Do[k = Append[k, Table[0, {ii, 1, n}]], {j, 1, i}]; 
          Do[k = Append[k, 
                Join[Table[0, {ii, 1, n - Length[C[[1]]]}], 
                  C[[j]]]], {j, 1, Length[C]}]; 
          k];
ExtendedSmithForm[A_] := 
        Module[{k, C, coli, colj, P, Q, m, n, H, i, it, control}, 
          m = Length[A]; n = Length[A[[1]]]; P = {IdentityMatrix[m]}; 
          Q = {IdentityMatrix[n]}; C = A; i = 1; 
          Fin = Max[Abs[Take[C, {i, m}, {i, n}]]] > 
              0; 
While[
            Fin, {coli, 
                colj} = Position[
                  Completar[Take[Abs[C], {i, m}, {i, n}], m, n], 
                  Min[Select[
                      Flatten[
                        Take[Abs[C], {i, m}, {i, n}]], #1 > 
                          0 &]]][[1]]; P = Prepend[P, T[i, coli, m]]; 
            Q = Append[Q, T[i, colj, n]]; it = i + 1; 
            C = First[P] . C . Last[Q]; 
            control = True; 
While[it ≤ n, 
              If[IntegerQ[C[[i, it]]/C[[i, i]]], it = it + 1, 
                Q = Append[Q, 
                    M[i, it, -Quotient[C[[i, it]], C[[i, i]]], 
                        n] . T[it, i, n]]; C = C . Last[Q]; control = False; 
                it = n + 1]
]; 
            If[control, 
              Do[Q = Append[Q, 
                    M[i, it, -C[[i, it]]/C[[i, i]], n]]; 
                C = C . Last[Q], {it, i + 1, n}]; 
              it = i + 1; 
While[it ≤ m, 
                If[IntegerQ[C[[it, i]]/C[[i, i]]], it = it + 1, 
                  P = Prepend[P, 
                      T[it, i, m] . 
                        M[it, i, -Quotient[C[[it, i]], 
                              C[[i, i]]], m]]; C = First[P] . C; 
                  control = False; it = m + 1]
]; 
              If[control, 
                Do[P = Prepend[P, 
                      M[it, i, -C[[it, i]]/C[[i, i]], m]]; 
                  C = First[P] . C, {it, i + 1, m}]; 
Catch[
                  Do[
Do[
                      If[IntegerQ[C[[coli, colj]]/C[[i, i]]], Null, 
                        P = Prepend[P, M[i, coli, 1, m]]; C = First[P] . C; 
                        control = False; Throw[False]], {colj, i + 1, 
                        n}], {coli, i + 1, m}]; Throw[True]]; 
                If[ control, 
                  P = Prepend[P, M[i, i, Sign[C[[i, i]]], m]]; 
                  C = First[P] . C; i = i + 1; 
                  Fin = Max[Abs[Take[C, {i, m}, {i, n}]]] > 
                      0]
];
];
]; 
P = Fold[Dot, IdentityMatrix[m], P]; 
          Q = Fold[Dot, IdentityMatrix[n], Q]; {C, {P, 
              Q}}
];
 (*


*)

matrizdeunos[n_] := 
        Table[Table[1, {j, n}], {i, n}];
matriznegaciclica[n_] := 
        Table[Join[Table[1, {j1, n + 1 - j}], 
            Table[-1, {j2, n + 2 - j, n}]], {j, 
            n}];
kronunosaizq[a_, n_] := 
        Flatten[Table[
            Table[Apply[Join, 
                Table[Table[a[[i, k]], {k2, n}], {k, 
                    Length[a[[1]]]}]], {j, n}], {i, Length[a[[1]]]}], 
          1];
kronunosader[a_, n_] := 
        Flatten[Table[
            Table[Apply[Join, Table[a[[j]], {k, n}]], {j, 
                Length[a[[1]]]}], {i, n}], 1];

\(\(\( (*
Cocyclic\ Hadamard\ \(\(Test\)\(.\)\)\ 
*) \)\(
\)\(testhadamard[
          L_] := 
		Catch[
          Do[If[Apply[Plus, L[\([i]\)]] ≠ 0, Throw[False]], {i, 2, 
              Length[L]}]; Throw[True]];\)\)\)

prodhadamard[a_, b_] := 
        Table[Table[
            a[[i, j]]*b[[i, j]], {j, Length[a[[1]]]}], {i, 
            Length[a[[1]]]}];

Main program

\(\(\( (*

Main\ program

*) \)\(
\)\(HadamardSearch[PR_, M2_, M3_, F1_, F2_, method_] := 
        Module[{}, 
 (*\ 

Calculating\ H1\ and\ \(\(H2\)\(.\)\)\ 

*) 
 (*\ 
            b1\ and\ b2\ denote\ the\ number\ of\ generators\ in\ the\ homological\ model\ at\ degrees\ 1\ and\ 2, \ \(\(respectively\)\(.\)\)\ *) 
fnsa1 = ExtendedSmithForm[M2]; 
          b1 = Length[M2[\([1]\)]]; 
          b2 = Length[M2]; 
abelianizado = 
            Select[Table[
                fnsa1[\([1, ji, ji]\)], {ji, b1}], #1 > 
                  0 &]; 
b1 = b2; 
          b2 = Length[M3]; 
fnsa2 = 
            ExtendedSmithForm[M3]; 
homologia = 
            Select[Table[
                fnsa2[\([1, ji, ji]\)], {ji, b1}], #1 > 
                  0 &]; 
 (*
\ 
Constructing\ a\ basis\ _base2cociclos  _\ for\ normalized\ 2 - \(\(cocycles\)\(.\)\)\ 

*) 
base2cociclos = {}; 
Print["Calculating a basis for 2-coboundaries..."]; 
 (*\ 

Constructing\ a\ basis\ for\ 2 - \(\(coboundaries\)\(.\)\)\ 

*) 
orden = 
            Length[PR]; 
cobordes = 
            Table[Apply[Join, 
                Table[Table[
                    Mod[KroneckerDelta[i, k] + KroneckerDelta[i, j] + 
                        KroneckerDelta[i, PR[\([k, j]\)]], 2], {j, 
                      orden}], {k, orden}]], {i, 2, 
                orden}]; 
m = cobordes; 
          gen = {}; 
i = 0; 
While[
            i < orden - 1, 
n = 
              Select[Range[i + 1, orden - 1], 
                m[\([#1]\)] ≠ Table[0, {k, orden^2}] &, 
                1]; 
If[n == {}, i = orden - 1, 
              gen = Join[gen, n]; 
              i = n[\([1]\)]; 
j = 
                Position[m[\([i]\)], 1, 1, 1]; 
filas = 
                Select[Range[i + 1, orden - 1], 
                  m[\([#1, j[\([1, 1]\)]]\)] == 
                      1 &]; 
Do[
                m = ReplacePart[m, 
                    Mod[m[\([filas[\([k]\)]]\)] + m[\([i]\)], 2], 
                    filas[\([k]\)]], {k, 
                  Length[filas]}]];
]; 
Do[
            base2cociclos = 
              Append[base2cociclos, 
                Partition[
                  Replace[
                    Replace[cobordes[\([gen[\([i]\)]]\)], 1 -> \(-1\), 
                      1], 0 -> 1, 1], 
                  orden]]; 
Print["The ", 
              gen[\([i]\)] + 1, "-ith 2-coboundary is a generator:"]; 
            Print[base2cociclos[\([i]\)] // MatrixForm], {i, 
              Length[gen]}]; 
 (*\ 

Constructing\ a\ basis\ for\ representative\ 2 - 
              cocycles\ coming\ from\ \(\(inflation\)\(.\)\)

*) 
Print["Calculating a system of generators for 2-cocycles coming from inflation..."]; 
k = 
            Select[Range[Length[abelianizado]], 
              EvenQ[abelianizado[\([#1]\)]] &]; 
          Do[col = 
              Select[Range[Length[M2[\([1]\)]]], 
                Mod[fnsa1[\([2, 2, #1, k[\([m1]\)]]\)], 
                      abelianizado[\([k[\([m1]\)]]\)]] ≠ 0 &]; 
            matriz = {Table[1, {i, orden}]}; 
            m2 = 2^\(FactorInteger[abelianizado[\([k[\([m1]\)]]\)]]\)[\([1, 
                    2]\)]; Do[matriz = Append[matriz, {1}]; 
              Do[mi = F1[\([i]\)]; mj = F1[\([j]\)]; 
                n = Mod[
                      Apply[Plus, 
                        Table[fnsa1[\([2, 2, col[\([m3]\)], k[\([m1]\)]]\)]*
                            mi[\([col[\([m3]\)]]\)], {m3, Length[col]}]], 
                      m2] + Mod[
                      Apply[Plus, 
                        Table[fnsa1[\([2, 2, col[\([m3]\)], k[\([m1]\)]]\)]*
                            mj[\([col[\([m3]\)]]\)], {m3, Length[col]}]], 
                      m2]; matriz[\([i]\)] = 
                  Append[matriz[\([i]\)], \((\(-1\))\)^Floor[n/m2]], {j, 2, 
                  orden}], {i, 2, orden}]; 
            base2cociclos = Append[base2cociclos, matriz]; 
            Print[matriz // MatrixForm], {m1, 
              Length[k]}]; 
 (*\ 

Constructing\ a\ basis\ for\ representative\ 2 - 
              cocycles\ coming\ from\ \(\(transgression\)\(.\)\)

*) 
Print["Calculating a system of generators for 2-cocycles coming from transgression..."]; 
k = 
            Select[Range[Length[homologia]], EvenQ[homologia[\([#1]\)]] &]; 
          Do[col = 
              Select[Range[b1], OddQ[fnsa2[\([2, 2, #1, k[\([m1]\)]]\)]] &]; 
            matriz = {Table[1, {i, orden}]}; 
            Do[matriz = Append[matriz, {1}]; 
              Do[m = F2[\([\((i - 1)\)*orden + j]\)]; 
                m2 = Mod[
                    Apply[Plus, 
                      Table[m[\([col[\([m3]\)]]\)], {m3, Length[col]}]], 2]; 
                matriz[\([i]\)] = 
                  Append[matriz[\([i]\)], \((\(-1\))\)^m2], {j, 2, 
                  orden}], {i, 2, orden}]; 
            base2cociclos = Append[base2cociclos, matriz]; 
            Print[matriz // MatrixForm], {m1, 
              Length[k]}]; 
 (*
\ 
Searching\ for\ Hadamard\ cocyclic\ matrices

*) 
If[
            method == 
              1, 
 (*
\ 
Exhaustive\ search

*) 
had = {}; 
Print["Searching for cocyclic Hadamard matrices..."]; 
Do[
              ele = Position[Reverse[IntegerDigits[i, 2]], 
                  1]; 
m = 
                Fold[prodhadamard, matrizdeunos[orden], 
                  Extract[base2cociclos, ele]]; 
If[
                testhadamard[
                  m], 
Print["The 2-cocycle generated by the Hadamard product of the following generators ", 
                  Flatten[ele, 
                    1], " gives raise to a Hadamard matrix"];  (*\(Print[
                      m // MatrixForm];\)*) 
had = 
                  Append[had, m]]
, {i, 
                2^Length[base2cociclos] - 
                  1}]; 
Print["There are ", 
              Length[had], " Hadamard matrices coming from normalized 2-cocycles."], 
 (*
\ 
Heuristic\ \(search : \ 
                  a\ genetic\ algorithm\)

*) 
t = 
              orden/4; 
RandomPermutation[
                n_Integer?Positive] := 
              Block[{t}, 
                t = Array[{Random[], #} &, n]; 
t = 
                  Sort[t]; 
                Map[#[\([2]\)] &, 
                  t]]; 
Print["Generating the initial population..."]; 
 (*\ 
              La\ población\ constará\ siempre\ de\ 4  
                t\ individuos, \ 
              que\ se\ reproducirán\ mediante\ cruces\ simples . \ 
                  La\ probabilidad\ de\ mutación\ será\ del\ 1\ por\ ciento . \ 
                  Se\ permite\ la\ existencia\ de\ \(\(gemelos\)\(.\)\)\ *) 
adaptacion[p_] := 
              Map[adaptacion1, p]; 
adaptacion1[l_] := 
              Module[{k, n}, k = Position[l, 1]; 
                k = Fold[prodhadamard, matrizdeunos[4*t], 
                    Extract[base2cociclos, k]]; n = 0; 
                Do[If[Apply[Plus, k[\([i]\)]] == 0, n = n + 1], {i, 
                    4*t}]; n]; 
cruces[p_] := 
              Module[{k, l, n}, n = 2*Floor[Length[p]/2]; 
                l = RandomPermutation[n]; k = {}; 
                Do[k = Join[k, 
                      cruces1[p[\([l[\([2*i - 1]\)]]\)], 
                        p[\([l[\([2*i]\)]]\)]]], {i, n/2}]; 
                k]; 
cruces1[k_, l_] := 
              Module[{m, n}, 
                n = Random[Integer, {1, Length[base2cociclos] - 1}]; {Join[
                    Take[k, n], 
                    Take[l, \(-\((Length[base2cociclos] - n)\)\)]], 
                  Join[Take[k, \(-\((Length[base2cociclos] - n)\)\)], 
                    Take[l, n]]}]; 
mutacion[p_] := 
              Module[{n, k}, 
                k = Table[Random[Integer, {1, 100}], {i, Length[p]}]; 
                n = Select[Range[Length[p]], k[\([#1]\)] ≤ 10 &]; 
                k = {}; 
                Do[k = Append[k, mutacion1[p[\([n[\([i]\)]]\)]]], {i, 
                    Length[n]}]; k]; 
mutacion1[l_] := 
              Module[{n, k}, n = Random[Integer, {1, Length[base2cociclos]}]; 
                k = l; ReplacePart[k, 1 - l[\([n]\)], 
                  n]]; 
pob = {}; 
            iter = 0; 
Do[
              pob = Append[pob, 
                  Table[Random[Integer], {j, Length[base2cociclos]}]], {i, 
                4*t}]; 
mathad = adaptacion[pob]; 
            pos = Flatten[Position[mathad, 4*t - 1], 
                1]; 
While[Length[pos] == 0, 
              iter = iter + 1; 
              Print["Searching in the generation ", iter]; 
              descen = mutacion[pob]; pob = Join[pob, descen]; 
              mathad = Join[mathad, adaptacion[descen]]; 
              descen = Union[cruces[pob]]; 
              Print["Crossover and mutation finished..."]; 
              mathad = Join[mathad, adaptacion[descen]]; 
              Print["Evaluation of fitness finished..."]; 
              pob = Join[pob, descen]; ind = 1; pob2 = {}; numero = 0; 
              mathad2 = {}; 
While[numero ≤ 4*t, 
                natalidad = Flatten[Position[mathad, 4*t - ind], 1]; 
                Print["With a lack of ", 
                  ind - 1, " rows to be Hadamard"]; 
                config = 
                  Union[Table[
                      pob[\([natalidad[\([i]\)]]\)], {i, 
                        Length[natalidad]}]]; pob2 = Join[pob2, config]; 
                mathad2 = 
                  Join[mathad2, Table[4*t - ind, {i, Length[config]}]]; 
                numero = numero + Length[config]; 
                Print[Length[config], " individuals"]; 
                ind = ind + 
                    1]; 
Print["Natural selection finished..."]; 
pob = pob2; 
              mathad = mathad2; 
If[ind ≠ 3, 
                mathad = Take[mathad2, 4*t]; 
                auxiliar = 
                  Table[Random[
                      Integer, {numero - Length[config] + 1, 
                        numero + 1 - i}], {i, numero - 4*t}]; 
                Do[pob = Delete[pob, auxiliar[\([i]\)]], {i, 
                    Length[auxiliar]}]]; 
Do[
                pob = Append[pob, 
                    Table[Random[Integer], {j, Length[base2cociclos]}]], {i, 
                  t}]; mathad = Join[mathad, adaptacion[Take[pob, \(-t\)]]]; 
              pos = Flatten[Position[mathad, 4*t - 1], 
                  1]]; 
Print["We have found the following Hadamard matrices in ", 
              iter, " generations..."]; 
Do[
              Print[pob[\([pos[\([i]\)]]\)]], {i, 
                Length[pos]}];
]];\)\)\)

End the private context

End[ ]

Epilog

This section ends the package.

End the package context

EndPackage[ ]

Examples, Tests

Examples, tests for the use of the package can go here.

All the calculations about the homological model have been provided by the package "HomologyIteratedGroups" which has been developed by the author as well.

Let consider the dihedral group D_4t = Z_2t x_chi Z_2, for the dihedral action chi:Z_2 x Z_2t--->Z_2t given by chi[1,a]=  2t-a and _a_ otherwise. We consider the following ordering in D_4t: {0, 0},{0,1},{1,0},{1,1},{2,0},{2,1},...,{2t-1,0},{2t-1,1}.     Attending to this ordering, a matrix PR representing the group law in D_4t for t=4  is given by

PR=(({{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}, {2, 1, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3}, {3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 1, 2}, {4, 3, 2, 1, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5}, {5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 1, 2, 3, 4}, {6, 5, 4, 3, 2, 1, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7}, {7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 1, 2, 3, 4, 5, 6}, {8, 7, 6, 5, 4, 3, 2, 1, 16, 15, 14, 13, 12, 11, 10, 9}, {9, 10, 11, 12, 13, 14, 15, 16, 1, 2, 3, 4, 5, 6, 7, 8}, {10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 16, 15, 14, 13, 12, 11}, {11, 12, 13, 14, 15, 16, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}, {12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 16, 15, 14, 13}, {13, 14, 15, 16, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}, {14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 16, 15}, {15, 16, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14}, {16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1}}));

Assume that a basis for hG_1 is {{1,0},{0,1}}, a basis for hG_2 is {{2,0},{1,1},{0,2}} and a basis for hG_3 is {{3,0},{2,1},{1,2},{0,3}}. In these circumstances, a matrix representing F1 is

F1=(({{0, 0}, {0, 1}, {1, 0}, {1, 1}, {2, 0}, {2, 1}, {3, 0}, {3, 1}, {4, 0}, {4, 1}, {5, 0}, {5, 1}, {6, 0}, {6, 1}, {7, 0}, {7, 1}}));

\(\(\(A\)\(\ \)\(matrix\)\(\ \)\(representing\)\(\ \)\(F2\)\(\ \)\(is\)\(\ \)\)\)

F2=(({{0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 1}, {0, 1, 0}, {0, 1, 1}, {1, 2, 0}, {1, 2,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0, 0}, {1, 0, 0}, {1, 0, 0}, {1, 0, 0}, {1, 0, 0}, {1, 0, 0}, {1, 0, 0}, {1, 0, 0}, {1, 0, 0}, {1, 0, 0}, {1, 0, 0}, {1, 0, 0}, {1, 0, 0}, {1, 0, 0}, {0, 0, 0}, {0, 0, 1}, {1, 1, 0}, {1, 1, 1}, {2, 2, 0}, {2, 2, 1}, {3, 3, 0}, {3, 3, 1}, {4, 4, 0}, {4, 4, 1}, {5, 5, 0}, {5, 5, 1}, {6, 6, 0}, {6, 6, 1}, {7, 7, 0}, {7, 7, 1}}));

\(\(\(A\)\(\ \)\(matrix\)\(\ \)\(representing\)\(\ \)\(M2\)\(\ \)\((d2)\)\(\ \)\(is\)\(\ \)\)\)

M2=(({{8, 0}, {-6, 0}, {0, 2}}));

A matrix representing M3 (d3) is

M3=(({{0, 0, 0}, {6, 8, 0}, {-6, -8, 0}, {0, 0, 0}}));

Now we may proceed to develope an exahustive search (this is only feasible for groups of low order, up to order 28).

HadamardSearch[PR, M2, M3, F1, F2, 1];

Now we develope a heuristic search, which will output a few (posibly one) cocyclic Hadamard matrices over the group.

HadamardSearch[PR, M2, M3, F1, F2, 2];