/*Translated by FOR_C, v3.4.2 (-), on 07/09/115 at 08:30:07 */ /*FOR_C Options SET: ftn=u io=c no=p op=aimnv s=dbov str=l x=f - prototypes */ #include #include "fcrt.h" #include "imatp.h" #include #include /* PARAMETER translations */ #define MAXCOL 8 /* end of PARAMETER translations */ void /*FUNCTION*/ imatp( long *a, long lda, long m, long n, char *text) { #define A(I_,J_) (*(a+(I_)*(lda)+(J_))) long int i, iblock, j1, j2, nblock; /* IMATP.. Print a matrix. * Copyright (c) 1996 California Institute of Technology, Pasadena, CA. * ALL RIGHTS RESERVED. * Based on Government Sponsored Research NAS7-03001. *>> 1996-07-09 IMATP Krogh Changes to use .C. and C%%. *>> 1996-01-24 IMATP Krogh M77CON instructions for conversion to C. *>> 1994-08-08 CLL Special treatment for text(1:1) .eq. '0' *>> 1994-04-20 CLL Making code in IMATP similar to DMATP and SMATP. *>> 1992-04-22 CLL *>> 1990-01-23 CLL removed extraneous "60 continue" *>> 1985-09-20 CLL *>> 1983-07-05 Kris Stewart For MATH77 *>> 1981-07-23 Kris Stewart Improve portability. *>> 1969-00-00 C. L. Lawson, JPL, Original code: MOUT/VOUT * ------------------------------------------------------------------ * A( ) MATRIX TO BE OUTPUT * LDA Leading dimension of array A(). * M NO. OF ROWS IN A MATRIX * N NO. OF COLS IN A MATRIX * TEXT Character string to be printed as a title. * First character in TEXT controls line spacing before title on * an impact printer. For output to be viewed on a screen it is * safest to always use ' '. * ' ' = normal single space. * '0' = double space. * '1' = page advance. * '+' = suppress space, i.e., overprint. * ------------------------------------------------------------------ */ /*++ CODE for ~.C. is inactive * integer j * if(text(1:1) .eq. '0') then * write(*,'(/1x,a)') text(2:) * else * write(*,'(a)') text * endif *++ CODE for .C. is active */ long int j; if(text[0] == '0') printf("\n %s\n", &text[1]); else printf("%s\n", text); nblock = (n + MAXCOL - 1)/MAXCOL; /*++ END */ j2 = 0; for (iblock = 1; iblock <= nblock; iblock++) { j1 = j2 + 1; j2 = min( j1 + MAXCOL - 1, n ); printf("\n "); for (j = j1; j <= j2; j++) printf(" COL%4ld ", j); printf("\n"); for (i = 1; i <= m; i++) { /* write(*,'(/15x,8(4x,a3,i4,4x)/1x)') ('COL',j,j=j1,j2) */ printf("ROW%4ld ", i); for (j = j1; j <= j2; j++) printf("%15ld", A(j-1, i-1)); printf("\n"); ; } /* write(*,'(a,i4,4x,8i15)') ' ROW',i,(a(i,j),j=j1,j2) */ } return; #undef A } /* end of function */