dmmul1.c

Go to the documentation of this file.
00001 
00002 /* Table of constant values */
00003 
00004 static int c__1 = 1;
00005 
00006 int dmmul1(double *a, int *na, double *b, int *nb, double *c__, 
00007            int *nc, int *l, int *m, int *n)
00008 {
00009   /* System generated locals */
00010   int i__1, i__2;
00011   
00012   /* Local variables */
00013   double ddot();
00014   static int i__, j, ib, ic;
00015   
00016   /* !but */
00017   /*     ce sous programme effectue le produit matriciel: */
00018   /*     c=c+a*b . */
00019   /* !liste d'appel */
00020   
00021   /*     subroutine dmmul1(a,na,b,nb,c,nc,l,m,n) */
00022   /*     double precision a(na,m),b(nb,n),c(nc,n) */
00023   /*     integer na,nb,nc,l,m,n */
00024   
00025   /*     a            tableau de taille na*m contenant la matrice a */
00026   /*     na           nombre de lignes du tableau a dans le programme appel */
00027   /*     b,nb,c,nc    definitions similaires a celles de a,na */
00028   /*     l            nombre de ligne des matrices a et c */
00029   /*     m            nombre de colonnes de a et de lignes de b */
00030   /*     n            nombre de colonnes de b et c */
00031   /* !sous programmes utilises */
00032   /*     neant */
00033   /* ! */
00034   /*     Copyright INRIA */
00035   
00036   /* Parameter adjustments */
00037   --c__;
00038   --b;
00039   --a;
00040   
00041   /* Function Body */
00042   ib = 1;
00043   ic = 0;
00044   i__1 = *n;
00045   for (j = 1; j <= i__1; ++j) {
00046     i__2 = *l;
00047     for (i__ = 1; i__ <= i__2; ++i__) {
00048       /* L20: */
00049       c__[ic + i__] += ddot(m, &a[i__], na, &b[ib], &c__1);
00050     }
00051     ic += *nc;
00052     ib += *nb;
00053     /* L30: */
00054   }
00055   return 0;
00056 } /* dmmul1 */
00057 
00058 double ddot(int *n, double *dx, int *incx, double *dy, int *incy)
00059 {
00060   /* System generated locals */
00061   int i__1;
00062   double ret_val;
00063   
00064   /* Local variables */
00065   static int i__, m;
00066   static double dtemp;
00067   static int ix, iy, mp1;
00068   
00069   
00070   /*     forms the dot product of two vectors. */
00071   /*     uses unrolled loops for increments equal to one. */
00072   /*     jack dongarra, linpack, 3/11/78. */
00073   /*     modified 12/3/93, array(1) declarations changed to array(*) */
00074   
00075   
00076   /* Parameter adjustments */
00077   --dy;
00078   --dx;
00079   
00080   /* Function Body */
00081   ret_val = 0.;
00082   dtemp = 0.;
00083   if (*n <= 0) {
00084     return ret_val;
00085   }
00086   if (*incx == 1 && *incy == 1) {
00087     goto L20;
00088   }
00089   
00090   /*        code for unequal increments or equal increments */
00091   /*          not equal to 1 */
00092   
00093   ix = 1;
00094   iy = 1;
00095   if (*incx < 0) {
00096     ix = (-(*n) + 1) * *incx + 1;
00097   }
00098   if (*incy < 0) {
00099     iy = (-(*n) + 1) * *incy + 1;
00100   }
00101   i__1 = *n;
00102   for (i__ = 1; i__ <= i__1; ++i__) {
00103     dtemp += dx[ix] * dy[iy];
00104     ix += *incx;
00105     iy += *incy;
00106     /* L10: */
00107   }
00108   ret_val = dtemp;
00109   return ret_val;
00110   
00111   /*        code for both increments equal to 1 */
00112   
00113   
00114   /*        clean-up loop */
00115   
00116  L20:
00117   m = *n % 5;
00118   if (m == 0) {
00119     goto L40;
00120   }
00121   i__1 = m;
00122   for (i__ = 1; i__ <= i__1; ++i__) {
00123     dtemp += dx[i__] * dy[i__];
00124     /* L30: */
00125   }
00126   if (*n < 5) {
00127     goto L60;
00128   }
00129  L40:
00130   mp1 = m + 1;
00131   i__1 = *n;
00132   for (i__ = mp1; i__ <= i__1; i__ += 5) {
00133     dtemp = dtemp + dx[i__] * dy[i__] + dx[i__ + 1] * dy[i__ + 1] + dx[
00134                                                                        i__ + 2] * dy[i__ + 2] + dx[i__ + 3] * dy[i__ + 3] + dx[i__ + 
00135                                                                                                                                4] * dy[i__ + 4];
00136     /* L50: */
00137   }
00138  L60:
00139   ret_val = dtemp;
00140   return ret_val;
00141 } /* ddot */
00142 

Generated on Sun Mar 4 15:03:59 2007 for Scilab [trunk] by  doxygen 1.5.1