ddot
C DDOT SOURCE FANDEUR 22/05/02 21:15:03 11359 IMPLICIT INTEGER(I-N) IMPLICIT REAL*8 (A-H,O-Z) -INC PPARAM -INC CCOPTIO * .. Scalar Result .. C C FORMS THE DOT PRODUCT OF TWO VECTORS. C dot <- xT y (T : transpose) C USES UNROLLED LOOPS FOR INCREMENTS EQUAL TO ONE. C JACK DONGARRA, LINPACK, 3/11/78 C MODIFIED 12/3/93, ARRAY(1) DECLARATIONS CHANGED TO ARRAY(*) C C modified 16/2/98 double precision -> real*8 C no unrolled loops : compiler can do that C added error handling C REAL*8 DX(*),DY(*),DTEMP INTEGER I,INCX,INCY,IX,IY,N C DDOT = 0.0D0 DTEMP = 0.0D0 IF(N.LE.0) GOTO 9999 IF(INCX.NE.1.OR.INCY.NE.1) THEN C C CODE FOR UNEQUAL INCREMENTS OR EQUAL INCREMENTS C NOT EQUAL TO 1 C IX = 1 IY = 1 IF(INCX.LT.0)IX = (-N+1)*INCX + 1 IF(INCY.LT.0)IY = (-N+1)*INCY + 1 DO 10 I = 1,N DTEMP = DTEMP + DX(IX)*DY(IY) IX = IX + INCX IY = IY + INCY 10 CONTINUE ELSE C C CODE FOR BOTH INCREMENTS EQUAL TO 1 C DO 30 I = 1, N DTEMP = DTEMP + DX(I)*DY(I) 30 CONTINUE ENDIF C C Normal termination C DDOT = DTEMP RETURN C C Error handling C 9999 CONTINUE WRITE(IOIMP,*) 'dimension lower than 1 transmitted to' WRITE(IOIMP,*) 'function ddot : nil value returned' RETURN C C End of DDOT C END
© Cast3M 2003 - Tous droits réservés.
Mentions légales