Function: chardiv
Section: number_theoretical
C-Name: chardiv0
Prototype: GGG
Help: chardiv(cyc, a,b): given a finite abelian group (by its elementary
 divisors cyc) and two characters a and b, return the character a/b.
Doc: let \var{cyc} represent a finite abelian group by its elementary
 divisors, i.e. $(d_j)$ represents $\sum_{j \leq k} \Z/d_j\Z$ with $d_k
 \mid \dots \mid d_1$; any object which has a \kbd{.cyc} method is also
 allowed, e.g.~the output of \kbd{znstar} or \kbd{bnrinit}. A character
 on this group is given by a row vector $a = [a_1,\ldots,a_n]$ such that
 $\chi(\prod g_j^{n_j}) = \exp(2\pi i\sum a_j n_j / d_j)$, where $g_j$ denotes
 the generator (of order $d_j$) of the $j$-th cyclic component.

 Given two characters $a$ and $b$, return the character
 $a / b = a \overline{b}$.
 \bprog
 ? cyc = [15,5]; a = [1,1]; b =  [2,4];
 ? chardiv(cyc, a,b)
 %2 = [14, 2]
 ? bnf = bnfinit(x^2+23);
 ? bnf.cyc
 %4 = [3]
 ? chardiv(bnf, [1], [2])
 %5 = [2]
 @eprog\noindent For Dirichlet characters on  $(\Z/N\Z)^*$, additional
 representations are available (Conrey labels, Conrey logarithm),
 see \secref{se:dirichletchar} or \kbd{??character}.
 If the two characters are in the same format, the
 result is given in the same format, otherwise a Conrey logarithm is used.
 \bprog
 ? G = znstar(100, 1);
 ? G.cyc
 %2 = [20, 2]
 ? a = [10, 1]; \\ usual representation for characters
 ? b = 7; \\ Conrey label;
 ? c = znconreylog(G, 11); \\ Conrey log
 ? chardiv(G, b,b)
 %6 = 1   \\ Conrey label
 ? chardiv(G, a,b)
 %7 = [0, 5]~  \\ Conrey log
 ? chardiv(G, a,c)
 %7 = [0, 14]~   \\ Conrey log
 @eprog

Variant: Also available is
 \fun{GEN}{chardiv}{GEN cyc, GEN a, GEN b}, when \kbd{cyc} is known to
 be a vector of elementary divisors and $a, b$ are compatible characters
 (no checks).
