home *** CD-ROM | disk | FTP | other *** search
- marith(lra,lrb,lrc,nrow,ncol,iflag,a,b,c,scalar)
-
- /*this function performs matrix addition, subtraction, and*/
- /*multiplication by a constant, as specified by the control*/
- /*parameter iflag.*/
-
- int lra,lrb,lrc,nrow,ncol,iflag;
- float a[],b[],c[],scalar;
- {
- int i,j,ija,ijb,ijc;
- float x;
-
- for(i = 0; i <= nrow-1; i++)
- {
- ija = i * lra;
- ijb = i * lrb;
- ijc = i * lrc;
-
- for(j = 0; j <= ncol-1; j++)
- {
- x = b[ijb];
- if (iflag != 1 && iflag != 2) x *= scalar;
- if (iflag == 2 || iflag == 5) x = -x;
- if (iflag != 3) x += a[ija];
- c[ijc] = x;
- ija++;
- ijb++;
- ijc++;
- } /* end of j loop */
- } /* end of i loop */
- }