-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathzdscal_dev.f90
58 lines (55 loc) · 1.3 KB
/
zdscal_dev.f90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#if defined(__CUDA)
ATTRIBUTES(DEVICE) SUBROUTINE ZDSCAL_XG(N,DA,ZX,INCX)
#else
SUBROUTINE ZDSCAL_XG(N,DA,ZX,INCX)
#endif
!
! -- Reference BLAS level1 routine --
! -- Reference BLAS is a software package provided by Univ. of Tennessee, --
! -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
!
! .. Scalar Arguments ..
DOUBLE PRECISION DA
INTEGER INCX,N
! ..
! .. Array Arguments ..
COMPLEX*16 ZX(*)
! ..
!
! =====================================================================
!
! .. Local Scalars ..
INTEGER I,NINCX
! .. Parameters ..
DOUBLE PRECISION ONE
PARAMETER (ONE=1.0D+0)
! ..
! .. Intrinsic Functions ..
INTRINSIC DBLE, DCMPLX, DIMAG
! ..
#if defined(__CUDA)
ATTRIBUTES(VALUE) :: N,DA,INCX
ATTRIBUTES(DEVICE) :: ZX
#endif
IF (N.LE.0 .OR. INCX.LE.0 .OR. DA.EQ.ONE) RETURN
IF (INCX.EQ.1) THEN
!
! code for increment equal to 1
!
DO I = 1,N
ZX(I) = DCMPLX(DA*DBLE(ZX(I)),DA*DIMAG(ZX(I)))
END DO
ELSE
!
! code for increment not equal to 1
!
NINCX = N*INCX
DO I = 1,NINCX,INCX
ZX(I) = DCMPLX(DA*DBLE(ZX(I)),DA*DIMAG(ZX(I)))
END DO
END IF
RETURN
!
! End of ZDSCAL_XG
!
END