home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / C / Samples / C-SSP.ARJ / MATEIG.TST < prev    next >
Encoding:
Text File  |  1984-08-31  |  1.2 KB  |  56 lines

  1.         /* General form test program for scientific functions */
  2.  
  3.         /* Routine Tested:  MATEIG */
  4.  
  5.         main()
  6.  
  7.         {
  8.         int lra,n;
  9.         static float a[3][3]={ 1., 1.,.5,
  10.                                1., 1.,.25,
  11.                               .5,.25,  2.
  12.                              };
  13.         float s[3][3];
  14.  
  15.         lra = 3;
  16.         n   = 3;
  17.  
  18.         mateig(lra,n,a,s);            /* call the function */
  19.         printr(a,n,n);                /* print the result  */
  20.         printr(s,n,n);
  21.  
  22.         }
  23.  
  24.                 /* Routine to print matrices */
  25.  
  26.       printr(a,nrow,ncol)
  27.  
  28.         int nrow,ncol;
  29.         float a[];
  30.  
  31.       {
  32.         int *fp,j,k,ne;
  33.  
  34.         ne = ncol-1;
  35.  
  36.         *fp=fopen("PRN:","w");                 /* open the printer */
  37.  
  38.         fprintf(*fp,"Test Results from MATEIG\n\n");
  39.          printf("Test Results from MATEIG\n\n");
  40.  
  41.         for(j = 0; j <= nrow-1 ; j++)
  42.          {
  43.           for(k = j*ncol; k <= j*ncol+ne ; k++)
  44.            {
  45.             fprintf(*fp,"%18.9f ",a[k]);
  46.              printf("%18.9f  ",a[k]);
  47.            };
  48.            fprintf(*fp,"\n");
  49.             printf("\n");
  50.          }
  51.            fprintf(*fp,"\n\n");
  52.             printf("\n\n");
  53.  
  54.        }
  55.  
  56.