CFPRIME DAXPY                                                           DAXPY       1
C***********************************************************************RIGHTE      1
C*                                                                     *RIGHTE      2
C*        Extended Transient-Midterm Stability Program (ETMSP)         *RIGHTE      3
C*        ====================================================         *RIGHTE      4
C*                                                                     *RIGHTE      5
C*       Copyright (C) (1993) Electric Power Research Institute        *RIGHTE      6
C*                                                                     *RIGHTE      7
C* EPRI reserves all rights in the software and associated             *RIGHTE      8
C* documentation as delivered. The software and its associated         *RIGHTE      9
C* documention or any portion thereof may not be reproduced in any form*RIGHTE     10
C* whatsoever without the consent of EPRI, except as explicity provided*RIGHTE     11
C* for by license. Licensee shall submit a detailed description to EPRI*RIGHTE     12
C* of any changes or modifications to the software within two (2)      *RIGHTE     13
C* months after such changes or modifications are made. At EPRI's sole *RIGHTE     14
C* discretion, the software, as changed or modified, shall be given a  *RIGHTE     15
C* new designation sufficiently different from its then current        *RIGHTE     16
C* designation as to prevent mistake,confusion, or deception as between*RIGHTE     17
C* the current software as changed or modified.                        *RIGHTE     18
C*                                                                     *RIGHTE     19
C* A license under EPRI's rights in the software can be obtained       *RIGHTE     20
C* directly from EPRI.                                                 *RIGHTE     21
C*                                                                     *RIGHTE     22
C* This program and supporting materials may be independently available*RIGHTE     23
C* from Electric Power Software centre (EPSC) for an appropriate       *RIGHTE     24
C* distribution fee. The EPSC is a service of                          *RIGHTE     25
C*                                                                     *RIGHTE     26
C*                    Power Computing Company                          *RIGHTE     27
C*                    1930 Hi Line                                     *RIGHTE     28
C*                    Dallas, Tx 75207                                 *RIGHTE     29
C*                                                                     *RIGHTE     30
C* NEITHER EPRI, ANY MEMBER OF EPRI, NOR ANY PERSON OR  ORGANIZATION   *RIGHTE     31
C* ACTING ON BEHAVE OF THEM:                                           *RIGHTE     32
C*                                                                     *RIGHTE     33
C* 1. MAKE ANY WARRANTY OR REPRESENTATION WHATSOEVER, EXPRESS OR       *RIGHTE     34
C*    IMPLIED, INCLUDING ANY WARRANTY OF MERCHANTABILITY OR FITNESS OR *RIGHTE     35
C*    ANY PURPOSE WITH RESPECT TO THE SOFTWARE OR ITS ASSOCIATED       *RIGHTE     36
C*    DOCUMENTATION; OR                                                *RIGHTE     37
C*                                                                     *RIGHTE     38
C* 2. ASSUMES ANY LIABILITY WHATSOEVER WITH RESPECT TO ANY USE OF THE  *RIGHTE     39
C*    SOFTWARE OR ITS ASSOCIATED DOCUMENTATION OR ANY PORTION THEREOF  *RIGHTE     40
C*    OR WITH RESPECT TO ANY DAMAGES WHICH MAY RESULT FROM SUCH USE.   *RIGHTE     41
C*                                                                     *RIGHTE     42
C* THIS NOTICE MAY NOT BE REMOVED FROM THE SOFTWARE BY ANY USER        *RIGHTE     43
C* THEREOF.                                                            *RIGHTE     44
C*                                                                     *RIGHTE     45
C***********************************************************************RIGHTE     46
      SUBROUTINE DAXPY (N, DA, DX, INCX, DY, INCY)                      DAXPY       3
CD -------------------------------------------------------------------  DAXPY       4
CD                                                                      DAXPY       5
CD              *****     DAXPY   ROUTINE   *****                       DAXPY       6
CD                                                                      DAXPY       7
CD -------------------------------------------------------------------  DAXPY       8
CD                                                                      DAXPY       9
CD    PREFORMS Constant times a vector plus a vector.                   DAXPY      10
CD    Uses unrolled loops for increments equal to one.                  DAXPY      11
CD    JACK DONGARRA, LINPACK, 3/11/78.                                  DAXPY      12
CD                                                                      DAXPY      13
CD -------------------------------------------------------------------  DAXPY      14
C                                                                       DAXPY      15
      DOUBLE PRECISION DX(*), DY(*), DA                                 DAXPY      16
C                                                                       DAXPY      17
C---------------------------------------------------------------------  DAXPY      18
C                                                                       DAXPY      19
      IF (N .LE. 0) RETURN                                              DAXPY      20
      IF (ABS(DA) .LE. 0.0D0) RETURN                                    DAXPY      21
      IF (INCX .EQ. 1 .AND. INCY .EQ. 1) GO TO 20                       DAXPY      22
C                                                                       DAXPY      23
C        Code for unequal increments or equal increments                DAXPY      24
C          not equal to 1.                                              DAXPY      25
C                                                                       DAXPY      26
      IX = 1                                                            DAXPY      27
      IY = 1                                                            DAXPY      28
      IF (INCX .LT. 0) IX = (-N + 1) * INCX + 1                         DAXPY      29
      IF (INCY .LT. 0) IY = (-N + 1) * INCY + 1                         DAXPY      30
C                                                                       DAXPY      31
      DO 10 I = 1, N                                                    DAXPY      32
        DY(IY) = DY(IY) + DA * DX(IX)                                   DAXPY      33
        IX = IX + INCX                                                  DAXPY      34
        IY = IY + INCY                                                  DAXPY      35
   10 CONTINUE                                                          DAXPY      36
      RETURN                                                            DAXPY      37
C                                                                       DAXPY      38
C        Code for both increments equal to 1.                           DAXPY      39
C                                                                       DAXPY      40
C        Clean-up loop.                                                 DAXPY      41
C                                                                       DAXPY      42
   20 M = MOD(N,4)                                                      DAXPY      43
      IF (M .EQ. 0) GO TO 40                                            DAXPY      44
      DO 30 I = 1, M                                                    DAXPY      45
        DY(I) = DY(I) + DA * DX(I)                                      DAXPY      46
   30 CONTINUE                                                          DAXPY      47
      IF (N .LT. 4) RETURN                                              DAXPY      48
   40 MP1 = M + 1                                                       DAXPY      49
      DO 50 I = MP1, N, 4                                               DAXPY      50
        DY(I)   = DY(I)   + DA * DX(I)                                  DAXPY      51
        DY(I+1) = DY(I+1) + DA * DX(I+1)                                DAXPY      52
        DY(I+2) = DY(I+2) + DA * DX(I+2)                                DAXPY      53
        DY(I+3) = DY(I+3) + DA * DX(I+3)                                DAXPY      54
   50 CONTINUE                                                          DAXPY      55
C                                                                       DAXPY      56
      RETURN                                                            DAXPY      57
      END                                                               DAXPY      58
