| 1 |
c* /////////////////////////////////////////////////////////////////////////// |
| 2 |
c* @file powerd.f |
| 3 |
c* @author Michael Holst |
| 4 |
c* @brief Power and Inverse Power Methods for doing spectral diagnostics. |
| 5 |
c* @version $Id: powerd.f,v 1.2 2010/08/12 05:45:40 fetk Exp $ |
| 6 |
c* @attention |
| 7 |
c* @verbatim |
| 8 |
c* |
| 9 |
c* PMG -- Parallel algebraic MultiGrid |
| 10 |
c* Copyright (C) 1994-- Michael Holst. |
| 11 |
c* |
| 12 |
c* Michael Holst <[email protected]> |
| 13 |
c* University of California, San Diego |
| 14 |
c* Department of Mathematics, 5739 AP&M |
| 15 |
c* 9500 Gilman Drive, Dept. 0112 |
| 16 |
c* La Jolla, CA 92093-0112 USA |
| 17 |
c* http://math.ucsd.edu/~mholst |
| 18 |
c* |
| 19 |
c* This file is part of PMG. |
| 20 |
c* |
| 21 |
c* PMG is free software; you can redistribute it and/or modify |
| 22 |
c* it under the terms of the GNU General Public License as published by |
| 23 |
c* the Free Software Foundation; either version 2 of the License, or |
| 24 |
c* (at your option) any later version. |
| 25 |
c* |
| 26 |
c* PMG is distributed in the hope that it will be useful, |
| 27 |
c* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 28 |
c* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 29 |
c* GNU General Public License for more details. |
| 30 |
c* |
| 31 |
c* You should have received a copy of the GNU General Public License |
| 32 |
c* along with PMG; if not, write to the Free Software |
| 33 |
c* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| 34 |
c* |
| 35 |
c* Linking PMG statically or dynamically with other modules is making a |
| 36 |
c* combined work based on PMG. Thus, the terms and conditions of the GNU |
| 37 |
c* General Public License cover the whole combination. |
| 38 |
c* |
| 39 |
c* SPECIAL GPL EXCEPTION |
| 40 |
c* In addition, as a special exception, the copyright holders of PMG |
| 41 |
c* give you permission to combine the PMG program with free software |
| 42 |
c* programs and libraries that are released under the GNU LGPL or with |
| 43 |
c* code included in releases of ISIM, PMV, PyMOL, SMOL, VMD, and Vision. |
| 44 |
c* Such combined software may be linked with PMG and redistributed together |
| 45 |
c* in original or modified form as mere aggregation without requirement that |
| 46 |
c* the entire work be under the scope of the GNU General Public License. |
| 47 |
c* This special exception permission is also extended to any software listed |
| 48 |
c* in the SPECIAL GPL EXCEPTION clauses by the FEtk and APBS libraries. |
| 49 |
c* |
| 50 |
c* Note that people who make modified versions of PMG are not obligated |
| 51 |
c* to grant this special exception for their modified versions; it is |
| 52 |
c* their choice whether to do so. The GNU General Public License gives |
| 53 |
c* permission to release a modified version without this exception; this |
| 54 |
c* exception also makes it possible to release a modified version which |
| 55 |
c* carries forward this exception. |
| 56 |
c* |
| 57 |
c* @endverbatim |
| 58 |
c* /////////////////////////////////////////////////////////////////////////// |
| 59 |
|
| 60 |
subroutine power(nx,ny,nz,iz,ilev,ipc,rpc,ac,cc, |
| 61 |
2 w1,w2,w3,w4,eigmax,eigmax_model,tol,itmax,iters,iinfo) |
| 62 |
c* ********************************************************************* |
| 63 |
c* purpose: |
| 64 |
c* |
| 65 |
c* standard power method for maximum eigenvalue estimation |
| 66 |
c* of the system matrix A. |
| 67 |
c* |
| 68 |
c* notes: |
| 69 |
c* |
| 70 |
c* to test, note that the 3d laplacean has min/max eigenvalues: |
| 71 |
c* |
| 72 |
c* lambda_min = 6 - 2*dcos(pi/(nx-1)) |
| 73 |
c* - 2*dcos(pi/(ny-1)) |
| 74 |
c* - 2*dcos(pi/(nz-1)) |
| 75 |
c* |
| 76 |
c* lambda_max = 6 - 2*dcos((nx-2)*pi/(nx-1)) |
| 77 |
c* - 2*dcos((ny-2)*pi/(ny-1)) |
| 78 |
c* - 2*dcos((nz-2)*pi/(nz-1)) |
| 79 |
c* |
| 80 |
c* author: michael holst |
| 81 |
c* ********************************************************************* |
| 82 |
implicit none |
| 83 |
integer ipc(*),iz(50,*),ilev,lev,nx,ny,nz,itmax,iters |
| 84 |
integer iinfo,level |
| 85 |
double precision rpc(*),ac(*),cc(*) |
| 86 |
double precision w1(*),w2(*),w3(*),w4(*) |
| 87 |
double precision eigmax,eigmax_model,denom,fac,tol,rho,oldrho |
| 88 |
double precision error,relerr,xnrm2,xdot |
| 89 |
c* |
| 90 |
c* *** some parameters *** |
| 91 |
double precision pi |
| 92 |
pi = 4.0d0 * datan(1.0d0) |
| 93 |
c* |
| 94 |
c* *** recover level information *** |
| 95 |
level = 1 |
| 96 |
lev = (ilev-1)+level |
| 97 |
c* |
| 98 |
c* *** seed vector: random to contain all components *** |
| 99 |
call axrand(nx,ny,nz,w1) |
| 100 |
call azeros(nx,ny,nz,w2) |
| 101 |
call azeros(nx,ny,nz,w3) |
| 102 |
call azeros(nx,ny,nz,w4) |
| 103 |
c* |
| 104 |
c* *** compute raleigh quotient with the seed vector *** |
| 105 |
denom = xnrm2(nx,ny,nz,w1) |
| 106 |
fac = 1.0 / denom |
| 107 |
call xscal(nx,ny,nz,fac,w1) |
| 108 |
call matvec(nx,ny,nz,ipc(iz(5,lev)),rpc(iz(6,lev)), |
| 109 |
2 ac(iz(7,lev)),cc(iz(1,lev)),w1,w2) |
| 110 |
oldrho = xdot(nx,ny,nz,w1,w2) |
| 111 |
c* |
| 112 |
c* *** i/o *** |
| 113 |
if (oldrho .eq. 0.0e0) then |
| 114 |
if (iinfo .gt. 3) then |
| 115 |
write(6,510) 'POWER: iter; estimate = ',iters,oldrho |
| 116 |
510 format('% ',a,i5,1pe11.4) |
| 117 |
endif |
| 118 |
rho = oldrho |
| 119 |
goto 99 |
| 120 |
endif |
| 121 |
c* |
| 122 |
c* *** main iteration *** |
| 123 |
iters = 0 |
| 124 |
20 continue |
| 125 |
iters = iters + 1 |
| 126 |
c* |
| 127 |
c* *** apply the matrix A *** |
| 128 |
call matvec(nx,ny,nz,ipc(iz(5,lev)),rpc(iz(6,lev)), |
| 129 |
2 ac(iz(7,lev)),cc(iz(1,lev)),w1,w2) |
| 130 |
call xcopy(nx,ny,nz,w2,w1) |
| 131 |
c* |
| 132 |
c* *** normalize the new vector *** |
| 133 |
denom = xnrm2(nx,ny,nz,w1) |
| 134 |
fac = 1.0 / denom |
| 135 |
call xscal(nx,ny,nz,fac,w1) |
| 136 |
c* |
| 137 |
c* *** compute the new raleigh quotient *** |
| 138 |
call matvec(nx,ny,nz,ipc(iz(5,lev)),rpc(iz(6,lev)), |
| 139 |
2 ac(iz(7,lev)),cc(iz(1,lev)),w1,w2) |
| 140 |
rho = xdot(nx,ny,nz,w1,w2) |
| 141 |
c* |
| 142 |
c* *** stopping test *** |
| 143 |
c* *** w2=A*x, w1=x, stop = 2-norm(A*x-lamda*x) *** |
| 144 |
call xcopy(nx,ny,nz,w1,w3) |
| 145 |
call xcopy(nx,ny,nz,w2,w4) |
| 146 |
call xscal(nx,ny,nz,rho,w3) |
| 147 |
call xaxpy(nx,ny,nz,(-1.0d0),w3,w4) |
| 148 |
error = xnrm2(nx,ny,nz,w4) |
| 149 |
relerr = dabs( rho - oldrho ) / dabs( rho ) |
| 150 |
c* |
| 151 |
c* *** i/o *** |
| 152 |
if (iinfo .gt. 3) then |
| 153 |
write(6,500) |
| 154 |
2 'POWER: iter; error; relerr; estimate = ', |
| 155 |
3 iters,error,relerr,rho |
| 156 |
500 format('% ',a,i5,2(1pe9.2),1pe11.4) |
| 157 |
endif |
| 158 |
if ((relerr .lt. tol) .or. (iters .eq. itmax)) then |
| 159 |
goto 99 |
| 160 |
endif |
| 161 |
oldrho = rho |
| 162 |
goto 20 |
| 163 |
c* |
| 164 |
c* *** return some stuff *** |
| 165 |
99 continue |
| 166 |
eigmax = rho |
| 167 |
fac = 2.0e0**(ilev-1) |
| 168 |
eigmax_model = fac * (6.0d0 |
| 169 |
2 - 2.0d0*dcos(dble(nx-2)*pi/dble(nx-1)) |
| 170 |
2 - 2.0d0*dcos(dble(ny-2)*pi/dble(ny-1)) |
| 171 |
2 - 2.0d0*dcos(dble(nz-2)*pi/dble(nz-1)) ) |
| 172 |
c* |
| 173 |
c* *** return and end *** |
| 174 |
return |
| 175 |
end |
| 176 |
subroutine ipower(nx,ny,nz,u,iz,w0,w1,w2,w3,w4, |
| 177 |
2 eigmin,eigmin_model,tol,itmax,iters, |
| 178 |
3 nlev,ilev,nlev_real,mgsolv, |
| 179 |
4 iok,iinfo,epsiln,errtol,omega,nu1,nu2,mgsmoo, |
| 180 |
5 ipc,rpc,pc,ac,cc,tru) |
| 181 |
c* ********************************************************************* |
| 182 |
c* purpose: |
| 183 |
c* |
| 184 |
c* standard inverse power method for minimum eigenvalue estimation |
| 185 |
c* of the system matrix A. |
| 186 |
c* |
| 187 |
c* notes: |
| 188 |
c* |
| 189 |
c* to test, note that the 3d laplacean has min/max eigenvalues: |
| 190 |
c* |
| 191 |
c* lambda_min = 6 - 2*dcos(pi/(nx-1)) |
| 192 |
c* - 2*dcos(pi/(ny-1)) |
| 193 |
c* - 2*dcos(pi/(nz-1)) |
| 194 |
c* |
| 195 |
c* lambda_max = 6 - 2*dcos((nx-2)*pi/(nx-1)) |
| 196 |
c* - 2*dcos((ny-2)*pi/(ny-1)) |
| 197 |
c* - 2*dcos((nz-2)*pi/(nz-1)) |
| 198 |
c* |
| 199 |
c* author: michael holst |
| 200 |
c* ********************************************************************* |
| 201 |
implicit none |
| 202 |
c* |
| 203 |
c* *** other declarations *** |
| 204 |
integer ipc(*),iz(50,*),iok,ilev,iinfo,nx,ny,nz |
| 205 |
integer nu1,nu2,mgsmoo,mgsolv |
| 206 |
integer itmax,iters,level,lev,nlev,nlev_real |
| 207 |
double precision epsiln,errtol,omega |
| 208 |
double precision u(*),w0(*) |
| 209 |
double precision w1(*),w2(*),w3(*),w4(*) |
| 210 |
double precision rpc(*),pc(*),ac(*),cc(*),tru(*) |
| 211 |
c* |
| 212 |
c* *** some more *** |
| 213 |
double precision eigmin,eigmin_model,denom,fac,tol,rho,oldrho |
| 214 |
double precision error,relerr,xnrm2,xdot,errtol_s |
| 215 |
integer itmax_s,iters_s,ierror_s,iok_s,iinfo_s,istop_s |
| 216 |
integer nu1_s,nu2_s,mgsmoo_s |
| 217 |
c* |
| 218 |
c* *** some parameters *** |
| 219 |
double precision pi |
| 220 |
pi = 4.0d0 * datan(1.0d0) |
| 221 |
c* |
| 222 |
c* *** recover level information *** |
| 223 |
level = 1 |
| 224 |
lev = (ilev-1)+level |
| 225 |
c* |
| 226 |
c* *** seed vector: random to contain all components *** |
| 227 |
call axrand(nx,ny,nz,w1) |
| 228 |
call azeros(nx,ny,nz,w2) |
| 229 |
call azeros(nx,ny,nz,w3) |
| 230 |
call azeros(nx,ny,nz,w4) |
| 231 |
call azeros(nx,ny,nz,w0(iz(1,lev))) |
| 232 |
call azeros(nx,ny,nz,u(iz(1,lev))) |
| 233 |
c* |
| 234 |
c* *** compute raleigh quotient with the seed vector *** |
| 235 |
denom = xnrm2(nx,ny,nz,w1) |
| 236 |
fac = 1.0 / denom |
| 237 |
call xscal(nx,ny,nz,fac,w1) |
| 238 |
call matvec(nx,ny,nz,ipc(iz(5,lev)),rpc(iz(6,lev)), |
| 239 |
2 ac(iz(7,lev)),cc(iz(1,lev)),w1,w2) |
| 240 |
oldrho = xdot(nx,ny,nz,w1,w2) |
| 241 |
c* |
| 242 |
c* *** i/o *** |
| 243 |
if (oldrho .eq. 0.0e0) then |
| 244 |
if (iinfo .gt. 3) then |
| 245 |
write(6,510) 'IPOWER: iter; estimate = ',iters,oldrho |
| 246 |
510 format('% ',a,i5,1pe11.4) |
| 247 |
endif |
| 248 |
rho = oldrho |
| 249 |
goto 99 |
| 250 |
endif |
| 251 |
c* |
| 252 |
c* *** main iteration *** |
| 253 |
iters = 0 |
| 254 |
20 continue |
| 255 |
iters = iters + 1 |
| 256 |
c* |
| 257 |
c* *** apply the matrix A^{-1} (using MG solver) *** |
| 258 |
itmax_s = 100 |
| 259 |
iters_s = 0 |
| 260 |
ierror_s = 0 |
| 261 |
iok_s = 0 |
| 262 |
iinfo_s = 0 |
| 263 |
istop_s = 0 |
| 264 |
mgsmoo_s = 1 |
| 265 |
nu1_s = 1 |
| 266 |
nu2_s = 1 |
| 267 |
errtol_s = epsiln |
| 268 |
call xcopy(nx,ny,nz,w1,w0(iz(1,lev))) |
| 269 |
call mvcs(nx,ny,nz,u,iz,w1,w2,w3,w4, |
| 270 |
2 istop_s,itmax_s,iters_s,ierror_s, |
| 271 |
3 nlev,ilev,nlev_real,mgsolv, |
| 272 |
4 iok_s,iinfo_s,epsiln,errtol_s,omega,nu1_s,nu2_s,mgsmoo_s, |
| 273 |
5 ipc,rpc,pc,ac,cc,w0,tru) |
| 274 |
call xcopy(nx,ny,nz,u(iz(1,lev)),w1) |
| 275 |
c* |
| 276 |
c* *** normalize the new vector *** |
| 277 |
denom = xnrm2(nx,ny,nz,w1) |
| 278 |
fac = 1.0 / denom |
| 279 |
call xscal(nx,ny,nz,fac,w1) |
| 280 |
c* |
| 281 |
c* *** compute the new raleigh quotient *** |
| 282 |
call matvec(nx,ny,nz,ipc(iz(5,lev)),rpc(iz(6,lev)), |
| 283 |
2 ac(iz(7,lev)),cc(iz(1,lev)),w1,w2) |
| 284 |
rho = xdot(nx,ny,nz,w1,w2) |
| 285 |
c* |
| 286 |
c* *** stopping test *** |
| 287 |
c* *** w2=A*x, w1=x, stop = 2-norm(A*x-lamda*x) *** |
| 288 |
call xcopy(nx,ny,nz,w1,w3) |
| 289 |
call xcopy(nx,ny,nz,w2,w4) |
| 290 |
call xscal(nx,ny,nz,rho,w3) |
| 291 |
call xaxpy(nx,ny,nz,(-1.0d0),w3,w4) |
| 292 |
error = xnrm2(nx,ny,nz,w4) |
| 293 |
relerr = dabs( rho - oldrho ) / dabs( rho ) |
| 294 |
c* |
| 295 |
c* *** i/o *** |
| 296 |
if (iinfo .gt. 3) then |
| 297 |
write(6,500) |
| 298 |
2 'IPOWER: iter; error; relerr; estimate = ', |
| 299 |
3 iters,error,relerr,rho |
| 300 |
500 format('% ',a,i5,2(1pe9.2),1pe11.4) |
| 301 |
endif |
| 302 |
if ((relerr .lt. tol) .or. (iters .eq. itmax)) then |
| 303 |
goto 99 |
| 304 |
endif |
| 305 |
oldrho = rho |
| 306 |
goto 20 |
| 307 |
c* |
| 308 |
c* *** return some stuff *** |
| 309 |
99 continue |
| 310 |
eigmin = rho |
| 311 |
fac = 2.0e0**(ilev-1) |
| 312 |
eigmin_model = fac * (6.0d0 |
| 313 |
2 - 2.0d0*dcos(pi/dble(nx-1)) |
| 314 |
2 - 2.0d0*dcos(pi/dble(ny-1)) |
| 315 |
2 - 2.0d0*dcos(pi/dble(nz-1)) ) |
| 316 |
c* |
| 317 |
c* *** return and end *** |
| 318 |
return |
| 319 |
end |
| 320 |
subroutine mpower(nx,ny,nz,u,iz,w0,w1,w2,w3,w4, |
| 321 |
2 eigmax,tol,itmax,iters, |
| 322 |
3 nlev,ilev,nlev_real,mgsolv, |
| 323 |
4 iok,iinfo,epsiln,errtol,omega,nu1,nu2,mgsmoo, |
| 324 |
5 ipc,rpc,pc,ac,cc,fc,tru) |
| 325 |
c* ********************************************************************* |
| 326 |
c* purpose: |
| 327 |
c* |
| 328 |
c* standard power method for maximimum eigenvalue estimation |
| 329 |
c* of the multigrid operator M. |
| 330 |
c* |
| 331 |
c* author: michael holst |
| 332 |
c* ********************************************************************* |
| 333 |
implicit none |
| 334 |
c* |
| 335 |
c* *** other declarations *** |
| 336 |
integer ipc(*),iz(50,*),iok,ilev,iinfo,nx,ny,nz |
| 337 |
integer nu1,nu2,mgsmoo,mgsolv |
| 338 |
integer itmax,iters,level,lev,nlev,nlev_real |
| 339 |
double precision epsiln,errtol,omega |
| 340 |
double precision u(*),w0(*) |
| 341 |
double precision w1(*),w2(*),w3(*),w4(*) |
| 342 |
double precision rpc(*),pc(*),ac(*),cc(*),fc(*),tru(*) |
| 343 |
c* |
| 344 |
c* *** some more *** |
| 345 |
double precision eigmax,denom,fac,tol,rho,oldrho,error |
| 346 |
double precision relerr,xnrm2,xdot |
| 347 |
integer itmax_s,iters_s,ierror_s,iok_s,iinfo_s,istop_s |
| 348 |
c* |
| 349 |
c* *** recover level information *** |
| 350 |
level = 1 |
| 351 |
lev = (ilev-1)+level |
| 352 |
c* |
| 353 |
c* *** seed vector: random to contain all components *** |
| 354 |
call axrand(nx,ny,nz,w1) |
| 355 |
call azeros(nx,ny,nz,w2) |
| 356 |
call azeros(nx,ny,nz,w3) |
| 357 |
call azeros(nx,ny,nz,w4) |
| 358 |
call azeros(nx,ny,nz,u(iz(1,lev))) |
| 359 |
c* |
| 360 |
c* *** NOTE: we destroy "fc" on this level due to lack of vectors... *** |
| 361 |
call azeros(nx,ny,nz,fc(iz(1,lev))) |
| 362 |
c* |
| 363 |
c* *** normalize the seed vector *** |
| 364 |
denom = xnrm2(nx,ny,nz,w1) |
| 365 |
fac = 1.0 / denom |
| 366 |
call xscal(nx,ny,nz,fac,w1) |
| 367 |
c* |
| 368 |
c* *** compute raleigh quotient with the seed vector *** |
| 369 |
call xcopy(nx,ny,nz,w1,u(iz(1,lev))) |
| 370 |
itmax_s = 1 |
| 371 |
iters_s = 0 |
| 372 |
ierror_s = 0 |
| 373 |
iok_s = 0 |
| 374 |
iinfo_s = 0 |
| 375 |
istop_s = 1 |
| 376 |
call mvcs(nx,ny,nz,u,iz,w0,w2,w3,w4, |
| 377 |
2 istop_s,itmax_s,iters_s,ierror_s, |
| 378 |
3 nlev,ilev,nlev_real,mgsolv, |
| 379 |
4 iok_s,iinfo_s,epsiln,errtol,omega,nu1,nu2,mgsmoo, |
| 380 |
5 ipc,rpc,pc,ac,cc,fc,tru) |
| 381 |
oldrho = xdot(nx,ny,nz,w1,u(iz(1,lev))) |
| 382 |
c* |
| 383 |
c* *** i/o *** |
| 384 |
if (oldrho .eq. 0.0e0) then |
| 385 |
if (iinfo .gt. 3) then |
| 386 |
write(6,510) 'MPOWER: iter; estimate = ',iters,oldrho |
| 387 |
510 format('% ',a,i5,1pe11.4) |
| 388 |
endif |
| 389 |
rho = oldrho |
| 390 |
goto 99 |
| 391 |
endif |
| 392 |
c* |
| 393 |
c* *** main iteration *** |
| 394 |
iters = 0 |
| 395 |
20 continue |
| 396 |
iters = iters + 1 |
| 397 |
c* |
| 398 |
c* *** apply the matrix M *** |
| 399 |
call xcopy(nx,ny,nz,w1,u(iz(1,lev))) |
| 400 |
itmax_s = 1 |
| 401 |
iters_s = 0 |
| 402 |
ierror_s = 0 |
| 403 |
iok_s = 0 |
| 404 |
iinfo_s = 0 |
| 405 |
istop_s = 1 |
| 406 |
call mvcs(nx,ny,nz,u,iz,w1,w2,w3,w4, |
| 407 |
2 istop_s,itmax_s,iters_s,ierror_s, |
| 408 |
3 nlev,ilev,nlev_real,mgsolv, |
| 409 |
4 iok_s,iinfo_s,epsiln,errtol,omega,nu1,nu2,mgsmoo, |
| 410 |
5 ipc,rpc,pc,ac,cc,fc,tru) |
| 411 |
call xcopy(nx,ny,nz,u(iz(1,lev)),w1) |
| 412 |
c* |
| 413 |
c* *** normalize the new vector *** |
| 414 |
denom = xnrm2(nx,ny,nz,w1) |
| 415 |
fac = 1.0 / denom |
| 416 |
call xscal(nx,ny,nz,fac,w1) |
| 417 |
c* |
| 418 |
c* *** compute the new raleigh quotient *** |
| 419 |
call xcopy(nx,ny,nz,w1,u(iz(1,lev))) |
| 420 |
itmax_s = 1 |
| 421 |
iters_s = 0 |
| 422 |
ierror_s = 0 |
| 423 |
iok_s = 0 |
| 424 |
iinfo_s = 0 |
| 425 |
istop_s = 1 |
| 426 |
call mvcs(nx,ny,nz,u,iz,w0,w2,w3,w4, |
| 427 |
2 istop_s,itmax_s,iters_s,ierror_s, |
| 428 |
3 nlev,ilev,nlev_real,mgsolv, |
| 429 |
4 iok_s,iinfo_s,epsiln,errtol,omega,nu1,nu2,mgsmoo, |
| 430 |
5 ipc,rpc,pc,ac,cc,fc,tru) |
| 431 |
call xcopy(nx,ny,nz,u(iz(1,lev)),w2) |
| 432 |
rho = xdot(nx,ny,nz,w1,w2) |
| 433 |
c* |
| 434 |
c* *** stopping test *** |
| 435 |
c* *** w2=A*x, w1=x, stop = 2-norm(A*x-lamda*x) *** |
| 436 |
call xcopy(nx,ny,nz,w1,w3) |
| 437 |
call xcopy(nx,ny,nz,w2,w4) |
| 438 |
call xscal(nx,ny,nz,rho,w3) |
| 439 |
call xaxpy(nx,ny,nz,(-1.0d0),w3,w4) |
| 440 |
error = xnrm2(nx,ny,nz,w4) |
| 441 |
relerr = dabs( rho - oldrho ) / dabs( rho ) |
| 442 |
c* |
| 443 |
c* *** i/o *** |
| 444 |
if (iinfo .gt. 3) then |
| 445 |
write(6,500) |
| 446 |
2 'MPOWER: iter; error; relerr; estimate = ', |
| 447 |
3 iters,error,relerr,rho |
| 448 |
500 format('% ',a,i5,2(1pe9.2),1pe11.4) |
| 449 |
endif |
| 450 |
if ((relerr .lt. tol) .or. (iters .eq. itmax)) then |
| 451 |
goto 99 |
| 452 |
endif |
| 453 |
oldrho = rho |
| 454 |
goto 20 |
| 455 |
c* |
| 456 |
c* *** return some stuff *** |
| 457 |
99 continue |
| 458 |
eigmax = rho |
| 459 |
c* |
| 460 |
c* *** return and end *** |
| 461 |
return |
| 462 |
end |
| 463 |
|