Hana 9e216da9ef go.mod: add go.mod and move pygments to third_party
After go1.16, go will use module mode by default,
even when the repository is checked out under GOPATH
or in a one-off directory. Add go.mod, go.sum to keep
this repo buildable without opting out of the module
mode.

> go mod init github.com/mmcgrana/gobyexample
> go mod tidy
> go mod vendor

In module mode, the 'vendor' directory is special
and its contents will be actively maintained by the
go command. pygments aren't the dependency the go will
know about, so it will delete the contents from vendor
directory. Move it to `third_party` directory now.

And, vendor the blackfriday package.

Note: the tutorial contents are not affected by the
change in go1.16 because all the examples in this
tutorial ask users to run the go command with the
explicit list of files to be compiled (e.g.
`go run hello-world.go` or `go build command-line-arguments.go`).
When the source list is provided, the go command does
not have to compute the build list and whether it's
running in GOPATH mode or module mode becomes irrelevant.
2021-02-15 16:45:26 -05:00

103 lines
2.4 KiB
Plaintext

/*++ $Id: AlternatingGroup.mu,v 1.4 2003/09/08 15:00:47 nthiery Exp $
Dom::AlternatingGroup(n) -- the Alternating Group of {1..n}
n - integer >= 1
Elements are represented as in Dom::PermutationGroup(n)
Author: Nicolas M. Thiéry <nthiery@users.sourceforge.net>
License: LGPL
Created: August 8th, 1999
Last update: $Date: 2003/09/08 15:00:47 $
++*/
domain Dom::AlternatingGroup(n: Type::PosInt)
inherits Dom::PermutationGroup(n,toBeDefined);
category Cat::PermutationGroup;
axiom Ax::canonicalRep;
/*--
size
Size of the group.
--*/
size := fact(n)/2;
/*--
generators
A list of generators of the group
The first 3-cycle (1,2,3), and a maximal even cycle (1,...,n) or
(2,...,n) depending on the parity of n
--*/
generators :=
if n<=2 then generators:=[dom([[1]])];
elif n=3 then generators:=[dom([[1,2,3]])];
elif n mod 2=0 then generators:=[dom([[1,2,3]]), dom([[$2..n]])];
else generators:=[dom([[1,2,3]]), dom([[$1..n]])];
end_if;
/*--
allElements
List of all the elements of the group
--*/
allElements :=
proc()
option remember;
local p;
begin
[new(dom,p) $ p in select(combinat::permutations(n),
p->bool(combinat::permutations::sign(p)=1))];
end_proc;
/*--
cycleTypes:
Count the elements of the group by cycle type.
(Cf Cat::PermutationGroupModule).
Same algorithm as for Dom::SymmetricGroup, but only even permutations
are considered. This is done by disregarding partitions p such
that n-length(p) is odd.
--*/
cycleTypes :=
proc()
option remember;
local t, p, gen;
begin
userinfo(3, "cycleTypes: starting computation");
t:=table();
gen := combinat::partitions::generator(n);
while (p:=gen()) <> FAIL do
userinfo(5, "working on partition", p);
if(n-nops(p) mod 2=0) then
// Compute the size of the conjugacy class of Sn indexed by p
// and the cycle type of a permutation in this conjugacy class
t[combinat::partitions::toExp(p,n)]
:= combinat::partitions::conjugacyClassSize(p);
end_if;
end_while;
t;
end_proc;
begin
if testargs() then
if args(0) <> 1 then error("wrong no of args"); end_if;
if not testtype(n,DOM_INT) then
error("argument must be integer")
end_if;
if n < 1 then
error("argument must be positive")
end_if;
end_if;
end_domain: