/* vector processing routines from Handbook of C Tools for Scientists and Engineers by L. Baker often simplified versions of BLAS routines for vectors with contiguous storage dot(a,b,n) returns double value of dot product of two vectors a,b of n elements pv(v,n) prints vector of n elements mv(a,x,y,m,n) y=ax where a is m x n matrix normv(v,n) normalize a vector (scale its length to one) sqnor(v,n) square of the length of vector v of n elements mvt(a,x,y,m,n) like mv except y=a^x a^ =transpose of a resid(r,a,x,n) r=ax-x, a matrix all other vectors. vs(v,s,n) scale vector by multiplying each element by s vset(v,s,n) set vector v to scalar value s for each element vcopy(x,y,n) y=x, vectors vv(a,b,c,s,n) a=b+c*s, s scalar, a,b,c,vectors */ #include "ftoc.h" double dot(a,b,n) int n; float a[],b[]; { int i; double sum; if(n<=0)return(0.); sum=0.; DOFOR(i,n)sum+=a[i]*b[i]; return(sum); } pv(v,n) int n;float v[]; { int btm,top,i; btm=0; top=0; while (btm