LAPACK 3.3.1
Linear Algebra PACKage
|
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) THEN 00034 * 00035 * code for both increments equal to 1 00036 * 00037 DO I = 1,N 00038 CTEMP = CTEMP + CONJG(CX(I))*CY(I) 00039 END DO 00040 ELSE 00041 * 00042 * code for unequal increments or equal increments 00043 * not equal to 1 00044 * 00045 IX = 1 00046 IY = 1 00047 IF (INCX.LT.0) IX = (-N+1)*INCX + 1 00048 IF (INCY.LT.0) IY = (-N+1)*INCY + 1 00049 DO I = 1,N 00050 CTEMP = CTEMP + CONJG(CX(IX))*CY(IY) 00051 IX = IX + INCX 00052 IY = IY + INCY 00053 END DO 00054 END IF 00055 CDOTC = CTEMP 00056 RETURN 00057 END