2 * Generally useful stuff.
5 #include <gsl/gsl_vector.h>
6 #include <gsl/gsl_blas.h>
10 double magnD(const double pq[D3]) {
16 /* owner and block ought not to be used */
18 return gsl_blas_dnrm2(&v);
21 double hypotD(const double p[D3], const double q[D3]) {
29 double hypotD2(const double p[D3], const double q[D3]) {
33 K d2= ffsqa(p[k] - q[k], d2);
37 double hypotD2plus(const double p[D3], const double q[D3], double d2) {
39 K d2= ffsqa(p[k] - q[k], d2);
43 void xprod(double r[D3], const double a[D3], const double b[D3]) {
44 r[0]= a[1]*b[2] - a[2]*b[1];
45 r[1]= a[2]*b[0] - a[0]*b[2];
46 r[2]= a[0]*b[1] - a[1]*b[0];
49 void diee(const char *what) { perror(what); exit(16); }
50 void flushoutput(void) { if (fflush(stdout)||ferror(stdout)) diee("stdout"); }