1 !--------------------------------------------------------------
3 ! BLAS
/LAPACK
-like subroutines used by the integration algorithms
4 ! It is recommended
to replace them by calls
to the optimized
5 ! BLAS
/LAPACK library
for your machine
7 ! (C
) Adrian Sandu
, Aug
. 2004
8 ! Virginia Polytechnic Institute and State University
9 !--------------------------------------------------------------
12 !--------------------------------------------------------------
13 SUBROUTINE WCOPY
(N
,X
,incX
,Y
,incY
)
14 !--------------------------------------------------------------
15 ! copies a vector
, x
, to a vector
, y
: y
<- x
16 ! only
for incX
=incY
=1
18 ! replace this by the
function from the optimized BLAS implementation
:
19 ! CALL SCOPY
(N
,X
,1,Y
,1) or
CALL DCOPY
(N
,X
,1,Y
,1)
20 !--------------------------------------------------------------
22 INTEGER i
,incX
,incY
,M
,MP1
,N
49 !--------------------------------------------------------------
50 SUBROUTINE WAXPY
(N
,Alpha
,X
,incX
,Y
,incY
)
51 !--------------------------------------------------------------
52 ! constant times a vector plus a vector
: y
<- y
+ Alpha*x
53 ! only
for incX
=incY
=1
55 ! replace this by the
function from the optimized BLAS implementation
:
56 ! CALL SAXPY
(N
,Alpha
,X
,1,Y
,1) or
CALL DAXPY
(N
,Alpha
,X
,1,Y
,1)
57 !--------------------------------------------------------------
59 INTEGER i
,incX
,incY
,M
,MP1
,N
60 KPP_REAL X
(N
),Y
(N
),Alpha
62 PARAMETER( ZERO
= 0.0d0
)
64 IF (Alpha
.EQ
. ZERO
) RETURN
70 Y
(i
) = Y
(i
) + Alpha*X
(i
)
76 Y
(i
) = Y
(i
) + Alpha*X
(i
)
77 Y
(i
+ 1) = Y
(i
+ 1) + Alpha*X
(i
+ 1)
78 Y
(i
+ 2) = Y
(i
+ 2) + Alpha*X
(i
+ 2)
79 Y
(i
+ 3) = Y
(i
+ 3) + Alpha*X
(i
+ 3)
86 !--------------------------------------------------------------
87 SUBROUTINE WSCAL
(N
,Alpha
,X
,incX
)
88 !--------------------------------------------------------------
89 ! constant times a vector
: x
(1:N
) <- Alpha*x
(1:N
)
90 ! only
for incX
=incY
=1
92 ! replace this by the
function from the optimized BLAS implementation
:
93 ! CALL SSCAL
(N
,Alpha
,X
,1) or
CALL DSCAL
(N
,Alpha
,X
,1)
94 !--------------------------------------------------------------
96 INTEGER i
,incX
,M
,MP1
,N
99 PARAMETER( ZERO
= 0.0d0
)
100 PARAMETER( ONE
= 1.0d0
)
102 IF (Alpha
.EQ
. ONE
) RETURN
107 IF (Alpha
.EQ
. (-ONE
)) THEN
111 ELSEIF
(Alpha
.EQ
. ZERO
) THEN
120 IF( N
.LT
. 5 ) RETURN
123 IF (Alpha
.EQ
. (-ONE
)) THEN
131 ELSEIF
(Alpha
.EQ
. ZERO
) THEN
142 X
(i
+ 1) = Alpha*X
(i
+ 1)
143 X
(i
+ 2) = Alpha*X
(i
+ 2)
144 X
(i
+ 3) = Alpha*X
(i
+ 3)
145 X
(i
+ 4) = Alpha*X
(i
+ 4)
151 !--------------------------------------------------------------
152 KPP_REAL
FUNCTION WLAMCH
( C
)
153 !--------------------------------------------------------------
154 ! returns epsilon machine
156 ! replace this by the
function from the optimized LAPACK implementation
:
157 ! CALL SLAMCH
('E') or
CALL DLAMCH
('E')
158 !--------------------------------------------------------------
162 KPP_REAL ONE
, HALF
, Eps
, Sum
163 PARAMETER (ONE
= 1.0d0
)
164 PARAMETER (HALF
= 0.5d0
)
174 CALL WLAMCH_ADD
(ONE
,Eps
,Sum
)
175 IF (Sum
.LE
.ONE
) GOTO 10
177 PRINT*
,'ERROR IN WLAMCH. EPS < ',Eps
188 SUBROUTINE WLAMCH_ADD
( A
, B
, Sum
)
193 !--------------------------------------------------------------