LAPACK 3.3.0

dscal.f

Go to the documentation of this file.
00001       SUBROUTINE DSCAL(N,DA,DX,INCX)
00002 *     .. Scalar Arguments ..
00003       DOUBLE PRECISION DA
00004       INTEGER INCX,N
00005 *     ..
00006 *     .. Array Arguments ..
00007       DOUBLE PRECISION DX(*)
00008 *     ..
00009 *
00010 *  Purpose
00011 *  =======
00012 *
00013 *     DSCAL scales a vector by a constant.
00014 *     uses unrolled loops for increment equal to one.
00015 *
00016 *  Further Details
00017 *  ===============
00018 *
00019 *     jack dongarra, linpack, 3/11/78.
00020 *     modified 3/93 to return if incx .le. 0.
00021 *     modified 12/3/93, array(1) declarations changed to array(*)
00022 *
00023 *  =====================================================================
00024 *
00025 *     .. Local Scalars ..
00026       INTEGER I,M,MP1,NINCX
00027 *     ..
00028 *     .. Intrinsic Functions ..
00029       INTRINSIC MOD
00030 *     ..
00031       IF (N.LE.0 .OR. INCX.LE.0) RETURN
00032       IF (INCX.EQ.1) GO TO 20
00033 *
00034 *        code for increment not equal to 1
00035 *
00036       NINCX = N*INCX
00037       DO 10 I = 1,NINCX,INCX
00038           DX(I) = DA*DX(I)
00039    10 CONTINUE
00040       RETURN
00041 *
00042 *        code for increment equal to 1
00043 *
00044 *
00045 *        clean-up loop
00046 *
00047    20 M = MOD(N,5)
00048       IF (M.EQ.0) GO TO 40
00049       DO 30 I = 1,M
00050           DX(I) = DA*DX(I)
00051    30 CONTINUE
00052       IF (N.LT.5) RETURN
00053    40 MP1 = M + 1
00054       DO 50 I = MP1,N,5
00055           DX(I) = DA*DX(I)
00056           DX(I+1) = DA*DX(I+1)
00057           DX(I+2) = DA*DX(I+2)
00058           DX(I+3) = DA*DX(I+3)
00059           DX(I+4) = DA*DX(I+4)
00060    50 CONTINUE
00061       RETURN
00062       END
 All Files Functions