home *** CD-ROM | disk | FTP | other *** search
- /* General form test program for scientific functions */
-
- /* Routine Tested: MATMUL */
-
- main()
-
- {
- int lra,lrb,lrc,i,j,k;
- static float a[4][5]={0.,-1.,-2.,-3.,-4.,
- 1., 0.,-1.,-2.,-3.,
- 2., 1., 0.,-1.,-2.,
- 3., 2., 1., 0.,-1.
- };
- static float b[5][3]={-1.,-3.,-5.,
- 0.,-2.,-4.,
- 1.,-1.,-3.,
- 2., 0.,-2.,
- 3., 1.,-1.
- };
- float c[4][3];
-
- lra = 5;
- lrb = 3;
- lrc = 3;
- i = 4;
- j = 5;
- k = 3;
-
- matmul(lra,lrb,lrc,i,j,k,a,b,c); /* call the function */
- printr(c,i,k); /* print the result */
- }
-
- /* Routine to print matrices */
-
- printr(a,nrow,ncol)
-
- int nrow,ncol;
- float a[];
-
- {
- int *fp,j,k,ne;
-
- ne = ncol-1;
-
- *fp=fopen("PRN:","w"); /* open the printer */
-
- fprintf(*fp,"Test Results from MATMUL\n\n");
- printf("Test Results from MATMUL\n\n");
-
- for(j = 0; j <= nrow-1 ; j++)
- {
- for(k = j*ncol; k <= j*ncol+ne ; k++)
- {
- fprintf(*fp,"%5.1f ",a[k]);
- printf("%5.1f ",a[k]);
- };
- fprintf(*fp,"\n");
- printf("\n");
- }
- fprintf(*fp,"\n\n");
- printf("\n\n");
-
- }
-
- afil(a,b,ne) /* routine to reset array to original form */
-
- int ne;
- float a[],b[];
-
- {
- int i;
-
- for(i = 0; i <= ne-1; i++)
- a[i] = b[i];
- }
-
-
-
-
-