daxpy
C DAXPY SOURCE BP208322 15/10/13 21:15:19 8670 C C CONSTANT TIMES A VECTOR PLUS A VECTOR. C y <- ax + y 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 IMPLICIT INTEGER(I-N) -INC PPARAM -INC CCOPTIO REAL*8 DX(*),DY(*),DA INTEGER I,INCX,INCY,IX,IY,N C IF(N.EQ.0) RETURN IF(N.LT.0) GOTO 9999 IF (DA.EQ.0.0D0) RETURN 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 DY(IY) = DY(IY) + DA*DX(IX) IX = IX + INCX IY = IY + INCY 10 CONTINUE ELSE C C CODE FOR BOTH INCREMENTS EQUAL TO 1 C DO 30 I = 1, N DY(I) = DY(I) + DA*DX(I) 30 CONTINUE ENDIF C C Normal termination C RETURN C C Error handling C 9999 CONTINUE WRITE(IOIMP,*) 'dimension lower than 1',N,' transmitted' WRITE(IOIMP,*) 'to subroutine daxpy : nothing done' RETURN C C End of DAXPY C END
© Cast3M 2003 - Tous droits réservés.
Mentions légales