/* tsv2lsq.c CCMATH mathematics library source code. * * Copyright (C) 2000 Daniel A. Atkinson All rights reserved. * This code may be redistributed under the terms of the GNU library * public license (LGPL). ( See the lgpl.license file for details.) * ------------------------------------------------------------------------ */ /* Tests: sv2lsq Uses: sv2uv Input file: tlsq1.dat */ #include "ccmath.h" void main(int na,char **av) { int m,n,i; double *a,*b,*d,*v,*p; double *a1,*b1,*u,s; FILE *fp; if(na!=2){ printf("para: in_file\n"); exit(-1);} fp=fopen(*++av,"r"); fscanf(fp,"%d %d",&m,&n); printf(" %d meas. %d param.\n",m,n); a=(double *)calloc(m*n,sizeof(double)); b=(double *)calloc(m,sizeof(double)); d=(double *)calloc(n,sizeof(double)); v=(double *)calloc(n*n,sizeof(double)); a1=(double *)calloc(m*n,sizeof(double)); b1=(double *)calloc(m,sizeof(double)); u=(double *)calloc(m*m,sizeof(double)); for(i=0,p=a; i> parameters */ sv2lsq(d,a,b,m,v,n); printf(" sing-val:\n"); matprt(d,1,n," %10.6f"); printf(" vec-b~:\n"); matprt(b,1,m," %10.6f"); printf(" v-mat:\n"); matprt(v,n,n," %9.6f"); for(i=n,s=0.; i