// -*- 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, c<n.
//  ex*ey == -ey*ex (unless one of ex and ey is e0)
// 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.

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/constants.h: ==========

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

static inline Complex SinCos(double phi);

static inline void SinCos(double phi, Complex *z);

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

inline ulong factorial(ulong n);
// Return n!

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

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

// ========== 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/range.h: ==========

static inline bool in_range_q(Type xmin, Type xmax, Type x);
// Return whether xmin<= x <=xmax
// precondition:  xmin<=xmax

static inline bool off_range_q(Type x, Type xmin, Type xmax);
// Return whether x<xmin or x>xmax
// precondition:  xmin<=xmax

static inline void wrap_range(Type xmin, Type xmax, Type &x);
// toroidal rules apply
// precondition:  xmin<=xmax

static inline void clip_range(Type xmin, Type xmax, Type &x);
// force x into [xmin, xmax]
// precondition:  xmin<=xmax

static inline bool clip_range_q(Type xmin, Type xmax, Type &x);
// force x into [xmin, xmax]
// return whether clipping occurred
// precondition:  xmin<=xmax

static inline void clip_range0(Type xmax, Type &x);
// force x into [0, xmax]

static inline bool intersect_range_o(Type xmin, Type xmax, Type &x1, Type &x2);
// push  [x1,x2]  into  [xmin,xmax]
// return:  0  if  completely outside  1  else
// precondition:  xmin<=xmax
// precondition:  x1<=x2

static inline bool intersect_range(Type xmin, Type xmax, Type &x1, Type &x2);
// push  [x1,x2]  into  [xmin,xmax]
// return:  0  if  completely outside  1  else
// precondition:  xmin<=xmax

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

static inline Type sign(const Type &x);
// Return sign(x)

static inline Type sign1(const Type &x);
// Return 1 if x==0, else sign(x)

static inline int sign_bit(const Type &x);
// Return 1 if x<0, else 0

static inline Type Abs(const Type &x);
// Return abs(x)

// ========== 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);

// ========== 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).
// 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).
// 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*/);
// Draw the part of the turn from
// (x,y) over (x+dx,y+dy) to  (x+ndx,y+ndy)
// indicated as X1, X2, X3 below.
//           NX == X + DX              :
//         * X2 * X3                   :
//       * X1     \                    :
//    X /          \ == NX + NDX       :

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

inline double timediff(timeval &x, timeval &y);
// Return time difference in seconds.
// Usage:
//    timeval t0, t1;
//    gettimeofday(&t0, 0);
//    big_computation();
//    gettimeofday(&t1, 0);
//    double elapsed_time = timediff(t0, t1);

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

class trigrec;
// Type either double or long double.

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

// ----- SRCFILE=src/aux0/version.cc: -----
void print_fxt_version();
// Print fxt version (by date), compile time, and flags.

