// -*- C++ -*-
// automatically generated by autodoc

// ========== HEADER FILE src/aux0/binomial.h: ==========

inline ulong binomial(ulong n, ulong k);

// ========== HEADER FILE src/aux0/cayley-dickson-mult.h: ==========

inline int CD_sign_rec(ulong r, ulong c, ulong n);
// Signs in the multiplication table for the
//   algebra of n-ions (where n is a power of 2)
//   that is obtained by the Cayley-Dickson construction:
// If component r is multiplied with component c, then the
//   result is CD_sign_rec(r,c,n) * (r XOR c).
// Multiplication rule is
//   (a,b) * (A,b) = (a*A - B*conj(b),  conj(a)*B + A*b)
//   where conj(a,b) := (conj(a), -b) and conj(x):=x for x real
// [ Transposed rule/table is obtained if rule is changed to
//    (a,b) * (A,b) = (a*A - conj(B)*b,  b*conj(A) + B*a)  ]
// Must have: r < n  and  c < n.
// We have ex * e0 = e0 * ex = ex,  and ex * ex = -1 for x != 0,
//   and ex * ey == -ey * ex for x != y, x != 0, y != 0
// Example (octionions, n==8):
// (er*ec) e0   e1   e2   e3    e4   e5   e6   e7
//   e0:  +e0  +e1  +e2  +e3   +e4  +e5  +e6  +e7
//   e1:  +e1  -e0  -e3  +e2   -e5  +e4  +e7  -e6
//   e2:  +e2  +e3  -e0  -e1   -e6  -e7  +e4  +e5
//   e3:  +e3  -e2  +e1  -e0   -e7  +e6  -e5  +e4
//
//   e4:  +e4  +e5  +e6  +e7   -e0  -e1  -e2  -e3
//   e5:  +e5  -e4  +e7  -e6   +e1  -e0  +e3  -e2
//   e6:  +e6  -e7  -e4  +e5   +e2  -e3  -e0  +e1
//   e7:  +e7  +e6  -e5  -e4   +e3  +e2  -e1  -e0
// Signs at row r, column c equal CD_sign_rec(r,c,8):
//   + + + + + + + +
//   + - - + - + + -
//   + + - - - - + +
//   + - + - - + - +
//   + + + + - - - -
//   + - + - + - + -
//   + - - + + - - +
//   + + - - + + - -
// This is a (8 x 8) Hadamard matrix.
// The second row is the (signed) Thue-Morse sequence,
// see OEIS sequences A118685, A010060, and A106400.


inline int CD_sign_it(ulong r, ulong c, ulong n);
// iterative version of CD_sign_rec()

inline bool CD_zerodiv_q(ulong r, ulong c);
// Return whether (r+c) where r and c are units
// is a zero divisor in the Cayley-Dickson algebra.

// ========== HEADER FILE src/aux0/cmult.h: ==========

static inline void csqr(double &u, double &v);
// {u,v} <--| {u*u-v*v, 2*u*v}

static inline void csqr_n(double &u, double &v, double dn);
// {u,v} <--| {dn*(u*u-v*v), dn*(2*u*v)}

static inline void csqr(double a, double b,;
                        double &u, double &v)
// {u,v} <--| {a*a-b*b, 2*a*b}

static inline void cmult(double c, double s,;
                         double &u, double &v)
// {u,v} <--| u = u*c-v*s;  v = u*s+v*c

static inline void cmult_n(double c, double s,;
                           double &u, double &v,
                           double dn)
// {u,v} <--| {dn*(u*c-v*s), dn*(u*s+v*c)}

static inline void cmult(double c, double s,;
                         double x, double y,
                         double &u, double &v)
// {u,v} <--| {x*c-y*s, x*s+y*c}

static inline void cmult(double c, double s,;
                         Complex x, Complex y,
                         Complex &u, Complex &v)
// {u,v} <--| {x*c-y*s, x*s+y*c}
// used in generated complex fhts

static inline void cmult(Complex c, Complex s,;
                         Complex x, Complex y,
                         Complex &u, Complex &v)
// {u,v} <--| {x*c-y*s, x*s+y*c}
// used in generated complex fhts

static inline void cmult_inv(double c, double s,;
                             double x, double y,
                             double &u, double &v)
// {u,v} <--| {x*c+y*s, -x*s+y*c}
// same as cmult(c, -s, x, y, u, v)

static inline void cmult_inv(double c, double s,;
                             Complex x, Complex y,
                             Complex &u, Complex &v)
// {u,v} <--| {x*c+y*s, -x*s+y*c}
// same as cmult(c, -s, x, y, u, v)
// used in generated complex fhts

static inline void cmult_inv(Complex c, Complex s,;
                             Complex x, Complex y,
                             Complex &u, Complex &v)
// {u,v} <--| {x*c+y*s, -x*s+y*c}
// same as cmult(c, -s, x, y, u, v)
// used in generated complex fhts

// ========== HEADER FILE src/aux0/csincos.h: ==========

static inline Complex SinCos(double phi);

// ========== HEADER FILE src/aux0/factorial.h: ==========

inline Type factorial(Type n);
// Return n!
//.
// For n<=12 n! fits into 32 bits.
// For n<=20 n! fits into 64 bits.
// For n<=34 n! fits into 128 bits.
// For n<=57 n! fits into 256 bits.

inline Type ffactpow(Type x, Type n);
// Falling factorial power.

inline Type rfactpow(Type x, Type n);
// Rising factorial power.

// ========== HEADER FILE src/aux0/fibonacci.h: ==========

inline ulong fibonacci(ulong n);
// Return the n-th Fibonacci number
// Limitation:  F(n) must fit into ulong
// 32 bit:  n<=47, F(47)=2971215073 [F(48)=4807526976 > 2^32]
// 64 bit:  n<=93  F(93)=12200160415121876738 [F(94) > 2^64]

inline void fibonacci_pair(ulong n, ulong &f0, ulong &f1);
// Set f0 to F(n), the n-th Fibonacci number, and
// f1 to the F(n-1).
// Limitation:  F(n) must fit into ulong
// 32 bit:  n<=47, F(47)=2971215073 [F(48)=4807526976 > 2^32]
// 64 bit:  n<=93  F(93)=12200160415121876738 [F(94) > 2^64]

// ========== HEADER FILE src/aux0/gcd.h: ==========

Type gcd(Type a, Type b);
// Return greatest common divisor of a and b.

Type egcd(Type u, Type v, Type &tu1, Type &tu2);
// Return u3 and set u1,v1 so that
//   gcd(u,v) == u3 == u*u1 + v*u2
// Type must be a signed type.
//.
// Cf. Knuth2, p.325

Type binary_ugcd(Type a, Type b);
// Return greatest common divisor of a and b.
// Version for unsigned types.

Type binary_sgcd(Type a, Type b);
// Return greatest common divisor of a and b.
// Version for signed types.

Type lcm(Type a, Type b);
// Return least common multiple of a and b.

// ========== HEADER FILE src/aux0/ipow.h: ==========

Type1 ipow(Type1 a, Type2 ex);
// Return a**ex

// ========== HEADER FILE src/aux0/ldn2rc.h: ==========

static inline void ldn2rc(ulong ldn, ulong &nr, ulong &nc);
// Input ldn := log_2(n)
// nr, nc are set so that nr*nc = n and ldr>=ldc
// Used in matrix-fft based convolution.

// ========== HEADER FILE src/aux0/print-fixed.h: ==========

// ----- SRCFILE=src/aux0/print-fixed.cc: -----
void print_fixed(const char *bla, double v, long nd, bool sq);
// Print exactly nd digits of v
// Print sign if sq!=0

// ========== HEADER FILE src/aux0/rand-idx.h: ==========

inline ulong rand_idx(ulong m);
// Return random number in the range [0, 1, ..., m-1].
// Must have m>0.

// ========== HEADER FILE src/aux0/randf.h: ==========

// ----- SRCFILE=src/aux0/randf.cc: -----
uint rseed(uint s/*=0*/);

double rnd01();
// Random number in [0,1[

void rnd01(double *f, ulong n);
// Fill with random numbers in [0,1[

double white_noise();
// Return one sample of white noise (with mean=0, sigma=1).

void white_noise(double *f, ulong n);
// Fill array with samples of white noise (with mean=0, sigma=1).

// ========== HEADER FILE src/aux0/sincos.h: ==========

static inline void SinCos(double a, double *s, double *c);

static inline void SinCos(double a, double *s, double *c);

static inline void SinCos(double a, double *s, double *c);

// ========== HEADER FILE src/aux0/sumdiff.h: ==========

static inline void sumdiff(Type &a, Type &b);
// {a, b}  <--| {a+b, a-b}

static inline void sumdiff_r(Type &a, Type &b);
// {a, b}  <--| {b+a, b-a}
// Up to scaling (by a factor 2) the inverse of diffsum(a,b).

static inline void sumdiff05(Type &a, Type &b);
// {a, b}  <--| {0.5*(a+b),  0.5*(a-b)}

static inline void sumdiff05_r(Type &a, Type &b);
// {a, b}  <--| {0.5*(a+b), 0.5*(b-a)}

static inline void diffsum(Type &a, Type &b);
// {a, b}  <--| {a-b, a+b}
// Up to scaling (by a factor 2) the inverse of sumdiff_r(a,b).

static inline void sumdiff(Type a, Type b, Type &s, Type &d);
// {s, d}  <--| {a+b, a-b}

static inline void sumdiff05(Type a, Type b, Type &s, Type &d);
// {s, d}  <--| {0.5*(a+b), 0.5*(a-b)}

static inline void sumdiff3(Type &a, Type b, Type &d);
// {a, b, d} <--| {a+b, b, a-b}  (used in split-radix FFTs)
// NEVER call like func(a,b,a) or func(a,b,b)

static inline void sumdiff3_r(Type &a, Type b, Type &d);
// {a,b,d} <--| {a+b, b, b-a}  (used in split-radix FFTs)
// NEVER call like func(a,b,a) or func(a,b,b)

static inline void diffsum3(Type a, Type &b, Type &s);
// {a, b, s} <--| {a, a-b, a+b}  (used in split-radix FFTs)
// NEVER call like func(a,b,a) or func(a,b,b)

static inline void diffsum3_r(Type a, Type &b, Type &s);
// {a, b, s} <--| {a, b-a, a+b}  (used in split-radix FFTs)
// NEVER call like func(a,b,a) or func(a,b,b)

// ========== HEADER FILE src/aux0/swap.h: ==========

static inline void  swap2(Type &x, Type &y);
// swap values

static inline void  swap0(Type &x, Type &y);
// swap() for y known to be zero

// ========== HEADER FILE src/aux0/tex-line.h: ==========

// ----- SRCFILE=src/aux0/tex-line.cc: -----
void tex_line(long x0, long y0, long x1, long y1, bool vq/*=true*/);
// Print TeX command to draw vector (or line) from (x0, y0) to (x1, y1).
// Set vq to draw lines as vectors.
// For \line(dx, dy){length} and \vector(dx, dy}{length}
// Note: For \line(dx, dy){length} and \vector(dx, dy}{length}
// the argument 'length' is the VERTICAL coordinate for
// vertical line segments, else the HORIZONTAL coordinate.

inline void tex_line(ulong x0, ulong y0, ulong x1, ulong y1, bool vq=true);

void tex_line_fl(double x0, double y0, double x1, double y1, bool vq/*=true*/);
// Print TeX command to draw vector (or line) from (x0, y0) to (x1, y1).
// Set vq to draw lines as vectors.
// Note: For \line(dx, dy){length} and \vector(dx, dy}{length}
// the argument 'length' is the VERTICAL coordinate for
// vertical line segments, else the HORIZONTAL coordinate.

void tex_draw_turn(double x, double y,
              double dx, double dy,
              double ndx, double ndy,
              ulong style,
              bool vq/*=true*/,
              double m/*=0.25*/);
// Draw the part of the turn from
// X1=(x, y) over X2=(x+dx, y+dy) to X3=(x+ndx, y+ndy)
// as indicated below.
//           NX == X + DX              :
//         * X2 * X3                   :
//       * X1     \                    :
//    X /          \ == NX + NDX       :

