v.size= D3;
v.stride= 1;
- v.vector.data= pq;
+ v.data= (double*)pq;
/* owner and block ought not to be used */
- return gsl_blas_snrm2(&v);
+ return gsl_blas_dnrm2(&v);
}
double hypotD(const double p[D3], const double q[D3]) {
double pq[D3];
K pq[k]= p[k] - q[k];
- return hypotD1(pq);
+ return magnD(pq);
}
double hypotD2(const double p[D3], const double q[D3]) {
+ int k;
double d2= 0;
+
K d2= ffsqa(p[k] - q[k], d2);
return d2;
}
double hypotD2plus(const double p[D3], const double q[D3], double d2) {
+ int k;
K d2= ffsqa(p[k] - q[k], d2);
return d2;
}
void xprod(double r[D3], const double a[D3], const double b[D3]) {
- r[0]= a[1]*b[2] - a[2]*b[1]);
- r[1]= a[2]*b[0] - a[0]*b[2]);
- r[2]= a[0]*b[1] - a[1]*b[0]);
+ r[0]= a[1]*b[2] - a[2]*b[1];
+ r[1]= a[2]*b[0] - a[0]*b[2];
+ r[2]= a[0]*b[1] - a[1]*b[0];
+}
+
+double dotprod(const double a[D3], const double b[D3]) {
+ int k;
+ double result= 0;
+ K result += a[k] * b[k];
+ return result;
}
+
+void libdie(const char *lib, int l, const char *str) {
+ fprintf(stderr,"%s library call failed, line %d: %s\n", lib, l, str);
+}
+
+void gsldie(int l, const char *what, int status) {
+ fprintf(stderr,"gsl function failed, line %d: %s: %s\n",
+ l, what, gsl_strerror(status));
+ exit(-1);
+}
+
+void diee(const char *what) { perror(what); exit(16); }
+void flushoutput(void) { if (fflush(stdout)||ferror(stdout)) diee("stdout"); }