#include "types.h" #include pyReal vecScalarProduct(const pyWord size, const pyReal * a, const pyReal * b) { pyWord i; pyReal s = 0.0; for(i = 0; i < size ; i ++) { s += a[i] * b[i]; } return s; } pyReal vecNorm(const pyWord size, const pyReal * a) { pyWord i; pyReal s = 0.0; for(i = 0; i < size ; i ++) { s += a[i] * a[i]; } return sqrt(s); } pyReal vecDistSquared(const pyWord size, const pyReal * a, const pyReal * b) { pyWord i; pyReal s = 0.0, d; for(i = 0; i < size ; i ++) { d = a[i] - b[i] s += d * d; } return s; } void vecSubst(const pyWord size, pyReal * dst, const pyReal * a, const pyReal * b ) { pyWord i; for(i = 0; i < size ; i ++) { dst[i] = a[i] - b[i]; } } void vecScale(const pyWord size, pyReal * dst, pyReal s, const pyReal * a) { pyWord i; for(i = 0; i < size ; i ++) { dst[i] = s * a[i]; } }