Removed debug output.
[cadabra.git] / doc / combinatorics.tex
blob791612baaceefbbfee6c4af982a5ae4bf245b962
1 \documentclass[11pt]{kasper}
2 \usepackage{relsize}
4 \begin{document}
5 \title{{\tt combinatorics.hh} documentation}
6 \author{Kasper Peeters}
7 \address{1}{{\it MPI/AEI f\"ur Gravitationsphysik, Am M\"uhlenberg 1, 14476
8 Potsdam, Germany}}
9 \email{k.peeters@damtp.cam.ac.uk}
10 \maketitle
11 \begin{abstract}
12 The {\tt combinatorics.hh} class is bla bla
13 \end{abstract}
15 \begin{sectionunit}
16 \title{Reference guide}
17 \maketitle
18 The {\tt combinatorics.hh} class library contains two classes for the
19 generation of combinations
20 \begin{sectionunit}
21 \title{The {\tt combinations} class}
22 \maketitle
23 The {\tt combinations} class takes a vector of elements, and generates
24 combinations of a subset of these elements that satisfy several
25 requirements.
26 \begin{description}
27 \item[{\tt sublengths}]~\\
28 Stores the lengths of the object ranges in which objects can only
29 appear in increasing order. The usual concepts of ``combinations and
30 permutations'' translate to the following content of the {\tt
31 sublengths} vector:
32 \begin{equation}
33 \begin{aligned}
34 \text{combinations:} &\quad \text{one element, $v$=total length}\, ,\\
35 \text{permutations:} &\quad \text{$n$ elements, all equal to $1$}.
36 \end{aligned}
37 \end{equation}
38 However, many more general situations are possible with {\tt
39 combinatorics.hh}. See the examples below.
41 \item[{\tt input\_asym}] ~\\
42 Stores sets of objects which have to be ``implicitly
43 permuted''. That is, permutations are done only modulo the
44 permutations of the objects in these sets. An example may help:
45 \begin{equation}
46 \begin{aligned}
47 \{a,b,c\} &\rightarrow \frac{1}{6}(a,b,c + a,c,b + b,a,c + c,a,b + b,c,a + c,b,a)\\
48 \{a,b,c\}_{\{0,1\}} &\rightarrow \frac{1}{3}(a,b,c + a,c,b + c,a,b)\\
49 \{a,b,c\}_{\{0,2\}} &\rightarrow \frac{1}{3}(a,b,c + a,c,b + b,a,c)\\
50 \{a,b,c\}^{\{2,1\}} &\rightarrow \frac{1}{3}(a,b,c + a,c,b + c,a,b)
51 \end{aligned}
52 \end{equation}
53 Note that this does not just remove terms, it also corrects the
54 multiplicative factor.
55 \end{description}
56 \end{sectionunit}
57 \begin{sectionunit}
58 \title{The {\tt symmetriser} class}
59 \maketitle
60 The {\tt symmetriser} class takes a vector of elements, and applies
61 permutations or combinations to it. The difference with {\tt
62 combinations} is that {\tt symmetriser} can be used to apply several
63 permutations successively.
65 Here is an example,
66 \begin{screen}
67 symmetriser<string> sm;
68 sm.original.push_back("r1");
69 sm.original.push_back("r2");
70 sm.original.push_back("r3");
71 sm.original.push_back("r4");
72 sm.original.push_back("r5");
74 sm.block_length=1;
75 sm.permutation_sign=-1;
76 sm.permute_blocks.push_back(1);
77 sm.permute_blocks.push_back(2);
78 sm.apply_symmetry();
79 \end{screen}
80 This permutes the {\tt r2} and {\tt r3} items, with a minus sign under
81 exchange, leaving the other elements unchanged.
83 \begin{description}
84 \item[set storage]
85 \item[result storage]
86 \item[permuting by position]
87 \item[permuting by value]
88 \item[weights]
89 \item[input symmetries] Just as with the {\tt combinations} class,
90 the {\tt symmetriser} class can be told to apply symmetries only
91 modulo given symmetries. Take care when permuting objects by value:
92 the \verb|input\_asym| data still refer to object locations, not
93 object values (this may be a tricky bug to find when you are permuting
94 integers). The object locations are always relative to the set of
95 permuted values, not with respect to the complete set of original values.
96 \end{description}
99 \end{sectionunit}
100 \end{sectionunit}
102 \begin{sectionunit}
103 \title{Examples}
104 \maketitle
106 \end{sectionunit}
107 \end{document}