/* remove off-diagonal elements which are neglegible compared with the
   neighboring diagonal elements */

static void
chop_small_elements (const size_t N, const double d[], double sd[]);

/* Generate a Givens rotation (cos,sin) which takes v=(x,y) to (|v|,0) 
   From Golub and Van Loan, "Matrix Computations", Section 5.1.8 */

static void
create_givens (const double a, const double b, double *c, double *s);

static double
trailing_eigenvalue (const size_t n, const double d[], const double sd[]);

static void
qrstep (const size_t n, double d[], double sd[], double gc[], double gs[]);
