mndaxpy.cxx

Go to the documentation of this file.
00001 // @(#)root/minuit2:$Id: mndaxpy.cxx 20880 2007-11-19 11:23:41Z rdm $
00002 // Authors: M. Winkler, F. James, L. Moneta, A. Zsenei   2003-2005  
00003 
00004 /**********************************************************************
00005  *                                                                    *
00006  * Copyright (c) 2005 LCG ROOT Math team,  CERN/PH-SFT                *
00007  *                                                                    *
00008  **********************************************************************/
00009 
00010 /* daxpy.f -- translated by f2c (version 20010320).
00011    You must link the resulting object file with the libraries:
00012         -lf2c -lm   (in that order)
00013 */
00014 
00015 namespace ROOT {
00016 
00017    namespace Minuit2 {
00018 
00019  
00020 int Mndaxpy(unsigned int n, double da, const double* dx, int incx, double* dy, 
00021             int incy) {
00022    /* System generated locals */
00023    int i__1;
00024    
00025    /* Local variables */
00026    int i__, m, ix, iy, mp1;
00027    
00028    
00029    /*     constant times a vector plus a vector. */
00030    /*     uses unrolled loops for increments equal to one. */
00031    /*     jack dongarra, linpack, 3/11/78. */
00032    /*     modified 12/3/93, array(1) declarations changed to array(*) */
00033    
00034    
00035    /* Parameter adjustments */
00036    --dy;
00037    --dx;
00038    
00039    /* Function Body */
00040    if (n <= 0) {
00041       return 0;
00042    }
00043    if (da == 0.) {
00044       return 0;
00045    }
00046    if (incx == 1 && incy == 1) {
00047       goto L20;
00048    }
00049    
00050    /*        code for unequal increments or equal increments */
00051    /*          not equal to 1 */
00052    
00053    ix = 1;
00054    iy = 1;
00055    if (incx < 0) {
00056       ix = (-static_cast<int>(n) + 1) * incx + 1;
00057    }
00058    if (incy < 0) {
00059       iy = (-static_cast<int>(n) + 1) * incy + 1;
00060    }
00061    i__1 = n;
00062    for (i__ = 1; i__ <= i__1; ++i__) {
00063       dy[iy] += da * dx[ix];
00064       ix += incx;
00065       iy += incy;
00066       /* L10: */
00067    }
00068    return 0;
00069    
00070    /*        code for both increments equal to 1 */
00071    
00072    
00073    /*        clean-up loop */
00074    
00075 L20:
00076       m = n % 4;
00077    if (m == 0) {
00078       goto L40;
00079    }
00080    i__1 = m;
00081    for (i__ = 1; i__ <= i__1; ++i__) {
00082       dy[i__] += da * dx[i__];
00083       /* L30: */
00084    }
00085    if (n < 4) {
00086       return 0;
00087    }
00088 L40:
00089       mp1 = m + 1;
00090    i__1 = n;
00091    for (i__ = mp1; i__ <= i__1; i__ += 4) {
00092       dy[i__] += da * dx[i__];
00093       dy[i__ + 1] += da * dx[i__ + 1];
00094       dy[i__ + 2] += da * dx[i__ + 2];
00095       dy[i__ + 3] += da * dx[i__ + 3];
00096       /* L50: */
00097    }
00098    return 0;
00099 } /* daxpy_ */
00100 
00101 
00102    }  // namespace Minuit2
00103 
00104 }  // namespace ROOT

Generated on Tue Jul 5 14:37:10 2011 for ROOT_528-00b_version by  doxygen 1.5.1