comparison libcruft/arpack/docs/ex-complex.doc @ 12274:9f5d2ef078e8 release-3-4-x

import ARPACK sources to libcruft from Debian package libarpack2 2.1+parpack96.dfsg-3+b1
author John W. Eaton <jwe@octave.org>
date Fri, 28 Jan 2011 14:04:33 -0500
parents
children
comparison
equal deleted inserted replaced
12273:83133b5bf392 12274:9f5d2ef078e8
1 c-----------------------------------------------------------------------
2 c
3 c\Example-1
4 c ... Suppose want to solve A*x = lambda*x in regular mode
5 c ... so OP = A and B = I.
6 c ... Assume "call matvecA(n,x,y)" computes y = A*x
7 c ... Assume exact shifts are used
8 c ...
9 c ido = 0
10 c iparam(7) = 1
11 c
12 c %------------------------------------%
13 c | Beginning of reverse communication |
14 c %------------------------------------%
15 c 10 continue
16 c call _naupd ( ido, 'I', n, which, nev, tol, resid, ncv, v, ldv,
17 c & iparam, ipntr, workd, workl, lworkl, rwork, info )
18 c if (ido .eq. -1 .or. ido .eq. 1) then
19 c call matvecA (n, workd(ipntr(1)), workd(ipntr(2)))
20 c go to 10
21 c end if
22 c %------------------------------%
23 c | End of Reverse communication |
24 c %------------------------------%
25 c
26 c ... call _neupd to postprocess
27 c ... want the Ritz vectors set rvec = .true. else rvec = .false.
28 c call _neupd ( rvec, 'All', select, d, d(1,2), v, ldv,
29 c & sigmar, sigmai, workev, bmat, n, which, nev, tol,
30 c & resid, ncv, v, ldv, iparam, ipntr, workd, workl,
31 c & lworkl, rwork, info )
32 c stop
33 c end
34 c
35 c\Example-2
36 c ... Suppose want to solve A*x = lambda*x in shift-invert mode
37 c ... so OP = inv[A - sigma*I] and B = I
38 c ... Assume "call solve(n,rhs,x)" solves [A - sigma*I]*x = rhs
39 c ... Assume exact shifts are used
40 c ...
41 c ido = 0
42 c iaparam(7) = 3
43 c
44 c %------------------------------------%
45 c | Beginning of reverse communication |
46 c %------------------------------------%
47 c 10 continue
48 c call _naupd ( ido, 'I', n, which, nev, tol, resid, ncv, v, ldv,
49 c & iparam, ipntr, workd, workl, lworkl, rwork, info )
50 c if (ido .eq. -1 .or. ido .eq. 1) then
51 c call solve (n, workd(ipntr(1)), workd(ipntr(2)))
52 c go to 10
53 c end if
54 c %------------------------------%
55 c | End of Reverse communication |
56 c %------------------------------%
57 c
58 c ... call _neupd to postprocess
59 c ... want the Ritz vectors set rvec = .true. else rvec = .false.
60 c call _neupd ( rvec, 'All', select, d, d(1,2), v, ldv,
61 c & sigmar, sigmai, workev, bmat, n, which, nev, tol,
62 c & resid, ncv, v, ldv, iparam, ipntr, workd, workl,
63 c & lworkl, rwork, info )
64 c stop
65 c end
66 c
67 c\Example-3
68 c ... Suppose want to solve A*x = lambda*M*x in regular mode
69 c ... so OP = inv[M]*A and B = M.
70 c ... Assume "call matvecM(n,x,y)" computes y = M*x
71 c ... Assume "call matvecA(n,x,y)" computes y = A*x
72 c ... Assume "call solveM(n,rhs,x)" solves M*x = rhs
73 c ... Assume user will supplied shifts
74 c ...
75 c ido = 0
76 c iparam(7) = 2
77 c
78 c %------------------------------------%
79 c | Beginning of reverse communication |
80 c %------------------------------------%
81 c 10 continue
82 c call _naupd ( ido, 'G', n, which, nev, tol, resid, ncv, v, ldv,
83 c & iparam, ipntr, workd, workl, lworkl, rwork, info )
84 c if (ido .eq. -1 .or. ido .eq. 1) then
85 c call matvecA (n, workd(ipntr(1)), temp_array)
86 c call solveM (n, temp_array, workd(ipntr(2)))
87 c go to 10
88 c else if (ido .eq. 2) then
89 c call matvecM (n, workd(ipntr(1)), workd(ipntr(2)))
90 c go to 10
91 c
92 c ... delete this last conditional if want to use exact shifts
93 c else if (ido .eq. 3) then
94 c ... compute shifts and put in workl starting from the position
95 c ... pointed by ipntr(14).
96 c np = iparam(8)
97 c call scopy (np, shifts, 1, workl(ipntr(14), 1)
98 c go to 10
99 c end if
100 c %------------------------------%
101 c | End of Reverse communication |
102 c %------------------------------%
103 c
104 c ... call _neupd to postprocess
105 c ... want the Ritz vectors set rvec = .true. else rvec = .false.
106 c call _neupd ( rvec, 'All', select, d, d(1,2), v, ldv,
107 c & sigmar, sigmai, workev, bmat, n, which, nev, tol,
108 c & resid, ncv, v, ldv, iparam, ipntr, workd, workl,
109 c & lworkl, rwork, info )
110 c stop
111 c end
112 c
113 c\Example-4
114 c ... Suppose want to solve A*x = lambda*M*x in shift-invert mode
115 c ... so OP = inv[A - sigma*M]*M and B = M
116 c ... Assume "call matvecM(n,x,y)" computes y = M*x
117 c ... Assume "call solve(n,rhs,x)" solves [A - sigma*M]*x = rhs
118 c ... Assume exact shifts are used
119 c ...
120 c ido = 0
121 c iparam(7) = 3
122 c
123 c %------------------------------------%
124 c | Beginning of reverse communication |
125 c %------------------------------------%
126 c 10 continue
127 c call _naupd ( ido, 'G', n, which, nev, tol, resid, ncv, v, ldv,
128 c & iparam, ipntr, workd, workl, lworkl, rwork, info )
129 c if (ido .eq. -1) then
130 c call matvecM (n, workd(ipntr(1)), temp_array)
131 c call solve (n, temp_array, workd(ipntr(2)))
132 c go to 10
133 c else if (ido .eq. 1) then
134 c call solve (n, workd(ipntr(3)), workd(ipntr(2)))
135 c go to 10
136 c else if (ido .eq. 2) then
137 c call matvecM (n, workd(ipntr(1)), workd(ipntr(2)))
138 c go to 10
139 c end if
140 c %------------------------------%
141 c | End of Reverse communication |
142 c %------------------------------%
143 c
144 c ... call _neupd to postprocess
145 c ... want the Ritz vectors set rvec = .true. else rvec = .false.
146 c call _neupd ( rvec, 'All', select, d, d(1,2), v, ldv,
147 c & sigmar, sigmai, workev, bmat, n, which, nev, tol,
148 c & resid, ncv, v, ldv, iparam, ipntr, workd, workl,
149 c & lworkl, rwork, info )
150 c stop
151 c end
152 c\EndDoc