/* tsv2u1v.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.) * ------------------------------------------------------------------------ */ /* Test: sv2u1v Uses: rmmult trnm mcopy matprt Input file: svd?.dat with ? -> 1 to 7 */ #include "ccmath.h" #include char fma[]=" %11.6f"; char fmf[]=" %9.6f"; char fme[]=" %14.8f"; void main(int na,char **av) { int i,j,m,n; double *a,*d,*u,*v; double *a1,*a0,*u0,*us,*a2; double *p,*q; FILE *fin; if(na!=2){ printf("para: file_in\n"); exit(-1);} fin=fopen(*++av,"r"); fscanf(fin,"%d %d",&m,&n); if(m>n) */ i=sv2u1v(d,a,m,v,n); if(i== -1){ printf(" error: m < n\n"); exit(-1);} printf(" sval:"); matprt(d,1,n,fme); printf(" u1:\n"); matprt(a,m,n,fmf); printf(" v:\n"); matprt(v,n,n,fmf); /* check decomposition by inversion */ trnm(v,n); for(i=0,p=v; i