2 * Generally useful stuff.
7 double magnD(const double pq[D3]) {
13 /* owner and block ought not to be used */
15 return gsl_blas_dnrm2(&v);
18 double hypotD(const double p[D3], const double q[D3]) {
26 double hypotD2(const double p[D3], const double q[D3]) {
30 K d2= ffsqa(p[k] - q[k], d2);
34 double hypotD2plus(const double p[D3], const double q[D3], double d2) {
36 K d2= ffsqa(p[k] - q[k], d2);
40 void xprod(double r[D3], const double a[D3], const double b[D3]) {
41 r[0]= a[1]*b[2] - a[2]*b[1];
42 r[1]= a[2]*b[0] - a[0]*b[2];
43 r[2]= a[0]*b[1] - a[1]*b[0];
46 void libdie(const char *lib, int l, const char *str) {
47 fprintf(stderr,"%s library call failed, line %d: %s\n", lib, l, str);
50 void gsldie(int l, const char *what, int status) {
51 fprintf(stderr,"gsl function failed, line %d: %s: %s\n",
52 l, what, gsl_strerror(status));
56 void diee(const char *what) { perror(what); exit(16); }
57 void flushoutput(void) { if (fflush(stdout)||ferror(stdout)) diee("stdout"); }