Go to the documentation of this file.00001 COMPLEX FUNCTION CDOTC(N,CX,INCX,CY,INCY)
00002 * .. Scalar Arguments ..
00003 INTEGER INCX,INCY,N
00004 * ..
00005 * .. Array Arguments ..
00006 COMPLEX CX(*),CY(*)
00007 * ..
00008 *
00009 * Purpose
00010 * =======
00011 *
00012 * forms the dot product of two vectors, conjugating the first
00013 * vector.
00014 *
00015 * Further Details
00016 * ===============
00017 *
00018 * jack dongarra, linpack, 3/11/78.
00019 * modified 12/3/93, array(1) declarations changed to array(*)
00020 *
00021 * =====================================================================
00022 *
00023 * .. Local Scalars ..
00024 COMPLEX CTEMP
00025 INTEGER I,IX,IY
00026 * ..
00027 * .. Intrinsic Functions ..
00028 INTRINSIC CONJG
00029 * ..
00030 CTEMP = (0.0,0.0)
00031 CDOTC = (0.0,0.0)
00032 IF (N.LE.0) RETURN
00033 IF (INCX.EQ.1 .AND. INCY.EQ.1) GO TO 20
00034 *
00035 * code for unequal increments or equal increments
00036 * not equal to 1
00037 *
00038 IX = 1
00039 IY = 1
00040 IF (INCX.LT.0) IX = (-N+1)*INCX + 1
00041 IF (INCY.LT.0) IY = (-N+1)*INCY + 1
00042 DO 10 I = 1,N
00043 CTEMP = CTEMP + CONJG(CX(IX))*CY(IY)
00044 IX = IX + INCX
00045 IY = IY + INCY
00046 10 CONTINUE
00047 CDOTC = CTEMP
00048 RETURN
00049 *
00050 * code for both increments equal to 1
00051 *
00052 20 DO 30 I = 1,N
00053 CTEMP = CTEMP + CONJG(CX(I))*CY(I)
00054 30 CONTINUE
00055 CDOTC = CTEMP
00056 RETURN
00057 END