The elements of G must have an addition operation. The usual choices for G are the list of elements of ℤ/2 or (ℤ/2)2.
i1 : (a,b) = (0_(ZZ/2),1_(ZZ/2)) o1 = (0, 1) o1 : Sequence |
i2 : G = {{a,a}, {a,b}, {b,a}, {b,b}} o2 = {{0, 0}, {0, 1}, {1, 0}, {1, 1}} o2 : List |
The elements of B are lists of the elements of G with the same parameter value.
In the following example, the first two elements of G receive distinct parameters, while the last two share a parameter. This is precisely the Kimura 2-parameter model.
i3 : B = {{G#0}, {G#1}, {G#2,G#3}} o3 = {{{0, 0}}, {{0, 1}}, {{1, 0}, {1, 1}}} o3 : List |
Finally for every ordered pair of group elements sharing a parameter, aut must provide an automorphism of the group that switches those two group elements. In aut all of the group elements are identified by their index in G, and an automorphism is given by a list of permuted index values.
In our example, the pairs requiring an automorphism are (2,3) and (3,2).
i4 : aut = {({2,3}, {0,1,3,2}), ({3,2}, {0,1,3,2})} o4 = {({2, 3}, {0, 1, 3, 2}), ({3, 2}, {0, 1, 3, 2})} o4 : List |
i5 : model(G,B,aut) o5 = Model{AList => HashTable{{0, 0} => {1, 0, 0}} } {0, 1} => {0, 1, 0} {1, 0} => {0, 0, 1} {1, 1} => {0, 0, 1} Automorphisms => HashTable{{2, 3} => HashTable{{0, 0} => {0, 0}}} {0, 1} => {0, 1} {1, 0} => {1, 1} {1, 1} => {1, 0} {3, 2} => HashTable{{0, 0} => {0, 0}} {0, 1} => {0, 1} {1, 0} => {1, 1} {1, 1} => {1, 0} Group => {{0, 0}, {0, 1}, {1, 0}, {1, 1}} o5 : Model |