Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6c7a3240d8 | ||
|
|
2a7244b8a3 | ||
|
|
b8ab7a72c4 | ||
|
|
6be238e703 | ||
|
|
12814dc6b1 | ||
|
|
f4d7302a49 | ||
|
|
6f58bb1974 | ||
|
|
af09793e70 | ||
|
|
f4823d97e6 | ||
|
|
282bd42fde | ||
|
|
1278cb1001 | ||
|
|
4002c2733c | ||
|
|
81ed8ef3ec | ||
|
|
db55a7ff41 | ||
|
|
8ecf1be713 | ||
|
|
36eaaf0791 | ||
|
|
5131f792f2 | ||
|
|
04e1b3c9db | ||
|
|
5c81720203 | ||
|
|
98bf1f1ade | ||
|
|
68b2840c63 | ||
|
|
e0d67054f5 | ||
|
|
ce2e69a849 | ||
|
|
f36eb6c75d | ||
|
|
17e6bba6b2 | ||
|
|
90e04f3afa | ||
|
|
13bc40022c | ||
|
|
d280435c25 | ||
|
|
0c655a68cd | ||
|
|
872df83b9e | ||
|
|
d3cec6d67e | ||
|
|
51249ebcfc | ||
|
|
5eafea4328 | ||
|
|
83e6205289 | ||
|
|
08e2368179 | ||
|
|
2683ada680 | ||
|
|
b3f48b7cb7 | ||
|
|
7124d622ab | ||
|
|
5465aee30e | ||
|
|
bf82f61b13 | ||
|
|
e7abe8b42b | ||
|
|
9331036702 | ||
|
|
3ba4dbfbe9 | ||
|
|
1f4c1e0a44 | ||
|
|
a5155ee72b | ||
|
|
7e85cb19ad | ||
|
|
645db9e647 | ||
|
|
9cd6c25cb9 | ||
|
|
c45094c758 | ||
|
|
3b5dab9c93 | ||
|
|
e3a1f97f2a | ||
|
|
5f9bd674b1 | ||
|
|
38902e024c | ||
|
|
c7382178cf | ||
|
|
5cc85ad6f6 | ||
|
|
5c28eac0b3 | ||
|
|
0a655d918d | ||
|
|
51b299cba0 | ||
|
|
47fc83cb37 | ||
|
|
deb47b5682 | ||
|
|
e3bdd3b8db | ||
|
|
7b7ce1a46e | ||
|
|
896df0aa88 | ||
|
|
4345d4af51 | ||
|
|
1da025c2d3 | ||
|
|
a583f7d6a5 | ||
|
|
93a3016fc5 | ||
|
|
068a40817b | ||
|
|
c5e7b021dd | ||
|
|
1d84a81b8f | ||
|
|
d1a29c2947 | ||
|
|
c06ad87196 | ||
|
|
fd1a146fbe | ||
|
|
3914dcbe3b | ||
|
|
b42216cbb6 | ||
|
|
fd2fc43dbc | ||
|
|
f85e91fa99 | ||
|
|
5fbe6161c2 | ||
|
|
d513128421 | ||
|
|
4d5e71774e | ||
|
|
8a129088e1 | ||
|
|
455a0d6966 | ||
|
|
01297eee88 | ||
|
|
ff93cbc53b | ||
|
|
2d097e4a6a | ||
|
|
abc2fabc1c | ||
|
|
a04cf112ea | ||
|
|
4f993fdfe9 | ||
|
|
44554d2094 | ||
|
|
e0c308841e | ||
|
|
e260d411ea | ||
|
|
f475fd9bee | ||
|
|
b350513ddc | ||
|
|
2354e51961 | ||
|
|
e1a003d9ca | ||
|
|
3db367d0ff | ||
|
|
df811f8441 | ||
|
|
a0db6e8593 | ||
|
|
34ab5be34f | ||
|
|
6b752a10ae | ||
|
|
ce58425a01 | ||
|
|
e50818137a | ||
|
|
bb9f75a637 | ||
|
|
2aabeab53a | ||
|
|
82c193b909 | ||
|
|
0692c687cf | ||
|
|
63c1819252 | ||
|
|
745114243c | ||
|
|
dfd801dbc6 | ||
|
|
2803f701e6 | ||
|
|
277e9e56ce | ||
|
|
3b7aca7b26 | ||
|
|
be0c0b07b6 | ||
|
|
61b721932b | ||
|
|
6cd4d53934 | ||
|
|
face704209 | ||
|
|
6491e7774a | ||
|
|
0c883893e8 | ||
|
|
b38933b98c | ||
|
|
124c541c5f | ||
|
|
d3e7f0dab8 | ||
|
|
f1373935ad | ||
|
|
f2a747c98a | ||
|
|
c89b848a20 | ||
|
|
aa20bc5b8e | ||
|
|
fa8a1634a0 | ||
|
|
caaac63f3d | ||
|
|
6952afef4f | ||
|
|
1a1371a166 | ||
|
|
a38b411291 | ||
|
|
2ddb03cf46 | ||
|
|
a5b0573808 | ||
|
|
4e02e69902 | ||
|
|
8a97c96134 | ||
|
|
984335a15a | ||
|
|
160b572315 | ||
|
|
6dcecc8eef | ||
|
|
4a12554877 | ||
|
|
07739ac229 | ||
|
|
259a1596a5 | ||
|
|
5c988b0f41 | ||
|
|
addf1b0906 | ||
|
|
d153dffb80 | ||
|
|
03b65e5169 | ||
|
|
79204e9713 | ||
|
|
35bffac439 | ||
|
|
7438db1327 | ||
|
|
6d5ded77f9 | ||
|
|
cfdb5f680f | ||
|
|
ad82dcbc0b | ||
|
|
3dd2d5fe97 | ||
|
|
2535b97caf | ||
|
|
0c22019c6c | ||
|
|
6b04aa4bcc | ||
|
|
5100a99c1a | ||
|
|
1eff779f74 | ||
|
|
1cfa486a50 | ||
|
|
77b451835e | ||
|
|
e7fac50201 | ||
|
|
9418632214 | ||
|
|
3f7b86adde | ||
|
|
4bc2349330 | ||
|
|
7098047b71 | ||
|
|
1ae541f4a1 | ||
|
|
531d24c41f | ||
|
|
6fa8b271c0 | ||
|
|
21db0cd83a | ||
|
|
8a46621c64 | ||
|
|
6e2893f17f | ||
|
|
6254162e2e | ||
|
|
c0725738d7 | ||
|
|
c43cb86854 | ||
|
|
92787d9bcc | ||
|
|
dbe1582b5f | ||
|
|
f40f5f92ff | ||
|
|
10fb0c301c | ||
|
|
f5aead95fd | ||
|
|
c34f762fcd | ||
|
|
f670e731b7 | ||
|
|
a26b727bc4 | ||
|
|
1dab774991 | ||
|
|
6615574e37 | ||
|
|
8fe4734da8 | ||
|
|
dfc8abd708 | ||
|
|
a98f85544f | ||
|
|
5fff9efa5c | ||
|
|
7ae47646d4 | ||
|
|
e10f589232 | ||
|
|
9112422e3b | ||
|
|
3596f02a3e | ||
|
|
bc5cb025c8 | ||
|
|
6657ca2cca | ||
|
|
fee44e613d | ||
|
|
ad9f74b962 | ||
|
|
a580f6fc10 | ||
|
|
2dc21c1af9 | ||
|
|
a1a08e6eea | ||
|
|
92828f62e1 | ||
|
|
661fcdac82 | ||
|
|
e99054735d | ||
|
|
7317371abd | ||
|
|
c957f8c43e | ||
|
|
56c2791dc6 | ||
|
|
1e0348423e | ||
|
|
3d3bcd0c49 | ||
|
|
e67badf1e2 | ||
|
|
998b89840e | ||
|
|
16e331abf3 | ||
|
|
8a17cea5b7 | ||
|
|
13716fe86e | ||
|
|
fce1d44d96 | ||
|
|
aa970cefa6 | ||
|
|
2c1f6ebb5b | ||
|
|
8840cfdf43 | ||
|
|
aff1edc46a | ||
|
|
f18f8fa322 | ||
|
|
94dd13dc2c | ||
|
|
703fb580a4 | ||
|
|
95360d81d6 | ||
|
|
8f95a7d772 | ||
|
|
60cea47bd6 | ||
|
|
9e7ceb7480 | ||
|
|
e7ad0850a1 | ||
|
|
ee9a93a853 | ||
|
|
2d969e902d | ||
|
|
5872987e67 | ||
|
|
bbb87ba0ff | ||
|
|
78d781286a | ||
|
|
3829c449c0 | ||
|
|
b7ce7debe5 | ||
|
|
31854cadaf | ||
|
|
deb35559a6 | ||
|
|
cdfb08aac2 | ||
|
|
f532cc06a1 | ||
|
|
c61bb2c16a | ||
|
|
eb9d23dd3f | ||
|
|
68a420889c | ||
|
|
277a6c8cfe | ||
|
|
2fede344e2 | ||
|
|
e7e50bbc1b | ||
|
|
a4eaab6952 | ||
|
|
7a123870b2 | ||
|
|
e74e01dfc6 | ||
|
|
9db8c86fdf | ||
|
|
7f7c6fd93d | ||
|
|
26b936ba17 | ||
|
|
a48e17f7af | ||
|
|
63bde34786 | ||
|
|
449dc71690 | ||
|
|
a50b68b48d | ||
|
|
ccd45494a8 | ||
|
|
6194e09c65 | ||
|
|
390a4457cf | ||
|
|
9c9affa982 | ||
|
|
2333f73976 | ||
|
|
278774b072 | ||
|
|
d5153b941f | ||
|
|
34a81d09fb | ||
|
|
834c9c53e3 | ||
|
|
079ca38ee6 | ||
|
|
74784a5309 | ||
|
|
d7deefda82 | ||
|
|
534d6272d8 | ||
|
|
69f5411c1c | ||
|
|
9f6945657c | ||
|
|
33024f7d78 | ||
|
|
39258b58d4 | ||
|
|
f686312826 | ||
|
|
9ffcb48193 | ||
|
|
194be499be | ||
|
|
4db49c4687 | ||
|
|
aaa357d96d | ||
|
|
b521af291d | ||
|
|
d67b323399 | ||
|
|
18e6709a2b | ||
|
|
87178d7ce1 | ||
|
|
76b5c5017a | ||
|
|
2652660765 | ||
|
|
5829df36a7 | ||
|
|
be538c87c2 | ||
|
|
22d1b3b0b5 | ||
|
|
64f3c1b8dc | ||
|
|
a9c71f3180 | ||
|
|
533b9487b0 | ||
|
|
40ed22e42f | ||
|
|
449ae6b95a | ||
|
|
ececcc167b | ||
|
|
2ed9d33a13 | ||
|
|
edce634363 | ||
|
|
442e2ee534 | ||
|
|
431d45b5a2 | ||
|
|
5360fb7885 | ||
|
|
f3974f9720 | ||
|
|
4d26789a53 | ||
|
|
a07c391906 | ||
|
|
930b29d6ce | ||
|
|
c92f5d63d4 | ||
|
|
95997a6cf0 | ||
|
|
cf62285f34 | ||
|
|
e78134a671 | ||
|
|
72163e85b8 | ||
|
|
df740d197f | ||
|
|
3073998f84 | ||
|
|
b347211d95 | ||
|
|
84bd771150 | ||
|
|
f8754b29bc | ||
|
|
54c8e0b18c | ||
|
|
b52efe5f2c | ||
|
|
4985c11b19 | ||
|
|
6c1bd3053d | ||
|
|
2daaeaf2e9 | ||
|
|
7bdcee1b23 | ||
|
|
946dc3db7b | ||
|
|
70af492b6f | ||
|
|
264603d284 | ||
|
|
6752fbca20 | ||
|
|
7fc42e5f77 | ||
|
|
3e841c8b13 | ||
|
|
f14261dcb0 | ||
|
|
d04bdf19b9 | ||
|
|
cd6366097d | ||
|
|
db1d49b60f | ||
|
|
1d912add4f | ||
|
|
ebe3091d8e | ||
|
|
2f721dbade | ||
|
|
0e7d01d34b | ||
|
|
59bd5543e9 | ||
|
|
da46ff3d4b | ||
|
|
282fe8aa79 | ||
|
|
19ac60166b | ||
|
|
79f7ecc4ed | ||
|
|
771cbbd9c8 | ||
|
|
c5102cd602 | ||
|
|
6fd243b674 | ||
|
|
be3a61cfee | ||
|
|
7a91e3a665 | ||
|
|
5820b39ade | ||
|
|
616a91547d | ||
|
|
9233f7f86f | ||
|
|
81ef2f1a54 | ||
|
|
5705571117 | ||
|
|
c7bd8e70bc | ||
|
|
2279a76924 | ||
|
|
26e31ba431 | ||
|
|
0e2ed1b2f2 | ||
|
|
9631eb8b5f | ||
|
|
b16d8700a8 | ||
|
|
747a7d811f | ||
|
|
f9927db4cf | ||
|
|
00a6affb9b | ||
|
|
7ec2f3e7e5 | ||
|
|
fdbf8ffe98 | ||
|
|
eaeaebbc7d | ||
|
|
bbf870f3e7 | ||
|
|
6aeef41c11 | ||
|
|
1b42f88e11 | ||
|
|
b0e2a14258 | ||
|
|
b8aa09a548 | ||
|
|
b4ed4cadd1 | ||
|
|
3c6c210dc4 | ||
|
|
08a6349ff7 | ||
|
|
4a3502b11f | ||
|
|
d1cd023783 | ||
|
|
70a97f8f22 | ||
|
|
a9ab2a11af | ||
|
|
cc2466c635 | ||
|
|
a3ce584000 | ||
|
|
894faaa243 | ||
|
|
54f244612e | ||
|
|
bdaab9995a | ||
|
|
d66b8b4b0a | ||
|
|
56e6e9f763 | ||
|
|
b55cc59146 | ||
|
|
a0b3de6b82 | ||
|
|
a97e5c53b4 | ||
|
|
0e19885160 | ||
|
|
69ff75af05 | ||
|
|
5f47b8df2e | ||
|
|
f4f5173864 | ||
|
|
c9ace29448 | ||
|
|
86df5b062e | ||
|
|
7fc73aae63 | ||
|
|
1131e093af | ||
|
|
c6e5122c8e | ||
|
|
3d94a2cd3d | ||
|
|
d8f2020144 | ||
|
|
33a3efd6ee | ||
|
|
ddfd843e29 | ||
|
|
29e06320f6 | ||
|
|
e8267ce709 | ||
|
|
337ab26e85 | ||
|
|
01b5490e68 | ||
|
|
30a3e266e4 | ||
|
|
a3379944dc | ||
|
|
5a16aaf287 | ||
|
|
f0c4d81627 | ||
|
|
cdbce13db0 | ||
|
|
08cea42566 | ||
|
|
99ef033832 | ||
|
|
6a6f8528cd | ||
|
|
0704e64ff4 | ||
|
|
7bbfb50ad7 | ||
|
|
639e42a5ca | ||
|
|
5e0617f859 | ||
|
|
e511e06a33 | ||
|
|
664123a8d6 | ||
|
|
ceda2ef405 | ||
|
|
6c859f2e67 | ||
|
|
db90ad5881 | ||
|
|
8f020e2715 | ||
|
|
16b445ec08 | ||
|
|
b0f7a6008f | ||
|
|
5c2d41f710 | ||
|
|
5c020ea005 | ||
|
|
99ab5a9a29 | ||
|
|
e0a4cbbaec | ||
|
|
36be08bf41 | ||
|
|
afacb275c5 | ||
|
|
34882f42c4 | ||
|
|
82de5c6bed | ||
|
|
f571587ddf | ||
|
|
333a5e4f33 | ||
|
|
5b475d1c1c | ||
|
|
9568032129 | ||
|
|
2268b7bf82 | ||
|
|
04a138eb68 | ||
|
|
a29e13bd15 | ||
|
|
93d6e45696 | ||
|
|
c71a0fd5a7 | ||
|
|
b553f707d2 | ||
|
|
77028b5853 | ||
|
|
0a8dac28c4 | ||
|
|
5cd31c69d4 | ||
|
|
513d2088c3 | ||
|
|
ca1acab481 | ||
|
|
2d0900d503 | ||
|
|
e1fd52ac21 | ||
|
|
18b8c25fee | ||
|
|
ddaa55d8b8 | ||
|
|
0a8e936c7a | ||
|
|
607877d0b2 | ||
|
|
36f8d20f0f | ||
|
|
595618eebc | ||
|
|
872b44c592 | ||
|
|
8600fd13e4 | ||
|
|
8a6d23a38f | ||
|
|
ad373111a0 | ||
|
|
60777efcad | ||
|
|
a6395d059d | ||
|
|
1f6cf9d86a | ||
|
|
209bc9967b | ||
|
|
ff75ef2384 | ||
|
|
fe9b38df33 | ||
|
|
c8dda4c1e7 | ||
|
|
23e4995054 | ||
|
|
4eab7e3a60 | ||
|
|
4e72fd240f | ||
|
|
ce36b0e26e | ||
|
|
7b8343c9af | ||
|
|
8fc8fbe349 | ||
|
|
393e0c85a7 | ||
|
|
671a410c8e | ||
|
|
b8c7fdb000 | ||
|
|
6b9c613db7 | ||
|
|
793da95cb6 | ||
|
|
f1fe1b7427 | ||
|
|
97fbcbf6aa | ||
|
|
cbb0bf599d | ||
|
|
d783b264da | ||
|
|
ff8c6d325f | ||
|
|
0dee07b43c | ||
|
|
3ab47c9e81 | ||
|
|
2e58090484 | ||
|
|
8a82ceaa0a | ||
|
|
ab45bdb757 | ||
|
|
1371fd6bf8 | ||
|
|
d3796928af | ||
|
|
cdfee6183f | ||
|
|
f28b75cf5d | ||
|
|
b0693f6bcd | ||
|
|
e90e4f65c4 | ||
|
|
9fe0e320ee | ||
|
|
30ee9d7c3d | ||
|
|
616222b89b | ||
|
|
8446648c95 | ||
|
|
ca8f3fc66c | ||
|
|
aa5cc620ec | ||
|
|
9e319b3c1a | ||
|
|
29d8cbe63f | ||
|
|
c124f0c2fc | ||
|
|
0fea7c6990 | ||
|
|
1ae47e63dd | ||
|
|
94200e60c0 | ||
|
|
343b151f12 | ||
|
|
072f08e313 | ||
|
|
8b60cd295c | ||
|
|
c1264cfef0 | ||
|
|
972038c699 | ||
|
|
0d0437a758 | ||
|
|
a6848a5c6c | ||
|
|
2a3d8f7494 | ||
|
|
c555cdd10c | ||
|
|
b437a82d17 | ||
|
|
7ff6566790 | ||
|
|
6243c08d44 | ||
|
|
6365c9e931 | ||
|
|
d33ff2e405 | ||
|
|
5c89955f38 | ||
|
|
bf328ccd96 | ||
|
|
3d4e6942ea | ||
|
|
5744ca1e18 | ||
|
|
e2538f38f1 | ||
|
|
79526a1c62 | ||
|
|
d108516fd6 | ||
|
|
b43a0eda6f | ||
|
|
49887a41b0 | ||
|
|
7a25d0f10c | ||
|
|
576120a26c | ||
|
|
168aaf5a3f | ||
|
|
b4b959850e | ||
|
|
37120660f3 | ||
|
|
30fca4c6c1 | ||
|
|
628e80b2ec | ||
|
|
7834970e92 | ||
|
|
1e814091ff | ||
|
|
b105070b63 | ||
|
|
171f59a65a | ||
|
|
434a1a002a | ||
|
|
9edcf7a494 | ||
|
|
81ce8ecb6d | ||
|
|
2523fb7df5 | ||
|
|
36aaa0570f | ||
|
|
3c470ca5a2 | ||
|
|
75fb014285 | ||
|
|
7625b2456e | ||
|
|
b3d2f34a82 | ||
|
|
bf945c1837 | ||
|
|
933c31a183 | ||
|
|
e315ec7419 | ||
|
|
9a1658d77d | ||
|
|
f4e816d4d2 | ||
|
|
db18628436 | ||
|
|
9b99af7e6b | ||
|
|
8a69318bb7 | ||
|
|
a8b99df06d | ||
|
|
cd7c6b4379 | ||
|
|
beaad2654c | ||
|
|
4ade42ebd7 | ||
|
|
78b7d449b4 | ||
|
|
7c791977a1 | ||
|
|
2d3cdaf9e5 | ||
|
|
a8e958e2d8 | ||
|
|
fea0aabce0 | ||
|
|
4c8e2ecc9e | ||
|
|
eeae72a071 | ||
|
|
2bcad73e6c | ||
|
|
9f77178d43 | ||
|
|
30b8cc4cd4 |
@@ -0,0 +1 @@
|
||||
BasedOnStyle: Google
|
||||
@@ -0,0 +1,39 @@
|
||||
## Expected behavior
|
||||
|
||||
Do this.
|
||||
|
||||
## Actual behavior
|
||||
|
||||
Do that.
|
||||
|
||||
## Where/how to reproduce the problem
|
||||
|
||||
- arpack-ng: release or commit (SHA)
|
||||
- OS: debian ? ubuntu ? mac ?...
|
||||
- compiler: gcc ? intel ? clang ? version ?...
|
||||
- environment: export FFLAGS ?...
|
||||
- configure: ./configure --enable-stuff ? cmake -DSTUFFS=ON ?
|
||||
- input data ?
|
||||
|
||||
## Steps to reproduce the problem
|
||||
|
||||
-
|
||||
-
|
||||
-
|
||||
|
||||
## Error message
|
||||
|
||||
Bad stuff.
|
||||
|
||||
## Traces
|
||||
|
||||
~/arpack-ng> tail -n 300 test-suite.log
|
||||
|
||||
~/arpack-ng/build> tail -n 300 Testing/Temporary/LastTest.log
|
||||
|
||||
## Callstack
|
||||
|
||||
(gdb) bt
|
||||
|
||||
## Notes, remarks
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
## Pull request purpose
|
||||
|
||||
fixing issue #xx ? enhancement ? new feature ?...
|
||||
|
||||
## Detailed changes proposed in this pull request
|
||||
|
||||
-
|
||||
-
|
||||
-
|
||||
@@ -0,0 +1,293 @@
|
||||
name: arpack-ng
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
ubuntu_latest_cmake:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Clone and check out repository code
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: ${{github.event.pull_request.head.ref}} # Branch where changes are implemented.
|
||||
repository: ${{github.event.pull_request.head.repo.full_name}} # Repo where changes are implemented.
|
||||
- name: Check commit
|
||||
run: |
|
||||
git log -1
|
||||
- name: Update OS
|
||||
run: sudo apt-get update
|
||||
- name: Install apt-get dependencies
|
||||
run: sudo apt-get install -y gfortran gcc g++ openmpi-bin libopenmpi-dev libblas-dev liblapack-dev libeigen3-dev cmake
|
||||
- name: Run job
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -DEXAMPLES=ON -DMPI=ON -DICB=ON -DICBEXMM=ON ..
|
||||
make all
|
||||
CTEST_OUTPUT_ON_FAILURE=1 make test
|
||||
make package_source
|
||||
ubuntu_latest_cmake_install:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Clone and check out repository code
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: ${{github.event.pull_request.head.ref}} # Branch where changes are implemented.
|
||||
repository: ${{github.event.pull_request.head.repo.full_name}} # Repo where changes are implemented.
|
||||
- name: Check commit
|
||||
run: |
|
||||
git log -1
|
||||
- name: Update OS
|
||||
run: sudo apt-get update
|
||||
- name: Install apt-get dependencies
|
||||
run: sudo apt-get install -y gfortran gcc g++ openmpi-bin libopenmpi-dev libblas-dev liblapack-dev cmake
|
||||
- name: Run job
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
cmake ..
|
||||
bash ./tstCMakeInstall.sh
|
||||
bash ./tstCMakeInstall.sh 64-
|
||||
bash ./tstCMakeInstall.sh -ILP64
|
||||
bash ./tstCMakeInstall.sh 64-ILP64
|
||||
ubuntu_latest_autotools:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Clone and check out repository code
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: ${{github.event.pull_request.head.ref}} # Branch where changes are implemented.
|
||||
repository: ${{github.event.pull_request.head.repo.full_name}} # Repo where changes are implemented.
|
||||
- name: Check commit
|
||||
run: |
|
||||
git log -1
|
||||
- name: Update OS
|
||||
run: sudo apt-get update
|
||||
- name: Install apt-get dependencies
|
||||
run: sudo apt-get install -y gfortran gcc g++ openmpi-bin libopenmpi-dev libblas-dev liblapack-dev libeigen3-dev automake autoconf pkg-config libtool
|
||||
- name: Run job
|
||||
run: |
|
||||
./bootstrap
|
||||
./configure --enable-mpi --enable-icb --enable-icbexmm
|
||||
make all
|
||||
make check
|
||||
make distcheck
|
||||
ubuntu_latest_autotools_install:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Clone and check out repository code
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: ${{github.event.pull_request.head.ref}} # Branch where changes are implemented.
|
||||
repository: ${{github.event.pull_request.head.repo.full_name}} # Repo where changes are implemented.
|
||||
- name: Check commit
|
||||
run: |
|
||||
git log -1
|
||||
- name: Update OS
|
||||
run: sudo apt-get update
|
||||
- name: Install apt-get dependencies
|
||||
run: sudo apt-get install -y gfortran gcc g++ openmpi-bin libopenmpi-dev libblas-dev liblapack-dev automake autoconf pkg-config libtool
|
||||
- name: Run job
|
||||
run: |
|
||||
./bootstrap
|
||||
./configure
|
||||
bash ./tstAutotoolsInstall.sh
|
||||
bash ./tstAutotoolsInstall.sh 64-
|
||||
bash ./tstAutotoolsInstall.sh -ILP64
|
||||
bash ./tstAutotoolsInstall.sh 64-ILP64
|
||||
ubuntu_latest_cmake_python:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Clone and check out repository code
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: ${{github.event.pull_request.head.ref}} # Branch where changes are implemented.
|
||||
repository: ${{github.event.pull_request.head.repo.full_name}} # Repo where changes are implemented.
|
||||
- name: Check commit
|
||||
run: |
|
||||
git log -1
|
||||
- name: Update OS
|
||||
run: sudo apt-get update
|
||||
- name: Install apt-get dependencies
|
||||
run: sudo apt-get install -y gfortran gcc g++ openmpi-bin libopenmpi-dev libblas-dev liblapack-dev cmake libeigen3-dev
|
||||
- name: Install python dependencies
|
||||
run: sudo apt-get -y install python3-minimal python3-pip python3-numpy
|
||||
- name: Build boost-python for python3 (not provided by apt-cache)
|
||||
run : |
|
||||
sudo apt-get -y install wget
|
||||
wget https://sourceforge.net/projects/boost/files/boost/1.79.0/boost_1_79_0.tar.gz
|
||||
tar -xf boost_1_79_0.tar.gz
|
||||
cd boost_1_79_0
|
||||
./bootstrap.sh --with-libraries=python --with-python=/usr/bin/python3 --with-toolset=gcc
|
||||
sudo ./b2 toolset=gcc install
|
||||
sudo apt-get install locate
|
||||
sudo updatedb
|
||||
- name: Run job
|
||||
run: |
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -DEXAMPLES=ON -DMPI=ON -DICB=ON -DICBEXMM=ON -DPYTHON3=ON ..
|
||||
make all
|
||||
CTEST_OUTPUT_ON_FAILURE=1 make test
|
||||
ubuntu_latest_autotools_ilp64:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Clone and check out repository code
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: ${{github.event.pull_request.head.ref}} # Branch where changes are implemented.
|
||||
repository: ${{github.event.pull_request.head.repo.full_name}} # Repo where changes are implemented.
|
||||
- name: Check commit
|
||||
run: |
|
||||
git log -1
|
||||
- name: Update OS
|
||||
run: sudo apt-get update
|
||||
- name: Install apt-get dependencies
|
||||
run: sudo apt-get install -y gfortran gcc g++ openmpi-bin libopenmpi-dev libblas-dev liblapack-dev automake autoconf pkg-config libtool libeigen3-dev
|
||||
- name: Install Intel MKL (ILP64 blas/lapack)
|
||||
run: echo yes | sudo apt-get -y install intel-mkl libmkl-dev
|
||||
- name: Run job
|
||||
run: |
|
||||
./bootstrap
|
||||
./configure --enable-icb --with-blas=mkl_gf_ilp64 --with-lapack=mkl_gf_ilp64
|
||||
make all
|
||||
make check
|
||||
env:
|
||||
FFLAGS: "-DMKL_ILP64 -I/usr/include/mkl"
|
||||
FCFLAGS: "-DMKL_ILP64 -I/usr/include/mkl"
|
||||
LIBS: "-Wl,--no-as-needed -L/usr/lib/x86_64-linux-gnu -lmkl_sequential -lmkl_core -lpthread -lm -ldl"
|
||||
INTERFACE64: "1"
|
||||
macos_latest_cmake:
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- name: Clone and check out repository code
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: ${{github.event.pull_request.head.ref}} # Branch where changes are implemented.
|
||||
repository: ${{github.event.pull_request.head.repo.full_name}} # Repo where changes are implemented.
|
||||
- name: Check commit
|
||||
run: |
|
||||
git log -1
|
||||
- name: Install brew dependencies
|
||||
run: |
|
||||
brew reinstall gcc # brings gfortran on path
|
||||
brew install cmake mpich
|
||||
- name: Run job
|
||||
run: |
|
||||
mkdir -p build
|
||||
cd build
|
||||
export FC=mpif90 # Uses gfortran.
|
||||
export FFLAGS="-ff2c -fno-second-underscore"
|
||||
export CC=mpicc # Uses clang.
|
||||
export CFLAGS="-Qunused-arguments"
|
||||
export CXX=mpic++ # Uses clang++.
|
||||
export CXXFLAGS="-Qunused-arguments"
|
||||
LIBS="-framework Accelerate" cmake -DBLA_VENDOR=Generic -DEXAMPLES=ON -DICB=ON -DMPI=ON ..
|
||||
make all
|
||||
CTEST_OUTPUT_ON_FAILURE=1 make test
|
||||
macos_latest_cmake_python:
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- name: Clone and check out repository code
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: ${{github.event.pull_request.head.ref}} # Branch where changes are implemented.
|
||||
repository: ${{github.event.pull_request.head.repo.full_name}} # Repo where changes are implemented.
|
||||
- name: Check commit
|
||||
run: |
|
||||
git log -1
|
||||
- name: Install brew dependencies
|
||||
run: |
|
||||
# Unlink and re-link to prevent errors when github mac runner images
|
||||
# install python outside of brew, for example:
|
||||
# https://github.com/orgs/Homebrew/discussions/3895
|
||||
# https://github.com/actions/setup-python/issues/577
|
||||
# https://github.com/actions/runner-images/issues/6459
|
||||
# https://github.com/actions/runner-images/issues/6507
|
||||
# https://github.com/actions/runner-images/issues/2322
|
||||
brew list -1 | grep python | while read formula; do brew unlink $formula; brew link --overwrite $formula; done
|
||||
brew reinstall gcc # brings gfortran on path
|
||||
brew install cmake eigen boost-python3 python3
|
||||
pip3 install numpy
|
||||
- name: Run job
|
||||
run: |
|
||||
mkdir -p build
|
||||
cd build
|
||||
export FC=gfortran
|
||||
export FFLAGS="-ff2c -fno-second-underscore"
|
||||
export CC=clang
|
||||
export CFLAGS="-Qunused-arguments"
|
||||
export CXX=clang++
|
||||
export CXXFLAGS="-Qunused-arguments"
|
||||
LIBS="-framework Accelerate" cmake -DBLA_VENDOR=Generic -DEXAMPLES=ON -DICB=ON -DPYTHON3=ON ..
|
||||
make all
|
||||
CTEST_OUTPUT_ON_FAILURE=1 make test
|
||||
macos_latest_autotools:
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- name: Clone and check out repository code
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: ${{github.event.pull_request.head.ref}} # Branch where changes are implemented.
|
||||
repository: ${{github.event.pull_request.head.repo.full_name}} # Repo where changes are implemented.
|
||||
- name: Check commit
|
||||
run: |
|
||||
git log -1
|
||||
- name: Install brew dependencies
|
||||
run: |
|
||||
brew reinstall gcc # brings gfortran on path
|
||||
brew install autoconf automake libtool pkg-config mpich
|
||||
- name: Run job
|
||||
run: |
|
||||
./bootstrap
|
||||
LIBS="-framework Accelerate" FFLAGS="-ff2c -fno-second-underscore" FCFLAGS="-ff2c -fno-second-underscore" ./configure --enable-icb --enable-mpi
|
||||
make all
|
||||
make check
|
||||
windows_latest_cmake:
|
||||
runs-on: windows-latest
|
||||
defaults:
|
||||
run:
|
||||
# Use MSYS2 as default shell
|
||||
shell: msys2 {0}
|
||||
steps:
|
||||
- name: Install MSYS2 build environment
|
||||
uses: msys2/setup-msys2@v2
|
||||
with:
|
||||
update: true
|
||||
msystem: MINGW64
|
||||
install: >-
|
||||
base-devel
|
||||
git
|
||||
mingw-w64-x86_64-cmake
|
||||
mingw-w64-x86_64-ninja
|
||||
mingw-w64-x86_64-gcc-fortran
|
||||
mingw-w64-x86_64-openblas
|
||||
mingw-w64-x86_64-msmpi
|
||||
- name: Install MS-MPI (for mpiexec)
|
||||
uses: mpi4py/setup-mpi@v1
|
||||
- name: Clone and check out repository code
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
ref: ${{github.event.pull_request.head.ref}} # Branch where changes are implemented.
|
||||
repository: ${{github.event.pull_request.head.repo.full_name}} # Repo where changes are implemented.
|
||||
- name: Check commit
|
||||
run: |
|
||||
git log -1
|
||||
- name: Run job
|
||||
run: |
|
||||
mkdir -p build && cd build
|
||||
cmake -GNinja -DICB=ON -DEXAMPLES=ON -DMPI=ON ..
|
||||
cmake --build . -v
|
||||
- name: Run tests
|
||||
run: |
|
||||
export PATH="/c/Program Files/Microsoft MPI/Bin":$PATH # add mpiexec to msys2 path
|
||||
cd build
|
||||
ctest --output-on-failure
|
||||
+69
-8
@@ -1,14 +1,71 @@
|
||||
*.o
|
||||
*.lo
|
||||
Makefile
|
||||
*.la
|
||||
.libs/
|
||||
SRC/.libs/
|
||||
UTIL/.libs/
|
||||
.hgignore
|
||||
|
||||
# Generated by `autoreconf`
|
||||
Makefile.in
|
||||
aclocal.m4
|
||||
configure
|
||||
autom4te.cache/
|
||||
build-aux/
|
||||
m4/libtool.m4
|
||||
m4/lt*.m4
|
||||
|
||||
# Generated by `./configure`
|
||||
Makefile
|
||||
config.log
|
||||
config.status
|
||||
libtool
|
||||
.deps/
|
||||
arpack*.pc
|
||||
parpack*.pc
|
||||
arpackSolver*.pc
|
||||
arpackdef.h
|
||||
arpackicb.h
|
||||
tstAutotoolsInstall.sh
|
||||
|
||||
# Generated by `make`
|
||||
.dirstamp
|
||||
*.o
|
||||
*.mod
|
||||
*.lo
|
||||
*.la
|
||||
.libs/
|
||||
|
||||
# CMake build directories
|
||||
BUILD
|
||||
Build
|
||||
build
|
||||
|
||||
# Generated by `make check`
|
||||
*.log
|
||||
*.trs
|
||||
TESTS/dnsimp
|
||||
TESTS/bug_1315_double
|
||||
TESTS/bug_1315_single
|
||||
TESTS/bug_1323
|
||||
TESTS/bug_58_double
|
||||
TESTS/bug_79_double_complex
|
||||
TESTS/icb_arpack_c
|
||||
TESTS/icb_arpack_cpp
|
||||
TESTS/bug_142
|
||||
TESTS/bug_142_gen
|
||||
EXAMPLES/BAND/[sd][sn]bdr[123456]
|
||||
EXAMPLES/BAND/[cz]nbdr[1234]
|
||||
EXAMPLES/COMPLEX/[cz]ndrv[1234]
|
||||
EXAMPLES/NONSYM/[sd]ndrv[123456]
|
||||
EXAMPLES/SIMPLE/[sd]ssimp
|
||||
EXAMPLES/SIMPLE/[sdcz]nsimp
|
||||
EXAMPLES/SVD/[sd]svd
|
||||
EXAMPLES/SYM/[sd]sdrv[123456]
|
||||
EXAMPLES/MATRIX_MARKET/arpackmm
|
||||
EXAMPLES/MATRIX_MARKET/arpackSolver.resid.out
|
||||
EXAMPLES/MATRIX_MARKET/arpackSolver.v.out
|
||||
PARPACK/EXAMPLES/MPI/p[sd]ndrv[13]
|
||||
PARPACK/EXAMPLES/MPI/p[sd]sdrv1
|
||||
PARPACK/EXAMPLES/MPI/p[cz]ndrv1
|
||||
PARPACK/TESTS/MPI/icb_parpack_c
|
||||
PARPACK/TESTS/MPI/icb_parpack_cpp
|
||||
PARPACK/TESTS/MPI/issue46
|
||||
|
||||
*.lib
|
||||
*.def
|
||||
*.dll
|
||||
@@ -17,4 +74,8 @@ libtool
|
||||
*.u2d
|
||||
*.suo
|
||||
VISUAL_STUDIO/Release MKL/
|
||||
VISUAL_STUDIO/bin/
|
||||
VISUAL_STUDIO/bin/
|
||||
|
||||
# Temporary files
|
||||
*~
|
||||
\#*#
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
syntax: glob
|
||||
|
||||
.gitignore
|
||||
|
||||
Makefile
|
||||
|
||||
*.o
|
||||
*.lo
|
||||
*.la
|
||||
.libs/
|
||||
SRC/.libs/
|
||||
UTIL/.libs/
|
||||
arpack.pc
|
||||
autom4te.cache/
|
||||
config.log
|
||||
config.status
|
||||
libtool
|
||||
*.lib
|
||||
*.def
|
||||
*.dll
|
||||
*.bak
|
||||
*.exp
|
||||
*.u2d
|
||||
*.suo
|
||||
VISUAL_STUDIO/Release MKL/
|
||||
VISUAL_STUDIO/bin/
|
||||
TESTS/dnsimp
|
||||
PARPACK/EXAMPLES/MPI/pcndrv1
|
||||
PARPACK/EXAMPLES/MPI/pdndrv1
|
||||
PARPACK/EXAMPLES/MPI/pdndrv3
|
||||
PARPACK/EXAMPLES/MPI/pdsdrv1
|
||||
PARPACK/EXAMPLES/MPI/psndrv3
|
||||
PARPACK/EXAMPLES/MPI/pssdrv1
|
||||
PARPACK/EXAMPLES/MPI/pzndrv1
|
||||
@@ -0,0 +1,8 @@
|
||||
pull_request_rules:
|
||||
- name: automatic merge on CI success and review
|
||||
conditions:
|
||||
- status-success=continuous-integration/travis-ci/pr
|
||||
- "#approved-reviews-by>=1"
|
||||
actions:
|
||||
merge:
|
||||
method: merge
|
||||
@@ -1,3 +1,388 @@
|
||||
-- Franck Houssen <fghoussen@users.noreply.github.com> Sat, 11 Feb 2023 13:52:57 +0100
|
||||
|
||||
arpack-ng - 3.9.0
|
||||
|
||||
[ Vikas Sharma ]
|
||||
* Improve README.
|
||||
|
||||
[ Fabien Péan ]
|
||||
* CI: Enable job `windows_latest_cmake` to run all tests
|
||||
* CMake: Fix BLAS and LAPACK static library order needed to consume the library on Windows with static linkage
|
||||
* Fix using ARPACK on Windows with MSVC compiler from C++17 onwards
|
||||
|
||||
[ Zhentao Wang ]
|
||||
* [BUG FIX] parpack.h and parpack.hpp: type of rwork should be real instead of complex.
|
||||
* Allow ritz_option {"LR", "SR", "LI", "SI"} for complex eigenvalue problems in ICB.
|
||||
|
||||
[ Jose E. Roman ]
|
||||
* Avoid using isnan() in tests, since is GNU-specific
|
||||
|
||||
[ Tom Payerle ]
|
||||
* Change the continuation line format for stat.h, debug.h
|
||||
|
||||
[ John Doe ]
|
||||
* Avoid calling [c|z]dotc for better portability on macOS
|
||||
|
||||
[ Dima Pasechnik ]
|
||||
* [BUG FIX] autotools: replace obsolete AC_TRY_COMPILE macros.
|
||||
* Support for NAG's nagfor Fortran compiler
|
||||
|
||||
[ Franck Houssen ]
|
||||
* Create one .cmake file per arpack-ng flavor (32-bits, 64-bits, ILP64).
|
||||
* Test autotools pkg-config (*.pc files) with/without LIBSUFFIX/ITF64SUFFIX.
|
||||
* Test CMake find_package (*.cmake files) with/without LIBSUFFIX/ITF64SUFFIX.
|
||||
* [BUG FIX] autotools: ICB must be checked first (MPI changes compilers).
|
||||
* [BUG FIX] BLAS/LAPACK: allow suffixes in case BLAS/LAPACK can not provide ICB.
|
||||
* [BUG FIX] Compile C programs with ICB.
|
||||
* arpackmm: command line bug fix.
|
||||
* arpackmm: restart bug fix.
|
||||
* pyarpack: fix compilation warning, test on macos and latest boost-python (1.79).
|
||||
* arpackSolver: fix error messages.
|
||||
* [BUG FIX] Make sure iseed is always initialized to values allowed by lapack ?larnv.
|
||||
* [BUG FIX] According to lapack doc of ?larnv, iseed(4) must be odd.
|
||||
* [BUG FIX] Use MPI ICB types (mpi_f08) instead of integer(kind=i_int).
|
||||
* parpack: no ILP64 support.
|
||||
|
||||
[ Haoyang Liu ]
|
||||
* CMake: minimum required version changed to 3.0
|
||||
* CMake: add C99 standard checking
|
||||
* CI: Support for centos7 added.
|
||||
* CI: Add `scripts/travis_centos.sh` for centos builds
|
||||
|
||||
[ Robert Schütz ]
|
||||
* use CMAKE_INSTALL_FULL_<dir> in arpack.pc
|
||||
|
||||
[ Markus Mützel ]
|
||||
* CMake: Handle libraries without "lib" prefix.
|
||||
* CMake: Don't override BLAS/LAPACK/MPI flags. Directly use results from the Find* modules instead.
|
||||
|
||||
[ Juan José García-Ripoll ]
|
||||
* Adapt the C/C++ interface to accept also MSVC's non-standard complex types.
|
||||
* Propagate dependencies to CMake targets that use arpack-ng:
|
||||
- Create CMake-generated targets and configuration files that keep track of
|
||||
arpack's dependencies (libraries, directories) and expose them to users.
|
||||
- Install those files under ${prefix}/lib/cmake/arpackng* so that arpack can be
|
||||
found using 'find_package(arpackng)' from CMake files.
|
||||
- Add code to the arpackng-config.cmake to find required dependencies when this
|
||||
module is loaded by find_package(arpackng).
|
||||
|
||||
-- Sylvestre Ledru <sylvestre@debian.org> Mon, 07 Dec 2020 11:37:40 +0100
|
||||
|
||||
arpack-ng - 3.8.0
|
||||
|
||||
[ Myron Oikonomakis ]
|
||||
* [BUG FIX]: bmat return "G" instead of "B" for generalized matrix in arpack.hpp
|
||||
* [BUG FIX]: pass arrays of chars as scalar in fortran calls in order not to crash
|
||||
* when calling subroutines through icb interface
|
||||
|
||||
[ Izaak "Zaak" Beekman ]
|
||||
* [BUG FIX]: fix 'Unknown CMake command "check_symbol_exists".' when ICB=ON.
|
||||
|
||||
[ Franck Houssen ]
|
||||
* CI: Support for Mac OS X added in automation (GNU + "-ff2c -fno-second-underscore" options).
|
||||
* CI: Support for centos added in automation.
|
||||
* CI: Support for opensuse added in automation.
|
||||
* arpackSolver/arpackmm: switch eigen version to 3.3.
|
||||
* [BUG FIX] fix arpackdef.h (resp. arpackicb.h) must be included only by C/C++ (resp. F77/F90).
|
||||
* [BUG FIX] iparam/ipntr sizes may change depending on cases.
|
||||
* pyarpack: python binding based on Boost.Python.Numpy exposing C++ API.
|
||||
* [CLEAN] arpackSolver API: more convenient, suppress template parameters when possible.
|
||||
* [BUG FIX] ICB using rvec/select: rvec/select turned to integer
|
||||
bool should be, but, is not always supported (depend on compiler, options).
|
||||
* extract arpackSolver.hpp from arpakmm.cpp.
|
||||
* arpackmm: add --slvItrPC option (PC: Jacobi, ILU).
|
||||
* arpackmm: add --slv LLT LDLT (for SPD matrices).
|
||||
* arpackmm: add --simplePrec option (to enable use of s*upd).
|
||||
* arpackmm: add --dense option.
|
||||
* autotools: provide *.cmake files (in addition to *.pc file).
|
||||
* [BUG FIX] ILP64 support: using debug_c and stat_c.
|
||||
* [BUG FIX] fix check precision which may fail with some ATLAS versions.
|
||||
|
||||
[ Kyle Guinn ]
|
||||
* [BUG FIX]: fix 'eval: Syntax error: "(" unexpected' error at build time.
|
||||
* Only build shared libraries by default. To build static libraries, use
|
||||
--enable-static (autotools) or -DBUILD_SHARED_LIBS=OFF (cmake).
|
||||
* Add parpack.pc and arpackSolver.pc.
|
||||
|
||||
[ David Schwörer ]
|
||||
* Support of gfortran 10
|
||||
|
||||
-- Sylvestre Ledru <sylvestre@debian.org> Mon, 07 Dec 2020 11:35:57 +0100
|
||||
|
||||
arpack-ng - 3.7.0
|
||||
|
||||
[ Franck Houssen ]
|
||||
* [BUG FIX] ICB: missing workev for *[ds]neupd (real+not-sym) => API/ABI change for *[ds]neupd_c.
|
||||
* [BUG FIX] autotools - make distcheck: fix circular dependencies.
|
||||
* arpackmm: utility to test arpack with matrix market files.
|
||||
* ICB: add ILP64 support.
|
||||
The idea is:
|
||||
- autoheader/cmake generates arpackdef.h/arpackicb.h from arpackdef.h.in/arpackicb.h.in
|
||||
- in C/C++ files: arpackdef.h defines a_int according to architecture.
|
||||
- in F77/F90 files: arpackicb.h defines i_int to architecture.
|
||||
- MPI does not support ILP64: integer*4 must be imposed in all
|
||||
calls involving MPI (f90 example/test code).
|
||||
To enable ILP64 users to compile/link, arpackdef.h/arpackicb.h is added in
|
||||
the arpack installation (make install).
|
||||
|
||||
[ Kyle Guinn ]
|
||||
* Autoconf/Automake simplifications and fixes.
|
||||
* Simplify the generation of arpackdef.h.
|
||||
|
||||
-- Sylvestre Ledru <sylvestre@debian.org> Sat, 12 Jan 2019 16:24:00 +0100
|
||||
|
||||
arpack-ng - 3.6.3
|
||||
|
||||
[ Franck Houssen ]
|
||||
* Add Fortran common initialization (block data).
|
||||
|
||||
[ Marco Caliari ]
|
||||
* Give up forcing the initial residual to be in the range of the operator OP after a restart (Closes: #142).
|
||||
|
||||
-- Sylvestre Ledru <sylvestre@debian.org> Wed, 19 Sep 2018 09:59:59 +0200
|
||||
|
||||
arpack-ng - 3.6.2
|
||||
|
||||
* Remove all trailing whitespaces
|
||||
|
||||
[ Franck Houssen ]
|
||||
* Install: move headers into a dedicated directory (local/include/arpack).
|
||||
(Closes #126)
|
||||
* Add configuration summary.
|
||||
* Improve the flag detection. Hopefully fix the ppc64el and other archs
|
||||
issues in Debian
|
||||
|
||||
-- Sylvestre Ledru <sylvestre@debian.org> Sat, 23 Jun 2018 14:56:54 +0200
|
||||
|
||||
arpack-ng - 3.6.1
|
||||
|
||||
[ Ruslan Kabatsayev ]
|
||||
* Fix a regression on i386 and other archs (Closes #123)
|
||||
|
||||
-- Sylvestre Ledru <sylvestre@debian.org> Thu Jun 7 21:41:16 2018 +0200
|
||||
|
||||
arpack-ng - 3.6.0
|
||||
|
||||
[ Franck Houssen ]
|
||||
* Add support for ISO_C_BINDING (Fortran 2003) for ARPACK, PARPACK (Fortran <-> C/C++).
|
||||
ARPACK: example of C/Fortran binding can be found in the TESTS/icb_arpack_c.c file.
|
||||
ARPACK: example of C++/Fortran binding can be found in the TESTS/icb_arpack_cpp.cpp file.
|
||||
PARPACK: example of C/Fortran binding can be found in the PARPACK/TESTS/MPI/icb_parpack_c.c file.
|
||||
PARPACK: example of C++/Fortran binding can be found in the PARPACK/TESTS/MPI/icb_parpack_cpp.cpp file.
|
||||
DEBUG: add support for debug.
|
||||
STAT: add support for statistics (timers, nb operations, ...).
|
||||
* Provide tarball generation using cmake (cpack).
|
||||
* Provide find_package for (cmake) users to find arpack-ng.
|
||||
|
||||
[ Denis Davydov ]
|
||||
* Rename pslamch to pslamch10 to avoid symbol collision with Scalapack 2.0.2 in MPI context.
|
||||
|
||||
[ Kyle Guinn ]
|
||||
* Autoconf cleanup; move generated files to the build-aux subdirectory.
|
||||
|
||||
[ Marco Caliari ]
|
||||
* Force the initial residual to be in the range of the operator OP in the standard case, too (Closes: #79).
|
||||
|
||||
[ Sylvestre Ledru ]
|
||||
* Add coverage information to improve testing: https://coveralls.io/github/opencollab/arpack-ng
|
||||
|
||||
[ Darcy Beurle]
|
||||
* Add C++11 interface through arpack.hpp and parpack.hpp
|
||||
* Rewrite C++ examples / tests demonstrating new C++11 interface
|
||||
* Pre-C++11 interface available through arpack.h and parpack.h
|
||||
|
||||
-- Sylvestre Ledru <sylvestre@debian.org> Mon, 30 Oct 2017 14:21:48 +0200
|
||||
|
||||
arpack-ng - 3.5.0
|
||||
|
||||
[ Julien Schueller ]
|
||||
* Improve cmake build system: disable C++ detection, set default build type.
|
||||
|
||||
[ Marco Atzeri]
|
||||
* Use AC_PROG_FC instead of AC_PROG_F77 for proper inizialization
|
||||
for the usage of AC_FC_LINE_LENGTH. Noted on Cygwin.
|
||||
|
||||
[ Denis Davydov ]
|
||||
* Improve cmake build system: add make install and fix shared libraries.
|
||||
|
||||
[ Zhang Z ]
|
||||
* fix usages of DLACPY to not alias inputs
|
||||
(patch from https://software.intel.com/en-us/articles/how-to-resolve-arpack-issues-with-intel-mkl-110-update-3)
|
||||
|
||||
[ Iskakov Sergei ]
|
||||
* Fix possible deadlock when PARPACK call uses communicator with a larger
|
||||
number of CPUs than previous call
|
||||
|
||||
[ Kyle Guinn ]
|
||||
* Portability improvements to the autotools build system.
|
||||
* Let cmake guess the default installation directories. Can be
|
||||
overridden by changing CMAKE_INSTALL_LIBDIR and CMAKE_INSTALL_BINDIR.
|
||||
* Shared libraries built by cmake now have their SONAME set identical to
|
||||
those built by autotools.
|
||||
|
||||
[ Marco Caliari ]
|
||||
* Avoid purification stage in [d,s]neupd.f if it requires division
|
||||
by zero (Closes: #58)
|
||||
|
||||
-- Sylvestre Ledru <sylvestre@debian.org> Mon, 15 May 2017 14:21:48 +0200
|
||||
|
||||
arpack-ng - 3.4.0
|
||||
|
||||
[ Milan Bouchet-Valat ]
|
||||
* Allow adding suffixes to symbols and library names to build ILP64 version
|
||||
based on ILP64 BLAS/LAPACK with suffixes. This avoids conflicts when loading
|
||||
libraries with different integer sizes in the same program.
|
||||
|
||||
[ Martin Reuter ]
|
||||
* Add the support of cmake build system
|
||||
|
||||
-- Sylvestre Ledru <sylvestre@debian.org> Sat, 02 Jul 2016 21:51:52 +0200
|
||||
|
||||
arpack-ng - 3.3.0
|
||||
|
||||
[ Denis Davydov ]
|
||||
* Rename pdlamch to pdlamch10 to avoid symbol collision with Scalapack 2.0.2 in MPI context.
|
||||
|
||||
[ Kyle Guinn ]
|
||||
* General improvements on the build system
|
||||
* libparpack links against libarpack (instead of doing a static link)
|
||||
|
||||
[ Guillaume Horel ]
|
||||
* reverts using {d,s}lahqr from lapack 2
|
||||
* use dlahqr from lapack 3 instead of dlaqrb (credit to Marco Caliari)
|
||||
|
||||
-- Sylvestre Ledru <sylvestre@debian.org> Mon, 12 October 2015 08:40:51 +0200
|
||||
|
||||
arpack-ng - 3.2.0
|
||||
|
||||
* Switch to github - https://github.com/opencollab/arpack-ng/
|
||||
|
||||
* Fix dsneupd select/calculate wrong eigenpairs if rvec = true
|
||||
by using dlahqr and slahqr from lapack2 (Closes: #3)
|
||||
|
||||
-- Sylvestre Ledru <sylvestre@debian.org> Sat, 14 Nov 2014 16:25:36 +0200
|
||||
|
||||
arpack-ng - 3.1.5
|
||||
|
||||
* Build all examples and run them as tests
|
||||
|
||||
* Fix the version of arpack-ng itself
|
||||
|
||||
* Switch to automake 1.14.1
|
||||
|
||||
[ Ruediger Meier ]
|
||||
* Do not install test binaries (Closes: #1348)
|
||||
|
||||
[ Nikita Styopin ]
|
||||
* Fix the diagonal matrix example (dndrv5) (Closes: #1397)
|
||||
|
||||
-- Sylvestre Ledru <sylvestre@debian.org> Sat, 15 Feb 2014 14:24:42 +0200
|
||||
|
||||
arpack-ng - 3.1.4
|
||||
|
||||
* libparpack2: missing dependency on MPI:
|
||||
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=718790
|
||||
|
||||
* Replace LAPACK second function with ARPACK's own arscnd in PARPACK
|
||||
|
||||
* Fix issue #1259 in DSEUPD and SSEUPD
|
||||
The Ritz vector purification step assumes workl(iq) still contains the
|
||||
original Q matrix. This is however overwritten by the call to xGEQR2
|
||||
earlier.
|
||||
.
|
||||
This patch fixes the issue by making a copy of the last row of the
|
||||
eigenvector matrix, after it is recomputed after QR by xORM2R. The work
|
||||
space WORKL(IW+NCV:IW+2*NCV) is not used later in the routine, and can
|
||||
be used for this.
|
||||
|
||||
* Use configure supplied blas and lapack in the pkg-config.
|
||||
Thanks to Ward Poelmans (Closes: #1320)
|
||||
|
||||
* Switch to automake 1.14 + libtool 2.4.2.
|
||||
Thanks to Ward Poelmans (Closes: #1321)
|
||||
|
||||
* dseupd routine may lead to a segmentation fault
|
||||
Thanks to Edouard Canot (Closes: #1323)
|
||||
|
||||
* dsaupd and 'BE' option returns wrong eigenvalues for a SPD matrix
|
||||
Thanks to Edouard Canot (Closes: #1329)
|
||||
|
||||
-- Sylvestre Ledru <sylvestre.ledru@scilab-enterprises.com> Mon, 07 Oct 2013 14:24:42 +0200
|
||||
|
||||
arpack-ng - 3.1.3
|
||||
|
||||
[ Jordi Gutiérrez Hermoso ]
|
||||
* Replace depcomp symlink with actual file.
|
||||
* Update libtool usage. Thanks to John W. Eaton <jwe@octave.org>.
|
||||
* Replace arpack.pc with proper autotooled arpack.pc.in
|
||||
* Add debug.h to TESTS/Makefile.am sources
|
||||
|
||||
* "make dist" is functional
|
||||
* Also build the library "libparpacksrcblacs" (PARPACK/UTIL/BLACS/)
|
||||
|
||||
-- Sylvestre Ledru <sylvestre.ledru@scilab-enterprises.com> Tue, 02 Apr 2013 10:53:08 +0200
|
||||
|
||||
arpack-ng - 3.1.2
|
||||
|
||||
* Wrong call to pdlamch was causing segfaults
|
||||
Thanks to Kyrre Sjøbæk for finding the bug and the fix.
|
||||
* Get rid of the mpif.h occurrences in the source code (Closes: #782)
|
||||
* Compile also PARPACK / MPI example (Closes: #783)
|
||||
* Configure detected built-in LAPACK and BLAS, but refused to use them
|
||||
(Closes: #784)
|
||||
* Fixed division by zero in smlnum by using p[d,s]lamch instead of the
|
||||
serial. Thanks to Umberto De Giovannini.
|
||||
|
||||
-- Sylvestre Ledru <sylvestre.ledru@scilab-enterprises.com> Fri, 22 Jun 2012 22:05:41 +0200
|
||||
|
||||
arpack-ng - 3.1.1
|
||||
|
||||
* Option --enable-maintainer-mode added to the configure
|
||||
* --disable-mpi disables the build of parpack (Closes: #714)
|
||||
* Switch to automake 1.11.3
|
||||
|
||||
-- Sylvestre Ledru <sylvestre.ledru@scilab-enterprises.com> Mon, 21 May 2012 09:08:41 +0200
|
||||
|
||||
arpack-ng - 3.1.0
|
||||
|
||||
* Many bug fixes in the parpack lib. It is an old patch from upstream.
|
||||
Thanks to Viral Shah for pinging us on this subject.
|
||||
See the PARPACK_CHANGES file for the details.
|
||||
* Change the bug report from arpack@caam.rice.edu to
|
||||
http://forge.scilab.org/index.php/p/arpack-ng/issues/
|
||||
* Provide a M4 macro (detect_arpack_bug.m4) to check if the underlying
|
||||
arpack is buggy (ie not arpack-ng). This allows developer applications
|
||||
to perform the check in their autotools build system (configure).
|
||||
* Fixed a lack of appropriate bounds check in DNAUP2. Thanks to Pauli Virtanen
|
||||
for the patch (Closes: #632)
|
||||
* Update of the doc about TOL in dnaupd.
|
||||
* Reorder bug fixed when eigenvectors are requested and the resulting
|
||||
number of converged eigenvalues is less than the number requested.
|
||||
Patches from Tim Mitchell. (Closes: #664)
|
||||
* TESTS/ directory added and built.
|
||||
|
||||
-- Sylvestre Ledru <sylvestre.ledru@scilab-enterprises.com> Wed, 22 Feb 2012 10:58:39 +0100
|
||||
|
||||
arpack-ng - 3.0.2
|
||||
|
||||
* Fix a long line in pznaup2.f which was showing some wrong symbols
|
||||
(Closes: #620)
|
||||
* README content updated regarding ARPACK-NG
|
||||
* arpack.pc (pkg-config) file added
|
||||
* Update the title & version in the configure.ac
|
||||
* Always search for MPILIBS (in order to have the variable correctly set)
|
||||
* Explicitly link against MPI fortran libs for parpack
|
||||
|
||||
-- Sylvestre Ledru <sylvestre.ledru@scilab-enterprises.com> Wed, 28 Dec 2011 13:45:53 +0100
|
||||
|
||||
arpack-ng - 3.0.1
|
||||
|
||||
* libtool was missing (Closes: #615)
|
||||
* Missing license information (Closes: #614)
|
||||
* TODO added
|
||||
|
||||
-- Sylvestre Ledru <sylvestre.ledru@scilab-enterprises.com> Tue, 13 Dec 2011 16:33:25 +0100
|
||||
|
||||
arpack-ng - 3.0
|
||||
|
||||
* Patches from Scilab
|
||||
@@ -5,8 +390,8 @@ arpack-ng - 3.0
|
||||
second_NONE works with all fortrans compilers (used by default with Scilab)
|
||||
|
||||
sneupd.f, cneupd.f: modified for scilab add a check on nconv value (Scilab bug fix)
|
||||
dnaupd.f: modified NEV Integer: INPUT/OUTPUT before only INPUT (Scilab bug fix)
|
||||
|
||||
dnaupd.f: modified NEV Integer: INPUT/OUTPUT before only INPUT (Scilab bug fix)
|
||||
|
||||
* Patches from Octave: (Thanks to John W. EATON)
|
||||
dneupd.f: Restore value of nconv
|
||||
dseupd.f: Restore value of nconv
|
||||
|
||||
+969
@@ -0,0 +1,969 @@
|
||||
cmake_minimum_required(VERSION 3.0)
|
||||
|
||||
if (NOT DEFINED CMAKE_BUILD_TYPE)
|
||||
set (CMAKE_BUILD_TYPE Release CACHE STRING "Build type")
|
||||
endif ()
|
||||
|
||||
project(arpack C Fortran)
|
||||
|
||||
set(arpack_ng_MAJOR_VERSION 3)
|
||||
set(arpack_ng_MINOR_VERSION 9)
|
||||
set(arpack_ng_PATCH_VERSION 0)
|
||||
set(arpack_ng_VERSION ${arpack_ng_MAJOR_VERSION}.${arpack_ng_MINOR_VERSION}.${arpack_ng_PATCH_VERSION})
|
||||
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake)
|
||||
|
||||
# set C99 standard
|
||||
set(CMAKE_C_STANDARD 99)
|
||||
set(CMAKE_C_STANDARD_REQUIRED True)
|
||||
|
||||
# Adopted from https://github.com/feymark/arpack.git
|
||||
|
||||
if (POLICY CMP0042)
|
||||
# enable MACOSX_RPATH by default
|
||||
cmake_policy (SET CMP0042 NEW)
|
||||
endif ()
|
||||
|
||||
option(BUILD_SHARED_LIBS "Build shared libraries instead of static libraries" ON)
|
||||
option(MPI "Enable parallel support" OFF)
|
||||
option(ICB "Enable support for *[ae]upd_c with ISO_C_BINDING" OFF)
|
||||
option(ICBEXMM "Enable support for matrix market example based on ICB" OFF)
|
||||
option(PYTHON3 "Enable python3 support" OFF)
|
||||
set(BOOST_PYTHON_LIBSUFFIX "" CACHE STRING "suffix to add to custom boost python libs")
|
||||
option(EXAMPLES "Compile ARPACK examples" OFF)
|
||||
option(TESTS "Compile ARPACK tests" ON)
|
||||
|
||||
# Suffixes: LIBSUFFIX modify ONLY libraries names, ITF64SUFFIX modify BOTH libraries AND include directory names.
|
||||
set(LIBSUFFIX ""
|
||||
CACHE STRING "suffix to add to ARPACK libraries names")
|
||||
set(ITF64SUFFIX ""
|
||||
CACHE STRING "suffix to add to ARPACK include directory and libraries names (use with INTERFACE64)")
|
||||
set(SYMBOLSUFFIX ""
|
||||
CACHE STRING "suffix to add to ARPACK, BLAS and LAPACK function names")
|
||||
option(INTERFACE64 "use the 64-bit integer interface (ILP64) for ARPACK, BLAS and LAPACK")
|
||||
|
||||
# 'make install' to the correct location, and also define
|
||||
# paths for target_include_directories and target_link_libraries
|
||||
include(GNUInstallDirs)
|
||||
set(ARPACK_INSTALL_INCLUDEDIR "${CMAKE_INSTALL_INCLUDEDIR}/arpack-ng${ITF64SUFFIX}")
|
||||
set(ARPACK_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/arpackng${LIBSUFFIX}${ITF64SUFFIX}")
|
||||
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
||||
|
||||
function(prefixlist list_name prefix)
|
||||
set(${list_name}_TMP)
|
||||
foreach(l ${${list_name}})
|
||||
list(APPEND ${list_name}_TMP ${prefix}${l} )
|
||||
endforeach()
|
||||
set(${list_name} "${${list_name}_TMP}" PARENT_SCOPE)
|
||||
endfunction(prefixlist)
|
||||
|
||||
function(examples list_name)
|
||||
foreach(l ${${list_name}})
|
||||
get_filename_component(lwe ${l} NAME_WE)
|
||||
add_executable(${lwe} ${arpackexample_DIR}/${l} ${examples_EXTRA_SRCS})
|
||||
target_link_libraries(${lwe} arpack BLAS::BLAS LAPACK::LAPACK ${EXTRA_LDFLAGS})
|
||||
add_test(NAME "${lwe}_ex" COMMAND ${lwe})
|
||||
endforeach()
|
||||
endfunction(examples)
|
||||
|
||||
function(pexamples list_name)
|
||||
foreach(l ${${list_name}})
|
||||
get_filename_component(lwe ${l} NAME_WE)
|
||||
add_executable(${lwe} ${parpackexample_DIR}/${l} )
|
||||
target_link_libraries(${lwe} parpack arpack MPI::MPI_Fortran)
|
||||
add_test(NAME "${lwe}_ex" COMMAND mpiexec -n 2 ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${lwe})
|
||||
endforeach()
|
||||
endfunction(pexamples)
|
||||
|
||||
if (PYTHON3)
|
||||
enable_language(C CXX) # Boost requirement.
|
||||
set(CMAKE_CXX_STANDARD 14) # Boost requirement.
|
||||
|
||||
find_package(PythonInterp 3 REQUIRED)
|
||||
find_package(PythonLibs 3 REQUIRED)
|
||||
find_package(Boost 1.78 COMPONENTS python${BOOST_PYTHON_LIBSUFFIX} numpy${BOOST_PYTHON_LIBSUFFIX} REQUIRED)
|
||||
|
||||
set(ICBEXMM "ON")
|
||||
endif ()
|
||||
|
||||
if (ICBEXMM)
|
||||
find_package(Eigen3 3.3 QUIET)
|
||||
if (NOT EIGEN3_FOUND) # If not found, piggy-back pkg-config files.
|
||||
message(WARNING "CMake didn't find the Eigen3 package. Try to look for pkg-config file...")
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(EIGEN3 REQUIRED eigen3>=3.3)
|
||||
set(EIGEN3_INCLUDE_DIR ${EIGEN3_INCLUDE_DIRS})
|
||||
endif ()
|
||||
find_program (BASH_PROGRAM bash)
|
||||
|
||||
# Look for headers.
|
||||
find_path(EIGEN3_ITERATIVE_SOLVER_DIR NAMES IterativeLinearSolvers PATHS ${EIGEN3_INCLUDE_DIR} PATH_SUFFIXES Eigen)
|
||||
if (NOT EIGEN3_ITERATIVE_SOLVER_DIR)
|
||||
message(FATAL_ERROR "-- Eigen/IterativeLinearSolvers header not found.")
|
||||
endif ()
|
||||
find_path(EIGEN3_SPARSE_DIR NAMES Sparse PATHS ${EIGEN3_INCLUDE_DIR} PATH_SUFFIXES Eigen)
|
||||
if (NOT EIGEN3_SPARSE_DIR)
|
||||
message(FATAL_ERROR "-- Eigen/Sparse header not found.")
|
||||
endif ()
|
||||
find_path(EIGEN3_SPARSELU_SOLVER_DIR NAMES SparseLU PATHS ${EIGEN3_INCLUDE_DIR} PATH_SUFFIXES Eigen)
|
||||
if (NOT EIGEN3_SPARSELU_SOLVER_DIR)
|
||||
message(FATAL_ERROR "-- Eigen/SparseLU header not found.")
|
||||
endif ()
|
||||
find_path(EIGEN3_SPARSEQR_SOLVER_DIR NAMES SparseQR PATHS ${EIGEN3_INCLUDE_DIR} PATH_SUFFIXES Eigen)
|
||||
if (NOT EIGEN3_SPARSEQR_SOLVER_DIR)
|
||||
message(FATAL_ERROR "-- Eigen/SparseQR header not found.")
|
||||
endif ()
|
||||
find_path(EIGEN3_SPARSECHOLESKY_SOLVER_DIR NAMES SparseCholesky PATHS ${EIGEN3_INCLUDE_DIR} PATH_SUFFIXES Eigen)
|
||||
if (NOT EIGEN3_SPARSECHOLESKY_SOLVER_DIR)
|
||||
message(FATAL_ERROR "-- Eigen/SparseCholesky header not found.")
|
||||
endif ()
|
||||
find_path(EIGEN3_DENSE_DIR NAMES Dense PATHS ${EIGEN3_INCLUDE_DIR} PATH_SUFFIXES Eigen)
|
||||
if (NOT EIGEN3_DENSE_DIR)
|
||||
message(FATAL_ERROR "-- Eigen/Dense header not found.")
|
||||
endif ()
|
||||
find_path(EIGEN3_DENSELU_DIR NAMES LU PATHS ${EIGEN3_INCLUDE_DIR} PATH_SUFFIXES Eigen)
|
||||
if (NOT EIGEN3_DENSELU_DIR)
|
||||
message(FATAL_ERROR "-- Eigen/LU header not found.")
|
||||
endif ()
|
||||
find_path(EIGEN3_DENSEQR_DIR NAMES QR PATHS ${EIGEN3_INCLUDE_DIR} PATH_SUFFIXES Eigen)
|
||||
if (NOT EIGEN3_DENSEQR_DIR)
|
||||
message(FATAL_ERROR "-- Eigen/QR header not found.")
|
||||
endif ()
|
||||
find_path(EIGEN3_DENSECHOLESKY_DIR NAMES Cholesky PATHS ${EIGEN3_INCLUDE_DIR} PATH_SUFFIXES Eigen)
|
||||
if (NOT EIGEN3_DENSECHOLESKY_DIR)
|
||||
message(FATAL_ERROR "-- Eigen/Cholesky header not found.")
|
||||
endif ()
|
||||
|
||||
set(ICB "ON")
|
||||
endif ()
|
||||
|
||||
# Enable language(s) before any find_package (in particular before MPI find_package).
|
||||
if (ICB)
|
||||
enable_language(C CXX) # For testing binding with c/c++.
|
||||
|
||||
set(CMAKE_CXX_STANDARD 11) # OK, since cmake-3.1 only.
|
||||
|
||||
file(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/PROG_ICB.f90
|
||||
"
|
||||
PROGRAM PROG_ICB
|
||||
USE iso_c_binding
|
||||
IMPLICIT NONE
|
||||
INTEGER(C_INT) :: a
|
||||
a = 1
|
||||
END PROGRAM PROG_ICB
|
||||
")
|
||||
try_compile(COMPILE_ICB ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/PROG_ICB.f90)
|
||||
if(NOT ${COMPILE_ICB})
|
||||
message(FATAL_ERROR "-- Fortran compiler does not support iso_c_binding.")
|
||||
else()
|
||||
message("-- Fortran compiler does support iso_c_binding.")
|
||||
endif()
|
||||
else()
|
||||
# ICB saves you from old-fashion-boring-cumbersome-fortran/C crap... For arpack symbols (only).
|
||||
|
||||
if (SYMBOLSUFFIX)
|
||||
if ("${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU")
|
||||
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -cpp -ffixed-line-length-none")
|
||||
elseif ("${CMAKE_Fortran_COMPILER_ID}" MATCHES "Intel")
|
||||
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fpp -extend-source")
|
||||
else ()
|
||||
message(WARNING "build script does not know how to enable your Fortran compiler's preprocessor and support for lines longer than 72 characters: set them manually via FFLAGS.")
|
||||
endif ()
|
||||
|
||||
set(SCALARFUNS naitr napps naup2 naupd nconv neigh neupd ngets statn saitr sapps saup2 saupd sconv seigt seupd sgets stats getv0 sortc sortr sesrt stqrb)
|
||||
set(COMPLEXFUNS, naitr napps naup2 naupd neigh neupd ngets statn getv0 sortc)
|
||||
|
||||
foreach (f IN LISTS SCALARFUNS)
|
||||
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Ds${f}=s${f}${SYMBOLSUFFIX} -Dd${f}=d${f}${SYMBOLSUFFIX}")
|
||||
endforeach ()
|
||||
|
||||
foreach (f IN LISTS COMPLEXFUNS)
|
||||
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Dc${f}=c${f}${SYMBOLSUFFIX} -Dz${f}=z${f}${SYMBOLSUFFIX}")
|
||||
endforeach ()
|
||||
|
||||
set(CFUNS snaupd sneupd dnaupd dneupd)
|
||||
foreach (f IN LISTS CFUNS)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D${f}=${f}${SYMBOLSUFFIX}")
|
||||
list(APPEND CFUNS_SUFFIXED ${f}${SYMBOLSUFFIX})
|
||||
endforeach ()
|
||||
|
||||
include(FortranCInterface)
|
||||
FortranCInterface_HEADER(FCMangle.h SYMBOLS ${CFUNS_SUFFIXED})
|
||||
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DINCLUDE_FCMANGLE")
|
||||
|
||||
FortranCInterface_VERIFY()
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# Find MPI
|
||||
|
||||
if (MPI)
|
||||
if (NOT TARGET MPI::MPI_Fortran) # Search only if not already found by upper CMakeLists.txt
|
||||
include(FindMPI)
|
||||
find_package(MPI REQUIRED COMPONENTS Fortran)
|
||||
|
||||
# MPI::MPI_* target was already created at this point by FindMPI.cmake if cmake version >= 3.9
|
||||
if (NOT TARGET MPI::MPI_Fortran) # Create target "at hand" to ensure compatibility if cmake version < 3.9
|
||||
add_library(MPI::MPI_Fortran INTERFACE IMPORTED)
|
||||
set_target_properties(MPI::MPI_Fortran PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${MPI_Fortran_INCLUDE_DIRS}")
|
||||
set_target_properties(MPI::MPI_Fortran PROPERTIES INTERFACE_LINK_LIBRARIES "${MPI_Fortran_LIBRARIES}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${MPI_Fortran_COMPILE_FLAG}")
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "Windows" AND CMAKE_Fortran_COMPILER_ID MATCHES "GNU")
|
||||
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fallow-invalid-boz")
|
||||
endif()
|
||||
|
||||
# Check if we can use ISO_C_BINDING provided by MPI.
|
||||
file(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/PROG_ICB.f90
|
||||
"
|
||||
PROGRAM PROG_ICB
|
||||
USE :: mpi_f08
|
||||
IMPLICIT NONE
|
||||
type(MPI_Comm) comm
|
||||
type(MPI_Status) status
|
||||
END PROGRAM PROG_ICB
|
||||
")
|
||||
try_compile(COMPILE_ICB ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/PROG_ICB.f90 LINK_LIBRARIES MPI::MPI_Fortran)
|
||||
if(NOT ${COMPILE_ICB})
|
||||
message("-- MPI library does not support iso_c_binding.")
|
||||
set(HAVE_MPI_ICB 0)
|
||||
else()
|
||||
message("-- MPI library does support iso_c_binding.")
|
||||
set(HAVE_MPI_ICB 1)
|
||||
add_compile_definitions(HAVE_MPI_ICB=1)
|
||||
endif()
|
||||
|
||||
# As MPI can be used with or without ISO_C_BINDING (#ifdef), we need to preprocess code before compiling.
|
||||
if ("${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU")
|
||||
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -cpp")
|
||||
elseif ("${CMAKE_Fortran_COMPILER_ID}" MATCHES "Intel")
|
||||
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fpp")
|
||||
else ()
|
||||
message(WARNING "build script does not know how to preprocess Fortran code: set it manually via FFLAGS.")
|
||||
endif ()
|
||||
|
||||
if(ICB)
|
||||
if (NOT TARGET MPI::MPI_C) # Search only if not already found by upper CMakeLists.txt
|
||||
include(FindMPI)
|
||||
find_package(MPI REQUIRED COMPONENTS C)
|
||||
|
||||
if (NOT TARGET MPI::MPI_C) # Create target "at hand" to ensure compatibility if cmake version < 3.9
|
||||
add_library(MPI::MPI_C INTERFACE IMPORTED)
|
||||
set_target_properties(MPI::MPI_C PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${MPI_C_INCLUDE_DIRS}")
|
||||
set_target_properties(MPI::MPI_C PROPERTIES INTERFACE_LINK_LIBRARIES "${MPI_C_LIBRARIES}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (NOT TARGET MPI::MPI_CXX) # Search only if not already found by upper CMakeLists.txt
|
||||
include(FindMPI)
|
||||
find_package(MPI REQUIRED COMPONENTS CXX)
|
||||
|
||||
if (NOT TARGET MPI::MPI_CXX) # Create target "at hand" to ensure compatibility if cmake version < 3.9
|
||||
add_library(MPI::MPI_CXX INTERFACE IMPORTED)
|
||||
set_target_properties(MPI::MPI_CXX PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${MPI_CXX_INCLUDE_DIRS}")
|
||||
set_target_properties(MPI::MPI_CXX PROPERTIES INTERFACE_LINK_LIBRARIES "${MPI_CXX_LIBRARIES}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include(CheckSymbolExists)
|
||||
check_symbol_exists(MPI_Comm_c2f "${MPI_C_INCLUDE_DIRS}/mpi.h" MPI_Comm_c2f_FOUND)
|
||||
if(NOT ${MPI_Comm_c2f_FOUND})
|
||||
message(FATAL_ERROR "symbol MPI_Comm_c2f does not exist")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Find BLAS
|
||||
|
||||
if (NOT TARGET BLAS::BLAS) # Search only if not already found by upper CMakeLists.txt
|
||||
find_package(BLAS REQUIRED)
|
||||
|
||||
# BLAS::BLAS target was already created at this point by FindBLAS.cmake if cmake version >= 3.18
|
||||
if (NOT TARGET BLAS::BLAS) # Create target "at hand" to ensure compatibility if cmake version < 3.18
|
||||
add_library(BLAS::BLAS INTERFACE IMPORTED)
|
||||
set_target_properties(BLAS::BLAS PROPERTIES INTERFACE_LINK_LIBRARIES "${BLAS_LIBRARIES}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Find LAPACK
|
||||
|
||||
if (NOT TARGET LAPACK::LAPACK) # Search only if not already found by upper CMakeLists.txt
|
||||
find_package(LAPACK REQUIRED)
|
||||
|
||||
# LAPACK::LAPACK target was already created at this point by FindLAPACK.cmake if cmake version >= 3.18
|
||||
if (NOT TARGET LAPACK::LAPACK) # Create target "at hand" to ensure compatibility if cmake version < 3.18
|
||||
add_library(LAPACK::LAPACK INTERFACE IMPORTED)
|
||||
set_target_properties(LAPACK::LAPACK PROPERTIES INTERFACE_LINK_LIBRARIES "${LAPACK_LIBRARIES}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# As BLAS/LAPACK does not provide ICB, we may have to deal with symbols the old-fashion-boring-cumbersome-fortran/C way...
|
||||
|
||||
if (SYMBOLSUFFIX)
|
||||
if ("${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU")
|
||||
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -cpp -ffixed-line-length-none")
|
||||
elseif ("${CMAKE_Fortran_COMPILER_ID}" MATCHES "Intel")
|
||||
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fpp -extend-source")
|
||||
else ()
|
||||
message(WARNING "build script does not know how to enable your Fortran compiler's preprocessor and support for lines longer than 72 characters: set them manually via FFLAGS.")
|
||||
endif ()
|
||||
|
||||
set(BLASFUNS1 axpy copy gemv geqr2 lacpy lae2 lahqr lanhs larnv lartg lascl laset lasrt scal trevc trmm trsen gbmv gbtrf gbtrs gttrf gttrs pttrf pttrs)
|
||||
set(BLASFUNS2 dot ger labad laev2 lamch lanst lanv2 lapy2 larf larfg lasr nrm2 orm2r rot steqr swap)
|
||||
set(BLASFUNS3 dotc geru unm2r)
|
||||
set(BLASFUNS4 COPY LABAD LAMCH LANHS LANV2 LARFG ROT GEMV)
|
||||
set(BLASFUNS5 scnrm2 dznrm2 csscal zdscal)
|
||||
|
||||
foreach (f IN LISTS BLASFUNS1 BLASFUNS2)
|
||||
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Ds${f}=s${f}${SYMBOLSUFFIX} -Dd${f}=d${f}${SYMBOLSUFFIX}")
|
||||
endforeach ()
|
||||
|
||||
foreach (f IN LISTS BLASFUNS1 BLASFUNS3)
|
||||
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Dc${f}=c${f}${SYMBOLSUFFIX} -Dz${f}=z${f}${SYMBOLSUFFIX}")
|
||||
endforeach ()
|
||||
|
||||
foreach (f IN LISTS BLASFUNS4)
|
||||
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -DS${f}=S${f}${SYMBOLSUFFIX} -DD${f}=D${f}${SYMBOLSUFFIX}")
|
||||
endforeach ()
|
||||
|
||||
foreach (f IN LISTS BLASFUNS5)
|
||||
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -D${f}=${f}${SYMBOLSUFFIX}")
|
||||
endforeach ()
|
||||
|
||||
set(CFUNS sgemm cheev)
|
||||
foreach (f IN LISTS CFUNS)
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D${f}=${f}${SYMBOLSUFFIX}")
|
||||
list(APPEND CFUNS_SUFFIXED ${f}${SYMBOLSUFFIX})
|
||||
endforeach ()
|
||||
|
||||
include(FortranCInterface)
|
||||
FortranCInterface_HEADER(FCMangle.h SYMBOLS ${CFUNS_SUFFIXED})
|
||||
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DINCLUDE_FCMANGLE")
|
||||
|
||||
FortranCInterface_VERIFY()
|
||||
endif ()
|
||||
|
||||
if (MPI)
|
||||
set(parpackutil_DIR ${arpack_SOURCE_DIR}/PARPACK/UTIL/)
|
||||
set(parpacksrc_DIR ${arpack_SOURCE_DIR}/PARPACK/SRC/)
|
||||
endif()
|
||||
|
||||
file(GLOB arpacksrc_STAT_SRCS ${arpack_SOURCE_DIR}/dbgini.f ${arpack_SOURCE_DIR}/staini.f ${arpack_SOURCE_DIR}/SRC/*.f)
|
||||
|
||||
set(arpacksrc_ICB "")
|
||||
set(parpacksrc_ICB "")
|
||||
if(ICB)
|
||||
file(GLOB arpacksrc_ICB ${arpack_SOURCE_DIR}/SRC/icba*.F90 ${arpack_SOURCE_DIR}/ICB/debug_icb.F90 ${arpack_SOURCE_DIR}/ICB/stat_icb.F90)
|
||||
file(GLOB parpacksrc_ICB ${arpack_SOURCE_DIR}/PARPACK/SRC/MPI/icbp*.F90 ${arpack_SOURCE_DIR}/ICB/debug_icb.F90 ${arpack_SOURCE_DIR}/ICB/stat_icb.F90)
|
||||
endif()
|
||||
|
||||
set(arpackutil_STAT_SRCS
|
||||
${arpack_SOURCE_DIR}/UTIL/icnteq.f
|
||||
${arpack_SOURCE_DIR}/UTIL/icopy.f
|
||||
${arpack_SOURCE_DIR}/UTIL/iset.f
|
||||
${arpack_SOURCE_DIR}/UTIL/iswap.f
|
||||
${arpack_SOURCE_DIR}/UTIL/ivout.f
|
||||
${arpack_SOURCE_DIR}/UTIL/second_NONE.f
|
||||
${arpack_SOURCE_DIR}/UTIL/svout.f
|
||||
${arpack_SOURCE_DIR}/UTIL/smout.f
|
||||
${arpack_SOURCE_DIR}/UTIL/dvout.f
|
||||
${arpack_SOURCE_DIR}/UTIL/dmout.f
|
||||
${arpack_SOURCE_DIR}/UTIL/cvout.f
|
||||
${arpack_SOURCE_DIR}/UTIL/cmout.f
|
||||
${arpack_SOURCE_DIR}/UTIL/zvout.f
|
||||
${arpack_SOURCE_DIR}/UTIL/zmout.f )
|
||||
|
||||
|
||||
if (MPI)
|
||||
file(GLOB parpackutil_STAT_SRCS ${arpack_SOURCE_DIR}/PARPACK/UTIL/MPI/*.f)
|
||||
file(GLOB parpacksrc_STAT_SRCS ${arpack_SOURCE_DIR}/dbgini.f ${arpack_SOURCE_DIR}/staini.f ${arpack_SOURCE_DIR}/PARPACK/SRC/MPI/*.f)
|
||||
endif()
|
||||
|
||||
# use -DBUILD_SHARED_LIBS=ON|OFF to control static/shared
|
||||
add_library(arpack ${arpackutil_STAT_SRCS} ${arpacksrc_STAT_SRCS} ${arpacksrc_ICB})
|
||||
|
||||
target_link_libraries(arpack
|
||||
PUBLIC
|
||||
$<INSTALL_INTERFACE:$<IF:$<BOOL:${BUILD_SHARED_LIBS}>,,LAPACK::LAPACK>>
|
||||
$<INSTALL_INTERFACE:$<IF:$<BOOL:${BUILD_SHARED_LIBS}>,,BLAS::BLAS>>
|
||||
$<BUILD_INTERFACE:LAPACK::LAPACK>
|
||||
$<BUILD_INTERFACE:BLAS::BLAS>
|
||||
)
|
||||
target_link_options(arpack PUBLIC "${EXTRA_LDFLAGS}")
|
||||
set_target_properties(arpack PROPERTIES OUTPUT_NAME arpack${LIBSUFFIX}${ITF64SUFFIX})
|
||||
set_target_properties(arpack PROPERTIES VERSION 2.1.0)
|
||||
set_target_properties(arpack PROPERTIES SOVERSION 2)
|
||||
target_include_directories(arpack
|
||||
PUBLIC
|
||||
# Exported location of headers
|
||||
$<INSTALL_INTERFACE:${ARPACK_INSTALL_INCLUDEDIR}>
|
||||
# Find arpackdef.h, arpackicb.h, stat*.h, debug*.h at build time
|
||||
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}>
|
||||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
|
||||
# For ICB interface
|
||||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/ICB>
|
||||
)
|
||||
|
||||
if (MPI)
|
||||
# use -DBUILD_SHARED_LIBS=ON|OFF to control static/shared
|
||||
add_library(parpack ${parpacksrc_STAT_SRCS} ${parpackutil_STAT_SRCS} ${parpacksrc_ICB})
|
||||
target_link_libraries(parpack
|
||||
PUBLIC
|
||||
arpack
|
||||
$<INSTALL_INTERFACE:$<IF:$<BOOL:${BUILD_SHARED_LIBS}>,,MPI::MPI_Fortran>>
|
||||
$<BUILD_INTERFACE:MPI::MPI_Fortran>
|
||||
)
|
||||
set_target_properties(parpack PROPERTIES OUTPUT_NAME parpack${LIBSUFFIX}${ITF64SUFFIX})
|
||||
set_target_properties(parpack PROPERTIES VERSION 2.1.0)
|
||||
set_target_properties(parpack PROPERTIES SOVERSION 2)
|
||||
endif ()
|
||||
|
||||
set(PYINT "int32" CACHE STRING "int type to be used in python scripts") # PYINT : int used with python.
|
||||
if (INTERFACE64)
|
||||
set(PYINT "int64" CACHE STRING "int type to be used in python scripts") # PYINT : int used with python.
|
||||
set(INTERFACE64 1)
|
||||
if ("${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU")
|
||||
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fdefault-integer-8")
|
||||
elseif ("${CMAKE_Fortran_COMPILER_ID}" MATCHES "Intel")
|
||||
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -i8")
|
||||
else ()
|
||||
message(WARNING "build script does not know how to make your Fortran compiler use 64-bit integers: set it manually via FFLAGS.")
|
||||
endif ()
|
||||
|
||||
# TODO: this needs full re-write of parpack to support ILP64...
|
||||
if (MPI)
|
||||
message(FATAL_ERROR "Parallel arpack does not support ILP64.")
|
||||
endif()
|
||||
else ()
|
||||
set(INTERFACE64 0)
|
||||
endif ()
|
||||
|
||||
include_directories("${PROJECT_BINARY_DIR}") # Find arpackdef.h and arpackicb.h
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
||||
############################
|
||||
# EXAMPLES
|
||||
############################
|
||||
if (EXAMPLES)
|
||||
############################
|
||||
# EXAMPLES/BAND
|
||||
############################
|
||||
set(arpackexample_DIR ${arpack_SOURCE_DIR}/EXAMPLES/BAND/)
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/EXAMPLES/BAND/)
|
||||
|
||||
set(examples_EXTRA_SRCS ${arpackexample_DIR}/cnband.f)
|
||||
set(examples_STAT_SRCS
|
||||
cnbdr1.f
|
||||
cnbdr2.f
|
||||
cnbdr3.f
|
||||
cnbdr4.f)
|
||||
examples(examples_STAT_SRCS)
|
||||
|
||||
set(examples_EXTRA_SRCS ${arpackexample_DIR}/dnband.f)
|
||||
set(examples_STAT_SRCS
|
||||
dnbdr1.f
|
||||
dnbdr2.f
|
||||
dnbdr3.f
|
||||
dnbdr4.f
|
||||
dnbdr5.f
|
||||
dnbdr6.f)
|
||||
examples(examples_STAT_SRCS)
|
||||
|
||||
set(examples_EXTRA_SRCS ${arpackexample_DIR}/dsband.f)
|
||||
set(examples_STAT_SRCS
|
||||
dsbdr1.f
|
||||
dsbdr2.f
|
||||
dsbdr3.f
|
||||
dsbdr4.f
|
||||
dsbdr5.f
|
||||
dsbdr6.f)
|
||||
examples(examples_STAT_SRCS)
|
||||
|
||||
set(examples_EXTRA_SRCS ${arpackexample_DIR}/snband.f)
|
||||
set(examples_STAT_SRCS
|
||||
snbdr1.f
|
||||
snbdr2.f
|
||||
snbdr3.f
|
||||
snbdr4.f
|
||||
snbdr5.f
|
||||
snbdr6.f)
|
||||
examples(examples_STAT_SRCS)
|
||||
|
||||
set(examples_EXTRA_SRCS ${arpackexample_DIR}/ssband.f)
|
||||
set(examples_STAT_SRCS
|
||||
ssbdr1.f
|
||||
ssbdr2.f
|
||||
ssbdr3.f
|
||||
ssbdr4.f
|
||||
ssbdr5.f
|
||||
ssbdr6.f)
|
||||
examples(examples_STAT_SRCS)
|
||||
|
||||
set(examples_EXTRA_SRCS ${arpackexample_DIR}/znband.f)
|
||||
set(examples_STAT_SRCS
|
||||
znbdr1.f
|
||||
znbdr2.f
|
||||
znbdr3.f
|
||||
znbdr4.f)
|
||||
examples(examples_STAT_SRCS)
|
||||
set(examples_EXTRA_SRCS)
|
||||
|
||||
############################
|
||||
# EXAMPLES/COMPLEX
|
||||
############################
|
||||
set(arpackexample_DIR ${arpack_SOURCE_DIR}/EXAMPLES/COMPLEX/)
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/EXAMPLES/COMPLEX/)
|
||||
|
||||
set(examples_STAT_SRCS
|
||||
cndrv1.f
|
||||
cndrv2.f
|
||||
cndrv3.f
|
||||
cndrv4.f
|
||||
zndrv1.f
|
||||
zndrv2.f
|
||||
zndrv3.f
|
||||
zndrv4.f)
|
||||
examples(examples_STAT_SRCS)
|
||||
|
||||
############################
|
||||
# examples/nonsym
|
||||
############################
|
||||
set(arpackexample_DIR ${arpack_SOURCE_DIR}/EXAMPLES/NONSYM/)
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/EXAMPLES/NONSYM/)
|
||||
|
||||
set(examples_STAT_SRCS
|
||||
dndrv1.f
|
||||
dndrv2.f
|
||||
dndrv3.f
|
||||
dndrv4.f
|
||||
dndrv5.f
|
||||
dndrv6.f
|
||||
sndrv1.f
|
||||
sndrv2.f
|
||||
sndrv3.f
|
||||
sndrv4.f
|
||||
sndrv5.f
|
||||
sndrv6.f)
|
||||
examples(examples_STAT_SRCS)
|
||||
|
||||
############################
|
||||
# examples/SIMPLE
|
||||
############################
|
||||
set(arpackexample_DIR ${arpack_SOURCE_DIR}/EXAMPLES/SIMPLE/)
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/EXAMPLES/SIMPLE/)
|
||||
|
||||
set(examples_STAT_SRCS
|
||||
cnsimp.f
|
||||
dnsimp.f
|
||||
dssimp.f
|
||||
snsimp.f
|
||||
sssimp.f
|
||||
znsimp.f)
|
||||
|
||||
examples(examples_STAT_SRCS)
|
||||
|
||||
############################
|
||||
# examples/svd
|
||||
############################
|
||||
set(arpackexample_DIR ${arpack_SOURCE_DIR}/EXAMPLES/SVD/)
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/EXAMPLES/SVD/)
|
||||
|
||||
set(examples_STAT_SRCS
|
||||
ssvd.f)
|
||||
|
||||
examples(examples_STAT_SRCS)
|
||||
|
||||
############################
|
||||
# examples/sym
|
||||
############################
|
||||
set(arpackexample_DIR ${arpack_SOURCE_DIR}/EXAMPLES/SYM/)
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/EXAMPLES/SYM/)
|
||||
|
||||
set(examples_STAT_SRCS
|
||||
dsdrv1.f
|
||||
dsdrv2.f
|
||||
dsdrv3.f
|
||||
dsdrv4.f
|
||||
dsdrv5.f
|
||||
dsdrv6.f
|
||||
ssdrv1.f
|
||||
ssdrv2.f
|
||||
ssdrv3.f
|
||||
ssdrv4.f
|
||||
ssdrv5.f
|
||||
ssdrv6.f)
|
||||
|
||||
examples(examples_STAT_SRCS)
|
||||
|
||||
############################
|
||||
# parpack/examples
|
||||
############################
|
||||
if (MPI)
|
||||
set(parpackexample_DIR ${arpack_SOURCE_DIR}/PARPACK/EXAMPLES/MPI/)
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/PARPACK/EXAMPLES/MPI/)
|
||||
|
||||
set(pexamples_STAT_SRCS
|
||||
pcndrv1.f
|
||||
pdndrv1.f
|
||||
pdndrv3.f
|
||||
pdsdrv1.f
|
||||
psndrv1.f
|
||||
psndrv3.f
|
||||
pssdrv1.f
|
||||
pzndrv1.f)
|
||||
|
||||
pexamples(pexamples_STAT_SRCS)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
############################
|
||||
# TEST
|
||||
############################
|
||||
function(build_tests)
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/TESTS)
|
||||
|
||||
add_executable(dnsimp_test TESTS/dnsimp.f TESTS/mmio.f TESTS/debug.h)
|
||||
set_target_properties( dnsimp_test PROPERTIES OUTPUT_NAME dnsimp )
|
||||
target_link_libraries(dnsimp_test arpack BLAS::BLAS LAPACK::LAPACK ${EXTRA_LDFLAGS})
|
||||
add_custom_command(TARGET dnsimp_test POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/TESTS/testA.mtx testA.mtx
|
||||
)
|
||||
add_test(dnsimp_tst ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/dnsimp)
|
||||
|
||||
if (ICB)
|
||||
add_executable(bug_1315_single TESTS/bug_1315_single.c)
|
||||
target_include_directories(bug_1315_single PUBLIC ${PROJECT_SOURCE_DIR}/ICB) # Get arpack.h
|
||||
target_link_libraries(bug_1315_single arpack BLAS::BLAS LAPACK::LAPACK ${EXTRA_LDFLAGS})
|
||||
add_test(bug_1315_single_tst ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/bug_1315_single)
|
||||
|
||||
add_executable(bug_1315_double TESTS/bug_1315_double.c)
|
||||
target_include_directories(bug_1315_double PUBLIC ${PROJECT_SOURCE_DIR}/ICB) # Get arpack.h
|
||||
target_link_libraries(bug_1315_double arpack BLAS::BLAS LAPACK::LAPACK ${EXTRA_LDFLAGS})
|
||||
add_test(bug_1315_double_tst ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/bug_1315_double)
|
||||
endif()
|
||||
|
||||
add_executable(bug_1323 TESTS/bug_1323.f)
|
||||
target_link_libraries(bug_1323 arpack BLAS::BLAS LAPACK::LAPACK ${EXTRA_LDFLAGS})
|
||||
add_test(bug_1323_tst ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/bug_1323)
|
||||
|
||||
add_executable(bug_58_double TESTS/bug_58_double.f)
|
||||
target_link_libraries(bug_58_double arpack BLAS::BLAS LAPACK::LAPACK ${EXTRA_LDFLAGS})
|
||||
add_test(bug_58_double_tst ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/bug_58_double)
|
||||
|
||||
add_executable(bug_79_double_complex TESTS/bug_79_double_complex.f)
|
||||
target_link_libraries(bug_79_double_complex arpack BLAS::BLAS LAPACK::LAPACK ${EXTRA_LDFLAGS})
|
||||
add_test(bug_79_double_complex_tst ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/bug_79_double_complex)
|
||||
|
||||
add_executable(bug_142 TESTS/bug_142.f)
|
||||
target_link_libraries(bug_142 arpack BLAS::BLAS LAPACK::LAPACK ${EXTRA_LDFLAGS})
|
||||
add_test(bug_142_tst ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/bug_142)
|
||||
|
||||
add_executable(bug_142_gen TESTS/bug_142_gen.f)
|
||||
target_link_libraries(bug_142_gen arpack BLAS::BLAS LAPACK::LAPACK ${EXTRA_LDFLAGS})
|
||||
add_test(bug_142_gen_tst ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/bug_142_gen)
|
||||
|
||||
if(MPI)
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/PARPACK/TESTS/MPI)
|
||||
|
||||
add_executable(issue46 PARPACK/TESTS/MPI/issue46.f)
|
||||
target_link_libraries(issue46 parpack arpack BLAS::BLAS LAPACK::LAPACK ${EXTRA_LDFLAGS})
|
||||
add_test(issue46_tst ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/issue46)
|
||||
endif()
|
||||
|
||||
if(ICB)
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/TESTS)
|
||||
|
||||
add_executable(icb_arpack_c TESTS/icb_arpack_c.c)
|
||||
target_include_directories(icb_arpack_c PUBLIC ${PROJECT_SOURCE_DIR}/ICB) # Get arpack.h
|
||||
target_link_libraries(icb_arpack_c arpack BLAS::BLAS LAPACK::LAPACK ${EXTRA_LDFLAGS})
|
||||
add_test(icb_arpack_c_tst ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/icb_arpack_c)
|
||||
|
||||
add_executable(icb_arpack_cpp TESTS/icb_arpack_cpp.cpp)
|
||||
target_include_directories(icb_arpack_cpp PUBLIC ${PROJECT_SOURCE_DIR}/ICB) # Get arpack.hpp
|
||||
target_link_libraries(icb_arpack_cpp arpack BLAS::BLAS LAPACK::LAPACK ${EXTRA_LDFLAGS})
|
||||
add_test(icb_arpack_cpp_tst ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/icb_arpack_cpp)
|
||||
|
||||
if (ICBEXMM)
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/EXAMPLES/MATRIX_MARKET)
|
||||
|
||||
add_executable(arpackmm EXAMPLES/MATRIX_MARKET/arpackmm.cpp)
|
||||
target_include_directories(arpackmm PUBLIC ${PROJECT_SOURCE_DIR}/ICB ${EIGEN3_INCLUDE_DIR}) # Get arpack.h + eigen
|
||||
target_link_libraries(arpackmm arpack BLAS::BLAS LAPACK::LAPACK ${EXTRA_LDFLAGS})
|
||||
configure_file(EXAMPLES/MATRIX_MARKET/As.mtx ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/As.mtx)
|
||||
configure_file(EXAMPLES/MATRIX_MARKET/An.mtx ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/An.mtx)
|
||||
configure_file(EXAMPLES/MATRIX_MARKET/Az.mtx ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Az.mtx)
|
||||
configure_file(EXAMPLES/MATRIX_MARKET/B.mtx ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/B.mtx)
|
||||
configure_file(EXAMPLES/MATRIX_MARKET/Bz.mtx ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Bz.mtx)
|
||||
configure_file(EXAMPLES/MATRIX_MARKET/arpackmm.sh ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/arpackmm.sh)
|
||||
add_test(NAME arpackmm_tst WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} COMMAND ${BASH_PROGRAM} arpackmm.sh)
|
||||
endif()
|
||||
|
||||
if (PYTHON3)
|
||||
python_add_module(pyarpack ${arpackutil_STAT_SRCS} ${arpacksrc_STAT_SRCS} ${arpacksrc_ICB} ${PROJECT_SOURCE_DIR}/EXAMPLES/PYARPACK/pyarpack.cpp)
|
||||
target_include_directories(pyarpack
|
||||
PRIVATE
|
||||
${PROJECT_BINARY_DIR}
|
||||
${PROJECT_SOURCE_DIR}
|
||||
${PROJECT_SOURCE_DIR}/ICB
|
||||
${PROJECT_SOURCE_DIR}/EXAMPLES/MATRIX_MARKET
|
||||
${PROJECT_SOURCE_DIR}/EXAMPLES/PYARPACK
|
||||
${EIGEN3_INCLUDE_DIR}
|
||||
${Boost_INCLUDE_DIRS}
|
||||
${PYTHON_INCLUDE_DIRS})
|
||||
target_link_libraries(pyarpack
|
||||
BLAS::BLAS LAPACK::LAPACK ${Boost_LIBRARIES} ${PYTHON_LIBRARIES})
|
||||
install(TARGETS pyarpack
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/pyarpack
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/pyarpack)
|
||||
configure_file("${PROJECT_SOURCE_DIR}/EXAMPLES/PYARPACK/pyarpackSparseBiCGDiag.py.in" "${CMAKE_BINARY_DIR}/pyarpackSparseBiCGDiag.py" @ONLY)
|
||||
add_test(NAME pyarpackSparseBiCGDiag_tst COMMAND ${PYTHON_EXECUTABLE} pyarpackSparseBiCGDiag.py)
|
||||
set_tests_properties(pyarpackSparseBiCGDiag_tst PROPERTIES ENVIRONMENT PYTHONPATH=${CMAKE_BINARY_DIR}/lib:$ENV{PYTHONPATH})
|
||||
configure_file("${PROJECT_SOURCE_DIR}/EXAMPLES/PYARPACK/pyarpackSparseBiCGILU.py.in" "${CMAKE_BINARY_DIR}/pyarpackSparseBiCGILU.py" @ONLY)
|
||||
add_test(NAME pyarpackSparseBiCGILU_tst COMMAND ${PYTHON_EXECUTABLE} pyarpackSparseBiCGILU.py)
|
||||
set_tests_properties(pyarpackSparseBiCGILU_tst PROPERTIES ENVIRONMENT PYTHONPATH=${CMAKE_BINARY_DIR}/lib:$ENV{PYTHONPATH})
|
||||
configure_file("${PROJECT_SOURCE_DIR}/EXAMPLES/PYARPACK/pyarpackSparseCGDiag.py.in" "${CMAKE_BINARY_DIR}/pyarpackSparseCGDiag.py" @ONLY)
|
||||
add_test(NAME pyarpackSparseCGDiag_tst COMMAND ${PYTHON_EXECUTABLE} pyarpackSparseCGDiag.py)
|
||||
set_tests_properties(pyarpackSparseCGDiag_tst PROPERTIES ENVIRONMENT PYTHONPATH=${CMAKE_BINARY_DIR}/lib:$ENV{PYTHONPATH})
|
||||
configure_file("${PROJECT_SOURCE_DIR}/EXAMPLES/PYARPACK/pyarpackSparseCGILU.py.in" "${CMAKE_BINARY_DIR}/pyarpackSparseCGILU.py" @ONLY)
|
||||
add_test(NAME pyarpackSparseCGILU_tst COMMAND ${PYTHON_EXECUTABLE} pyarpackSparseCGILU.py)
|
||||
set_tests_properties(pyarpackSparseCGILU_tst PROPERTIES ENVIRONMENT PYTHONPATH=${CMAKE_BINARY_DIR}/lib:$ENV{PYTHONPATH})
|
||||
configure_file("${PROJECT_SOURCE_DIR}/EXAMPLES/PYARPACK/pyarpackSparseLLT.py.in" "${CMAKE_BINARY_DIR}/pyarpackSparseLLT.py" @ONLY)
|
||||
add_test(NAME pyarpackSparseLLT_tst COMMAND ${PYTHON_EXECUTABLE} pyarpackSparseLLT.py)
|
||||
set_tests_properties(pyarpackSparseLLT_tst PROPERTIES ENVIRONMENT PYTHONPATH=${CMAKE_BINARY_DIR}/lib:$ENV{PYTHONPATH})
|
||||
configure_file("${PROJECT_SOURCE_DIR}/EXAMPLES/PYARPACK/pyarpackSparseLDLT.py.in" "${CMAKE_BINARY_DIR}/pyarpackSparseLDLT.py" @ONLY)
|
||||
add_test(NAME pyarpackSparseLDLT_tst COMMAND ${PYTHON_EXECUTABLE} pyarpackSparseLDLT.py)
|
||||
set_tests_properties(pyarpackSparseLDLT_tst PROPERTIES ENVIRONMENT PYTHONPATH=${CMAKE_BINARY_DIR}/lib:$ENV{PYTHONPATH})
|
||||
configure_file("${PROJECT_SOURCE_DIR}/EXAMPLES/PYARPACK/pyarpackSparseLU.py.in" "${CMAKE_BINARY_DIR}/pyarpackSparseLU.py" @ONLY)
|
||||
add_test(NAME pyarpackSparseLU_tst COMMAND ${PYTHON_EXECUTABLE} pyarpackSparseLU.py)
|
||||
set_tests_properties(pyarpackSparseLU_tst PROPERTIES ENVIRONMENT PYTHONPATH=${CMAKE_BINARY_DIR}/lib:$ENV{PYTHONPATH})
|
||||
configure_file("${PROJECT_SOURCE_DIR}/EXAMPLES/PYARPACK/pyarpackSparseQR.py.in" "${CMAKE_BINARY_DIR}/pyarpackSparseQR.py" @ONLY)
|
||||
add_test(NAME pyarpackSparseQR_tst COMMAND ${PYTHON_EXECUTABLE} pyarpackSparseQR.py)
|
||||
set_tests_properties(pyarpackSparseQR_tst PROPERTIES ENVIRONMENT PYTHONPATH=${CMAKE_BINARY_DIR}/lib:$ENV{PYTHONPATH})
|
||||
configure_file("${PROJECT_SOURCE_DIR}/EXAMPLES/PYARPACK/pyarpackDenseLLT.py.in" "${CMAKE_BINARY_DIR}/pyarpackDenseLLT.py" @ONLY)
|
||||
add_test(NAME pyarpackDenseLLT_tst COMMAND ${PYTHON_EXECUTABLE} pyarpackDenseLLT.py)
|
||||
set_tests_properties(pyarpackDenseLLT_tst PROPERTIES ENVIRONMENT PYTHONPATH=${CMAKE_BINARY_DIR}/lib:$ENV{PYTHONPATH})
|
||||
configure_file("${PROJECT_SOURCE_DIR}/EXAMPLES/PYARPACK/pyarpackDenseLDLT.py.in" "${CMAKE_BINARY_DIR}/pyarpackDenseLDLT.py" @ONLY)
|
||||
add_test(NAME pyarpackDenseLDLT_tst COMMAND ${PYTHON_EXECUTABLE} pyarpackDenseLDLT.py)
|
||||
set_tests_properties(pyarpackDenseLDLT_tst PROPERTIES ENVIRONMENT PYTHONPATH=${CMAKE_BINARY_DIR}/lib:$ENV{PYTHONPATH})
|
||||
configure_file("${PROJECT_SOURCE_DIR}/EXAMPLES/PYARPACK/pyarpackDenseLURR.py.in" "${CMAKE_BINARY_DIR}/pyarpackDenseLURR.py" @ONLY)
|
||||
add_test(NAME pyarpackDenseLURR_tst COMMAND ${PYTHON_EXECUTABLE} pyarpackDenseLURR.py)
|
||||
set_tests_properties(pyarpackDenseLURR_tst PROPERTIES ENVIRONMENT PYTHONPATH=${CMAKE_BINARY_DIR}/lib:$ENV{PYTHONPATH})
|
||||
configure_file("${PROJECT_SOURCE_DIR}/EXAMPLES/PYARPACK/pyarpackDenseQRRR.py.in" "${CMAKE_BINARY_DIR}/pyarpackDenseQRRR.py" @ONLY)
|
||||
add_test(NAME pyarpackDenseQRRR_tst COMMAND ${PYTHON_EXECUTABLE} pyarpackDenseQRRR.py)
|
||||
set_tests_properties(pyarpackDenseQRRR_tst PROPERTIES ENVIRONMENT PYTHONPATH=${CMAKE_BINARY_DIR}/lib:$ENV{PYTHONPATH})
|
||||
configure_file("${PROJECT_SOURCE_DIR}/EXAMPLES/PYARPACK/pyarpackDenseLUPP.py.in" "${CMAKE_BINARY_DIR}/pyarpackDenseLUPP.py" @ONLY)
|
||||
add_test(NAME pyarpackDenseLUPP_tst COMMAND ${PYTHON_EXECUTABLE} pyarpackDenseLUPP.py)
|
||||
set_tests_properties(pyarpackDenseLUPP_tst PROPERTIES ENVIRONMENT PYTHONPATH=${CMAKE_BINARY_DIR}/lib:$ENV{PYTHONPATH})
|
||||
configure_file("${PROJECT_SOURCE_DIR}/EXAMPLES/PYARPACK/pyarpackDenseQRPP.py.in" "${CMAKE_BINARY_DIR}/pyarpackDenseQRPP.py" @ONLY)
|
||||
add_test(NAME pyarpackDenseQRPP_tst COMMAND ${PYTHON_EXECUTABLE} pyarpackDenseQRPP.py)
|
||||
set_tests_properties(pyarpackDenseQRPP_tst PROPERTIES ENVIRONMENT PYTHONPATH=${CMAKE_BINARY_DIR}/lib:$ENV{PYTHONPATH})
|
||||
configure_file("${PROJECT_SOURCE_DIR}/EXAMPLES/PYARPACK/pyarpackRestart.py.in" "${CMAKE_BINARY_DIR}/pyarpackRestart.py" @ONLY)
|
||||
add_test(NAME pyarpackRestart_tst COMMAND ${PYTHON_EXECUTABLE} pyarpackRestart.py)
|
||||
set_tests_properties(pyarpackRestart_tst PROPERTIES ENVIRONMENT PYTHONPATH=${CMAKE_BINARY_DIR}/lib:$ENV{PYTHONPATH})
|
||||
endif()
|
||||
|
||||
if (MPI)
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/PARPACK/TESTS/MPI)
|
||||
|
||||
add_executable(icb_parpack_c PARPACK/TESTS/MPI/icb_parpack_c.c)
|
||||
target_include_directories(icb_parpack_c PUBLIC ${PROJECT_SOURCE_DIR}/ICB MPI::MPI_C) # Get parpack.h mpi.h
|
||||
target_link_libraries(icb_parpack_c parpack arpack BLAS::BLAS LAPACK::LAPACK ${EXTRA_LDFLAGS} MPI::MPI_C)
|
||||
add_test(icb_parpack_c_tst mpiexec -n 2 ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/icb_parpack_c)
|
||||
|
||||
add_executable(icb_parpack_cpp PARPACK/TESTS/MPI/icb_parpack_cpp.cpp)
|
||||
target_include_directories(icb_parpack_cpp PUBLIC ${PROJECT_SOURCE_DIR}/ICB MPI::MPI_CXX) # Get parpack.hpp mpi.h
|
||||
target_link_libraries(icb_parpack_cpp parpack arpack BLAS::BLAS LAPACK::LAPACK ${EXTRA_LDFLAGS} MPI::MPI_CXX)
|
||||
add_test(icb_parpack_cpp_tst mpiexec -n 2 ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/icb_parpack_cpp)
|
||||
endif()
|
||||
endif()
|
||||
endfunction(build_tests)
|
||||
|
||||
if(TESTS)
|
||||
enable_testing()
|
||||
set(CMAKE_CTEST_COMMAND ctest -V)
|
||||
build_tests()
|
||||
endif()
|
||||
|
||||
############################
|
||||
# install
|
||||
############################
|
||||
|
||||
# Convert variable names to those expected by the .pc file.
|
||||
set(prefix ${CMAKE_INSTALL_PREFIX})
|
||||
set(exec_prefix \${prefix})
|
||||
set(libdir ${CMAKE_INSTALL_FULL_LIBDIR})
|
||||
set(includedir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR})
|
||||
set(PACKAGE_NAME ${PROJECT_NAME})
|
||||
set(PACKAGE_VERSION ${arpack_ng_VERSION})
|
||||
set(PACKAGE_URL "https://github.com/opencollab/arpack-ng/")
|
||||
|
||||
# Convert (LAPACK|BLAS)_LIBRARIES to -l flags, store in ARPACK_PC_LIBS_PRIVATE.
|
||||
# LAPACK_LIBRARIES contains transitive deps, no need to parse BLAS_LIBRARIES.
|
||||
set(ARPACK_PC_LIBS_PRIVATE)
|
||||
foreach(lib ${LAPACK_LIBRARIES})
|
||||
get_filename_component(libname ${lib} NAME)
|
||||
string(REGEX REPLACE "^(lib)?([^.]+).*$" "-l\\2" libname ${libname})
|
||||
list(APPEND ARPACK_PC_LIBS_PRIVATE "${libname}")
|
||||
endforeach()
|
||||
string(REPLACE ";" " " ARPACK_PC_LIBS_PRIVATE "${ARPACK_PC_LIBS_PRIVATE}")
|
||||
|
||||
set(PARPACK_PC_LIBS_PRIVATE)
|
||||
foreach(lib ${LAPACK_LIBRARIES} ${MPI_Fortran_LIBRARIES})
|
||||
get_filename_component(libname ${lib} NAME)
|
||||
string(REGEX REPLACE "^(lib)?([^.]+).*$" "-l\\2" libname ${libname})
|
||||
list(APPEND PARPACK_PC_LIBS_PRIVATE "${libname}")
|
||||
endforeach()
|
||||
string(REPLACE ";" " " PARPACK_PC_LIBS_PRIVATE "${PARPACK_PC_LIBS_PRIVATE}")
|
||||
|
||||
configure_file(pkg-config/arpack.pc.in "${PROJECT_BINARY_DIR}/arpack${LIBSUFFIX}${ITF64SUFFIX}.pc" @ONLY)
|
||||
configure_file(pkg-config/parpack.pc.in "${PROJECT_BINARY_DIR}/parpack${LIBSUFFIX}${ITF64SUFFIX}.pc" @ONLY)
|
||||
configure_file(pkg-config/arpackSolver.pc.in "${PROJECT_BINARY_DIR}/arpackSolver${LIBSUFFIX}${ITF64SUFFIX}.pc" @ONLY)
|
||||
|
||||
|
||||
install(TARGETS arpack
|
||||
EXPORT arpackngTargets
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
install(FILES "${PROJECT_BINARY_DIR}/arpack${LIBSUFFIX}${ITF64SUFFIX}.pc"
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
||||
|
||||
if (MPI)
|
||||
install(TARGETS parpack
|
||||
EXPORT arpackngTargets
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
install(FILES "${PROJECT_BINARY_DIR}/parpack${LIBSUFFIX}${ITF64SUFFIX}.pc"
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
||||
endif ()
|
||||
|
||||
if(ICB)
|
||||
install(FILES ICB/arpack.h DESTINATION "${ARPACK_INSTALL_INCLUDEDIR}")
|
||||
install(FILES ICB/arpack.hpp DESTINATION ${ARPACK_INSTALL_INCLUDEDIR})
|
||||
if (MPI)
|
||||
install(FILES ICB/parpack.h DESTINATION ${ARPACK_INSTALL_INCLUDEDIR})
|
||||
install(FILES ICB/parpack.hpp DESTINATION ${ARPACK_INSTALL_INCLUDEDIR})
|
||||
endif()
|
||||
if (ICBEXMM)
|
||||
install(FILES EXAMPLES/MATRIX_MARKET/arpackSolver.hpp DESTINATION ${ARPACK_INSTALL_INCLUDEDIR})
|
||||
install(FILES "${PROJECT_BINARY_DIR}/arpackSolver${LIBSUFFIX}${ITF64SUFFIX}.pc" DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
install(FILES debug.h DESTINATION ${ARPACK_INSTALL_INCLUDEDIR})
|
||||
install(FILES debugF90.h DESTINATION ${ARPACK_INSTALL_INCLUDEDIR})
|
||||
if(ICB)
|
||||
install(FILES ICB/debug_c.h DESTINATION ${ARPACK_INSTALL_INCLUDEDIR})
|
||||
install(FILES ICB/debug_c.hpp DESTINATION ${ARPACK_INSTALL_INCLUDEDIR})
|
||||
endif()
|
||||
|
||||
install(FILES stat.h DESTINATION ${ARPACK_INSTALL_INCLUDEDIR})
|
||||
install(FILES statF90.h DESTINATION ${ARPACK_INSTALL_INCLUDEDIR})
|
||||
if(ICB)
|
||||
install(FILES ICB/stat_c.h DESTINATION ${ARPACK_INSTALL_INCLUDEDIR})
|
||||
install(FILES ICB/stat_c.hpp DESTINATION ${ARPACK_INSTALL_INCLUDEDIR})
|
||||
endif()
|
||||
|
||||
configure_file(arpackdef.h.in "${PROJECT_BINARY_DIR}/arpackdef.h" @ONLY)
|
||||
install(FILES "${PROJECT_BINARY_DIR}/arpackdef.h" DESTINATION ${ARPACK_INSTALL_INCLUDEDIR})
|
||||
|
||||
configure_file(arpackicb.h.in "${PROJECT_BINARY_DIR}/arpackicb.h" @ONLY)
|
||||
install(FILES "${PROJECT_BINARY_DIR}/arpackicb.h" DESTINATION ${ARPACK_INSTALL_INCLUDEDIR})
|
||||
|
||||
install(EXPORT arpackngTargets
|
||||
DESTINATION "${ARPACK_INSTALL_CMAKEDIR}"
|
||||
)
|
||||
# Provide find_package for arpack-ng to users.
|
||||
configure_file(cmake/arpackng-config.cmake.in "${PROJECT_BINARY_DIR}/arpackng-config.cmake" @ONLY)
|
||||
configure_file(cmake/arpackng-config-version.cmake.in "${PROJECT_BINARY_DIR}/arpackng-config-version.cmake" @ONLY)
|
||||
install(
|
||||
FILES
|
||||
"${PROJECT_BINARY_DIR}/arpackng-config.cmake"
|
||||
"${PROJECT_BINARY_DIR}/arpackng-config-version.cmake"
|
||||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/arpackng${LIBSUFFIX}${ITF64SUFFIX}) # find_package(arpackng)
|
||||
|
||||
configure_file(cmake/tstCMakeInstall.sh.in ${PROJECT_BINARY_DIR}/tstCMakeInstall.sh @ONLY)
|
||||
|
||||
# Packaging: ease arpack-ng distribution (precompiled binaries and sources tarballs).
|
||||
set(CPACK_VERSION_MAJOR "${arpack_ng_MAJOR_VERSION}")
|
||||
set(CPACK_VERSION_MINOR "${arpack_ng_MINOR_VERSION}")
|
||||
set(CPACK_VERSION_PATCH "${arpack_ng_PATCH_VERSION}")
|
||||
set(CPACK_SOURCE_IGNORE_FILES "/BUILD/" "/Build/" "/build/" "/local/") # Do not ship (eventual) build or install directories in tarballs.
|
||||
set(CPACK_SOURCE_PACKAGE_FILE_NAME "arpack-ng-${CPACK_VERSION_MAJOR}.${CPACK_VERSION_MINOR}.${CPACK_VERSION_PATCH}")
|
||||
include(CPack)
|
||||
|
||||
function(libsummary title include libraries)
|
||||
message(" -- ${title}:")
|
||||
foreach(inc ${include})
|
||||
message(" -- compile: ${inc}")
|
||||
endforeach()
|
||||
foreach(lib ${libraries})
|
||||
message(" -- link: ${lib}")
|
||||
endforeach()
|
||||
endfunction(libsummary)
|
||||
|
||||
function(cprsummary title compiler debug_flags minsizerel_flags release_flags relwithdebinfo_flags more_flags)
|
||||
message(" -- ${title}: ${compiler}")
|
||||
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug" OR "${CMAKE_BUILD_TYPE}" STREQUAL "DEBUG")
|
||||
message(" -- ${title}FLAGS: ${debug_flags} ${more_flags}")
|
||||
endif()
|
||||
if("${CMAKE_BUILD_TYPE}" STREQUAL "MinSizeRel" OR "${CMAKE_BUILD_TYPE}" STREQUAL "MINSIZEREL")
|
||||
message(" -- ${title}FLAGS: ${minsizerel_flags} ${more_flags}")
|
||||
endif()
|
||||
if("${CMAKE_BUILD_TYPE}" STREQUAL "Release" OR "${CMAKE_BUILD_TYPE}" STREQUAL "RELEASE")
|
||||
message(" -- ${title}FLAGS: ${release_flags} ${more_flags}")
|
||||
endif()
|
||||
if("${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo" OR "${CMAKE_BUILD_TYPE}" STREQUAL "RELWITHDEBINFO")
|
||||
message(" -- ${title}FLAGS: ${relwithdebinfo_flags} ${more_flags}")
|
||||
endif()
|
||||
endfunction(cprsummary)
|
||||
|
||||
message("-- Configuration summary for arpack-ng-${arpack_ng_VERSION}:")
|
||||
message(" -- prefix: ${CMAKE_INSTALL_PREFIX}")
|
||||
message(" -- MPI: ${MPI} (ICB provided ${HAVE_MPI_ICB})")
|
||||
message(" -- ICB: ${ICB}")
|
||||
message(" -- INTERFACE64: ${INTERFACE64}")
|
||||
cprsummary("FC" "${CMAKE_Fortran_COMPILER}"
|
||||
"${CMAKE_Fortran_FLAGS_DEBUG}"
|
||||
"${CMAKE_Fortran_FLAGS_MINSIZEREL}"
|
||||
"${CMAKE_Fortran_FLAGS_RELEASE}"
|
||||
"${CMAKE_Fortran_FLAGS_RELWITHDEBINFO}"
|
||||
"${CMAKE_Fortran_FLAGS}")
|
||||
if (ICB)
|
||||
cprsummary("CC" "${CMAKE_C_COMPILER}"
|
||||
"${CMAKE_C_FLAGS_DEBUG}"
|
||||
"${CMAKE_C_FLAGS_MINSIZEREL}"
|
||||
"${CMAKE_C_FLAGS_RELEASE}"
|
||||
"${CMAKE_C_FLAGS_RELWITHDEBINFO}"
|
||||
"${CMAKE_C_FLAGS}")
|
||||
cprsummary("CXX" "${CMAKE_CXX_COMPILER}"
|
||||
"${CMAKE_CXX_FLAGS_DEBUG}"
|
||||
"${CMAKE_CXX_FLAGS_MINSIZEREL}"
|
||||
"${CMAKE_CXX_FLAGS_RELEASE}"
|
||||
"${CMAKE_CXX_FLAGS_RELWITHDEBINFO}"
|
||||
"${CMAKE_CXX_FLAGS}")
|
||||
endif()
|
||||
if (MPI)
|
||||
libsummary("MPIFC" "${MPI_Fortran_INCLUDE_DIRS}" "${MPI_Fortran_LIBRARIES}")
|
||||
if (ICB)
|
||||
libsummary("MPICC" "${MPI_C_INCLUDE_DIRS}" "${MPI_C_LIBRARIES}")
|
||||
libsummary("MPICXX" "${MPI_CXX_INCLUDE_DIRS}" "${MPI_CXX_LIBRARIES}")
|
||||
endif()
|
||||
endif()
|
||||
libsummary("BLAS" "" "${BLAS_LIBRARIES}")
|
||||
libsummary("LAPACK" "" "${LAPACK_LIBRARIES}")
|
||||
if (ICBEXMM)
|
||||
libsummary("EIGEN3" "${EIGEN3_INCLUDE_DIR}" "")
|
||||
endif()
|
||||
if (PYTHON3)
|
||||
libsummary("PYTHON" "${PYTHON_INCLUDE_DIRS}" "${PYTHON_LIBRARIES}")
|
||||
message(" -- exe: ${PYTHON_EXECUTABLE}")
|
||||
libsummary("BOOST" "${Boost_INCLUDE_DIRS}" "${Boost_LIBRARIES}")
|
||||
endif()
|
||||
@@ -0,0 +1,45 @@
|
||||
|
||||
BSD Software License
|
||||
|
||||
Pertains to ARPACK and P_ARPACK
|
||||
|
||||
Copyright (c) 1996-2008 Rice University.
|
||||
Developed by D.C. Sorensen, R.B. Lehoucq, C. Yang, and K. Maschhoff.
|
||||
All rights reserved.
|
||||
|
||||
Arpack has been renamed to arpack-ng.
|
||||
|
||||
Copyright (c) 2001-2011 - Scilab Enterprises
|
||||
Updated by Allan Cornet, Sylvestre Ledru.
|
||||
|
||||
Copyright (c) 2010 - Jordi Gutiérrez Hermoso (Octave patch)
|
||||
|
||||
Copyright (c) 2007 - Sébastien Fabbro (gentoo patch)
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
- Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer listed
|
||||
in this license in the documentation and/or other materials
|
||||
provided with the distribution.
|
||||
|
||||
- Neither the name of the copyright holders nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
+2
-2
@@ -219,7 +219,7 @@ c %---------------------------------%
|
||||
of the Hessenberg matrix and their the corresponding
|
||||
error bounds, KEV, NP.
|
||||
|
||||
mnapps > 0: *Print information about where deflation occured.
|
||||
mnapps > 0: *Print information about where deflation occurred.
|
||||
mnapps > 1: *Print sigmak, betak, order of the final Hessenberg matrix,
|
||||
and the final compressed upper Hessenberg matrix.
|
||||
mnapps > 2: *Print implicit application of shift number, real and imaginary
|
||||
@@ -303,7 +303,7 @@ c %---------------------------------%
|
||||
of the Hessenberg matrix and their the corresponding
|
||||
error bounds, KEV, NP.
|
||||
|
||||
mcapps > 0: *Print information about where deflation occured.
|
||||
mcapps > 0: *Print information about where deflation occurred.
|
||||
mcapps > 1: *Print sigmak, betak, order of the final Hessenberg matrix,
|
||||
and the final compressed upper Hessenberg matrix.
|
||||
mcapps > 2: *Print implicit application of shift number, the shift.
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
LDADD = $(top_builddir)/SRC/libarpack$(LIBSUFFIX)$(ITF64SUFFIX).la $(LAPACK_LIBS) $(BLAS_LIBS)
|
||||
|
||||
SSBDR = ssbdr1 ssbdr2 ssbdr3 ssbdr4 ssbdr5 ssbdr6
|
||||
DSBDR = dsbdr1 dsbdr2 dsbdr3 dsbdr4 dsbdr5 dsbdr6
|
||||
SNBDR = snbdr1 snbdr2 snbdr3 snbdr4 snbdr5 snbdr6
|
||||
DNBDR = dnbdr1 dnbdr2 dnbdr3 dnbdr4 dnbdr5 dnbdr6
|
||||
CNBDR = cnbdr1 cnbdr2 cnbdr3 cnbdr4
|
||||
ZNBDR = znbdr1 znbdr2 znbdr3 znbdr4
|
||||
BAND = $(SSBDR) $(DSBDR) $(SNBDR) $(DNBDR) $(CNBDR) $(ZNBDR)
|
||||
|
||||
check_PROGRAMS = $(BAND)
|
||||
TESTS = $(check_PROGRAMS)
|
||||
|
||||
EXTRA_DIST = README
|
||||
|
||||
# Simple symmetric problem using BAND solver (single precision)
|
||||
ssbdr1_SOURCES = ssbdr1.f ssband.f
|
||||
ssbdr2_SOURCES = ssbdr2.f ssband.f
|
||||
ssbdr3_SOURCES = ssbdr3.f ssband.f
|
||||
ssbdr4_SOURCES = ssbdr4.f ssband.f
|
||||
ssbdr5_SOURCES = ssbdr5.f ssband.f
|
||||
ssbdr6_SOURCES = ssbdr6.f ssband.f
|
||||
|
||||
# Simple symmetric problem using BAND solver (double precision)
|
||||
dsbdr1_SOURCES = dsbdr1.f dsband.f
|
||||
dsbdr2_SOURCES = dsbdr2.f dsband.f
|
||||
dsbdr3_SOURCES = dsbdr3.f dsband.f
|
||||
dsbdr4_SOURCES = dsbdr4.f dsband.f
|
||||
dsbdr5_SOURCES = dsbdr5.f dsband.f
|
||||
dsbdr6_SOURCES = dsbdr6.f dsband.f
|
||||
|
||||
# Simple nonsymmetric problem using BAND solver (single precision)
|
||||
snbdr1_SOURCES = snbdr1.f snband.f
|
||||
snbdr2_SOURCES = snbdr2.f snband.f
|
||||
snbdr3_SOURCES = snbdr3.f snband.f
|
||||
snbdr4_SOURCES = snbdr4.f snband.f
|
||||
snbdr5_SOURCES = snbdr5.f snband.f
|
||||
snbdr6_SOURCES = snbdr6.f snband.f
|
||||
|
||||
# Simple nonsymmetric problem using BAND solver (double precision)
|
||||
dnbdr1_SOURCES = dnbdr1.f dnband.f
|
||||
dnbdr2_SOURCES = dnbdr2.f dnband.f
|
||||
dnbdr3_SOURCES = dnbdr3.f dnband.f
|
||||
dnbdr4_SOURCES = dnbdr4.f dnband.f
|
||||
dnbdr5_SOURCES = dnbdr5.f dnband.f
|
||||
dnbdr6_SOURCES = dnbdr6.f dnband.f
|
||||
|
||||
# Complex problem using BAND solver (single precision complex)
|
||||
cnbdr1_SOURCES = cnbdr1.f cnband.f
|
||||
cnbdr2_SOURCES = cnbdr2.f cnband.f
|
||||
cnbdr3_SOURCES = cnbdr3.f cnband.f
|
||||
cnbdr4_SOURCES = cnbdr4.f cnband.f
|
||||
|
||||
# Complex problem using BAND solver (double precision complex)
|
||||
znbdr1_SOURCES = znbdr1.f znband.f
|
||||
znbdr2_SOURCES = znbdr2.f znband.f
|
||||
znbdr3_SOURCES = znbdr3.f znband.f
|
||||
znbdr4_SOURCES = znbdr4.f znband.f
|
||||
+97
-97
@@ -3,27 +3,27 @@ c
|
||||
c \Name: cnband
|
||||
c
|
||||
c \Description:
|
||||
c This subroutine returns the converged approximations to eigenvalues
|
||||
c of A*z = lambda*B*z and (optionally):
|
||||
c
|
||||
c (1) The corresponding approximate eigenvectors;
|
||||
c
|
||||
c (2) An orthonormal basis for the associated approximate
|
||||
c invariant subspace;
|
||||
c
|
||||
c (3) Both.
|
||||
c This subroutine returns the converged approximations to eigenvalues
|
||||
c of A*z = lambda*B*z and (optionally):
|
||||
c
|
||||
c (1) The corresponding approximate eigenvectors;
|
||||
c
|
||||
c (2) An orthonormal basis for the associated approximate
|
||||
c invariant subspace;
|
||||
c
|
||||
c (3) Both.
|
||||
c
|
||||
c Matrices A and B are stored in LAPACK-style banded form.
|
||||
c
|
||||
c There is negligible additional cost to obtain eigenvectors. An orthonormal
|
||||
c There is negligible additional cost to obtain eigenvectors. An orthonormal
|
||||
c basis is always computed. There is an additional storage cost of n*nev
|
||||
c if both are requested (in this case a separate array Z must be supplied).
|
||||
c if both are requested (in this case a separate array Z must be supplied).
|
||||
c
|
||||
c The approximate eigenvalues and eigenvectors of A*z = lambda*B*z
|
||||
c are commonly called Ritz values and Ritz vectors respectively. They are
|
||||
c referred to as such in the comments that follow. The computed orthonormal
|
||||
c basis for the invariant subspace corresponding to these Ritz values is
|
||||
c referred to as a Schur basis.
|
||||
c are commonly called Ritz values and Ritz vectors respectively. They are
|
||||
c referred to as such in the comments that follow. The computed orthonormal
|
||||
c basis for the invariant subspace corresponding to these Ritz values is
|
||||
c referred to as a Schur basis.
|
||||
c
|
||||
c cnband can be called with one of the following modes:
|
||||
c
|
||||
@@ -41,14 +41,14 @@ c Choice of different modes can be specified in IPARAM(7) defined below.
|
||||
c
|
||||
c \Usage
|
||||
c call cnband
|
||||
c ( RVEC, HOWMNY, SELECT, D , Z, LDZ, SIGMA, WORKEV, N, AB,
|
||||
c MB, LDA, FAC, KL, KU, WHICH, BMAT, NEV, TOL, RESID, NCV,
|
||||
c ( RVEC, HOWMNY, SELECT, D , Z, LDZ, SIGMA, WORKEV, N, AB,
|
||||
c MB, LDA, FAC, KL, KU, WHICH, BMAT, NEV, TOL, RESID, NCV,
|
||||
c V, LDV, IPARAM, WORKD, WORKL, LWORKL, RWORK, IWORK, INFO )
|
||||
c
|
||||
c \Arguments
|
||||
c RVEC LOGICAL (INPUT)
|
||||
c RVEC LOGICAL (INPUT)
|
||||
c Specifies whether a basis for the invariant subspace corresponding
|
||||
c to the converged Ritz value approximations for the eigenproblem
|
||||
c to the converged Ritz value approximations for the eigenproblem
|
||||
c A*z = lambda*B*z is computed.
|
||||
c
|
||||
c RVEC = .FALSE. Compute Ritz values only.
|
||||
@@ -56,8 +56,8 @@ c
|
||||
c RVEC = .TRUE. Compute Ritz vectors or Schur vectors.
|
||||
c See Remarks below.
|
||||
c
|
||||
c HOWMNY Character*1 (INPUT)
|
||||
c Specifies the form of the invariant subspace to be computed
|
||||
c HOWMNY Character*1 (INPUT)
|
||||
c Specifies the form of the invariant subspace to be computed
|
||||
c corresponding to the converged Ritz values.
|
||||
c = 'A': Compute NEV Ritz vectors;
|
||||
c = 'P': Compute NEV Schur vectors;
|
||||
@@ -67,7 +67,7 @@ c
|
||||
c SELECT Logical array of dimension NCV. (INPUT)
|
||||
c If HOWMNY = 'S', SELECT specifies the Ritz vectors to be
|
||||
c computed. To select the real Ritz vector corresponding to a
|
||||
c Ritz value D(j), SELECT(j) must be set to .TRUE..
|
||||
c Ritz value D(j), SELECT(j) must be set to .TRUE..
|
||||
c If HOWMNY = 'A' or 'P', SELECT need not be initialized
|
||||
c but it is used as internal workspace.
|
||||
c
|
||||
@@ -76,16 +76,16 @@ c On exit, D contains the Ritz approximations
|
||||
c to the eigenvalues lambda for A*z = lambda*B*z.
|
||||
c
|
||||
c Z Complex N by NEV array (OUTPUT)
|
||||
c On exit, if RVEC = .TRUE. and HOWMNY = 'A', then the columns of
|
||||
c Z represents approximate eigenvectors (Ritz vectors) corresponding
|
||||
c On exit, if RVEC = .TRUE. and HOWMNY = 'A', then the columns of
|
||||
c Z represents approximate eigenvectors (Ritz vectors) corresponding
|
||||
c to the NCONV=IPARAM(5) Ritz values for eigensystem
|
||||
c A*z = lambda*B*z.
|
||||
c
|
||||
c If RVEC = .FALSE. or HOWMNY = 'P', then Z is NOT REFERENCED.
|
||||
c
|
||||
c NOTE: If if RVEC = .TRUE. and a Schur basis is not required,
|
||||
c the array Z may be set equal to first NEV columns of the
|
||||
c array V.
|
||||
c NOTE: If if RVEC = .TRUE. and a Schur basis is not required,
|
||||
c the array Z may be set equal to first NEV columns of the
|
||||
c array V.
|
||||
c
|
||||
c LDZ Integer. (INPUT)
|
||||
c The leading dimension of the array Z. If Ritz vectors are
|
||||
@@ -97,7 +97,7 @@ c If IPARAM(7) = 3 then SIGMA represents the shift.
|
||||
c Not referenced if IPARAM(7) = 1 or 2.
|
||||
c
|
||||
c WORKEV Complex work array of dimension NCV. (WORKSPACE)
|
||||
c
|
||||
c
|
||||
c N Integer. (INPUT)
|
||||
c Dimension of the eigenproblem.
|
||||
c
|
||||
@@ -110,7 +110,7 @@ c AB(kl+ku+1+i-j,j) = A(i,j) for max(1,j-ku)<=i<=min(m,j+kl)
|
||||
c
|
||||
c MB Complex array of dimension LDA by N. (INPUT)
|
||||
c The matrix M in band storage, in rows KL+1 to
|
||||
c 2*KL+KU+1; rows 1 to KL of the array need not be set.
|
||||
c 2*KL+KU+1; rows 1 to KL of the array need not be set.
|
||||
c The j-th column of M is stored in the j-th column of the
|
||||
c array MB as follows:
|
||||
c MB(kl+ku+1+i-j,j) = M(i,j) for max(1,j-ku)<=i<=min(m,j+kl)
|
||||
@@ -134,7 +134,7 @@ c
|
||||
c WHICH Character*2. (INPUT)
|
||||
c When mode 1,2 are used, WHICH can be set to any one of
|
||||
c the following.
|
||||
c
|
||||
c
|
||||
c 'LM' -> want the NEV eigenvalues of largest magnitude.
|
||||
c 'SM' -> want the NEV eigenvalues of smallest magnitude.
|
||||
c 'LR' -> want the NEV eigenvalues of largest real part.
|
||||
@@ -142,8 +142,8 @@ c 'SR' -> want the NEV eigenvalues of smallest real part.
|
||||
c 'LI' -> want the NEV eigenvalues of largest imaginary part.
|
||||
c 'SI' -> want the NEV eigenvalues of smallest imaginary part.
|
||||
c
|
||||
c When mode 3 is used, WHICH should be set to 'LM' only.
|
||||
c
|
||||
c When mode 3 is used, WHICH should be set to 'LM' only.
|
||||
c
|
||||
c BMAT Character*1. (INPUT)
|
||||
c BMAT specifies the type of the matrix B that defines the
|
||||
c semi-inner product for the operator OP.
|
||||
@@ -152,13 +152,13 @@ c BMAT = 'G' -> generalized eigenvalue problem A*x = lambda*M*x
|
||||
|
||||
c NEV Integer. (INPUT)
|
||||
c Number of eigenvalues of to be computed.
|
||||
c
|
||||
c
|
||||
c TOL Real scalar. (INPUT)
|
||||
c Stopping criteria: the relative accuracy of the Ritz value
|
||||
c is considered acceptable if BOUNDS(I) .LE. TOL*ABS(RITZ(I))
|
||||
c where ABS(RITZ(I)) is the magnitude when RITZ(I) is complex.
|
||||
c DEFAULT = slamch('EPS') (machine precision as computed
|
||||
c by the LAPACK auxilliary subroutine slamch).
|
||||
c by the LAPACK auxiliary subroutine slamch).
|
||||
c
|
||||
c RESID Complex array of length N. (INPUT/OUTPUT)
|
||||
c On INPUT:
|
||||
@@ -171,12 +171,12 @@ c
|
||||
c NCV Integer. (INPUT)
|
||||
c Number of columns of the matrix V. NCV must satisfy the two
|
||||
c inequalities 2 <= NCV-NEV and NCV <= N.
|
||||
c This will indicate how many Arnoldi vectors are generated
|
||||
c at each iteration. After the startup phase in which NEV
|
||||
c Arnoldi vectors are generated, the algorithm generates
|
||||
c approximately NCV-NEV Arnoldi vectors at each subsequent update
|
||||
c iteration. Most of the cost in generating each Arnoldi vector is
|
||||
c in the matrix-vector operation OP*x.
|
||||
c This will indicate how many Arnoldi vectors are generated
|
||||
c at each iteration. After the startup phase in which NEV
|
||||
c Arnoldi vectors are generated, the algorithm generates
|
||||
c approximately NCV-NEV Arnoldi vectors at each subsequent update
|
||||
c iteration. Most of the cost in generating each Arnoldi vector is
|
||||
c in the matrix-vector operation OP*x.
|
||||
c
|
||||
c V Complex array N by NCV. (OUTPUT)
|
||||
c Upon OUTPUT: If RVEC = .TRUE. the first NCONV=IPARAM(5) columns
|
||||
@@ -184,8 +184,8 @@ c contain approximate Schur vectors that span the
|
||||
c desired invariant subspace.
|
||||
c
|
||||
c NOTE: If the array Z has been set equal to first NEV+1 columns
|
||||
c of the array V and RVEC=.TRUE. and HOWMNY= 'A', then
|
||||
c the first NCONV=IPARAM(5) columns of V will contain Ritz vectors
|
||||
c of the array V and RVEC=.TRUE. and HOWMNY= 'A', then
|
||||
c the first NCONV=IPARAM(5) columns of V will contain Ritz vectors
|
||||
c of the eigensystem A*z = lambda*B*z.
|
||||
c
|
||||
c LDV Integer. (INPUT)
|
||||
@@ -193,7 +193,7 @@ c Leading dimension of V exactly as declared in the calling
|
||||
c program. LDV must be great than or equal to N.
|
||||
c
|
||||
c IPARAM Integer array of length 11. (INPUT/OUTPUT)
|
||||
c IPARAM(1) = ISHIFT:
|
||||
c IPARAM(1) = ISHIFT:
|
||||
c The shifts selected at each iteration are used to restart
|
||||
c the Arnoldi iteration in an implicit fashion.
|
||||
c It is set to 1 in this subroutine. The user do not need
|
||||
@@ -223,12 +223,12 @@ c Not referenced. Implicit restarting is ALWAYS used.
|
||||
c
|
||||
c IPARAM(7) = MODE
|
||||
c On INPUT determines what type of eigenproblem is being solved.
|
||||
c Must be 1,2 or 3; See under \Description of cnband for the
|
||||
c Must be 1,2 or 3; See under \Description of cnband for the
|
||||
c three modes available.
|
||||
c
|
||||
c WORKD Complex work array of length at least 3*n. (WORKSPACE)
|
||||
c
|
||||
c WORKL Complex work array of length LWORKL. (WORKSPACE)
|
||||
c WORKL Complex work array of length LWORKL. (WORKSPACE)
|
||||
c
|
||||
c LWORKL Integer. (INPUT)
|
||||
c LWORKL must be at least 3*NCV**2 + 5*NCV.
|
||||
@@ -237,9 +237,9 @@ c RWORK Real array of length N (WORKSPACE)
|
||||
c Workspace used in cnaupd.
|
||||
c
|
||||
c IWORK Integer array of dimension at least N. (WORKSPACE)
|
||||
c Used to mode 2,3. Store the pivot information in the
|
||||
c Used to mode 2,3. Store the pivot information in the
|
||||
c factorization of M or (A-SIGMA*M).
|
||||
c
|
||||
c
|
||||
c INFO Integer. (INPUT/OUTPUT)
|
||||
c Error flag on output.
|
||||
c = 0: Normal exit.
|
||||
@@ -300,21 +300,21 @@ c
|
||||
c-----------------------------------------------------------------------
|
||||
c
|
||||
subroutine cnband(rvec, howmny, select, d , z, ldz, sigma,
|
||||
& workev, n, ab, mb, lda, fac, kl, ku, which,
|
||||
& bmat, nev, tol, resid, ncv, v, ldv, iparam,
|
||||
& workev, n, ab, mb, lda, fac, kl, ku, which,
|
||||
& bmat, nev, tol, resid, ncv, v, ldv, iparam,
|
||||
& workd, workl, lworkl, rwork, iwork, info )
|
||||
c
|
||||
c %------------------%
|
||||
c | Scalar Arguments |
|
||||
c %------------------%
|
||||
c
|
||||
c
|
||||
Character which*2, bmat, howmny
|
||||
Logical rvec
|
||||
Integer n, lda, kl, ku, nev, ncv, ldv,
|
||||
& ldz, lworkl, info
|
||||
Complex
|
||||
& sigma
|
||||
Real
|
||||
& ldz, lworkl, info
|
||||
Complex
|
||||
& sigma
|
||||
Real
|
||||
& tol
|
||||
c
|
||||
c %-----------------%
|
||||
@@ -323,11 +323,11 @@ c %-----------------%
|
||||
c
|
||||
Integer iparam(*), iwork(*)
|
||||
Logical select(*)
|
||||
Complex
|
||||
Complex
|
||||
& d(*), resid(*), v(ldv,*), z(ldz,*),
|
||||
& ab(lda,*), mb(lda,*), fac(lda,*),
|
||||
& ab(lda,*), mb(lda,*), fac(lda,*),
|
||||
& workd(*), workl(*), workev(*)
|
||||
Real
|
||||
Real
|
||||
& rwork(*)
|
||||
c
|
||||
c %--------------%
|
||||
@@ -346,7 +346,7 @@ c %------------%
|
||||
c | Parameters |
|
||||
c %------------%
|
||||
c
|
||||
Complex
|
||||
Complex
|
||||
& one, zero
|
||||
parameter (one = (1.0E+0, 0.0E+0) ,
|
||||
& zero = (0.0E+0, 0.0E+0) )
|
||||
@@ -355,14 +355,14 @@ c %-----------------------------%
|
||||
c | LAPACK & BLAS routines used |
|
||||
c %-----------------------------%
|
||||
c
|
||||
Real
|
||||
Real
|
||||
& scnrm2
|
||||
external ccopy, cgbmv, cgbtrf, cgbtrs, scnrm2, clacpy
|
||||
c
|
||||
c %-----------------------%
|
||||
c | Executable Statements |
|
||||
c %-----------------------%
|
||||
c
|
||||
c
|
||||
mode = iparam(7)
|
||||
c
|
||||
c %------------------------%
|
||||
@@ -398,9 +398,9 @@ c | to factor M. |
|
||||
c %-----------------------------------------------%
|
||||
c
|
||||
call clacpy ('A', ibot, n, mb, lda, fac, lda )
|
||||
call cgbtrf(n, n, kl, ku, fac, lda, iwork, ierr)
|
||||
call cgbtrf(n, n, kl, ku, fac, lda, iwork, ierr)
|
||||
if (ierr .ne. 0) then
|
||||
print*, ' '
|
||||
print*, ' '
|
||||
print*,'_band: error in _gbtrf'
|
||||
print*, ' '
|
||||
go to 9000
|
||||
@@ -426,7 +426,7 @@ c | Construct (A - sigma*M) |
|
||||
c %---------------------------%
|
||||
c
|
||||
do 30 j = 1,n
|
||||
do 20 i = itop, ibot
|
||||
do 20 i = itop, ibot
|
||||
fac(i,j) = ab(i,j) - sigma*mb(i,j)
|
||||
20 continue
|
||||
30 continue
|
||||
@@ -451,7 +451,7 @@ c %--------------------------------------------%
|
||||
c | M A I N L O O P (reverse communication) |
|
||||
c %--------------------------------------------%
|
||||
c
|
||||
40 continue
|
||||
40 continue
|
||||
c
|
||||
call cnaupd ( ido, bmat, n, which, nev, tol, resid, ncv,
|
||||
& v, ldv, iparam, ipntr, workd, workl, lworkl,
|
||||
@@ -466,8 +466,8 @@ c %----------------------------%
|
||||
c | Perform y <--- OP*x = A*x |
|
||||
c %----------------------------%
|
||||
c
|
||||
call cgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
call cgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
& workd(ipntr(2)), 1)
|
||||
c
|
||||
else if ( mode .eq. 2 ) then
|
||||
@@ -476,11 +476,11 @@ c %-----------------------------------%
|
||||
c | Perform y <--- OP*x = inv[M]*A*x |
|
||||
c %-----------------------------------%
|
||||
c
|
||||
call cgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
call cgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
& workd(ipntr(2)), 1)
|
||||
c
|
||||
call cgbtrs ('Notranspose', n, kl, ku, 1, fac, lda,
|
||||
call cgbtrs ('Notranspose', n, kl, ku, 1, fac, lda,
|
||||
& iwork, workd(ipntr(2)), n, ierr)
|
||||
if (ierr .ne. 0) then
|
||||
print*, ' '
|
||||
@@ -493,21 +493,21 @@ c
|
||||
c
|
||||
c %-----------------------------------------%
|
||||
c | Perform y <-- OP*x |
|
||||
c | = inv[A-SIGMA*M]*M* x
|
||||
c | = inv[A-SIGMA*M]*M* x
|
||||
c | to force the starting vector into the |
|
||||
c | range of OP. |
|
||||
c %-----------------------------------------%
|
||||
c
|
||||
call cgbmv('Notranspose', n, n, kl, ku, one, mb(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
call cgbmv('Notranspose', n, n, kl, ku, one, mb(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
& workd(ipntr(2)), 1)
|
||||
c
|
||||
call cgbtrs ('Notranspose', n, kl, ku, 1, fac, lda,
|
||||
call cgbtrs ('Notranspose', n, kl, ku, 1, fac, lda,
|
||||
& iwork, workd(ipntr(2)), n, ierr)
|
||||
if (ierr .ne. 0) then
|
||||
print*, ' '
|
||||
print*, ' '
|
||||
print*, '_band: error in _gbtrs.'
|
||||
print*, ' '
|
||||
print*, ' '
|
||||
go to 9000
|
||||
end if
|
||||
c
|
||||
@@ -521,8 +521,8 @@ c %----------------------------%
|
||||
c | Perform y <--- OP*x = A*x |
|
||||
c %----------------------------%
|
||||
c
|
||||
call cgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
call cgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
& workd(ipntr(2)), 1)
|
||||
c
|
||||
else if ( mode .eq. 2 ) then
|
||||
@@ -531,16 +531,16 @@ c %-----------------------------------%
|
||||
c | Perform y <--- OP*x = inv[M]*A*x |
|
||||
c %-----------------------------------%
|
||||
c
|
||||
call cgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
call cgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
& workd(ipntr(2)), 1)
|
||||
c
|
||||
call cgbtrs ('Notranspose', n, kl, ku, 1, fac, lda,
|
||||
call cgbtrs ('Notranspose', n, kl, ku, 1, fac, lda,
|
||||
& iwork, workd(ipntr(2)), ldv, ierr)
|
||||
if (ierr .ne. 0) then
|
||||
print*, ' '
|
||||
print*, '_band: error in sbgtrs.'
|
||||
print*, ' '
|
||||
print*, ' '
|
||||
go to 9000
|
||||
end if
|
||||
c
|
||||
@@ -563,19 +563,19 @@ c
|
||||
end if
|
||||
c
|
||||
else
|
||||
c
|
||||
c
|
||||
c %--------------------------------------%
|
||||
c | Perform y <-- inv(A-sigma*M)*(M*x). |
|
||||
c | (M*x) has been computed and stored |
|
||||
c | in workd(ipntr(3)). |
|
||||
c | in workd(ipntr(3)). |
|
||||
c %--------------------------------------%
|
||||
c
|
||||
call ccopy(n, workd(ipntr(3)), 1, workd(ipntr(2)), 1)
|
||||
call cgbtrs ('Notranspose', n, kl, ku, 1, fac, lda,
|
||||
call cgbtrs ('Notranspose', n, kl, ku, 1, fac, lda,
|
||||
& iwork, workd(ipntr(2)), n, ierr)
|
||||
if (ierr .ne. 0) then
|
||||
if (ierr .ne. 0) then
|
||||
print*, ' '
|
||||
print*, '_band: error in _gbtrs.'
|
||||
print*, '_band: error in _gbtrs.'
|
||||
print*, ' '
|
||||
go to 9000
|
||||
end if
|
||||
@@ -590,14 +590,14 @@ c %--------------------%
|
||||
c | Perform y <-- M*x |
|
||||
c %--------------------%
|
||||
c
|
||||
call cgbmv('Notranspose', n, n, kl, ku, one, mb(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
call cgbmv('Notranspose', n, n, kl, ku, one, mb(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
& workd(ipntr(2)), 1)
|
||||
c
|
||||
else
|
||||
else
|
||||
c
|
||||
c %-------------------------------------------%
|
||||
c | Either we have convergence, or there is |
|
||||
c | Either we have convergence, or there is |
|
||||
c | error. |
|
||||
c %-------------------------------------------%
|
||||
c
|
||||
@@ -613,7 +613,7 @@ c
|
||||
print *, ' Check the documentation of _naupd '
|
||||
print *, ' '
|
||||
c
|
||||
else
|
||||
else
|
||||
c
|
||||
call cneupd (rvec, howmny , select, d, z, ldz, sigma,
|
||||
& workev, bmat, n, which, nev, tol,
|
||||
@@ -621,17 +621,17 @@ c
|
||||
& workl, lworkl, rwork, info)
|
||||
c
|
||||
if ( info .ne. 0) then
|
||||
c
|
||||
c
|
||||
c %------------------------------------%
|
||||
c | Check the documentation of cneupd. |
|
||||
c %------------------------------------%
|
||||
c
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
print *, ' Error with _neupd = ', info
|
||||
print *, ' Check the documentation of _neupd '
|
||||
print *, ' '
|
||||
c
|
||||
endif
|
||||
print *, ' '
|
||||
c
|
||||
endif
|
||||
c
|
||||
end if
|
||||
c
|
||||
@@ -643,7 +643,7 @@ c %----------------------------------------%
|
||||
c | L O O P B A C K to call cnaupd again. |
|
||||
c %----------------------------------------%
|
||||
c
|
||||
go to 40
|
||||
go to 40
|
||||
c
|
||||
9000 continue
|
||||
c
|
||||
|
||||
+39
-39
@@ -49,13 +49,13 @@ c | MAXN - Maximum size of the matrix |
|
||||
c | MAXNEV - Maximum number of |
|
||||
c | eigenvalues to be computed |
|
||||
c | MAXNCV - Maximum number of Arnoldi |
|
||||
c | vectors stored |
|
||||
c | vectors stored |
|
||||
c | MAXBDW - Maximum bandwidth |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
integer maxn, maxnev, maxncv, maxbdw, lda,
|
||||
& lworkl, ldv
|
||||
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
|
||||
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
|
||||
& maxbdw=50, lda = maxbdw, ldv = maxn )
|
||||
c
|
||||
c %--------------%
|
||||
@@ -64,12 +64,12 @@ c %--------------%
|
||||
c
|
||||
integer iparam(11), iwork(maxn)
|
||||
logical select(maxncv)
|
||||
Complex
|
||||
Complex
|
||||
& a(lda,maxn), m(lda,maxn), fac(lda,maxn),
|
||||
& workl(3*maxncv*maxncv+5*maxncv), workd(3*maxn),
|
||||
& workl(3*maxncv*maxncv+5*maxncv), workd(3*maxn),
|
||||
& workev(2*maxncv), v(ldv, maxncv),
|
||||
& resid(maxn), d(maxncv), ax(maxn)
|
||||
Real
|
||||
Real
|
||||
& rwork(maxn), rd(maxncv,3)
|
||||
c
|
||||
c %---------------%
|
||||
@@ -81,28 +81,28 @@ c
|
||||
& n, nx, lo, isub, isup, idiag, maxitr, mode,
|
||||
& nconv
|
||||
logical rvec
|
||||
Real
|
||||
Real
|
||||
& tol
|
||||
Complex
|
||||
Complex
|
||||
& rho, h, h2, sigma
|
||||
c
|
||||
c
|
||||
c %------------%
|
||||
c | Parameters |
|
||||
c %------------%
|
||||
c
|
||||
Complex
|
||||
Complex
|
||||
& one, zero, two
|
||||
parameter ( one = (1.0E+0, 0.0E+0) ,
|
||||
& zero = (0.0E+0, 0.0E+0) ,
|
||||
parameter ( one = (1.0E+0, 0.0E+0) ,
|
||||
& zero = (0.0E+0, 0.0E+0) ,
|
||||
& two = (2.0E+0, 0.0E+0) )
|
||||
c
|
||||
c %-----------------------------%
|
||||
c | BLAS & LAPACK routines used |
|
||||
c %-----------------------------%
|
||||
c
|
||||
Real
|
||||
Real
|
||||
& scnrm2, slapy2
|
||||
external scnrm2, cgbmv, caxpy, slapy2, claset
|
||||
external scnrm2, cgbmv, caxpy, slapy2, claset
|
||||
c
|
||||
c %-----------------------%
|
||||
c | Executable Statements |
|
||||
@@ -112,7 +112,7 @@ c %-------------------------------------------------%
|
||||
c | The number NX is the number of interior points |
|
||||
c | in the discretization of the 2-dimensional |
|
||||
c | convection-diffusion operator on the unit |
|
||||
c | square with zero Dirichlet boundary condition. |
|
||||
c | square with zero Dirichlet boundary condition. |
|
||||
c | The number N(=NX*NX) is the dimension of the |
|
||||
c | matrix. A standard eigenvalue problem is |
|
||||
c | solved (BMAT = 'I'). NEV is the number of |
|
||||
@@ -123,13 +123,13 @@ c | the spectrum. However, the following |
|
||||
c | conditions must be satisfied: |
|
||||
c | N <= MAXN |
|
||||
c | NEV <= MAXNEV |
|
||||
c | NEV + 2 <= NCV <= MAXNCV |
|
||||
c %-------------------------------------------------%
|
||||
c | NEV + 2 <= NCV <= MAXNCV |
|
||||
c %-------------------------------------------------%
|
||||
c
|
||||
nx = 10
|
||||
nx = 10
|
||||
n = nx*nx
|
||||
nev = 4
|
||||
ncv = 10
|
||||
nev = 4
|
||||
ncv = 10
|
||||
if ( n .gt. maxn ) then
|
||||
print *, ' ERROR with _NBDR1: N is greater than MAXN '
|
||||
go to 9000
|
||||
@@ -154,7 +154,7 @@ c | Arnoldi iteration. |
|
||||
c %-----------------------------------------------------%
|
||||
c
|
||||
lworkl = 3*ncv**2+5*ncv
|
||||
tol = 0.0
|
||||
tol = 0.0
|
||||
info = 0
|
||||
c
|
||||
c %---------------------------------------------------%
|
||||
@@ -168,7 +168,7 @@ c
|
||||
maxitr = 300
|
||||
mode = 1
|
||||
c
|
||||
iparam(3) = maxitr
|
||||
iparam(3) = maxitr
|
||||
iparam(7) = mode
|
||||
c
|
||||
c %----------------------------------------%
|
||||
@@ -190,10 +190,10 @@ c | and subdiagonals within the band of |
|
||||
c | matrices A and M. |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
kl = nx
|
||||
ku = nx
|
||||
kl = nx
|
||||
ku = nx
|
||||
c
|
||||
c %---------------%
|
||||
c %---------------%
|
||||
c | Main diagonal |
|
||||
c %---------------%
|
||||
c
|
||||
@@ -203,13 +203,13 @@ c
|
||||
idiag = kl+ku+1
|
||||
do 30 j = 1, n
|
||||
a(idiag,j) = (4.0E+0, 0.0E+0) / h2
|
||||
30 continue
|
||||
c
|
||||
30 continue
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | First subdiagonal and superdiagonal |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
rho = (1.0E+2, 0.0E+0)
|
||||
c
|
||||
rho = (1.0E+2, 0.0E+0)
|
||||
isup = kl+ku
|
||||
isub = kl+ku+2
|
||||
do 50 i = 1, nx
|
||||
@@ -217,8 +217,8 @@ c
|
||||
do 40 j = lo+1, lo+nx-1
|
||||
a(isup,j+1) = -one/h2 + rho/two/h
|
||||
a(isub,j) = -one/h2 - rho/two/h
|
||||
40 continue
|
||||
50 continue
|
||||
40 continue
|
||||
50 continue
|
||||
c
|
||||
c %------------------------------------%
|
||||
c | KL-th subdiagonal and KU-th super- |
|
||||
@@ -232,8 +232,8 @@ c
|
||||
do 70 j = lo+1, lo+nx
|
||||
a(isup,nx+j) = -one / h2
|
||||
a(isub,j) = -one / h2
|
||||
70 continue
|
||||
80 continue
|
||||
70 continue
|
||||
80 continue
|
||||
c
|
||||
c %-----------------------------------------------%
|
||||
c | Call ARPACK banded solver to find eigenvalues |
|
||||
@@ -241,11 +241,11 @@ c | and eigenvectors. Eigenvalues are returned in |
|
||||
c | the one dimensional array D. Eigenvectors |
|
||||
c | are returned in the first NCONV (=IPARAM(5)) |
|
||||
c | columns of V. |
|
||||
c %-----------------------------------------------%
|
||||
c %-----------------------------------------------%
|
||||
c
|
||||
rvec = .true.
|
||||
rvec = .true.
|
||||
call cnband(rvec, 'A', select, d, v, ldv, sigma,
|
||||
& workev, n, a, m, lda, fac, kl, ku, which,
|
||||
& workev, n, a, m, lda, fac, kl, ku, which,
|
||||
& bmat, nev, tol, resid, ncv, v, ldv, iparam,
|
||||
& workd, workl, lworkl, rwork, iwork, info)
|
||||
c
|
||||
@@ -294,11 +294,11 @@ c
|
||||
rd(j,2) = aimag(d(j))
|
||||
rd(j,3) = scnrm2(n, ax, 1)
|
||||
rd(j,3) = rd(j,3) / slapy2(rd(j,1),rd(j,2))
|
||||
90 continue
|
||||
90 continue
|
||||
|
||||
call smout(6, nconv, 3, rd, maxncv, -6,
|
||||
& 'Ritz values (Real,Imag) and relative residuals')
|
||||
else
|
||||
else
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | Either convergence failed, or there |
|
||||
@@ -309,8 +309,8 @@ c
|
||||
print *, ' '
|
||||
print *, ' Error with _nband, info= ', info
|
||||
print *, ' Check the documentation of _nband '
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
c
|
||||
end if
|
||||
c
|
||||
9000 end
|
||||
9000 end
|
||||
|
||||
+37
-37
@@ -49,13 +49,13 @@ c | MAXN - Maximum size of the matrix |
|
||||
c | MAXNEV - Maximum number of |
|
||||
c | eigenvalues to be computed |
|
||||
c | MAXNCV - Maximum number of Arnoldi |
|
||||
c | vectors stored |
|
||||
c | vectors stored |
|
||||
c | MAXBDW - Maximum bandwidth |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
integer maxn, maxnev, maxncv, maxbdw, lda,
|
||||
& lworkl, ldv
|
||||
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
|
||||
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
|
||||
& maxbdw=50, lda = maxbdw, ldv = maxn )
|
||||
c
|
||||
c %--------------%
|
||||
@@ -64,12 +64,12 @@ c %--------------%
|
||||
c
|
||||
integer iparam(11), iwork(maxn)
|
||||
logical select(maxncv)
|
||||
Complex
|
||||
Complex
|
||||
& a(lda,maxn), m(lda,maxn), fac(lda,maxn),
|
||||
& workl(3*maxncv*maxncv+5*maxncv), workd(3*maxn),
|
||||
& workl(3*maxncv*maxncv+5*maxncv), workd(3*maxn),
|
||||
& workev(2*maxncv), v(ldv, maxncv),
|
||||
& resid(maxn), d(maxncv), ax(maxn)
|
||||
Real
|
||||
Real
|
||||
& rwork(maxn), rd(maxncv,3)
|
||||
c
|
||||
c %---------------%
|
||||
@@ -81,18 +81,18 @@ c
|
||||
& n, nxi, lo, isub, isup, idiag, maxitr, mode,
|
||||
& nconv
|
||||
logical rvec
|
||||
Real
|
||||
Real
|
||||
& tol
|
||||
Complex
|
||||
Complex
|
||||
& rho, h, h2, sigma
|
||||
c
|
||||
c
|
||||
c %------------%
|
||||
c | Parameters |
|
||||
c %------------%
|
||||
c
|
||||
Complex
|
||||
Complex
|
||||
& one, zero, two
|
||||
parameter (one = (1.0E+0, 0.0E+0) ,
|
||||
parameter (one = (1.0E+0, 0.0E+0) ,
|
||||
& zero = (0.0E+0, 0.0E+0) ,
|
||||
& two = (2.0E+0, 0.0E+0) )
|
||||
c
|
||||
@@ -100,7 +100,7 @@ c %-----------------------------%
|
||||
c | BLAS & LAPACK routines used |
|
||||
c %-----------------------------%
|
||||
c
|
||||
Real
|
||||
Real
|
||||
& scnrm2, slapy2
|
||||
external scnrm2, cgbmv, caxpy, slapy2, claset
|
||||
c
|
||||
@@ -112,7 +112,7 @@ c %-------------------------------------------------%
|
||||
c | The number NX is the number of interior points |
|
||||
c | in the discretization of the 2-dimensional |
|
||||
c | convection-diffusion operator on the unit |
|
||||
c | square with zero Dirichlet boundary condition. |
|
||||
c | square with zero Dirichlet boundary condition. |
|
||||
c | The number N(=NX*NX) is the dimension of the |
|
||||
c | matrix. A standard eigenvalue problem is |
|
||||
c | solved (BMAT = 'I'). NEV is the number of |
|
||||
@@ -122,16 +122,16 @@ c | is used, WHICH is set to 'LM'. The user can |
|
||||
c | modify NX, NEV and NCV to solve problems of |
|
||||
c | different sizes, and to get different parts the |
|
||||
c | spectrum. However, the following conditions |
|
||||
c | must be satisfied: |
|
||||
c | must be satisfied: |
|
||||
c | N <= MAXN |
|
||||
c | NEV <= MAXNEV |
|
||||
c | NEV + 2 <= NCV <= MAXNCV |
|
||||
c %-------------------------------------------------%
|
||||
c | NEV + 2 <= NCV <= MAXNCV |
|
||||
c %-------------------------------------------------%
|
||||
c
|
||||
nxi = 10
|
||||
nxi = 10
|
||||
n = nxi*nxi
|
||||
nev = 4
|
||||
ncv = 10
|
||||
nev = 4
|
||||
ncv = 10
|
||||
if ( n .gt. maxn ) then
|
||||
print *, ' ERROR with _NBDR2: N is greater than MAXN '
|
||||
go to 9000
|
||||
@@ -157,7 +157,7 @@ c | Arnoldi iteration. |
|
||||
c %-----------------------------------------------------%
|
||||
c
|
||||
lworkl = 3*ncv**2+5*ncv
|
||||
tol = 0.0
|
||||
tol = 0.0
|
||||
info = 0
|
||||
c
|
||||
c %---------------------------------------------------%
|
||||
@@ -193,10 +193,10 @@ c | and subdiagonals within the band of |
|
||||
c | matrices A and M. |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
kl = nxi
|
||||
ku = nxi
|
||||
kl = nxi
|
||||
ku = nxi
|
||||
c
|
||||
c %---------------%
|
||||
c %---------------%
|
||||
c | Main diagonal |
|
||||
c %---------------%
|
||||
c
|
||||
@@ -206,13 +206,13 @@ c
|
||||
idiag = kl+ku+1
|
||||
do 30 j = 1, n
|
||||
a(idiag,j) = (4.0E+0, 0.0E+0) / h2
|
||||
30 continue
|
||||
c
|
||||
30 continue
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | First subdiagonal and superdiagonal |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
rho = (1.0E+2, 0.0E+0)
|
||||
c
|
||||
rho = (1.0E+2, 0.0E+0)
|
||||
isup = kl+ku
|
||||
isub = kl+ku+2
|
||||
do 50 i = 1, nxi
|
||||
@@ -220,8 +220,8 @@ c
|
||||
do 40 j = lo+1, lo+nxi-1
|
||||
a(isup,j+1) = -one/h2 + rho/two/h
|
||||
a(isub,j) = -one/h2 - rho/two/h
|
||||
40 continue
|
||||
50 continue
|
||||
40 continue
|
||||
50 continue
|
||||
c
|
||||
c %------------------------------------%
|
||||
c | KL-th subdiagonal and KU-th super- |
|
||||
@@ -235,8 +235,8 @@ c
|
||||
do 70 j = lo+1, lo+nxi
|
||||
a(isup,nxi+j) = -one / h2
|
||||
a(isub,j) = -one / h2
|
||||
70 continue
|
||||
80 continue
|
||||
70 continue
|
||||
80 continue
|
||||
c
|
||||
c %-----------------------------------------------%
|
||||
c | Call ARPACK banded solver to find eigenvalues |
|
||||
@@ -244,11 +244,11 @@ c | and eigenvectors. Eigenvalues are returned in |
|
||||
c | the one dimensional array D. Eigenvectors |
|
||||
c | are returned in the first NCONV (=IPARAM(5)) |
|
||||
c | columns of V. |
|
||||
c %-----------------------------------------------%
|
||||
c %-----------------------------------------------%
|
||||
c
|
||||
rvec = .true.
|
||||
rvec = .true.
|
||||
call cnband(rvec, 'A', select, d, v, ldv, sigma,
|
||||
& workev, n, a, m, lda, fac, kl, ku, which,
|
||||
& workev, n, a, m, lda, fac, kl, ku, which,
|
||||
& bmat, nev, tol, resid, ncv, v, ldv, iparam,
|
||||
& workd, workl, lworkl, rwork, iwork, info)
|
||||
c
|
||||
@@ -297,11 +297,11 @@ c
|
||||
rd(j,2) = aimag(d(j))
|
||||
rd(j,3) = scnrm2(n, ax, 1)
|
||||
rd(j,3) = rd(j,3) / slapy2(rd(j,1),rd(j,2))
|
||||
90 continue
|
||||
90 continue
|
||||
|
||||
call smout(6, nconv, 3, rd, maxncv, -6,
|
||||
& 'Ritz values (Real,Imag) and relative residuals')
|
||||
else
|
||||
else
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | Either convergence failed, or there |
|
||||
@@ -312,8 +312,8 @@ c
|
||||
print *, ' '
|
||||
print *, ' Error with _nband, info= ', info
|
||||
print *, ' Check the documentation of _nband '
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
c
|
||||
end if
|
||||
c
|
||||
9000 end
|
||||
9000 end
|
||||
|
||||
+33
-33
@@ -1,9 +1,9 @@
|
||||
program cnbdr3
|
||||
c
|
||||
c ... Construct matrices A and M in LAPACK-style band form.
|
||||
c Matrices A and M are derived from the finite
|
||||
c element discretization of the 1-dimensional
|
||||
c convection-diffusion operator
|
||||
c Matrices A and M are derived from the finite
|
||||
c element discretization of the 1-dimensional
|
||||
c convection-diffusion operator
|
||||
c (d^2u/dx^2) + rho*(du/dx)
|
||||
c on the interval [0,1] with zero boundary condition using
|
||||
c piecewise linear elements.
|
||||
@@ -51,13 +51,13 @@ c | MAXN - Maximum size of the matrix |
|
||||
c | MAXNEV - Maximum number of |
|
||||
c | eigenvalues to be computed |
|
||||
c | MAXNCV - Maximum number of Arnoldi |
|
||||
c | vectors stored |
|
||||
c | vectors stored |
|
||||
c | MAXBDW - Maximum bandwidth |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
integer maxn, maxnev, maxncv, maxbdw, lda,
|
||||
& lworkl, ldv
|
||||
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
|
||||
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
|
||||
& maxbdw=50, lda = maxbdw, ldv = maxn)
|
||||
c
|
||||
c %--------------%
|
||||
@@ -66,12 +66,12 @@ c %--------------%
|
||||
c
|
||||
integer iparam(11), iwork(maxn)
|
||||
logical select(maxncv)
|
||||
Complex
|
||||
Complex
|
||||
& a(lda,maxn), m(lda,maxn), fac(lda,maxn),
|
||||
& workl(3*maxncv*maxncv+5*maxncv), workd(3*maxn),
|
||||
& workl(3*maxncv*maxncv+5*maxncv), workd(3*maxn),
|
||||
& workev(2*maxncv), v(ldv, maxncv),
|
||||
& resid(maxn), d(maxncv), ax(maxn), mx(maxn)
|
||||
Real
|
||||
Real
|
||||
& rwork(maxn), rd(maxncv,3)
|
||||
c
|
||||
c %---------------%
|
||||
@@ -83,16 +83,16 @@ c
|
||||
& n, idiag, isup, isub, maxitr,
|
||||
& mode, nconv
|
||||
logical rvec
|
||||
Real
|
||||
Real
|
||||
& tol
|
||||
Complex
|
||||
Complex
|
||||
& rho, h, sigma
|
||||
c
|
||||
c
|
||||
c %------------%
|
||||
c | Parameters |
|
||||
c %------------%
|
||||
c
|
||||
Complex
|
||||
Complex
|
||||
& one, zero, two
|
||||
parameter (one = (1.0E+0, 0.0E+0) ,
|
||||
& zero = (0.0E+0, 0.0E+0) ,
|
||||
@@ -102,9 +102,9 @@ c %-----------------------------%
|
||||
c | BLAS & LAPACK routines used |
|
||||
c %-----------------------------%
|
||||
c
|
||||
Real
|
||||
Real
|
||||
& scnrm2, slapy2
|
||||
external scnrm2, cgbmv, caxpy, slapy2, claset
|
||||
external scnrm2, cgbmv, caxpy, slapy2, claset
|
||||
c
|
||||
c %-----------------------%
|
||||
c | Executable Statements |
|
||||
@@ -129,8 +129,8 @@ c | NEV + 2 <= NCV <= MAXNCV |
|
||||
c %-------------------------------------------------%
|
||||
c
|
||||
n = 100
|
||||
nev = 4
|
||||
ncv = 10
|
||||
nev = 4
|
||||
ncv = 10
|
||||
if ( n .gt. maxn ) then
|
||||
print *, ' ERROR with _NBDR3: N is greater than MAXN '
|
||||
go to 9000
|
||||
@@ -146,13 +146,13 @@ c
|
||||
sigma = zero
|
||||
c
|
||||
c %----------------------------------------------------%
|
||||
c | The work array WORKL is used in CNAUPD as |
|
||||
c | The work array WORKL is used in CNAUPD as |
|
||||
c | workspace. Its dimension LWORKL has to be set as |
|
||||
c | illustrated below. The parameter TOL determines |
|
||||
c | the stopping criterion. If TOL<=0, machine machine |
|
||||
c | precision is used. Setting INFO=0 indicates that |
|
||||
c | using a randomly generated vector to start the |
|
||||
c | the ARNOLDI process. |
|
||||
c | the ARNOLDI process. |
|
||||
c %----------------------------------------------------%
|
||||
c
|
||||
lworkl = 3*ncv**2+5*ncv
|
||||
@@ -195,7 +195,7 @@ c
|
||||
kl = 1
|
||||
ku = 1
|
||||
c
|
||||
c %---------------%
|
||||
c %---------------%
|
||||
c | Main diagonal |
|
||||
c %---------------%
|
||||
c
|
||||
@@ -203,23 +203,23 @@ c
|
||||
c
|
||||
idiag = kl+ku+1
|
||||
do 30 j = 1, n
|
||||
a(idiag,j) = (2.0E+0, 0.0E+0) / h
|
||||
m(idiag,j) = (4.0E+0, 0.0E+0) * h
|
||||
30 continue
|
||||
c
|
||||
a(idiag,j) = (2.0E+0, 0.0E+0) / h
|
||||
m(idiag,j) = (4.0E+0, 0.0E+0) * h
|
||||
30 continue
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | First subdiagonal and superdiagonal |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
c
|
||||
isup = kl+ku
|
||||
isub = kl+ku+2
|
||||
rho = (1.0E+1, 0.0E+0)
|
||||
rho = (1.0E+1, 0.0E+0)
|
||||
do 40 j = 1, n-1
|
||||
a(isup,j+1) = -one/h + rho/two
|
||||
a(isub,j) = -one/h - rho/two
|
||||
m(isup,j+1) = one*h
|
||||
m(isub,j) = one*h
|
||||
40 continue
|
||||
40 continue
|
||||
c
|
||||
c %-----------------------------------------------%
|
||||
c | Call ARPACK banded solver to find eigenvalues |
|
||||
@@ -229,7 +229,7 @@ c | are returned in the first NCONV (=IPARAM(5)) |
|
||||
c | columns of V. |
|
||||
c %-----------------------------------------------%
|
||||
c
|
||||
rvec = .true.
|
||||
rvec = .true.
|
||||
call cnband(rvec, 'A', select, d, v, ldv, sigma,
|
||||
& workev, n, a, m, lda, fac, kl, ku, which,
|
||||
& bmat, nev, tol, resid, ncv, v, ldv, iparam,
|
||||
@@ -277,24 +277,24 @@ c
|
||||
rd(j,1) = real (d(j))
|
||||
rd(j,2) = aimag(d(j))
|
||||
rd(j,3) = scnrm2(n, ax, 1)
|
||||
rd(j,3) = rd(j,3) / slapy2(rd(j,1), rd(j,2))
|
||||
50 continue
|
||||
rd(j,3) = rd(j,3) / slapy2(rd(j,1), rd(j,2))
|
||||
50 continue
|
||||
|
||||
call smout(6, nconv, 3, rd, maxncv, -6,
|
||||
& 'Ritz values (Real,Imag) and relative residuals')
|
||||
else
|
||||
else
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | Either convergence failed, or there |
|
||||
c | is error. Check the documentation |
|
||||
c | for cnband. |
|
||||
c | for cnband. |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
print *, ' '
|
||||
print *, ' Error with _band, info= ', info
|
||||
print *, ' Check the documentation of _band '
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
c
|
||||
end if
|
||||
c
|
||||
9000 end
|
||||
9000 end
|
||||
|
||||
+28
-28
@@ -49,13 +49,13 @@ c | MAXN - Maximum size of the matrix |
|
||||
c | MAXNEV - Maximum number of |
|
||||
c | eigenvalues to be computed |
|
||||
c | MAXNCV - Maximum number of Arnoldi |
|
||||
c | vectors stored |
|
||||
c | vectors stored |
|
||||
c | MAXBDW - Maximum bandwidth |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
integer maxn, maxnev, maxncv, maxbdw, lda,
|
||||
& lworkl, ldv
|
||||
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
|
||||
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
|
||||
& maxbdw=50, lda = maxbdw, ldv = maxn)
|
||||
c
|
||||
c %--------------%
|
||||
@@ -64,12 +64,12 @@ c %--------------%
|
||||
c
|
||||
integer iparam(11), iwork(maxn)
|
||||
logical select(maxncv)
|
||||
Complex
|
||||
Complex
|
||||
& a(lda,maxn), m(lda,maxn), fac(lda,maxn),
|
||||
& workl(3*maxncv*maxncv+5*maxncv), workd(3*maxn),
|
||||
& workl(3*maxncv*maxncv+5*maxncv), workd(3*maxn),
|
||||
& workev(2*maxncv), v(ldv, maxncv),
|
||||
& resid(maxn), d(maxncv), ax(maxn), mx(maxn)
|
||||
Real
|
||||
Real
|
||||
& rwork(maxn), rd(maxncv,3)
|
||||
c
|
||||
c %---------------%
|
||||
@@ -81,16 +81,16 @@ c
|
||||
& n, idiag, isup, isub, maxitr, mode,
|
||||
& nconv
|
||||
logical rvec
|
||||
Real
|
||||
Real
|
||||
& tol
|
||||
Complex
|
||||
Complex
|
||||
& rho, h, sigma
|
||||
c
|
||||
c
|
||||
c %------------%
|
||||
c | Parameters |
|
||||
c %------------%
|
||||
c
|
||||
Complex
|
||||
Complex
|
||||
& one, zero, two, four, six
|
||||
parameter (one = (1.0E+0, 0.0E+0) ,
|
||||
& zero = (0.0E+0, 0.0E+0) ,
|
||||
@@ -102,7 +102,7 @@ c %-----------------------------%
|
||||
c | BLAS & LAPACK routines used |
|
||||
c %-----------------------------%
|
||||
c
|
||||
Real
|
||||
Real
|
||||
& scnrm2, slapy2
|
||||
external scnrm2, cgbmv, caxpy, slapy2, claset
|
||||
c
|
||||
@@ -121,7 +121,7 @@ c | solved (BMAT = 'G'). NEV is the number of |
|
||||
c | eigenvalues (closest to the shift SIGMA) to be |
|
||||
c | approximated. Since the shift and invert mode |
|
||||
c | is used, WHICH is set to 'LM'. The user can |
|
||||
c | modify NX, NEV and NCV to solve problems of |
|
||||
c | modify NX, NEV and NCV to solve problems of |
|
||||
c | different sizes, and to get different parts the |
|
||||
c | spectrum. However, the following conditions |
|
||||
c | must be satisfied: |
|
||||
@@ -131,8 +131,8 @@ c | NEV + 2 <= NCV <= MAXNCV |
|
||||
c %-------------------------------------------------%
|
||||
c
|
||||
n = 100
|
||||
nev = 4
|
||||
ncv = 10
|
||||
nev = 4
|
||||
ncv = 10
|
||||
if ( n .gt. maxn ) then
|
||||
print *, ' ERROR with _NBDR4: N is greater than MAXN '
|
||||
go to 9000
|
||||
@@ -145,16 +145,16 @@ c
|
||||
end if
|
||||
bmat = 'G'
|
||||
which = 'LM'
|
||||
sigma = (1.0E+1, 0.0E+0)
|
||||
sigma = (1.0E+1, 0.0E+0)
|
||||
c
|
||||
c %----------------------------------------------------%
|
||||
c | The work array WORKL is used in CNAUPD as |
|
||||
c | The work array WORKL is used in CNAUPD as |
|
||||
c | workspace. Its dimension LWORKL has to be set as |
|
||||
c | illustrated below. The parameter TOL determines |
|
||||
c | the stopping criterion. If TOL<=0, machine machine |
|
||||
c | precision is used. Setting INFO=0 indicates that |
|
||||
c | we using a randomly generated vector to start the |
|
||||
c | the ARNOLDI process. |
|
||||
c | the ARNOLDI process. |
|
||||
c %----------------------------------------------------%
|
||||
c
|
||||
lworkl = 3*ncv**2+5*ncv
|
||||
@@ -197,30 +197,30 @@ c
|
||||
kl = 1
|
||||
ku = 1
|
||||
c
|
||||
c %---------------%
|
||||
c %---------------%
|
||||
c | Main diagonal |
|
||||
c %---------------%
|
||||
c
|
||||
h = one / cmplx(n+1)
|
||||
idiag = kl+ku+1
|
||||
do 30 j = 1, n
|
||||
a(idiag,j) = two / h
|
||||
a(idiag,j) = two / h
|
||||
m(idiag,j) = four * h / six
|
||||
30 continue
|
||||
c
|
||||
30 continue
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | First subdiagonal and superdiagonal |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
c
|
||||
isup = kl+ku
|
||||
isub = kl+ku+2
|
||||
rho = (1.0E+1, 0.0E+0)
|
||||
rho = (1.0E+1, 0.0E+0)
|
||||
do 40 j = 1, n-1
|
||||
a(isup,j+1) = -one/h + rho/two
|
||||
a(isub,j) = -one/h - rho/two
|
||||
m(isup,j+1) = one*h / six
|
||||
m(isub,j) = one*h / six
|
||||
40 continue
|
||||
40 continue
|
||||
c
|
||||
c %-----------------------------------------------%
|
||||
c | Call ARPACK banded solver to find eigenvalues |
|
||||
@@ -230,7 +230,7 @@ c | are returned in the first NCONV (=IPARAM(5)) |
|
||||
c | columns of V. |
|
||||
c %-----------------------------------------------%
|
||||
c
|
||||
rvec = .true.
|
||||
rvec = .true.
|
||||
call cnband(rvec, 'A', select, d, v, ldv, sigma,
|
||||
& workev, n, a, m, lda, fac, kl, ku, which,
|
||||
& bmat, nev, tol, resid, ncv, v, ldv, iparam,
|
||||
@@ -279,11 +279,11 @@ c
|
||||
rd(j,2) = aimag(d(j))
|
||||
rd(j,3) = scnrm2(n, ax, 1)
|
||||
rd(j,3) = rd(j,3) / slapy2(rd(j,1), rd(j,2))
|
||||
90 continue
|
||||
90 continue
|
||||
|
||||
call smout(6, nconv, 3, rd, maxncv, -6,
|
||||
& 'Ritz values (Real,Imag) and relative residuals')
|
||||
else
|
||||
else
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | Either convergence failed, or there |
|
||||
@@ -294,8 +294,8 @@ c
|
||||
print *, ' '
|
||||
print *, ' Error with _band, info= ', info
|
||||
print *, ' Check the documentation of _band '
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
c
|
||||
end if
|
||||
c
|
||||
9000 end
|
||||
9000 end
|
||||
|
||||
+201
-201
@@ -35,18 +35,18 @@ c Mode 2: A*z = lambda*M*z, M symmetric positive definite
|
||||
c ===> OP = inv[M]*A and B = M.
|
||||
c
|
||||
c Mode 3: A*z = lambda*M*z, M symmetric semi-definite
|
||||
c ===> OP = Real_Part{ inv[A - sigma*M]*M } and B = M.
|
||||
c ===> OP = Real_Part{ inv[A - sigma*M]*M } and B = M.
|
||||
c ===> shift-and-invert mode (in real arithmetic)
|
||||
c If OP*z = amu*z, then
|
||||
c If OP*z = amu*z, then
|
||||
c amu = 1/2 * [ 1/(lambda-sigma) + 1/(lambda-conjg(sigma)) ].
|
||||
c Note: If sigma is real, i.e. imaginary part of sigma is zero;
|
||||
c Real_Part{ inv[A - sigma*M]*M } == inv[A - sigma*M]*M
|
||||
c amu == 1/(lambda-sigma).
|
||||
c
|
||||
c Real_Part{ inv[A - sigma*M]*M } == inv[A - sigma*M]*M
|
||||
c amu == 1/(lambda-sigma).
|
||||
c
|
||||
c Mode 4: A*z = lambda*M*z, M symmetric semi-definite
|
||||
c ===> OP = Imaginary_Part{ inv[A - sigma*M]*M } and B = M.
|
||||
c ===> OP = Imaginary_Part{ inv[A - sigma*M]*M } and B = M.
|
||||
c ===> shift-and-invert mode (in real arithmetic)
|
||||
c If OP*z = amu*z, then
|
||||
c If OP*z = amu*z, then
|
||||
c amu = 1/2i * [ 1/(lambda-sigma) - 1/(lambda-conjg(sigma)) ].
|
||||
c
|
||||
c
|
||||
@@ -54,28 +54,28 @@ c The choice of mode must be specified in IPARAM(7) defined below.
|
||||
c
|
||||
c \Usage
|
||||
c call dnband
|
||||
c ( RVEC, HOWMNY, SELECT, DR, DI, Z, LDZ, SIGMAR, SIGMAI,
|
||||
c WORKEV, V, N, AB, MB, LDA, RFAC, CFAC, KL, KU, WHICH,
|
||||
c BMAT, NEV, TOL, RESID, NCV, V, LDV, IPARAM, WORKD,
|
||||
c ( RVEC, HOWMNY, SELECT, DR, DI, Z, LDZ, SIGMAR, SIGMAI,
|
||||
c WORKEV, V, N, AB, MB, LDA, RFAC, CFAC, KL, KU, WHICH,
|
||||
c BMAT, NEV, TOL, RESID, NCV, V, LDV, IPARAM, WORKD,
|
||||
c WORKL, LWORKL, WORKC, IWORK, INFO )
|
||||
c
|
||||
c \Arguments
|
||||
c
|
||||
c RVEC LOGICAL (INPUT)
|
||||
c Specifies whether a basis for the invariant subspace corresponding
|
||||
c to the converged Ritz value approximations for the eigenproblem
|
||||
c
|
||||
c RVEC LOGICAL (INPUT)
|
||||
c Specifies whether a basis for the invariant subspace corresponding
|
||||
c to the converged Ritz value approximations for the eigenproblem
|
||||
c A*z = lambda*B*z is computed.
|
||||
c
|
||||
c RVEC = .FALSE. Compute Ritz values only.
|
||||
c
|
||||
c RVEC = .TRUE. Compute the Ritz vectors or Schur vectors.
|
||||
c See Remarks below.
|
||||
c See Remarks below.
|
||||
c
|
||||
c HOWMNY Character*1 (INPUT)
|
||||
c Specifies the form of the basis for the invariant subspace
|
||||
c HOWMNY Character*1 (INPUT)
|
||||
c Specifies the form of the basis for the invariant subspace
|
||||
c corresponding to the converged Ritz values that is to be computed.
|
||||
c
|
||||
c = 'A': Compute NEV Ritz vectors;
|
||||
c = 'A': Compute NEV Ritz vectors;
|
||||
c = 'P': Compute NEV Schur vectors;
|
||||
c = 'S': compute some of the Ritz vectors, specified
|
||||
c by the logical array SELECT.
|
||||
@@ -83,23 +83,23 @@ c
|
||||
c SELECT Logical array of dimension NCV. (INPUT)
|
||||
c If HOWMNY = 'S', SELECT specifies the Ritz vectors to be
|
||||
c computed. To select the Ritz vector corresponding to a
|
||||
c Ritz value (DR(j), DI(j)), SELECT(j) must be set to .TRUE..
|
||||
c Ritz value (DR(j), DI(j)), SELECT(j) must be set to .TRUE..
|
||||
c If HOWMNY = 'A' or 'P', SELECT is used as internal workspace.
|
||||
c
|
||||
c DR Double precision array of dimension NEV+1. (OUTPUT)
|
||||
c On exit, DR contains the real part of the Ritz value approximations
|
||||
c to the eigenvalues of A*z = lambda*B*z.
|
||||
c On exit, DR contains the real part of the Ritz value approximations
|
||||
c to the eigenvalues of A*z = lambda*B*z.
|
||||
c
|
||||
c DI Double precision array of dimension NEV+1. (OUTPUT)
|
||||
c On exit, DI contains the imaginary part of the Ritz value
|
||||
c On exit, DI contains the imaginary part of the Ritz value
|
||||
c approximations to the eigenvalues of A*z = lambda*B*z associated
|
||||
c with DR.
|
||||
c with DR.
|
||||
c
|
||||
c NOTE: When Ritz values are complex, they will come in complex
|
||||
c conjugate pairs. If eigenvectors are requested, the
|
||||
c corresponding Ritz vectors will also come in conjugate
|
||||
c pairs and the real and imaginary parts of these are
|
||||
c represented in two consecutive columns of the array Z
|
||||
c NOTE: When Ritz values are complex, they will come in complex
|
||||
c conjugate pairs. If eigenvectors are requested, the
|
||||
c corresponding Ritz vectors will also come in conjugate
|
||||
c pairs and the real and imaginary parts of these are
|
||||
c represented in two consecutive columns of the array Z
|
||||
c (see below).
|
||||
c
|
||||
c Z Real N by NEV+1 array if RVEC = .TRUE. and HOWMNY = 'A'. (OUTPUT)
|
||||
@@ -124,24 +124,24 @@ c the array Z may be set equal to first NEV+1 columns of the Arnoldi
|
||||
c basis array V computed by DNAUPD. In this case the Arnoldi basis
|
||||
c will be destroyed and overwritten with the eigenvector basis.
|
||||
c
|
||||
c LDZ Integer. (INPUT)
|
||||
c The leading dimension of the array Z. If Ritz vectors are
|
||||
c desired, then LDZ >= max( 1, N ). In any case, LDZ >= 1.
|
||||
c
|
||||
c SIGMAR Double precision (INPUT)
|
||||
c If IPARAM(7) = 3 or 4, represents the real part of the shift.
|
||||
c Not referenced if IPARAM(7) = 1 or 2.
|
||||
c
|
||||
c SIGMAI Double precision (INPUT)
|
||||
c If IPARAM(7) = 3 or 4, represents the imaginary part of the
|
||||
c shift.
|
||||
c Not referenced if IPARAM(7) = 1 or 2.
|
||||
c
|
||||
c WORKEV Double precision work array of dimension 3*NCV. (WORKSPACE)
|
||||
c
|
||||
c N Integer. (INPUT)
|
||||
c Dimension of the eigenproblem.
|
||||
c
|
||||
c LDZ Integer. (INPUT)
|
||||
c The leading dimension of the array Z. If Ritz vectors are
|
||||
c desired, then LDZ >= max( 1, N ). In any case, LDZ >= 1.
|
||||
c
|
||||
c SIGMAR Double precision (INPUT)
|
||||
c If IPARAM(7) = 3 or 4, represents the real part of the shift.
|
||||
c Not referenced if IPARAM(7) = 1 or 2.
|
||||
c
|
||||
c SIGMAI Double precision (INPUT)
|
||||
c If IPARAM(7) = 3 or 4, represents the imaginary part of the
|
||||
c shift.
|
||||
c Not referenced if IPARAM(7) = 1 or 2.
|
||||
c
|
||||
c WORKEV Double precision work array of dimension 3*NCV. (WORKSPACE)
|
||||
c
|
||||
c N Integer. (INPUT)
|
||||
c Dimension of the eigenproblem.
|
||||
c
|
||||
c AB Double precision array of dimension LDA by N. (INPUT)
|
||||
c The matrix A in band storage, in rows KL+1 to
|
||||
c 2*KL+KU+1; rows 1 to KL of the array need not be set.
|
||||
@@ -151,25 +151,25 @@ c AB(kl+ku+1+i-j,j) = A(i,j) for max(1,j-ku)<=i<=min(m,j+kl)
|
||||
c
|
||||
c MB Double precision array of dimension LDA by N. (INPUT)
|
||||
c The matrix M in band storage, in rows KL+1 to
|
||||
c 2*KL+KU+1; rows 1 to KL of the array need not be set.
|
||||
c 2*KL+KU+1; rows 1 to KL of the array need not be set.
|
||||
c The j-th column of M is stored in the j-th column of the
|
||||
c array AB as follows:
|
||||
c MB(kl+ku+1+i-j,j) = M(i,j) for max(1,j-ku)<=i<=min(m,j+kl)
|
||||
c Not referenced if IPARAM(7) = 1
|
||||
c
|
||||
c LDA Integer. (INPUT)
|
||||
c Leading dimension of AB, MB, RFAC and CFAC.
|
||||
c Leading dimension of AB, MB, RFAC and CFAC.
|
||||
c
|
||||
c RFAC Double precision array of LDA by N. (WORKSPACE/OUTPUT)
|
||||
c RFAC is used to store the LU factors of MB when IPARAM(7) = 2
|
||||
c RFAC is used to store the LU factors of MB when IPARAM(7) = 2
|
||||
c is invoked. It is used to store the LU factors of
|
||||
c (A-sigma*M) when IPARAM(7) = 3 is invoked with a real shift.
|
||||
c It is not referenced when IPARAM(7) = 1 or 4.
|
||||
c
|
||||
c CFAC Complex*16 array of LDA by N. (WORKSPACE/OUTPUT)
|
||||
c CFAC is used to store (A-SIGMA*M) and its LU factors
|
||||
c when IPARAM(7) = 3 or 4 are used with a complex shift SIGMA.
|
||||
c On exit, it contains the LU factors of (A-SIGMA*M).
|
||||
c when IPARAM(7) = 3 or 4 are used with a complex shift SIGMA.
|
||||
c On exit, it contains the LU factors of (A-SIGMA*M).
|
||||
c It is not referenced when IPARAM(7) = 1 or 2.
|
||||
c
|
||||
c KL Integer. (INPUT)
|
||||
@@ -181,7 +181,7 @@ c
|
||||
c WHICH Character*2. (INPUT)
|
||||
c When IPARAM(7)= 1 or 2, WHICH can be set to any one of
|
||||
c the following.
|
||||
c
|
||||
c
|
||||
c 'LM' -> want the NEV eigenvalues of largest magnitude.
|
||||
c 'SM' -> want the NEV eigenvalues of smallest magnitude.
|
||||
c 'LR' -> want the NEV eigenvalues of largest real part.
|
||||
@@ -189,8 +189,8 @@ c 'SR' -> want the NEV eigenvalues of smallest real part.
|
||||
c 'LI' -> want the NEV eigenvalues of largest imaginary part.
|
||||
c 'SI' -> want the NEV eigenvalues of smallest imaginary part.
|
||||
c
|
||||
c When IPARAM(7) = 3 or 4, WHICH should be set to 'LM' only.
|
||||
c
|
||||
c When IPARAM(7) = 3 or 4, WHICH should be set to 'LM' only.
|
||||
c
|
||||
c BMAT Character*1. (INPUT)
|
||||
c BMAT specifies the type of the matrix B that defines the
|
||||
c semi-inner product for the operator OP.
|
||||
@@ -199,9 +199,9 @@ c BMAT = 'G' -> generalized eigenvalue problem A*z = lambda*M*z
|
||||
|
||||
c NEV Integer. (INPUT)
|
||||
c Number of eigenvalues to be computed.
|
||||
c
|
||||
c
|
||||
c TOL Double precision scalar. (INPUT)
|
||||
c Stopping criteria: the relative accuracy of the Ritz value
|
||||
c Stopping criteria: the relative accuracy of the Ritz value
|
||||
c is considered acceptable if BOUNDS(I) .LE. TOL*ABS(RITZ(I)).
|
||||
c If TOL .LE. 0. is passed a default is set:
|
||||
c DEFAULT = DLAMCH('EPS') (machine precision as computed
|
||||
@@ -221,12 +221,12 @@ c Represents the dimension of the Arnoldi basis constructed
|
||||
c by dnaupd for OP.
|
||||
c
|
||||
c V Double precision array N by NCV+1. (OUTPUT)
|
||||
c Upon OUTPUT: If RVEC = .TRUE. the first NCONV=IPARAM(5) columns
|
||||
c represent approximate Schur vectors that span the
|
||||
c Upon OUTPUT: If RVEC = .TRUE. the first NCONV=IPARAM(5) columns
|
||||
c represent approximate Schur vectors that span the
|
||||
c desired invariant subspace.
|
||||
c NOTE: The array Z may be set equal to first NEV+1 columns of the
|
||||
c NOTE: The array Z may be set equal to first NEV+1 columns of the
|
||||
c Arnoldi basis vector array V computed by DNAUPD. In this case
|
||||
c if RVEC = .TRUE. and HOWMNY='A', then the first NCONV=IPARAM(5)
|
||||
c if RVEC = .TRUE. and HOWMNY='A', then the first NCONV=IPARAM(5)
|
||||
c are the desired Ritz vectors.
|
||||
c
|
||||
c LDV Integer. (INPUT)
|
||||
@@ -234,7 +234,7 @@ c Leading dimension of V exactly as declared in the calling
|
||||
c program.
|
||||
c
|
||||
c IPARAM Integer array of length 11. (INPUT/OUTPUT)
|
||||
c IPARAM(1) = ISHIFT:
|
||||
c IPARAM(1) = ISHIFT:
|
||||
c The shifts selected at each iteration are used to restart
|
||||
c the Arnoldi iteration in an implicit fashion.
|
||||
c It is set to 1 in this subroutine. The user do not need
|
||||
@@ -248,7 +248,7 @@ c combination of Ritz vectors associated with the
|
||||
c "wanted" eigenvalues.
|
||||
c -------------------------------------------------------------
|
||||
c
|
||||
c IPARAM(2) = No longer referenced.
|
||||
c IPARAM(2) = No longer referenced.
|
||||
c
|
||||
c IPARAM(3) = MXITER
|
||||
c On INPUT: max number of Arnoldi update iterations allowed.
|
||||
@@ -262,9 +262,9 @@ c
|
||||
c IPARAM(6) = IUPD
|
||||
c Not referenced. Implicit restarting is ALWAYS used.
|
||||
c
|
||||
c IPARAM(7) = IPARAM(7):
|
||||
c IPARAM(7) = IPARAM(7):
|
||||
c On INPUT determines what type of eigenproblem is being solved.
|
||||
c Must be 1,2,3,4; See under \Description of dnband for the
|
||||
c Must be 1,2,3,4; See under \Description of dnband for the
|
||||
c four modes available.
|
||||
c
|
||||
c IPARAM(9) = NUMOP, IPARAM(10) = NUMOPB, IPARAM(11) = NUMREO,
|
||||
@@ -280,22 +280,22 @@ c LWORKL Integer. (INPUT)
|
||||
c LWORKL must be at least 3*NCV**2 + 6*NCV.
|
||||
c
|
||||
c WORKC Complex*16 array of length N. (WORKSPACE)
|
||||
c Workspace used when IPARAM(7) = 3 or 4 for storing a temporary
|
||||
c Workspace used when IPARAM(7) = 3 or 4 for storing a temporary
|
||||
c complex vector.
|
||||
c
|
||||
c IWORK Integer array of dimension at least N. (WORKSPACE)
|
||||
c Used when IPARAM(7)=2,3,4 to store the pivot information in the
|
||||
c Used when IPARAM(7)=2,3,4 to store the pivot information in the
|
||||
c factorization of M or (A-SIGMA*M).
|
||||
c
|
||||
c
|
||||
c INFO Integer. (INPUT/OUTPUT)
|
||||
c Error flag on output.
|
||||
c = 0: Normal exit.
|
||||
c = 1: The Schur form computed by LAPACK routine dlahqr
|
||||
c could not be reordered by LAPACK routine dtrsen.
|
||||
c Re-enter subroutine DNEUPD with IPARAM(5)=NCV and
|
||||
c increase the size of the arrays DR and DI to have
|
||||
c dimension at least NCV and allocate at least NCV
|
||||
c columns for Z. NOTE: Not necessary if Z and V share
|
||||
c Re-enter subroutine DNEUPD with IPARAM(5)=NCV and
|
||||
c increase the size of the arrays DR and DI to have
|
||||
c dimension at least NCV and allocate at least NCV
|
||||
c columns for Z. NOTE: Not necessary if Z and V share
|
||||
c the same space. Please notify the authors.
|
||||
c
|
||||
c = -1: N must be positive.
|
||||
@@ -314,9 +314,9 @@ c = -12: HOWMNY = 'S' not yet implemented
|
||||
c = -13: HOWMNY must be one of 'A' or 'P'
|
||||
c = -14: DNAUPD did not find any eigenvalues to sufficient
|
||||
c accuracy.
|
||||
c = -15: Overflow occurs when we try to transform the Ritz
|
||||
c = -15: Overflow occurs when we try to transform the Ritz
|
||||
c values returned from DNAUPD to those of the original
|
||||
c problem using Rayleigh Quotient.
|
||||
c problem using Rayleigh Quotient.
|
||||
c = -9999: Could not build an Arnoldi factorization.
|
||||
c IPARAM(5) returns the size of the current
|
||||
c Arnoldi factorization.
|
||||
@@ -332,7 +332,7 @@ c 1. D.C. Sorensen, "Implicit Application of Polynomial Filters in
|
||||
c a k-Step Arnoldi Method", SIAM J. Matr. Anal. Apps., 13 (1992),
|
||||
c pp 357-385.
|
||||
c
|
||||
c 2. R.B. Lehoucq, "Analysis and Implementation of an Implicitly
|
||||
c 2. R.B. Lehoucq, "Analysis and Implementation of an Implicitly
|
||||
c Restarted Arnoldi Iteration", Ph.D thesis, TR95-13, Rice Univ,
|
||||
c May 1995.
|
||||
c
|
||||
@@ -363,9 +363,9 @@ c Ritz vectors. Thus, their numerical properties are often superior.
|
||||
c If RVEC = .TRUE. then the relationship
|
||||
c A * V(:,1:IPARAM(5)) = V(:,1:IPARAM(5)) * T, and
|
||||
c V(:,1:IPARAM(5))' * V(:,1:IPARAM(5)) = I are approximately satisfied.
|
||||
c Here T is the leading submatrix of order IPARAM(5) of the real
|
||||
c Here T is the leading submatrix of order IPARAM(5) of the real
|
||||
c upper quasi-triangular matrix stored workl(ipntr(12)). That is,
|
||||
c T is block upper triangular with 1-by-1 and 2-by-2 diagonal blocks;
|
||||
c T is block upper triangular with 1-by-1 and 2-by-2 diagonal blocks;
|
||||
c each 2-by-2 diagonal block has its diagonal elements equal and its
|
||||
c off-diagonal elements of opposite sign. Corresponding to each 2-by-2
|
||||
c diagonal block is a complex conjugate pair of Ritz values. The real
|
||||
@@ -387,20 +387,20 @@ c\EndLib
|
||||
c
|
||||
c---------------------------------------------------------------------
|
||||
c
|
||||
subroutine dnband( rvec, howmny, select, dr, di, z, ldz, sigmar,
|
||||
& sigmai, workev, n, ab, mb, lda, rfac, cfac, kl, ku,
|
||||
& which, bmat, nev, tol, resid, ncv, v, ldv,
|
||||
subroutine dnband( rvec, howmny, select, dr, di, z, ldz, sigmar,
|
||||
& sigmai, workev, n, ab, mb, lda, rfac, cfac, kl, ku,
|
||||
& which, bmat, nev, tol, resid, ncv, v, ldv,
|
||||
& iparam, workd, workl, lworkl, workc, iwork, info)
|
||||
c
|
||||
c %------------------%
|
||||
c | Scalar Arguments |
|
||||
c %------------------%
|
||||
c
|
||||
c
|
||||
character which*2, bmat, howmny
|
||||
integer n, lda, kl, ku, nev, ncv, ldv,
|
||||
& ldz, lworkl, info
|
||||
& ldz, lworkl, info
|
||||
Double precision
|
||||
& tol, sigmar, sigmai
|
||||
& tol, sigmar, sigmai
|
||||
c
|
||||
c %-----------------%
|
||||
c | Array Arguments |
|
||||
@@ -410,7 +410,7 @@ c
|
||||
logical select(*)
|
||||
Double precision
|
||||
& dr(*), di(*), resid(*), v(ldv,*), z(ldz,*),
|
||||
& ab(lda,*), mb(lda,*), rfac(lda,*),
|
||||
& ab(lda,*), mb(lda,*), rfac(lda,*),
|
||||
& workd(*), workl(*), workev(*)
|
||||
Complex*16
|
||||
& cfac(lda,*), workc(*)
|
||||
@@ -426,9 +426,9 @@ c | Local Scalars |
|
||||
c %---------------%
|
||||
c
|
||||
integer ido, i, j, type, imid, itop, ibot, ierr
|
||||
Double precision
|
||||
& numr, denr, deni, dmdul, safmin
|
||||
logical rvec, first
|
||||
Double precision
|
||||
& numr, denr, deni, dmdul, safmin
|
||||
logical rvec, first
|
||||
c
|
||||
c %------------%
|
||||
c | Parameters |
|
||||
@@ -445,7 +445,7 @@ c %-----------------------------%
|
||||
c
|
||||
Double precision
|
||||
& ddot, dnrm2, dlapy2, dlamch
|
||||
external ddot, dcopy, dgbmv, zgbtrf, zgbtrs, dgbtrf,
|
||||
external ddot, dcopy, dgbmv, zgbtrf, zgbtrs, dgbtrf,
|
||||
& dgbtrs, dnrm2, dlapy2, dlacpy, dlamch
|
||||
c
|
||||
c %---------------------%
|
||||
@@ -464,17 +464,17 @@ c | that 1/sfmin does not overflow |
|
||||
c %--------------------------------%
|
||||
c
|
||||
safmin = dlamch('safmin')
|
||||
c
|
||||
c
|
||||
c %----------------------------------------------------------------%
|
||||
c | Set type of the problem to be solved. Check consistency |
|
||||
c | between BMAT and IPARAM(7). |
|
||||
c | type = 1 --> Solving standard problem in regular mode. |
|
||||
c | type = 2 --> Solving standard problem in shift-invert mode. |
|
||||
c | type = 2 --> Solving standard problem in shift-invert mode. |
|
||||
c | type = 3 --> Solving generalized problem in regular mode. |
|
||||
c | type = 4 --> Solving generalized problem in shift-invert mode. |
|
||||
c | type = 5 --> Solving standard problem in shift-invert mode |
|
||||
c | using iparam(7) = 4 in DNAUPD. |
|
||||
c | type = 6 --> Solving generalized problem in shift-invert mode. |
|
||||
c | type = 6 --> Solving generalized problem in shift-invert mode. |
|
||||
c | using iparam(7) = 4 in DNAUPD. |
|
||||
c %----------------------------------------------------------------%
|
||||
c
|
||||
@@ -485,19 +485,19 @@ c
|
||||
else if ( iparam(7) .eq. 2 ) then
|
||||
type = 3
|
||||
else if ( iparam(7) .eq. 3 .and. bmat .eq. 'G') then
|
||||
type = 4
|
||||
type = 4
|
||||
else if ( iparam(7) .eq. 4 .and. bmat .eq. 'I') then
|
||||
type = 5
|
||||
else if ( iparam(7) .eq. 4 .and. bmat .eq. 'G') then
|
||||
else if ( iparam(7) .eq. 4 .and. bmat .eq. 'G') then
|
||||
type = 6
|
||||
else
|
||||
print*, ' '
|
||||
print*, 'BMAT is inconsistent with IPARAM(7).'
|
||||
print*, ' '
|
||||
print*, ' '
|
||||
go to 9000
|
||||
end if
|
||||
c
|
||||
c %----------------------------------%
|
||||
c %----------------------------------%
|
||||
c | When type = 5,6 are used, sigmai |
|
||||
c | must be nonzero. |
|
||||
c %----------------------------------%
|
||||
@@ -505,16 +505,16 @@ c
|
||||
if ( type .eq. 5 .or. type .eq. 6 ) then
|
||||
if ( sigmai .eq. zero ) then
|
||||
print*, ' '
|
||||
print*, '_NBAND: sigmai must be nonzero when type 5 or 6
|
||||
print*, '_NBAND: sigmai must be nonzero when type 5 or 6
|
||||
& is used. '
|
||||
print*, ' '
|
||||
go to 9000
|
||||
end if
|
||||
end if
|
||||
end if
|
||||
c
|
||||
c %------------------------%
|
||||
c | Initialize the reverse |
|
||||
c | communication flag. |
|
||||
c | communication flag. |
|
||||
c %------------------------%
|
||||
c
|
||||
ido = 0
|
||||
@@ -546,7 +546,7 @@ c | Factor (A-sigma*I). |
|
||||
c %-------------------------------%
|
||||
c
|
||||
if (sigmai .eq. zero) then
|
||||
c
|
||||
c
|
||||
c %-----------------------------------%
|
||||
c | Construct (A-sigmar*I) and factor |
|
||||
c | in real arithmetic. |
|
||||
@@ -558,7 +558,7 @@ c
|
||||
10 continue
|
||||
call dgbtrf(n, n, kl, ku, rfac, lda, iwork, ierr )
|
||||
if (ierr .ne. 0) then
|
||||
print*, ' '
|
||||
print*, ' '
|
||||
print*, ' _NBAND: Error with _gbtrf. '
|
||||
print*, ' '
|
||||
go to 9000
|
||||
@@ -574,24 +574,24 @@ c
|
||||
do 30 j = 1, n
|
||||
do 20 i = itop, ibot
|
||||
cfac(i,j) = dcmplx(ab(i,j))
|
||||
20 continue
|
||||
20 continue
|
||||
30 continue
|
||||
c
|
||||
do 40 j = 1, n
|
||||
cfac(imid,j) = cfac(imid,j)
|
||||
cfac(imid,j) = cfac(imid,j)
|
||||
$ - dcmplx(sigmar, sigmai)
|
||||
40 continue
|
||||
c
|
||||
call zgbtrf(n, n, kl, ku, cfac, lda, iwork, ierr )
|
||||
40 continue
|
||||
c
|
||||
call zgbtrf(n, n, kl, ku, cfac, lda, iwork, ierr )
|
||||
if ( ierr .ne. 0) then
|
||||
print*, ' '
|
||||
print*, ' _NBAND: Error with _gbtrf. '
|
||||
print*, ' '
|
||||
go to 9000
|
||||
end if
|
||||
c
|
||||
c
|
||||
end if
|
||||
|
||||
|
||||
else if ( type .eq. 3 ) then
|
||||
c
|
||||
c %-----------------------------------------------%
|
||||
@@ -603,7 +603,7 @@ c
|
||||
call dlacpy ('A', ibot, n, mb, lda, rfac, lda )
|
||||
call dgbtrf(n, n, kl, ku, rfac, lda, iwork, ierr)
|
||||
if (ierr .ne. 0) then
|
||||
print*, ' '
|
||||
print*, ' '
|
||||
print*,'_NBAND: Error with _gbtrf.'
|
||||
print*, ' '
|
||||
go to 9000
|
||||
@@ -615,7 +615,7 @@ c %-------------------------------------------%
|
||||
c | Solving generalized eigenvalue problem in |
|
||||
c | shift-invert mode. |
|
||||
c %-------------------------------------------%
|
||||
c
|
||||
c
|
||||
if ( sigmai .eq. zero ) then
|
||||
c
|
||||
c %--------------------------------------------%
|
||||
@@ -624,7 +624,7 @@ c | arithmetic. |
|
||||
c %--------------------------------------------%
|
||||
c
|
||||
do 60 j = 1,n
|
||||
do 50 i = itop, ibot
|
||||
do 50 i = itop, ibot
|
||||
rfac(i,j) = ab(i,j) - sigmar*mb(i,j)
|
||||
50 continue
|
||||
60 continue
|
||||
@@ -642,13 +642,13 @@ c
|
||||
c %-----------------------------------------------%
|
||||
c | Construct (A - sigma*M) and factor in complex |
|
||||
c | arithmetic. |
|
||||
c %-----------------------------------------------%
|
||||
c %-----------------------------------------------%
|
||||
c
|
||||
do 80 j = 1,n
|
||||
do 70 i = itop, ibot
|
||||
cfac(i,j) = dcmplx( ab(i,j)-sigmar*mb(i,j),
|
||||
do 70 i = itop, ibot
|
||||
cfac(i,j) = dcmplx( ab(i,j)-sigmar*mb(i,j),
|
||||
& -sigmai*mb(i,j) )
|
||||
70 continue
|
||||
70 continue
|
||||
80 continue
|
||||
c
|
||||
call zgbtrf(n, n, kl, ku, cfac, lda, iwork, ierr)
|
||||
@@ -658,7 +658,7 @@ c
|
||||
print*, ' '
|
||||
go to 9000
|
||||
end if
|
||||
c
|
||||
c
|
||||
end if
|
||||
c
|
||||
end if
|
||||
@@ -667,7 +667,7 @@ c %--------------------------------------------%
|
||||
c | M A I N L O O P (reverse communication) |
|
||||
c %--------------------------------------------%
|
||||
c
|
||||
90 continue
|
||||
90 continue
|
||||
c
|
||||
call dnaupd ( ido, bmat, n, which, nev, tol, resid, ncv,
|
||||
& v, ldv, iparam, ipntr, workd, workl, lworkl,
|
||||
@@ -681,8 +681,8 @@ c %----------------------------%
|
||||
c | Perform y <--- OP*x = A*x |
|
||||
c %----------------------------%
|
||||
c
|
||||
call dgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
call dgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
& workd(ipntr(2)), 1)
|
||||
c
|
||||
else if ( type .eq. 2 ) then
|
||||
@@ -690,7 +690,7 @@ c
|
||||
if (sigmai .eq. zero) then
|
||||
c
|
||||
c %----------------------------------%
|
||||
c | Shift is real. Perform |
|
||||
c | Shift is real. Perform |
|
||||
c | y <--- OP*x = inv[A-sigmar*I]*x |
|
||||
c | to force the starting vector |
|
||||
c | into the range of OP. |
|
||||
@@ -700,7 +700,7 @@ c
|
||||
call dgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
|
||||
& iwork, workd(ipntr(2)), n, ierr)
|
||||
if ( ierr .ne. 0 ) then
|
||||
print*, ' '
|
||||
print*, ' '
|
||||
print*, ' _NBAND: Error with _bgtrs. '
|
||||
print*, ' '
|
||||
go to 9000
|
||||
@@ -711,8 +711,8 @@ c
|
||||
c %--------------------------------------------%
|
||||
c | Shift is COMPLEX. Perform |
|
||||
c | y <--- OP*x = Real_Part{inv[A-sigma*I]*x} |
|
||||
c | to force the starting vector into the |
|
||||
c | range of OP. |
|
||||
c | to force the starting vector into the |
|
||||
c | range of OP. |
|
||||
c %--------------------------------------------%
|
||||
c
|
||||
do 100 j = 1, n
|
||||
@@ -732,21 +732,21 @@ c
|
||||
workd(ipntr(2)+j-1) = dble(workc(j))
|
||||
110 continue
|
||||
c
|
||||
end if
|
||||
c
|
||||
end if
|
||||
c
|
||||
else if ( type .eq. 3 ) then
|
||||
c
|
||||
c %-----------------------------------%
|
||||
c | Perform y <--- OP*x = inv[M]*A*x |
|
||||
c | to force the starting vector into |
|
||||
c | to force the starting vector into |
|
||||
c | the range of OP. |
|
||||
c %-----------------------------------%
|
||||
c
|
||||
call dgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
call dgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
& workd(ipntr(2)), 1)
|
||||
c
|
||||
call dgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
|
||||
call dgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
|
||||
& iwork, workd(ipntr(2)), n, ierr)
|
||||
if (ierr .ne. 0) then
|
||||
print*, ' '
|
||||
@@ -759,13 +759,13 @@ c
|
||||
c
|
||||
c %-----------------------------------------%
|
||||
c | Perform y <-- OP*x |
|
||||
c | = Real_part{inv[A-SIGMA*M]*M}*x |
|
||||
c | = Real_part{inv[A-SIGMA*M]*M}*x |
|
||||
c | to force the starting vector into the |
|
||||
c | range of OP. |
|
||||
c %-----------------------------------------%
|
||||
c
|
||||
call dgbmv('Notranspose', n, n, kl, ku, one, mb(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
call dgbmv('Notranspose', n, n, kl, ku, one, mb(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
& workd(ipntr(2)), 1)
|
||||
c
|
||||
if ( sigmai .eq. zero ) then
|
||||
@@ -773,14 +773,14 @@ c
|
||||
c %---------------------%
|
||||
c | Shift is real, stay |
|
||||
c | in real arithmetic. |
|
||||
c %---------------------%
|
||||
c %---------------------%
|
||||
c
|
||||
call dgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
|
||||
call dgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
|
||||
& iwork, workd(ipntr(2)), n, ierr)
|
||||
if (ierr .ne. 0) then
|
||||
print*, ' '
|
||||
print*, ' '
|
||||
print*, '_NBAND: Error with _gbtrs.'
|
||||
print*, ' '
|
||||
print*, ' '
|
||||
go to 9000
|
||||
end if
|
||||
c
|
||||
@@ -792,26 +792,26 @@ c %--------------------------%
|
||||
c
|
||||
do 120 i = 1,n
|
||||
workc(i) = dcmplx(workd(ipntr(2)+i-1))
|
||||
120 continue
|
||||
120 continue
|
||||
c
|
||||
call zgbtrs ('Notranspose', n, kl, ku, 1, cfac, lda,
|
||||
call zgbtrs ('Notranspose', n, kl, ku, 1, cfac, lda,
|
||||
& iwork, workc, n, ierr)
|
||||
if (ierr .ne. 0) then
|
||||
if (ierr .ne. 0) then
|
||||
print*, ' '
|
||||
print*, '_NBAND: Error with _gbtrs.'
|
||||
print*, '_NBAND: Error with _gbtrs.'
|
||||
print*, ' '
|
||||
go to 9000
|
||||
end if
|
||||
c
|
||||
do 130 i = 1, n
|
||||
workd(ipntr(2)+i-1) = dble(workc(i))
|
||||
130 continue
|
||||
130 continue
|
||||
c
|
||||
end if
|
||||
c
|
||||
else if ( type .eq. 5) then
|
||||
c
|
||||
c %---------------------------------------%
|
||||
c %---------------------------------------%
|
||||
c | Perform y <-- OP*x |
|
||||
c | = Imaginary_part{inv[A-SIGMA*I]}*x |
|
||||
c | to force the starting vector into the |
|
||||
@@ -839,32 +839,32 @@ c
|
||||
c
|
||||
c %----------------------------------------%
|
||||
c | Perform y <-- OP*x |
|
||||
c | Imaginary_part{inv[A-SIGMA*M]*M} |
|
||||
c | Imaginary_part{inv[A-SIGMA*M]*M} |
|
||||
c | to force the starting vector into the |
|
||||
c | range of OP. |
|
||||
c %----------------------------------------%
|
||||
c
|
||||
call dgbmv('Notranspose', n, n, kl, ku, one, mb(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
call dgbmv('Notranspose', n, n, kl, ku, one, mb(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
& workd(ipntr(2)), 1)
|
||||
c
|
||||
do 160 i = 1,n
|
||||
workc(i) = dcmplx(workd(ipntr(2)+i-1))
|
||||
160 continue
|
||||
160 continue
|
||||
c
|
||||
call zgbtrs ('Notranspose', n, kl, ku, 1, cfac, lda,
|
||||
call zgbtrs ('Notranspose', n, kl, ku, 1, cfac, lda,
|
||||
& iwork, workc, n, ierr)
|
||||
if (ierr .ne. 0) then
|
||||
if (ierr .ne. 0) then
|
||||
print*, ' '
|
||||
print*, '_NBAND: Error with _gbtrs.'
|
||||
print*, '_NBAND: Error with _gbtrs.'
|
||||
print*, ' '
|
||||
go to 9000
|
||||
end if
|
||||
c
|
||||
do 170 i = 1, n
|
||||
workd(ipntr(2)+i-1) = dimag(workc(i))
|
||||
170 continue
|
||||
c
|
||||
170 continue
|
||||
c
|
||||
end if
|
||||
c
|
||||
else if (ido .eq. 1) then
|
||||
@@ -875,8 +875,8 @@ c %----------------------------%
|
||||
c | Perform y <--- OP*x = A*x |
|
||||
c %----------------------------%
|
||||
c
|
||||
call dgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
call dgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
& workd(ipntr(2)), 1)
|
||||
c
|
||||
else if ( type .eq. 2) then
|
||||
@@ -907,7 +907,7 @@ c
|
||||
& iwork, workc, n, ierr)
|
||||
if ( ierr .ne. 0 ) then
|
||||
print*, ' '
|
||||
print*, '_NBAND: Error with _gbtrs.'
|
||||
print*, '_NBAND: Error with _gbtrs.'
|
||||
print*, ' '
|
||||
go to 9000
|
||||
end if
|
||||
@@ -924,16 +924,16 @@ c %-----------------------------------%
|
||||
c | Perform y <--- OP*x = inv[M]*A*x |
|
||||
c %-----------------------------------%
|
||||
c
|
||||
call dgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
call dgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
& workd(ipntr(2)), 1)
|
||||
c
|
||||
call dgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
|
||||
call dgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
|
||||
& iwork, workd(ipntr(2)), n, ierr)
|
||||
if (ierr .ne. 0) then
|
||||
print*, ' '
|
||||
print*, '_NBAND: Error with _bgtrs.'
|
||||
print*, ' '
|
||||
print*, ' '
|
||||
go to 9000
|
||||
end if
|
||||
c
|
||||
@@ -942,7 +942,7 @@ c
|
||||
c %--------------------------------------%
|
||||
c | Perform y <-- inv(A-sigma*M)*(M*x). |
|
||||
c | (M*x) has been computed and stored |
|
||||
c | in workd(ipntr(3)). |
|
||||
c | in workd(ipntr(3)). |
|
||||
c %--------------------------------------%
|
||||
c
|
||||
if ( sigmai .eq. zero ) then
|
||||
@@ -953,16 +953,16 @@ c | real arithmetic. |
|
||||
c %------------------------%
|
||||
c
|
||||
call dcopy(n, workd(ipntr(3)), 1, workd(ipntr(2)), 1)
|
||||
call dgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
|
||||
call dgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
|
||||
& iwork, workd(ipntr(2)), n, ierr)
|
||||
if (ierr .ne. 0) then
|
||||
if (ierr .ne. 0) then
|
||||
print*, ' '
|
||||
print*, '_NBAND: Error with _gbtrs.'
|
||||
print*, '_NBAND: Error with _gbtrs.'
|
||||
print*, ' '
|
||||
go to 9000
|
||||
end if
|
||||
c
|
||||
else
|
||||
c
|
||||
else
|
||||
c
|
||||
c %---------------------------%
|
||||
c | Go to COMPLEX arithmetic. |
|
||||
@@ -970,26 +970,26 @@ c %---------------------------%
|
||||
c
|
||||
do 200 i = 1,n
|
||||
workc(i) = dcmplx(workd(ipntr(3)+i-1))
|
||||
200 continue
|
||||
200 continue
|
||||
c
|
||||
call zgbtrs ('Notranspose', n, kl, ku, 1, cfac, lda,
|
||||
call zgbtrs ('Notranspose', n, kl, ku, 1, cfac, lda,
|
||||
& iwork, workc, n, ierr)
|
||||
if (ierr .ne. 0) then
|
||||
if (ierr .ne. 0) then
|
||||
print*, ' '
|
||||
print*, '_NBAND: Error in _gbtrs.'
|
||||
print*, ' '
|
||||
print*, '_NBAND: Error in _gbtrs.'
|
||||
print*, ' '
|
||||
go to 9000
|
||||
end if
|
||||
c
|
||||
do 210 i = 1,n
|
||||
workd(ipntr(2)+i-1) = dble(workc(i))
|
||||
210 continue
|
||||
210 continue
|
||||
c
|
||||
end if
|
||||
c
|
||||
else if ( type .eq. 5 ) then
|
||||
c
|
||||
c %---------------------------------------%
|
||||
c %---------------------------------------%
|
||||
c | Perform y <-- OP*x |
|
||||
c | = Imaginary_part{inv[A-SIGMA*I]*x} |
|
||||
c %---------------------------------------%
|
||||
@@ -1015,25 +1015,25 @@ c
|
||||
c
|
||||
c %-----------------------------------------%
|
||||
c | Perform y <-- OP*x |
|
||||
c | = Imaginary_part{inv[A-SIGMA*M]*M}*x. |
|
||||
c | = Imaginary_part{inv[A-SIGMA*M]*M}*x. |
|
||||
c %-----------------------------------------%
|
||||
c
|
||||
do 240 i = 1,n
|
||||
workc(i) = dcmplx(workd(ipntr(3)+i-1))
|
||||
240 continue
|
||||
240 continue
|
||||
c
|
||||
call zgbtrs ('Notranspose', n, kl, ku, 1, cfac, lda,
|
||||
call zgbtrs ('Notranspose', n, kl, ku, 1, cfac, lda,
|
||||
& iwork, workc, n, ierr)
|
||||
if (ierr .ne. 0) then
|
||||
if (ierr .ne. 0) then
|
||||
print*, ' '
|
||||
print*, '_NBAND: Error with _gbtrs.'
|
||||
print*, '_NBAND: Error with _gbtrs.'
|
||||
print*, ' '
|
||||
go to 9000
|
||||
end if
|
||||
c
|
||||
do 250 i = 1, n
|
||||
workd(ipntr(2)+i-1) = dimag(workc(i))
|
||||
250 continue
|
||||
250 continue
|
||||
c
|
||||
end if
|
||||
c
|
||||
@@ -1045,14 +1045,14 @@ c | Not used when |
|
||||
c | type = 1,2. |
|
||||
c %--------------------%
|
||||
c
|
||||
call dgbmv('Notranspose', n, n, kl, ku, one, mb(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
call dgbmv('Notranspose', n, n, kl, ku, one, mb(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
& workd(ipntr(2)), 1)
|
||||
c
|
||||
else
|
||||
else
|
||||
c
|
||||
c %-----------------------------------------%
|
||||
c | Either we have convergence, or there is |
|
||||
c | Either we have convergence, or there is |
|
||||
c | error. |
|
||||
c %-----------------------------------------%
|
||||
c
|
||||
@@ -1069,7 +1069,7 @@ c
|
||||
print *, ' '
|
||||
go to 9000
|
||||
c
|
||||
else
|
||||
else
|
||||
c
|
||||
if ( info .eq. 1) then
|
||||
print *, ' '
|
||||
@@ -1084,29 +1084,29 @@ c
|
||||
c
|
||||
if (iparam(5) .gt. 0) then
|
||||
c
|
||||
call dneupd ( rvec, 'A', select, dr, di, z, ldz,
|
||||
& sigmar, sigmai, workev, bmat, n, which,
|
||||
call dneupd ( rvec, 'A', select, dr, di, z, ldz,
|
||||
& sigmar, sigmai, workev, bmat, n, which,
|
||||
& nev, tol, resid, ncv, v, ldv, iparam,
|
||||
& ipntr, workd, workl, lworkl, info )
|
||||
& ipntr, workd, workl, lworkl, info )
|
||||
c
|
||||
if ( info .ne. 0) then
|
||||
c
|
||||
c
|
||||
c %------------------------------------%
|
||||
c | Check the documentation of DNEUPD. |
|
||||
c %------------------------------------%
|
||||
c
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
print *, ' Error with _neupd = ', info
|
||||
print *, ' Check the documentation of _neupd '
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
go to 9000
|
||||
c
|
||||
else if ( sigmai .ne. zero ) then
|
||||
c
|
||||
else if ( sigmai .ne. zero ) then
|
||||
c
|
||||
if ( type .eq. 4 .or. type .eq. 6 ) then
|
||||
c
|
||||
c
|
||||
first = .true.
|
||||
do 270 j = 1, iparam(5)
|
||||
do 270 j = 1, iparam(5)
|
||||
c
|
||||
c %----------------------------------%
|
||||
c | Use Rayleigh Quotient to recover |
|
||||
@@ -1118,16 +1118,16 @@ c
|
||||
c
|
||||
c %--------------------------------------%
|
||||
c | Eigenvalue is real. Compute |
|
||||
c | d = (x'*inv[A-sigma*M]*M*x) / (x'*x) |
|
||||
c | d = (x'*inv[A-sigma*M]*M*x) / (x'*x) |
|
||||
c %--------------------------------------%
|
||||
c
|
||||
call dgbmv('Nontranspose', n, n, kl, ku, one,
|
||||
call dgbmv('Nontranspose', n, n, kl, ku, one,
|
||||
$ mb(itop,1), lda, z(1,j), 1, zero,
|
||||
$ workd, 1)
|
||||
do i = 1, n
|
||||
workc(i) = dcmplx(workd(i))
|
||||
end do
|
||||
call zgbtrs ('Notranspose', n, kl, ku, 1,
|
||||
call zgbtrs ('Notranspose', n, kl, ku, 1,
|
||||
$ cfac, lda, iwork, workc, n, info)
|
||||
do i = 1, n
|
||||
workd(i) = dble(workc(i))
|
||||
@@ -1151,7 +1151,7 @@ c
|
||||
go to 9000
|
||||
end if
|
||||
c
|
||||
else if (first) then
|
||||
else if (first) then
|
||||
c
|
||||
c %------------------------%
|
||||
c | Eigenvalue is complex. |
|
||||
@@ -1166,7 +1166,7 @@ c
|
||||
call dgbmv('Nontranspose', n, n, kl, ku,
|
||||
$ one, mb(itop,1), lda, z(1,j), 1, zero,
|
||||
$ workd, 1)
|
||||
call dgbmv('Nontranspose', n, n, kl, ku,
|
||||
call dgbmv('Nontranspose', n, n, kl, ku,
|
||||
$ one, mb(itop,1), lda, z(1,j+1), 1,
|
||||
$ zero, workd(n+1), 1)
|
||||
do i = 1, n
|
||||
@@ -1177,7 +1177,7 @@ c %----------------------------%
|
||||
c | Compute inv(A-sigma*M)*M*x |
|
||||
c %----------------------------%
|
||||
c
|
||||
call zgbtrs('Notranspose',n,kl,ku,1,cfac,
|
||||
call zgbtrs('Notranspose',n,kl,ku,1,cfac,
|
||||
$ lda, iwork, workc, n, info)
|
||||
c
|
||||
c %-------------------------------%
|
||||
@@ -1197,7 +1197,7 @@ c %----------------%
|
||||
c | Compute (x'*x) |
|
||||
c %----------------%
|
||||
c
|
||||
numr = dlapy2( dnrm2(n, z(1,j), 1),
|
||||
numr = dlapy2( dnrm2(n, z(1,j), 1),
|
||||
& dnrm2(n, z(1, j+1), 1) )**2
|
||||
c
|
||||
c %----------------------------------------%
|
||||
@@ -1237,7 +1237,7 @@ c
|
||||
c
|
||||
end if
|
||||
c
|
||||
270 continue
|
||||
270 continue
|
||||
c
|
||||
else if ( type .eq. 2 .or. type .eq. 5) then
|
||||
c
|
||||
@@ -1260,7 +1260,7 @@ c
|
||||
do i = 1, n
|
||||
workc(i) = dcmplx(z(i,j))
|
||||
end do
|
||||
call zgbtrs ('Notranspose', n, kl, ku, 1,
|
||||
call zgbtrs ('Notranspose', n, kl, ku, 1,
|
||||
$ cfac, lda, iwork, workc, n, info)
|
||||
do i = 1, n
|
||||
workd(i) = dble(workc(i))
|
||||
@@ -1329,7 +1329,7 @@ c | Compute (x'x) / (x'*inv(A-sigma*I)*x). |
|
||||
c %----------------------------------------%
|
||||
c
|
||||
dmdul = dlapy2(denr,deni)**2
|
||||
if (dmdul .ge. safmin) then
|
||||
if (dmdul .ge. safmin) then
|
||||
dr(j) = sigmar+numr*denr / dmdul
|
||||
di(j) = sigmai-numr*deni / dmdul
|
||||
first = .false.
|
||||
@@ -1378,7 +1378,7 @@ c %----------------------------------------%
|
||||
c | L O O P B A C K to call DNAUPD again. |
|
||||
c %----------------------------------------%
|
||||
c
|
||||
go to 90
|
||||
go to 90
|
||||
c
|
||||
9000 continue
|
||||
c
|
||||
|
||||
+51
-51
@@ -1,4 +1,4 @@
|
||||
program dnbdr1
|
||||
program dnbdr1
|
||||
c
|
||||
c ... Construct the matrix A in LAPACK-style band form.
|
||||
c The matrix A is derived from the discretization of
|
||||
@@ -49,13 +49,13 @@ c | MAXN - Maximum size of the matrix |
|
||||
c | MAXNEV - Maximum number of |
|
||||
c | eigenvalues to be computed |
|
||||
c | MAXNCV - Maximum number of Arnoldi |
|
||||
c | vectors stored |
|
||||
c | vectors stored |
|
||||
c | MAXBDW - Maximum bandwidth |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
integer maxn, maxnev, maxncv, maxbdw, lda,
|
||||
& lworkl, ldv
|
||||
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
|
||||
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
|
||||
& maxbdw=50, lda = maxbdw, ldv = maxn )
|
||||
c
|
||||
c %--------------%
|
||||
@@ -64,12 +64,12 @@ c %--------------%
|
||||
c
|
||||
integer iparam(11), iwork(maxn)
|
||||
logical select(maxncv)
|
||||
Double precision
|
||||
Double precision
|
||||
& a(lda,maxn), m(lda,maxn), rfac(lda,maxn),
|
||||
& workl(3*maxncv*maxncv+6*maxncv), workd(3*maxn),
|
||||
& workl(3*maxncv*maxncv+6*maxncv), workd(3*maxn),
|
||||
& workev(3*maxncv), v(ldv, maxncv),
|
||||
& resid(maxn), d(maxncv, 3), ax(maxn)
|
||||
Complex*16
|
||||
Complex*16
|
||||
& cfac(lda, maxn), workc(maxn)
|
||||
c
|
||||
c %---------------%
|
||||
@@ -81,25 +81,25 @@ c
|
||||
& n, nx, lo, isub, isup, idiag, mode, maxitr,
|
||||
& nconv
|
||||
logical rvec, first
|
||||
Double precision
|
||||
Double precision
|
||||
& tol, rho, h, h2, sigmar, sigmai
|
||||
c
|
||||
c
|
||||
c %------------%
|
||||
c | Parameters |
|
||||
c %------------%
|
||||
c
|
||||
Double precision
|
||||
Double precision
|
||||
& one, zero, two
|
||||
parameter (one = 1.0D+0 , zero = 0.0D+0 ,
|
||||
parameter (one = 1.0D+0 , zero = 0.0D+0 ,
|
||||
& two = 2.0D+0 )
|
||||
c
|
||||
c %-----------------------------%
|
||||
c | BLAS & LAPACK routines used |
|
||||
c %-----------------------------%
|
||||
c
|
||||
Double precision
|
||||
& dlapy2 , dnrm2
|
||||
external dlapy2 , dnrm2 , dgbmv , daxpy
|
||||
Double precision
|
||||
& dlapy2 , dnrm2
|
||||
external dlapy2 , dnrm2 , dgbmv , daxpy
|
||||
c
|
||||
c %--------------------%
|
||||
c | Intrinsic function |
|
||||
@@ -115,7 +115,7 @@ c %-------------------------------------------------%
|
||||
c | The number NX is the number of interior points |
|
||||
c | in the discretization of the 2-dimensional |
|
||||
c | convection-diffusion operator on the unit |
|
||||
c | square with zero Dirichlet boundary condition. |
|
||||
c | square with zero Dirichlet boundary condition. |
|
||||
c | The number N(=NX*NX) is the dimension of the |
|
||||
c | matrix. A standard eigenvalue problem is |
|
||||
c | solved (BMAT = 'I'). NEV is the number of |
|
||||
@@ -126,13 +126,13 @@ c | spectrum. However, The following conditions |
|
||||
c | must be satisfied: |
|
||||
c | N <= MAXN |
|
||||
c | NEV <= MAXNEV |
|
||||
c | NEV + 2 <= NCV <= MAXNCV |
|
||||
c %-------------------------------------------------%
|
||||
c | NEV + 2 <= NCV <= MAXNCV |
|
||||
c %-------------------------------------------------%
|
||||
c
|
||||
nx = 10
|
||||
nx = 10
|
||||
n = nx*nx
|
||||
nev = 4
|
||||
ncv = 10
|
||||
nev = 4
|
||||
ncv = 10
|
||||
if ( n .gt. maxn ) then
|
||||
print *, ' ERROR with _NBDR1: N is greater than MAXN '
|
||||
go to 9000
|
||||
@@ -158,7 +158,7 @@ c | generated in DNAUPD to start the Arnoldi iteration. |
|
||||
c %-----------------------------------------------------%
|
||||
c
|
||||
lworkl = 3*ncv**2+6*ncv
|
||||
tol = zero
|
||||
tol = zero
|
||||
ido = 0
|
||||
info = 0
|
||||
c
|
||||
@@ -173,7 +173,7 @@ c
|
||||
maxitr = 300
|
||||
mode = 1
|
||||
c
|
||||
iparam(3) = maxitr
|
||||
iparam(3) = maxitr
|
||||
iparam(7) = mode
|
||||
c
|
||||
c %----------------------------------------%
|
||||
@@ -195,10 +195,10 @@ c | and subdiagonals within the band of |
|
||||
c | matrices A and M. |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
kl = nx
|
||||
ku = nx
|
||||
kl = nx
|
||||
ku = nx
|
||||
c
|
||||
c %---------------%
|
||||
c %---------------%
|
||||
c | Main diagonal |
|
||||
c %---------------%
|
||||
c
|
||||
@@ -208,13 +208,13 @@ c
|
||||
idiag = kl+ku+1
|
||||
do 30 j = 1, n
|
||||
a(idiag,j) = 4.0D+0 / h2
|
||||
30 continue
|
||||
c
|
||||
30 continue
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | First subdiagonal and superdiagonal |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
rho = 1.0D+2
|
||||
c
|
||||
rho = 1.0D+2
|
||||
isup = kl+ku
|
||||
isub = kl+ku+2
|
||||
do 50 i = 1, nx
|
||||
@@ -222,8 +222,8 @@ c
|
||||
do 40 j = lo+1, lo+nx-1
|
||||
a(isup,j+1) = -one/h2 + rho/two/h
|
||||
a(isub,j) = -one/h2 - rho/two/h
|
||||
40 continue
|
||||
50 continue
|
||||
40 continue
|
||||
50 continue
|
||||
c
|
||||
c %------------------------------------%
|
||||
c | KL-th subdiagonal and KU-th super- |
|
||||
@@ -237,8 +237,8 @@ c
|
||||
do 70 j = lo+1, lo+nx
|
||||
a(isup,nx+j) = -one / h2
|
||||
a(isub,j) = -one / h2
|
||||
70 continue
|
||||
80 continue
|
||||
70 continue
|
||||
80 continue
|
||||
c
|
||||
c %------------------------------------------------%
|
||||
c | Call ARPACK banded solver to find eigenvalues |
|
||||
@@ -247,12 +247,12 @@ c | eigenvalues are returned in the first column |
|
||||
c | of D, the imaginary parts are returned in the |
|
||||
c | second column of D. Eigenvectors are returned |
|
||||
c | in the first NCONV (=IPARAM(5)) columns of V. |
|
||||
c %------------------------------------------------%
|
||||
c %------------------------------------------------%
|
||||
c
|
||||
rvec = .true.
|
||||
call dnband (rvec, 'A', select, d, d(1,2), v, ldv, sigmar, sigmai,
|
||||
& workev, n, a, m, lda, rfac, cfac, kl, ku, which,
|
||||
& bmat, nev, tol, resid, ncv, v, ldv, iparam, workd,
|
||||
rvec = .true.
|
||||
call dnband (rvec, 'A', select, d, d(1,2), v, ldv, sigmar, sigmai,
|
||||
& workev, n, a, m, lda, rfac, cfac, kl, ku, which,
|
||||
& bmat, nev, tol, resid, ncv, v, ldv, iparam, workd,
|
||||
& workl, lworkl, workc, iwork, info)
|
||||
c
|
||||
if ( info .eq. 0) then
|
||||
@@ -285,8 +285,8 @@ c | Compute the residual norm. |
|
||||
c | || A*x - lambda*x || |
|
||||
c %----------------------------%
|
||||
c
|
||||
first = .true.
|
||||
do 90 j = 1, nconv
|
||||
first = .true.
|
||||
do 90 j = 1, nconv
|
||||
c
|
||||
if ( d(j,2) .eq. zero ) then
|
||||
c
|
||||
@@ -294,11 +294,11 @@ c %--------------------%
|
||||
c | Ritz value is real |
|
||||
c %--------------------%
|
||||
c
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
& ax, 1)
|
||||
call daxpy (n, -d(j,1), v(1,j), 1, ax, 1)
|
||||
d(j,3) = dnrm2 (n, ax, 1)
|
||||
d(j,3) = dnrm2 (n, ax, 1)
|
||||
d(j,3) = d(j,3) / abs(d(j,1))
|
||||
c
|
||||
else if ( first ) then
|
||||
@@ -307,17 +307,17 @@ c %------------------------%
|
||||
c | Ritz value is complex |
|
||||
c | Residual of one Ritz |
|
||||
c | value of the conjugate |
|
||||
c | pair is computed. |
|
||||
c | pair is computed. |
|
||||
c %------------------------%
|
||||
c
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
& ax, 1)
|
||||
call daxpy (n, -d(j,1), v(1,j), 1, ax, 1)
|
||||
call daxpy (n, d(j,2), v(1,j+1), 1, ax, 1)
|
||||
d(j,3) = dnrm2 (n, ax, 1)
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j+1), 1, zero,
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j+1), 1, zero,
|
||||
& ax, 1)
|
||||
call daxpy (n, -d(j,2), v(1,j), 1, ax, 1)
|
||||
call daxpy (n, -d(j,1), v(1,j+1), 1, ax, 1)
|
||||
@@ -329,11 +329,11 @@ c
|
||||
first = .true.
|
||||
end if
|
||||
c
|
||||
90 continue
|
||||
90 continue
|
||||
|
||||
call dmout (6, nconv, 3, d, maxncv, -6,
|
||||
& 'Ritz values (Real,Imag) and relative residuals')
|
||||
else
|
||||
else
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | Either convergence failed, or there |
|
||||
@@ -344,8 +344,8 @@ c
|
||||
print *, ' '
|
||||
print *, ' Error with _nband, info= ', info
|
||||
print *, ' Check the documentation of _nband '
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
c
|
||||
end if
|
||||
c
|
||||
9000 end
|
||||
9000 end
|
||||
|
||||
+47
-47
@@ -1,4 +1,4 @@
|
||||
program dnbdr2
|
||||
program dnbdr2
|
||||
c
|
||||
c ... Construct matrices A in LAPACK-style band form.
|
||||
c The matrix A is derived from the discretization of
|
||||
@@ -53,13 +53,13 @@ c | MAXN - Maximum size of the matrix |
|
||||
c | MAXNEV - Maximum number of |
|
||||
c | eigenvalues to be computed |
|
||||
c | MAXNCV - Maximum number of Arnoldi |
|
||||
c | vectors stored |
|
||||
c | vectors stored |
|
||||
c | MAXBDW - Maximum bandwidth |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
integer maxn, maxnev, maxncv, maxbdw, lda,
|
||||
& lworkl, ldv
|
||||
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
|
||||
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
|
||||
& maxbdw=50, lda = maxbdw, ldv = maxn )
|
||||
c
|
||||
c %--------------%
|
||||
@@ -68,12 +68,12 @@ c %--------------%
|
||||
c
|
||||
integer iparam(11), iwork(maxn)
|
||||
logical select(maxncv)
|
||||
Double precision
|
||||
Double precision
|
||||
& a(lda,maxn), m(lda,maxn), rfac(lda,maxn),
|
||||
& workl(3*maxncv*maxncv+6*maxncv), workd(3*maxn),
|
||||
& workl(3*maxncv*maxncv+6*maxncv), workd(3*maxn),
|
||||
& workev(3*maxncv), v(ldv, maxncv),
|
||||
& resid(maxn), d(maxncv, 3), ax(maxn)
|
||||
Complex*16
|
||||
Complex*16
|
||||
& cfac(lda, maxn), workc(maxn)
|
||||
c
|
||||
c %---------------%
|
||||
@@ -85,25 +85,25 @@ c
|
||||
& n, nx, lo, idiag, isub, isup, mode, maxitr,
|
||||
& nconv
|
||||
logical rvec, first
|
||||
Double precision
|
||||
Double precision
|
||||
& tol, rho, h2, h, sigmar, sigmai
|
||||
c
|
||||
c
|
||||
c %------------%
|
||||
c | Parameters |
|
||||
c %------------%
|
||||
c
|
||||
Double precision
|
||||
Double precision
|
||||
& one, zero, two
|
||||
parameter (one = 1.0D+0 , zero = 0.0D+0 ,
|
||||
parameter (one = 1.0D+0 , zero = 0.0D+0 ,
|
||||
& two = 2.0D+0 )
|
||||
c
|
||||
c %-----------------------------%
|
||||
c | BLAS & LAPACK routines used |
|
||||
c %-----------------------------%
|
||||
c
|
||||
Double precision
|
||||
& dlapy2 , dnrm2
|
||||
external dlapy2 , dnrm2 , daxpy , dgbmv
|
||||
Double precision
|
||||
& dlapy2 , dnrm2
|
||||
external dlapy2 , dnrm2 , daxpy , dgbmv
|
||||
c
|
||||
c %--------------------%
|
||||
c | Intrinsic function |
|
||||
@@ -135,10 +135,10 @@ c | NEV <= MAXNEV |
|
||||
c | NEV + 2 <= NCV <= MAXNCV |
|
||||
c %-------------------------------------------------%
|
||||
c
|
||||
nx = 10
|
||||
nx = 10
|
||||
n = nx*nx
|
||||
nev = 4
|
||||
ncv = 20
|
||||
nev = 4
|
||||
ncv = 20
|
||||
if ( n .gt. maxn ) then
|
||||
print *, ' ERROR with _NBDR2: N is greater than MAXN '
|
||||
go to 9000
|
||||
@@ -151,8 +151,8 @@ c
|
||||
end if
|
||||
bmat = 'I'
|
||||
which = 'LM'
|
||||
sigmar = 1.0D+4
|
||||
sigmai = 0.0D+0
|
||||
sigmar = 1.0D+4
|
||||
sigmai = 0.0D+0
|
||||
c
|
||||
c %-----------------------------------------------------%
|
||||
c | The work array WORKL is used in DNAUPD as |
|
||||
@@ -166,7 +166,7 @@ c | generated in DNAUPD to start the Arnoldi iteration. |
|
||||
c %-----------------------------------------------------%
|
||||
c
|
||||
lworkl = 3*ncv**2+6*ncv
|
||||
tol = zero
|
||||
tol = zero
|
||||
ido = 0
|
||||
info = 0
|
||||
c
|
||||
@@ -181,7 +181,7 @@ c
|
||||
maxitr = 300
|
||||
mode = 3
|
||||
c
|
||||
iparam(3) = maxitr
|
||||
iparam(3) = maxitr
|
||||
iparam(7) = mode
|
||||
c
|
||||
c %----------------------------------------%
|
||||
@@ -203,10 +203,10 @@ c | and subdiagonals within the band of |
|
||||
c | matrices A. |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
kl = nx
|
||||
ku = nx
|
||||
kl = nx
|
||||
ku = nx
|
||||
c
|
||||
c %---------------%
|
||||
c %---------------%
|
||||
c | Main diagonal |
|
||||
c %---------------%
|
||||
c
|
||||
@@ -216,22 +216,22 @@ c
|
||||
idiag = kl+ku+1
|
||||
do 30 j = 1, n
|
||||
a(idiag,j) = 4.0D+0 / h2
|
||||
30 continue
|
||||
c
|
||||
30 continue
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | First subdiagonal and superdiagonal |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
c
|
||||
isup = kl+ku
|
||||
isub = kl+ku+2
|
||||
rho = 1.0D+1
|
||||
rho = 1.0D+1
|
||||
do 50 i = 1, nx
|
||||
lo = (i-1)*nx
|
||||
do 40 j = lo+1, lo+nx-1
|
||||
a(isub,j+1) = -one/h2 + rho/two/h
|
||||
a(isup,j) = -one/h2 - rho/two/h
|
||||
40 continue
|
||||
50 continue
|
||||
40 continue
|
||||
50 continue
|
||||
c
|
||||
c %------------------------------------%
|
||||
c | KL-th subdiagonal and KU-th super- |
|
||||
@@ -245,8 +245,8 @@ c
|
||||
do 70 j = lo+1, lo+nx
|
||||
a(isup,nx+j) = -one / h2
|
||||
a(isub,j) = -one / h2
|
||||
70 continue
|
||||
80 continue
|
||||
70 continue
|
||||
80 continue
|
||||
c
|
||||
c %------------------------------------------------%
|
||||
c | Call ARPACK banded solver to find eigenvalues |
|
||||
@@ -258,9 +258,9 @@ c | in the first NCONV (=IPARAM(5)) columns of V. |
|
||||
c %------------------------------------------------%
|
||||
c
|
||||
rvec = .true.
|
||||
call dnband (rvec, 'A', select, d, d(1,2), v, ldv, sigmar,
|
||||
& sigmai, workev, n, a, m, lda, rfac, cfac, kl, ku,
|
||||
& which, bmat, nev, tol, resid, ncv, v, ldv, iparam,
|
||||
call dnband (rvec, 'A', select, d, d(1,2), v, ldv, sigmar,
|
||||
& sigmai, workev, n, a, m, lda, rfac, cfac, kl, ku,
|
||||
& which, bmat, nev, tol, resid, ncv, v, ldv, iparam,
|
||||
& workd, workl, lworkl, workc, iwork, info)
|
||||
c
|
||||
if ( info .eq. 0) then
|
||||
@@ -293,8 +293,8 @@ c | Compute the residual norm. |
|
||||
c | || A*x - lambda*x || |
|
||||
c %----------------------------%
|
||||
c
|
||||
first = .true.
|
||||
do 90 j = 1, nconv
|
||||
first = .true.
|
||||
do 90 j = 1, nconv
|
||||
c
|
||||
if ( d(j,2) .eq. zero ) then
|
||||
c
|
||||
@@ -302,8 +302,8 @@ c %--------------------%
|
||||
c | Ritz value is real |
|
||||
c %--------------------%
|
||||
c
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
& ax, 1)
|
||||
call daxpy (n, -d(j,1), v(1,j), 1, ax, 1)
|
||||
d(j,3) = dnrm2 (n, ax, 1)
|
||||
@@ -315,17 +315,17 @@ c %------------------------%
|
||||
c | Ritz value is complex |
|
||||
c | Residual of one Ritz |
|
||||
c | value of the conjugate |
|
||||
c | pair is computed. |
|
||||
c | pair is computed. |
|
||||
c %------------------------%
|
||||
c
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
& ax, 1)
|
||||
call daxpy (n, -d(j,1), v(1,j), 1, ax, 1)
|
||||
call daxpy (n, d(j,2), v(1,j+1), 1, ax, 1)
|
||||
d(j,3) = dnrm2 (n, ax, 1)
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j+1), 1, zero,
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j+1), 1, zero,
|
||||
& ax, 1)
|
||||
call daxpy (n, -d(j,1), v(1,j+1), 1, ax, 1)
|
||||
call daxpy (n, -d(j,2), v(1,j), 1, ax, 1)
|
||||
@@ -337,11 +337,11 @@ c
|
||||
first = .true.
|
||||
end if
|
||||
c
|
||||
90 continue
|
||||
90 continue
|
||||
|
||||
call dmout (6, nconv, 3, d, maxncv, -6,
|
||||
& 'Ritz values (Real,Imag) and relative residuals')
|
||||
else
|
||||
else
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | Either convergence failed, or there |
|
||||
@@ -352,8 +352,8 @@ c
|
||||
print *, ' '
|
||||
print *, ' Error with _nband, info= ', info
|
||||
print *, ' Check the documentation of _nband '
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
c
|
||||
end if
|
||||
c
|
||||
9000 end
|
||||
9000 end
|
||||
|
||||
+55
-55
@@ -1,8 +1,8 @@
|
||||
program dnbdr3
|
||||
program dnbdr3
|
||||
c
|
||||
c ... Construct matrices A and M in LAPACK-style band form.
|
||||
c The matrix A and M are derived from the finite element
|
||||
c discretization of the 1-dimensional convection-diffusion operator
|
||||
c discretization of the 1-dimensional convection-diffusion operator
|
||||
c (d^2u/dx^2) + rho*(du/dx)
|
||||
c on the interval [0,1] with zero boundary condition,
|
||||
|
||||
@@ -49,13 +49,13 @@ c | MAXN - Maximum size of the matrix |
|
||||
c | MAXNEV - Maximum number of |
|
||||
c | eigenvalues to be computed |
|
||||
c | MAXNCV - Maximum number of Arnoldi |
|
||||
c | vectors stored |
|
||||
c | vectors stored |
|
||||
c | MAXBDW - Maximum bandwidth |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
integer maxn, maxnev, maxncv, maxbdw, lda,
|
||||
& lworkl, ldv
|
||||
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
|
||||
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
|
||||
& maxbdw=50, lda = maxbdw, ldv = maxn)
|
||||
c
|
||||
c %--------------%
|
||||
@@ -64,12 +64,12 @@ c %--------------%
|
||||
c
|
||||
integer iparam(11), iwork(maxn)
|
||||
logical select(maxncv)
|
||||
Double precision
|
||||
Double precision
|
||||
& a(lda,maxn), m(lda,maxn), rfac(lda,maxn),
|
||||
& workl(3*maxncv*maxncv+6*maxncv), workd(3*maxn),
|
||||
& workl(3*maxncv*maxncv+6*maxncv), workd(3*maxn),
|
||||
& workev(3*maxncv), v(ldv, maxncv),
|
||||
& resid(maxn), d(maxncv, 3), ax(maxn), mx(maxn)
|
||||
Complex*16
|
||||
Complex*16
|
||||
& cfac(lda, maxn), workc(maxn)
|
||||
c
|
||||
c %---------------%
|
||||
@@ -81,25 +81,25 @@ c
|
||||
& n, idiag, isup, isub, mode, maxitr,
|
||||
& nconv
|
||||
logical rvec, first
|
||||
Double precision
|
||||
Double precision
|
||||
& tol, rho, h, sigmar, sigmai
|
||||
c
|
||||
c
|
||||
c %------------%
|
||||
c | Parameters |
|
||||
c %------------%
|
||||
c
|
||||
Double precision
|
||||
Double precision
|
||||
& one, zero, two
|
||||
parameter (one = 1.0D+0 , zero = 0.0D+0 ,
|
||||
parameter (one = 1.0D+0 , zero = 0.0D+0 ,
|
||||
& two = 2.0D+0 )
|
||||
c
|
||||
c %-----------------------------%
|
||||
c | BLAS & LAPACK routines used |
|
||||
c %-----------------------------%
|
||||
c
|
||||
Double precision
|
||||
& dlapy2 , dnrm2
|
||||
external dlapy2 , dnrm2 , dgbmv , daxpy
|
||||
Double precision
|
||||
& dlapy2 , dnrm2
|
||||
external dlapy2 , dnrm2 , dgbmv , daxpy
|
||||
c
|
||||
c %--------------------%
|
||||
c | Intrinsic function |
|
||||
@@ -126,8 +126,8 @@ c | NEV + 2 <= NCV <= MAXNCV |
|
||||
c %-------------------------------------------------%
|
||||
c
|
||||
n = 100
|
||||
nev = 4
|
||||
ncv = 10
|
||||
nev = 4
|
||||
ncv = 10
|
||||
if ( n .gt. maxn ) then
|
||||
print *, ' ERROR with _NBDR3: N is greater than MAXN '
|
||||
go to 9000
|
||||
@@ -142,7 +142,7 @@ c
|
||||
which = 'LM'
|
||||
c
|
||||
c %----------------------------------------------------%
|
||||
c | The work array WORKL is used in DNAUPD as |
|
||||
c | The work array WORKL is used in DNAUPD as |
|
||||
c | workspace. Its dimension LWORKL has to be set as |
|
||||
c | illustrated below. The parameter TOL determines |
|
||||
c | the stopping criterion. If TOL<=0, machine machine |
|
||||
@@ -150,12 +150,12 @@ c | precision is used. The number IDO is used for |
|
||||
c | reverse communication and has to be set to 0 at |
|
||||
c | the beginning. Setting INFO=0 indicates that we |
|
||||
c | using a randomly generated vector to start the |
|
||||
c | the ARNOLDI process. |
|
||||
c | the ARNOLDI process. |
|
||||
c %----------------------------------------------------%
|
||||
c
|
||||
lworkl = 3*ncv**2+6*ncv
|
||||
info = 0
|
||||
tol = zero
|
||||
tol = zero
|
||||
ido = 0
|
||||
c
|
||||
c %---------------------------------------------------%
|
||||
@@ -169,8 +169,8 @@ c
|
||||
mode = 2
|
||||
maxitr = 300
|
||||
c
|
||||
iparam(3) = maxitr
|
||||
iparam(7) = mode
|
||||
iparam(3) = maxitr
|
||||
iparam(7) = mode
|
||||
c
|
||||
c %--------------------------------------------%
|
||||
c | Construct matrices A and M in LAPACK-style |
|
||||
@@ -191,10 +191,10 @@ c | and subdiagonals within the band of |
|
||||
c | matrices A and M. |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
kl = 1
|
||||
ku = 1
|
||||
kl = 1
|
||||
ku = 1
|
||||
c
|
||||
c %---------------%
|
||||
c %---------------%
|
||||
c | Main diagonal |
|
||||
c %---------------%
|
||||
c
|
||||
@@ -204,21 +204,21 @@ c
|
||||
do 30 j = 1, n
|
||||
a(idiag,j) = 2.0D+0 / h
|
||||
m(idiag,j) = 4.0D+0 * h
|
||||
30 continue
|
||||
c
|
||||
30 continue
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | First subdiagonal and superdiagonal |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
c
|
||||
isup = kl+ku
|
||||
isub = kl+ku+2
|
||||
rho = 1.0D+1
|
||||
rho = 1.0D+1
|
||||
do 50 j = 1, n
|
||||
a(isup,j+1) = -one/h + rho/two
|
||||
a(isub,j) = -one/h - rho/two
|
||||
m(isup,j+1) = one*h
|
||||
m(isub,j) = one*h
|
||||
50 continue
|
||||
50 continue
|
||||
c
|
||||
c %------------------------------------------------%
|
||||
c | Call ARPACK banded solver to find eigenvalues |
|
||||
@@ -229,10 +229,10 @@ c | second column of D. Eigenvectors are returned |
|
||||
c | in the first NCONV (=IPARAM(5)) columns of V. |
|
||||
c %------------------------------------------------%
|
||||
c
|
||||
rvec = .true.
|
||||
call dnband ( rvec, 'A', select, d, d(1,2), v, ldv, sigmar,
|
||||
& sigmai, workev, n, A, M, lda, rfac, cfac, kl, ku,
|
||||
& which, bmat, nev, tol, resid, ncv, v, ldv, iparam,
|
||||
rvec = .true.
|
||||
call dnband ( rvec, 'A', select, d, d(1,2), v, ldv, sigmar,
|
||||
& sigmai, workev, n, A, M, lda, rfac, cfac, kl, ku,
|
||||
& which, bmat, nev, tol, resid, ncv, v, ldv, iparam,
|
||||
& workd, workl, lworkl, workc, iwork, info)
|
||||
c
|
||||
if ( info .eq. 0) then
|
||||
@@ -265,7 +265,7 @@ c | Compute the residual norm. |
|
||||
c | || A*x - lambda*x || |
|
||||
c %----------------------------%
|
||||
c
|
||||
first = .true.
|
||||
first = .true.
|
||||
do 90 j = 1, nconv
|
||||
c
|
||||
if ( d(j,2) .eq. zero ) then
|
||||
@@ -274,11 +274,11 @@ c %--------------------%
|
||||
c | Ritz value is real |
|
||||
c %--------------------%
|
||||
c
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
& ax, 1)
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j), 1, zero,
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j), 1, zero,
|
||||
& mx, 1)
|
||||
call daxpy (n, -d(j,1), mx, 1, ax, 1)
|
||||
d(j,3) = dnrm2 (n, ax, 1)
|
||||
@@ -290,30 +290,30 @@ c %------------------------%
|
||||
c | Ritz value is complex |
|
||||
c | Residual of one Ritz |
|
||||
c | value of the conjugate |
|
||||
c | pair is computed. |
|
||||
c | pair is computed. |
|
||||
c %------------------------%
|
||||
c
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
& ax, 1)
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j), 1, zero,
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j), 1, zero,
|
||||
& mx, 1)
|
||||
call daxpy (n, -d(j,1), mx, 1, ax, 1)
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j+1), 1, zero,
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j+1), 1, zero,
|
||||
& mx, 1)
|
||||
call daxpy (n, d(j,2), mx, 1, ax, 1)
|
||||
d(j,3) = dnrm2 (n, ax, 1)
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j+1), 1, zero,
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j+1), 1, zero,
|
||||
& ax, 1)
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j+1), 1, zero,
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j+1), 1, zero,
|
||||
& mx, 1)
|
||||
call daxpy (n, -d(j,1), mx, 1, ax, 1)
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j), 1, zero,
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j), 1, zero,
|
||||
& mx, 1)
|
||||
call daxpy (n, -d(j,2), mx, 1, ax, 1)
|
||||
d(j,3) = dlapy2 ( d(j,3), dnrm2 (n, ax, 1) )
|
||||
@@ -324,11 +324,11 @@ c
|
||||
first = .true.
|
||||
end if
|
||||
c
|
||||
90 continue
|
||||
90 continue
|
||||
|
||||
call dmout (6, nconv, 3, d, maxncv, -6,
|
||||
& 'Ritz values (Real,Imag) and relative residuals')
|
||||
else
|
||||
else
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | Either convergence failed, or there |
|
||||
@@ -339,8 +339,8 @@ c
|
||||
print *, ' '
|
||||
print *, ' Error with _nband, info= ', info
|
||||
print *, ' Check the documentation of _nband '
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
c
|
||||
end if
|
||||
c
|
||||
9000 end
|
||||
9000 end
|
||||
|
||||
+46
-46
@@ -50,14 +50,14 @@ c | MAXN - Maximum size of the matrix |
|
||||
c | MAXNEV - Maximum number of |
|
||||
c | eigenvalues to be computed |
|
||||
c | MAXNCV - Maximum number of Arnoldi |
|
||||
c | vectors stored |
|
||||
c | vectors stored |
|
||||
c | MAXBDW - Maximum bandwidth |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
integer maxn, maxnev, maxncv, maxbdw, lda,
|
||||
& lworkl, ldv
|
||||
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
|
||||
& maxbdw=50, lda = maxbdw, ldv = maxn)
|
||||
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
|
||||
& maxbdw=50, lda = maxbdw, ldv = maxn)
|
||||
c
|
||||
c %--------------%
|
||||
c | Local Arrays |
|
||||
@@ -67,10 +67,10 @@ c
|
||||
logical select(maxncv)
|
||||
Double precision
|
||||
& a(lda,maxn), m(lda,maxn), rfac(lda,maxn),
|
||||
& workl(3*maxncv*maxncv+6*maxncv), workd(3*maxn),
|
||||
& workl(3*maxncv*maxncv+6*maxncv), workd(3*maxn),
|
||||
& workev(3*maxncv), v(ldv, maxncv),
|
||||
& resid(maxn), d(maxncv, 3), ax(maxn), mx(maxn)
|
||||
Complex*16
|
||||
Complex*16
|
||||
& cfac(lda, maxn), workc(maxn)
|
||||
c
|
||||
c %---------------%
|
||||
@@ -82,16 +82,16 @@ c
|
||||
& n, idiag, isup, isub, mode, maxitr,
|
||||
& nconv
|
||||
logical rvec, first
|
||||
Double precision
|
||||
Double precision
|
||||
& tol, rho, h, sigmar, sigmai
|
||||
c
|
||||
c
|
||||
c %------------%
|
||||
c | Parameters |
|
||||
c %------------%
|
||||
c
|
||||
Double precision
|
||||
Double precision
|
||||
& one, zero, two, six
|
||||
parameter (one = 1.0D+0, zero = 0.0D+0,
|
||||
parameter (one = 1.0D+0, zero = 0.0D+0,
|
||||
& two = 2.0D+0, six = 6.0D+0)
|
||||
c
|
||||
c %-----------------------------%
|
||||
@@ -100,7 +100,7 @@ c %-----------------------------%
|
||||
c
|
||||
Double precision
|
||||
& dlapy2, dnrm2
|
||||
external dlapy2, dnrm2, dgbmv, daxpy
|
||||
external dlapy2, dnrm2, dgbmv, daxpy
|
||||
c
|
||||
c %--------------------%
|
||||
c | Intrinsic function |
|
||||
@@ -127,8 +127,8 @@ c | NEV + 2 <= NCV <= MAXNCV |
|
||||
c %-------------------------------------------------%
|
||||
c
|
||||
n = 100
|
||||
nev = 4
|
||||
ncv = 10
|
||||
nev = 4
|
||||
ncv = 10
|
||||
if ( n .gt. maxn ) then
|
||||
print *, ' ERROR with _NBDR4: N is greater than MAXN '
|
||||
go to 9000
|
||||
@@ -142,7 +142,7 @@ c
|
||||
bmat = 'G'
|
||||
which = 'LM'
|
||||
sigmar = 1.0D+1
|
||||
sigmai = 0.0D+0
|
||||
sigmai = 0.0D+0
|
||||
c
|
||||
c %-----------------------------------------------------%
|
||||
c | The work array WORKL is used in DNAUPD as |
|
||||
@@ -157,7 +157,7 @@ c %-----------------------------------------------------%
|
||||
c
|
||||
lworkl = 3*ncv**2+6*ncv
|
||||
info = 0
|
||||
tol = zero
|
||||
tol = zero
|
||||
ido = 0
|
||||
c
|
||||
c %---------------------------------------------------%
|
||||
@@ -171,7 +171,7 @@ c
|
||||
maxitr = 300
|
||||
mode = 3
|
||||
c
|
||||
iparam(3) = n
|
||||
iparam(3) = n
|
||||
iparam(7) = 3
|
||||
c
|
||||
c %--------------------------------------------%
|
||||
@@ -194,9 +194,9 @@ c | matrices A and M. |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
kl = 1
|
||||
ku = 1
|
||||
ku = 1
|
||||
c
|
||||
c %---------------%
|
||||
c %---------------%
|
||||
c | Main diagonal |
|
||||
c %---------------%
|
||||
c
|
||||
@@ -205,12 +205,12 @@ c
|
||||
do 30 j = 1, n
|
||||
a(idiag,j) = 2.0D+0 / h
|
||||
m(idiag,j) = 4.0D+0 * h / six
|
||||
30 continue
|
||||
c
|
||||
30 continue
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | First subdiagonal and superdiagonal |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
c
|
||||
isup = kl+ku
|
||||
isub = kl+ku+2
|
||||
rho = 1.0D+1
|
||||
@@ -218,8 +218,8 @@ c
|
||||
a(isup,j+1) = -one/h + rho/two
|
||||
a(isub,j) = -one/h - rho/two
|
||||
m(isup,j+1) = one*h/six
|
||||
m(isub,j) = one*h/six
|
||||
40 continue
|
||||
m(isub,j) = one*h/six
|
||||
40 continue
|
||||
c
|
||||
c %------------------------------------------------%
|
||||
c | Call ARPACK banded solver to find eigenvalues |
|
||||
@@ -231,9 +231,9 @@ c | in the first NCONV (=IPARAM(5)) columns of V. |
|
||||
c %------------------------------------------------%
|
||||
c
|
||||
rvec = .true.
|
||||
call dnband(rvec, 'A', select, d, d(1,2), v, ldv, sigmar,
|
||||
call dnband(rvec, 'A', select, d, d(1,2), v, ldv, sigmar,
|
||||
& sigmai, workev, n, A, M, lda, rfac, cfac, kl, ku,
|
||||
& which, bmat, nev, tol, resid, ncv, v, ldv, iparam,
|
||||
& which, bmat, nev, tol, resid, ncv, v, ldv, iparam,
|
||||
& workd, workl, lworkl, workc, iwork, info)
|
||||
c
|
||||
if ( info .eq. 0) then
|
||||
@@ -266,7 +266,7 @@ c | Compute the residual norm. |
|
||||
c | || A*x - lambda*x || |
|
||||
c %----------------------------%
|
||||
c
|
||||
first = .true.
|
||||
first = .true.
|
||||
do 50 j = 1, nconv
|
||||
c
|
||||
if ( d(j,2) .eq. zero ) then
|
||||
@@ -275,11 +275,11 @@ c %--------------------%
|
||||
c | Ritz value is real |
|
||||
c %--------------------%
|
||||
c
|
||||
call dgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
call dgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
& ax, 1)
|
||||
call dgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j), 1, zero,
|
||||
call dgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j), 1, zero,
|
||||
& mx, 1)
|
||||
call daxpy(n, -d(j,1), mx, 1, ax, 1)
|
||||
d(j,3) = dnrm2(n, ax, 1)
|
||||
@@ -291,30 +291,30 @@ c %------------------------%
|
||||
c | Ritz value is complex |
|
||||
c | Residual of one Ritz |
|
||||
c | value of the conjugate |
|
||||
c | pair is computed. |
|
||||
c | pair is computed. |
|
||||
c %------------------------%
|
||||
c
|
||||
call dgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
call dgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
& ax, 1)
|
||||
call dgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j), 1, zero,
|
||||
call dgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j), 1, zero,
|
||||
& mx, 1)
|
||||
call daxpy(n, -d(j,1), mx, 1, ax, 1)
|
||||
call dgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j+1), 1, zero,
|
||||
call dgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j+1), 1, zero,
|
||||
& mx, 1)
|
||||
call daxpy(n, d(j,2), mx, 1, ax, 1)
|
||||
d(j,3) = dnrm2(n, ax, 1)
|
||||
call dgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j+1), 1, zero,
|
||||
call dgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j+1), 1, zero,
|
||||
& ax, 1)
|
||||
call dgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j+1), 1, zero,
|
||||
call dgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j+1), 1, zero,
|
||||
& mx, 1)
|
||||
call daxpy(n, -d(j,1), mx, 1, ax, 1)
|
||||
call dgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j), 1, zero,
|
||||
call dgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j), 1, zero,
|
||||
& mx, 1)
|
||||
call daxpy(n, -d(j,2), mx, 1, ax, 1)
|
||||
d(j,3) = dlapy2( d(j,3), dnrm2(n, ax, 1) )
|
||||
@@ -325,11 +325,11 @@ c
|
||||
first = .true.
|
||||
end if
|
||||
c
|
||||
50 continue
|
||||
50 continue
|
||||
|
||||
call dmout(6, nconv, 3, d, maxncv, -6,
|
||||
& 'Ritz values (Real,Imag) and relatve residuals')
|
||||
else
|
||||
else
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | Either convergence failed, or there |
|
||||
@@ -340,8 +340,8 @@ c
|
||||
print *, ' '
|
||||
print *, ' Error with _nband, info= ', info
|
||||
print *, ' Check the documentation of _nband '
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
c
|
||||
end if
|
||||
c
|
||||
9000 end
|
||||
9000 end
|
||||
|
||||
+48
-48
@@ -1,7 +1,7 @@
|
||||
program dnbdr5
|
||||
program dnbdr5
|
||||
c
|
||||
c ... Construct matrices A and M in LAPACK-style band form.
|
||||
c The matrix A is a block tridiagonal matrix. Each
|
||||
c The matrix A is a block tridiagonal matrix. Each
|
||||
c diagonal block is a tridiagonal matrix with
|
||||
c 4 on the diagonal, 1-rho*h/2 on the subdiagonal and
|
||||
c 1+rho*h/2 on the superdiagonal. Each off-diagonal block
|
||||
@@ -51,13 +51,13 @@ c | MAXN - Maximum size of the matrix |
|
||||
c | MAXNEV - Maximum number of |
|
||||
c | eigenvalues to be computed |
|
||||
c | MAXNCV - Maximum number of Arnoldi |
|
||||
c | vectors stored |
|
||||
c | vectors stored |
|
||||
c | MAXBDW - Maximum bandwidth |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
integer maxn, maxnev, maxncv, maxbdw, lda,
|
||||
& lworkl, ldv
|
||||
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
|
||||
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
|
||||
& maxbdw=50, lda = maxbdw, ldv = maxn )
|
||||
c
|
||||
c %--------------%
|
||||
@@ -66,12 +66,12 @@ c %--------------%
|
||||
c
|
||||
integer iparam(11), iwork(maxn)
|
||||
logical select(maxncv)
|
||||
Double precision
|
||||
Double precision
|
||||
& a(lda,maxn), m(lda,maxn), rfac(lda,maxn),
|
||||
& workl(3*maxncv*maxncv+6*maxncv), workd(3*maxn),
|
||||
& workl(3*maxncv*maxncv+6*maxncv), workd(3*maxn),
|
||||
& workev(3*maxncv), v(ldv, maxncv),
|
||||
& resid(maxn), d(maxncv, 3), ax(maxn)
|
||||
Complex*16
|
||||
Complex*16
|
||||
& cfac(lda, maxn), workc(maxn)
|
||||
c
|
||||
c %---------------%
|
||||
@@ -83,25 +83,25 @@ c
|
||||
& n, nx, lo, idiag, isup, isub, mode, maxitr,
|
||||
& nconv
|
||||
logical rvec, first
|
||||
Double precision
|
||||
Double precision
|
||||
& tol, rho, h, sigmar, sigmai
|
||||
c
|
||||
c
|
||||
c %------------%
|
||||
c | Parameters |
|
||||
c %------------%
|
||||
c
|
||||
Double precision
|
||||
Double precision
|
||||
& one, zero, two
|
||||
parameter (one = 1.0D+0 , zero = 0.0D+0 ,
|
||||
parameter (one = 1.0D+0 , zero = 0.0D+0 ,
|
||||
& two = 2.0D+0 )
|
||||
c
|
||||
c %-----------------------------%
|
||||
c | BLAS & LAPACK routines used |
|
||||
c %-----------------------------%
|
||||
c
|
||||
Double precision
|
||||
& dlapy2 , dnrm2
|
||||
external dlapy2 , dnrm2 , dgbmv , daxpy
|
||||
Double precision
|
||||
& dlapy2 , dnrm2
|
||||
external dlapy2 , dnrm2 , dgbmv , daxpy
|
||||
c
|
||||
c %--------------------%
|
||||
c | Intrinsic function |
|
||||
@@ -132,8 +132,8 @@ c %--------------------------------------------------%
|
||||
c
|
||||
nx = 10
|
||||
n = nx*nx
|
||||
nev = 4
|
||||
ncv = 10
|
||||
nev = 4
|
||||
ncv = 10
|
||||
if ( n .gt. maxn ) then
|
||||
print *, ' ERROR with _NBDR5: N is greater than MAXN '
|
||||
go to 9000
|
||||
@@ -146,8 +146,8 @@ c
|
||||
end if
|
||||
bmat = 'I'
|
||||
which = 'LM'
|
||||
sigmar = 4.0D-1
|
||||
sigmai = 6.0D-1
|
||||
sigmar = 4.0D-1
|
||||
sigmai = 6.0D-1
|
||||
c
|
||||
c %-----------------------------------------------------%
|
||||
c | The work array WORKL is used in DNAUPD as |
|
||||
@@ -161,7 +161,7 @@ c | generated in DNAUPD to start the Arnoldi iteration. |
|
||||
c %-----------------------------------------------------%
|
||||
c
|
||||
lworkl = 3*ncv**2+6*ncv
|
||||
tol = zero
|
||||
tol = zero
|
||||
ido = 0
|
||||
info = 0
|
||||
c
|
||||
@@ -198,34 +198,34 @@ c | and subdiagonals within the band of |
|
||||
c | matrices A and M. |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
kl = nx
|
||||
ku = nx
|
||||
kl = nx
|
||||
ku = nx
|
||||
c
|
||||
c %---------------%
|
||||
c %---------------%
|
||||
c | Main diagonal |
|
||||
c %---------------%
|
||||
c
|
||||
idiag = kl+ku+1
|
||||
do 30 j = 1, n
|
||||
a(idiag,j) = 4.0D+0
|
||||
m(idiag,j) = 4.0D+0
|
||||
30 continue
|
||||
c
|
||||
a(idiag,j) = 4.0D+0
|
||||
m(idiag,j) = 4.0D+0
|
||||
30 continue
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | First subdiagonal and superdiagonal |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
c
|
||||
isup = kl+ku
|
||||
isub = kl+kl+2
|
||||
h = one / dble (nx+1)
|
||||
rho = 1.0D+2
|
||||
rho = 1.0D+2
|
||||
do 50 i = 1, nx
|
||||
lo = (i-1)*nx
|
||||
do 40 j = lo+1, lo+nx-1
|
||||
a(isup,j+1) = -one+h*rho/two
|
||||
a(isub,j) = -one-h*rho/two
|
||||
40 continue
|
||||
50 continue
|
||||
40 continue
|
||||
50 continue
|
||||
c
|
||||
do 60 j = 1, n-1
|
||||
m(isup,j+1) = one
|
||||
@@ -244,8 +244,8 @@ c
|
||||
do 70 j = lo+1, lo+nx
|
||||
a(isup,nx+j) = -one
|
||||
a(isub,j) = -one
|
||||
70 continue
|
||||
80 continue
|
||||
70 continue
|
||||
80 continue
|
||||
c
|
||||
c %------------------------------------------------%
|
||||
c | Call ARPACK banded solver to find eigenvalues |
|
||||
@@ -253,13 +253,13 @@ c | and eigenvectors. The real parts of the |
|
||||
c | eigenvalues are returned in the first column |
|
||||
c | of D, the imaginary parts are returned in the |
|
||||
c | second column of D. Eigenvectors are returned |
|
||||
c | in the first NCONV (=IPARAM(5)) columns of V. |
|
||||
c | in the first NCONV (=IPARAM(5)) columns of V. |
|
||||
c %------------------------------------------------%
|
||||
c
|
||||
rvec = .true.
|
||||
call dnband (rvec, 'A', select, d, d(1,2), v, ldv, sigmar,
|
||||
& sigmai, workev, n, a, m, lda, rfac, cfac, ku, kl,
|
||||
& which, bmat, nev, tol, resid, ncv, v, ldv, iparam,
|
||||
call dnband (rvec, 'A', select, d, d(1,2), v, ldv, sigmar,
|
||||
& sigmai, workev, n, a, m, lda, rfac, cfac, ku, kl,
|
||||
& which, bmat, nev, tol, resid, ncv, v, ldv, iparam,
|
||||
& workd, workl, lworkl, workc, iwork, info)
|
||||
c
|
||||
if ( info .eq. 0) then
|
||||
@@ -292,7 +292,7 @@ c | Compute the residual norm. |
|
||||
c | || A*x - lambda*x || |
|
||||
c %----------------------------%
|
||||
c
|
||||
first = .true.
|
||||
first = .true.
|
||||
do 90 j = 1, nconv
|
||||
c
|
||||
if ( d(j,2) .eq. zero ) then
|
||||
@@ -301,8 +301,8 @@ c %--------------------%
|
||||
c | Ritz value is real |
|
||||
c %--------------------%
|
||||
c
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
& ax, 1)
|
||||
call daxpy (n, -d(j,1), v(1,j), 1, ax, 1)
|
||||
d(j,3) = dnrm2 (n, ax, 1)
|
||||
@@ -314,17 +314,17 @@ c %------------------------%
|
||||
c | Ritz value is complex |
|
||||
c | Residual of one Ritz |
|
||||
c | value of the conjugate |
|
||||
c | pair is computed. |
|
||||
c | pair is computed. |
|
||||
c %------------------------%
|
||||
c
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
& ax, 1)
|
||||
call daxpy (n, -d(j,1), v(1,j), 1, ax, 1)
|
||||
call daxpy (n, d(j,2), v(1,j+1), 1, ax, 1)
|
||||
d(j,3) = dnrm2 (n, ax, 1)
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j+1), 1, zero,
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j+1), 1, zero,
|
||||
& ax, 1)
|
||||
call daxpy (n, -d(j,1), v(1,j+1), 1, ax, 1)
|
||||
call daxpy (n, -d(j,2), v(1,j), 1, ax, 1)
|
||||
@@ -336,11 +336,11 @@ c
|
||||
first = .true.
|
||||
end if
|
||||
c
|
||||
90 continue
|
||||
90 continue
|
||||
|
||||
call dmout (6, nconv, 3, d, maxncv, -6,
|
||||
& 'Ritz values (Real,Imag) and relative residuals')
|
||||
else
|
||||
else
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | Either convergence failed, or there |
|
||||
@@ -351,8 +351,8 @@ c
|
||||
print *, ' '
|
||||
print *, ' Error with _nband, info= ', info
|
||||
print *, ' Check the documentation of _nband '
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
c
|
||||
end if
|
||||
c
|
||||
9000 end
|
||||
9000 end
|
||||
|
||||
+61
-61
@@ -1,7 +1,7 @@
|
||||
program dnbdr6
|
||||
program dnbdr6
|
||||
c
|
||||
c ... Construct matrices A and M in LAPACK-style band form.
|
||||
c The matrix A is a block tridiagonal matrix. Each
|
||||
c The matrix A is a block tridiagonal matrix. Each
|
||||
c diagonal block is a tridiagonal matrix with
|
||||
c 4 on the diagonal, 1-rho*h/2 on the subdiagonal and
|
||||
c 1+rho*h/2 on the superdiagonal. Each subdiagonal block
|
||||
@@ -53,13 +53,13 @@ c | MAXN - Maximum size of the matrix |
|
||||
c | MAXNEV - Maximum number of |
|
||||
c | eigenvalues to be computed |
|
||||
c | MAXNCV - Maximum number of Arnoldi |
|
||||
c | vectors stored |
|
||||
c | vectors stored |
|
||||
c | MAXBDW - Maximum bandwidth |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
integer maxn, maxnev, maxncv, maxbdw, lda,
|
||||
& lworkl, ldv
|
||||
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
|
||||
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
|
||||
& maxbdw=50, lda = maxbdw, ldv = maxn )
|
||||
c
|
||||
c %--------------%
|
||||
@@ -68,12 +68,12 @@ c %--------------%
|
||||
c
|
||||
integer iparam(11), iwork(maxn)
|
||||
logical select(maxncv)
|
||||
Double precision
|
||||
Double precision
|
||||
& a(lda,maxn), m(lda,maxn), rfac(lda,maxn),
|
||||
& workl(3*maxncv*maxncv+6*maxncv), workd(3*maxn),
|
||||
& workl(3*maxncv*maxncv+6*maxncv), workd(3*maxn),
|
||||
& workev(3*maxncv), v(ldv, maxncv),
|
||||
& resid(maxn), d(maxncv, 3), ax(maxn), mx(maxn)
|
||||
Complex*16
|
||||
Complex*16
|
||||
& cfac(lda, maxn), workc(maxn)
|
||||
c
|
||||
c %---------------%
|
||||
@@ -85,16 +85,16 @@ c
|
||||
& n, nx, lo, idiag, isup, isub, mode, maxitr,
|
||||
& nconv
|
||||
logical rvec, first
|
||||
Double precision
|
||||
Double precision
|
||||
& tol, rho, h, sigmar, sigmai
|
||||
c
|
||||
c
|
||||
c %------------%
|
||||
c | Parameters |
|
||||
c %------------%
|
||||
c
|
||||
Double precision
|
||||
Double precision
|
||||
& one, zero, two
|
||||
parameter (one = 1.0D+0 , zero = 0.0D+0 ,
|
||||
parameter (one = 1.0D+0 , zero = 0.0D+0 ,
|
||||
& two = 2.0D+0 )
|
||||
c
|
||||
c %--------------------%
|
||||
@@ -107,9 +107,9 @@ c %-----------------------------%
|
||||
c | BLAS & LAPACK routines used |
|
||||
c %-----------------------------%
|
||||
c
|
||||
Double precision
|
||||
& dlapy2 , dnrm2
|
||||
external dlapy2 , dnrm2 , dgbmv , daxpy
|
||||
Double precision
|
||||
& dlapy2 , dnrm2
|
||||
external dlapy2 , dnrm2 , dgbmv , daxpy
|
||||
c
|
||||
c %-----------------------%
|
||||
c | Executable Statements |
|
||||
@@ -129,13 +129,13 @@ c | to get different parts the spectrum. However, the |
|
||||
c | following rules must be satisfied: |
|
||||
c | N <= MAXN |
|
||||
c | NEV <= MAXNEV |
|
||||
c | NEV + 2 <= NCV <= MAXNCV |
|
||||
c %-----------------------------------------------------%
|
||||
c | NEV + 2 <= NCV <= MAXNCV |
|
||||
c %-----------------------------------------------------%
|
||||
c
|
||||
nx = 10
|
||||
nx = 10
|
||||
n = nx*nx
|
||||
nev = 4
|
||||
ncv = 10
|
||||
nev = 4
|
||||
ncv = 10
|
||||
if ( n .gt. maxn ) then
|
||||
print *, ' ERROR with _NBDR6: N is greater than MAXN '
|
||||
go to 9000
|
||||
@@ -148,8 +148,8 @@ c
|
||||
end if
|
||||
bmat = 'G'
|
||||
which = 'LM'
|
||||
sigmar = 4.0D-1
|
||||
sigmai = 6.0D-1
|
||||
sigmar = 4.0D-1
|
||||
sigmai = 6.0D-1
|
||||
c
|
||||
c %-----------------------------------------------------%
|
||||
c | The work array WORKL is used in DNAUPD as |
|
||||
@@ -163,7 +163,7 @@ c | generated in DNAUPD to start the Arnoldi iteration. |
|
||||
c %-----------------------------------------------------%
|
||||
c
|
||||
lworkl = 3*ncv**2+6*ncv
|
||||
tol = zero
|
||||
tol = zero
|
||||
ido = 0
|
||||
info = 0
|
||||
c
|
||||
@@ -178,7 +178,7 @@ c
|
||||
maxitr = 300
|
||||
mode = 4
|
||||
c
|
||||
iparam(3) = maxitr
|
||||
iparam(3) = maxitr
|
||||
iparam(7) = mode
|
||||
c
|
||||
c %--------------------------------------------%
|
||||
@@ -200,34 +200,34 @@ c | and subdiagonals within the band of |
|
||||
c | matrices A and M. |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
kl = nx
|
||||
ku = nx
|
||||
kl = nx
|
||||
ku = nx
|
||||
c
|
||||
c %---------------%
|
||||
c %---------------%
|
||||
c | Main diagonal |
|
||||
c %---------------%
|
||||
c
|
||||
idiag = kl+ku+1
|
||||
do 30 j = 1, n
|
||||
a(idiag,j) = 4.0D+0
|
||||
m(idiag,j) = 4.0D+0
|
||||
30 continue
|
||||
c
|
||||
a(idiag,j) = 4.0D+0
|
||||
m(idiag,j) = 4.0D+0
|
||||
30 continue
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | First subdiagonal and superdiagonal |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
c
|
||||
isup = kl+ku
|
||||
isub = kl+ku+2
|
||||
h = one / dble (nx+1)
|
||||
rho = 1.0D+2
|
||||
rho = 1.0D+2
|
||||
do 50 i = 1, nx
|
||||
lo = (i-1)*nx
|
||||
do 40 j = lo+1, lo+nx-1
|
||||
a(isub,j+1) = -one+h*rho/two
|
||||
a(isup,j) = -one-h*rho/two
|
||||
40 continue
|
||||
50 continue
|
||||
40 continue
|
||||
50 continue
|
||||
c
|
||||
do 60 j = 1, n-1
|
||||
m(isub,j+1) = one
|
||||
@@ -246,8 +246,8 @@ c
|
||||
do 70 j = lo+1, lo+nx
|
||||
a(isup,nx+j) = -one
|
||||
a(isub,j) = -one
|
||||
70 continue
|
||||
80 continue
|
||||
70 continue
|
||||
80 continue
|
||||
c
|
||||
c %------------------------------------------------%
|
||||
c | Call ARPACK banded solver to find eigenvalues |
|
||||
@@ -259,9 +259,9 @@ c | in the first NCONV (=IPARAM(5)) columns of V. |
|
||||
c %------------------------------------------------%
|
||||
c
|
||||
rvec = .true.
|
||||
call dnband (rvec, 'A', select, d, d(1,2), v, ldv, sigmar,
|
||||
& sigmai, workev, n, a, m, lda, rfac, cfac, ku, kl,
|
||||
& which, bmat, nev, tol, resid, ncv, v, ldv, iparam,
|
||||
call dnband (rvec, 'A', select, d, d(1,2), v, ldv, sigmar,
|
||||
& sigmai, workev, n, a, m, lda, rfac, cfac, ku, kl,
|
||||
& which, bmat, nev, tol, resid, ncv, v, ldv, iparam,
|
||||
& workd, workl, lworkl, workc, iwork, info)
|
||||
c
|
||||
if ( info .eq. 0) then
|
||||
@@ -294,7 +294,7 @@ c | Compute the residual norm. |
|
||||
c | || A*x - lambda*x || |
|
||||
c %----------------------------%
|
||||
c
|
||||
first = .true.
|
||||
first = .true.
|
||||
do 90 j = 1, nconv
|
||||
c
|
||||
if ( d(j,2) .eq. zero ) then
|
||||
@@ -303,11 +303,11 @@ c %--------------------%
|
||||
c | Ritz value is real |
|
||||
c %--------------------%
|
||||
c
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
& ax, 1)
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j), 1, zero,
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j), 1, zero,
|
||||
& mx, 1)
|
||||
call daxpy (n, -d(j,1), mx, 1, ax, 1)
|
||||
d(j,3) = dnrm2 (n, ax, 1)
|
||||
@@ -319,30 +319,30 @@ c %------------------------%
|
||||
c | Ritz value is complex |
|
||||
c | Residual of one Ritz |
|
||||
c | value of the conjugate |
|
||||
c | pair is computed. |
|
||||
c | pair is computed. |
|
||||
c %------------------------%
|
||||
c
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
& ax, 1)
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j), 1, zero,
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j), 1, zero,
|
||||
& mx, 1)
|
||||
call daxpy (n, -d(j,1), mx, 1, ax, 1)
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j+1), 1, zero,
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j+1), 1, zero,
|
||||
& mx, 1)
|
||||
call daxpy (n, d(j,2), mx, 1, ax, 1)
|
||||
d(j,3) = dnrm2 (n, ax, 1)
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j+1), 1, zero,
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j+1), 1, zero,
|
||||
& ax, 1)
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j+1), 1, zero,
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j+1), 1, zero,
|
||||
& mx, 1)
|
||||
call daxpy (n, -d(j,1), mx, 1, ax, 1)
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j), 1, zero,
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j), 1, zero,
|
||||
& mx, 1)
|
||||
call daxpy (n, -d(j,2), mx, 1, ax, 1)
|
||||
d(j,3) = dlapy2 ( d(j,3), dnrm2 (n, ax, 1) )
|
||||
@@ -353,11 +353,11 @@ c
|
||||
first = .true.
|
||||
end if
|
||||
c
|
||||
90 continue
|
||||
90 continue
|
||||
|
||||
call dmout (6, nconv, 3, d, maxncv, -6,
|
||||
& 'Ritz values (Real,Imag) and relative residuals')
|
||||
else
|
||||
else
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | Either convergence failed, or there |
|
||||
@@ -368,8 +368,8 @@ c
|
||||
print *, ' '
|
||||
print *, ' Error with _nband, info= ', info
|
||||
print *, ' Check the documentation of _nband '
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
c
|
||||
end if
|
||||
c
|
||||
9000 end
|
||||
9000 end
|
||||
|
||||
+152
-152
@@ -17,19 +17,19 @@ c
|
||||
c Matrices A and B are stored in LAPACK-style band form.
|
||||
c
|
||||
c There is negligible additional cost to obtain eigenvectors. An orthonormal
|
||||
c (Lanczos) basis is always computed. There is an additional storage cost
|
||||
c of n*nev if both are requested (in this case a separate array Z must be
|
||||
c (Lanczos) basis is always computed. There is an additional storage cost
|
||||
c of n*nev if both are requested (in this case a separate array Z must be
|
||||
c supplied).
|
||||
c
|
||||
c The approximate eigenvalues and eigenvectors of A*z = lambda*B*z
|
||||
c are called Ritz values and Ritz vectors respectively. They are referred
|
||||
c to as such in the comments that follow. The computed orthonormal basis
|
||||
c for the invariant subspace corresponding to these Ritz values is referred
|
||||
c are called Ritz values and Ritz vectors respectively. They are referred
|
||||
c to as such in the comments that follow. The computed orthonormal basis
|
||||
c for the invariant subspace corresponding to these Ritz values is referred
|
||||
c to as a Lanczos basis.
|
||||
c
|
||||
c dsband can be called with one of the following modes:
|
||||
c
|
||||
c Mode 1: A*x = lambda*x, A symmetric
|
||||
c Mode 1: A*x = lambda*x, A symmetric
|
||||
c ===> OP = A and B = I.
|
||||
c
|
||||
c Mode 2: A*x = lambda*M*x, A symmetric, M symmetric positive definite
|
||||
@@ -37,10 +37,10 @@ c ===> OP = inv[M]*A and B = M.
|
||||
c ===> (If M can be factored see remark 3 in DSAUPD)
|
||||
c
|
||||
c Mode 3: K*x = lambda*M*x, K symmetric, M symmetric positive semi-definite
|
||||
c ===> OP = (inv[K - sigma*M])*M and B = M.
|
||||
c ===> OP = (inv[K - sigma*M])*M and B = M.
|
||||
c ===> Shift-and-Invert mode
|
||||
c
|
||||
c Mode 4: K*x = lambda*KG*x, K symmetric positive semi-definite,
|
||||
c Mode 4: K*x = lambda*KG*x, K symmetric positive semi-definite,
|
||||
c KG symmetric indefinite
|
||||
c ===> OP = (inv[K - sigma*KG])*K and B = K.
|
||||
c ===> Buckling mode
|
||||
@@ -53,21 +53,21 @@ c The choice of mode must be specified in IPARAM(7) defined below.
|
||||
c
|
||||
c \Usage
|
||||
c call dsband
|
||||
c ( RVEC, HOWMNY, SELECT, D, Z, LDZ, SIGMA, N, AB, MB, LDA,
|
||||
c RFAC, KL, KU, WHICH, BMAT, NEV, TOL, RESID, NCV, V,
|
||||
c ( RVEC, HOWMNY, SELECT, D, Z, LDZ, SIGMA, N, AB, MB, LDA,
|
||||
c RFAC, KL, KU, WHICH, BMAT, NEV, TOL, RESID, NCV, V,
|
||||
c LDV, IPARAM, WORKD, WORKL, LWORKL, IWORK, INFO )
|
||||
c
|
||||
c \Arguments
|
||||
c
|
||||
c RVEC Logical (INPUT)
|
||||
c Specifies whether Ritz vectors corresponding to the Ritz value
|
||||
c Specifies whether Ritz vectors corresponding to the Ritz value
|
||||
c approximations to the eigenproblem A*z = lambda*B*z are computed.
|
||||
c
|
||||
c RVEC = .FALSE. Compute Ritz values only.
|
||||
c
|
||||
c RVEC = .TRUE. Compute the associated Ritz vectors.
|
||||
c RVEC = .TRUE. Compute the associated Ritz vectors.
|
||||
c
|
||||
c HOWMNY Character*1 (INPUT)
|
||||
c HOWMNY Character*1 (INPUT)
|
||||
c Specifies how many Ritz vectors are wanted and the form of Z
|
||||
c the matrix of Ritz vectors. See remark 1 below.
|
||||
c = 'A': compute all Ritz vectors;
|
||||
@@ -77,7 +77,7 @@ c
|
||||
c SELECT Logical array of dimension NCV. (INPUT)
|
||||
c If HOWMNY = 'S', SELECT specifies the Ritz vectors to be
|
||||
c computed. To select the Ritz vector corresponding to a
|
||||
c Ritz value D(j), SELECT(j) must be set to .TRUE..
|
||||
c Ritz value D(j), SELECT(j) must be set to .TRUE..
|
||||
c If HOWMNY = 'A' , SELECT is not referenced.
|
||||
c
|
||||
c D Double precision array of dimension NEV. (OUTPUT)
|
||||
@@ -85,8 +85,8 @@ c On exit, D contains the Ritz value approximations to the
|
||||
c eigenvalues of A*z = lambda*B*z. The values are returned
|
||||
c in ascending order. If IPARAM(7) = 3,4,5 then D represents
|
||||
c the Ritz values of OP computed by dsaupd transformed to
|
||||
c those of the original eigensystem A*z = lambda*B*z. If
|
||||
c IPARAM(7) = 1,2 then the Ritz values of OP are the same
|
||||
c those of the original eigensystem A*z = lambda*B*z. If
|
||||
c IPARAM(7) = 1,2 then the Ritz values of OP are the same
|
||||
c as the those of A*z = lambda*B*z.
|
||||
c
|
||||
c Z Double precision N by NEV array if HOWMNY = 'A'. (OUTPUT)
|
||||
@@ -95,20 +95,20 @@ c eigensystem A*z = lambda*B*z corresponding to the Ritz
|
||||
c value approximations.
|
||||
c
|
||||
c If RVEC = .FALSE. then Z is not referenced.
|
||||
c NOTE: The array Z may be set equal to first NEV columns of the
|
||||
c NOTE: The array Z may be set equal to first NEV columns of the
|
||||
c Lanczos basis array V computed by DSAUPD.
|
||||
c
|
||||
c LDZ Integer. (INPUT)
|
||||
c LDZ Integer. (INPUT)
|
||||
c The leading dimension of the array Z. If Ritz vectors are
|
||||
c desired, then LDZ .ge. max( 1, N ). In any case, LDZ .ge. 1.
|
||||
c
|
||||
c SIGMA Double precision (INPUT)
|
||||
c If IPARAM(7) = 3,4,5 represents the shift. Not referenced if
|
||||
c IPARAM(7) = 1 or 2.
|
||||
c
|
||||
c N Integer. (INPUT)
|
||||
c Dimension of the eigenproblem.
|
||||
c
|
||||
c
|
||||
c N Integer. (INPUT)
|
||||
c Dimension of the eigenproblem.
|
||||
c
|
||||
c AB Double precision array of dimension LDA by N. (INPUT)
|
||||
c The matrix A in band storage, in rows KL+1 to
|
||||
c 2*KL+KU+1; rows 1 to KL of the array need not be set.
|
||||
@@ -118,7 +118,7 @@ c AB(kl+ku+1+i-j,j) = A(i,j) for max(1,j-ku)<=i<=min(m,j+kl)
|
||||
c
|
||||
c MB Double precision array of dimension LDA by N. (INPUT)
|
||||
c The matrix M in band storage, in rows KL+1 to
|
||||
c 2*KL+KU+1; rows 1 to KL of the array need not be set.
|
||||
c 2*KL+KU+1; rows 1 to KL of the array need not be set.
|
||||
c The j-th column of M is stored in the j-th column of the
|
||||
c array AB as follows:
|
||||
c MB(kl+ku+1+i-j,j) = M(i,j) for max(1,j-ku)<=i<=min(m,j+kl)
|
||||
@@ -128,7 +128,7 @@ c LDA Integer. (INPUT)
|
||||
c Leading dimension of AB, MB, RFAC.
|
||||
c
|
||||
c RFAC Double precision array of LDA by N. (WORKSPACE/OUTPUT)
|
||||
c RFAC is used to store the LU factors of MB when IPARAM(7) = 2
|
||||
c RFAC is used to store the LU factors of MB when IPARAM(7) = 2
|
||||
c is invoked. It is used to store the LU factors of
|
||||
c (A-sigma*M) when IPARAM(7) = 3,4,5 is invoked.
|
||||
c It is not referenced when IPARAM(7) = 1.
|
||||
@@ -142,17 +142,17 @@ c
|
||||
c WHICH Character*2. (INPUT)
|
||||
c When IPARAM(7)= 1 or 2, WHICH can be set to any one of
|
||||
c the following.
|
||||
c
|
||||
c
|
||||
c 'LM' -> want the NEV eigenvalues of largest magnitude.
|
||||
c 'SM' -> want the NEV eigenvalues of smallest magnitude.
|
||||
c 'LA' -> want the NEV eigenvalues of largest REAL part.
|
||||
c 'SA' -> want the NEV eigenvalues of smallest REAL part.
|
||||
c 'BE' -> Compute NEV eigenvalues, half from each end of the
|
||||
c spectrum. When NEV is odd, compute one more from
|
||||
c the high end than from the low end.
|
||||
c 'BE' -> Compute NEV eigenvalues, half from each end of the
|
||||
c spectrum. When NEV is odd, compute one more from
|
||||
c the high end than from the low end.
|
||||
c
|
||||
c When IPARAM(7) = 3, 4, or 5, WHICH should be set to 'LM' only.
|
||||
c
|
||||
c When IPARAM(7) = 3, 4, or 5, WHICH should be set to 'LM' only.
|
||||
c
|
||||
c BMAT Character*1. (INPUT)
|
||||
c BMAT specifies the type of the matrix B that defines the
|
||||
c semi-inner product for the operator OP.
|
||||
@@ -161,9 +161,9 @@ c BMAT = 'G' -> generalized eigenvalue problem A*x = lambda*M*x
|
||||
|
||||
c NEV Integer. (INPUT)
|
||||
c Number of eigenvalues of OP to be computed.
|
||||
c
|
||||
c
|
||||
c TOL Double precision scalar. (INPUT)
|
||||
c Stopping criterion: the relative accuracy of the Ritz value
|
||||
c Stopping criterion: the relative accuracy of the Ritz value
|
||||
c is considered acceptable if BOUNDS(I) .LE. TOL*ABS(RITZ(I)).
|
||||
c If TOL .LE. 0. is passed a default is set:
|
||||
c DEFAULT = DLAMCH('EPS') (machine precision as computed
|
||||
@@ -183,35 +183,35 @@ c Represents the dimension of the Lanczos basis constructed
|
||||
c by dsaupd for OP.
|
||||
c
|
||||
c V Double precision array N by NCV. (OUTPUT)
|
||||
c Upon INPUT: the NCV columns of V contain the Lanczos basis
|
||||
c Upon INPUT: the NCV columns of V contain the Lanczos basis
|
||||
c vectors as constructed by dsaupd for OP.
|
||||
c Upon OUTPUT: If RVEC = .TRUE. the first NCONV=IPARAM(5) columns
|
||||
c represent the Ritz vectors that span the desired
|
||||
c Upon OUTPUT: If RVEC = .TRUE. the first NCONV=IPARAM(5) columns
|
||||
c represent the Ritz vectors that span the desired
|
||||
c invariant subspace.
|
||||
c NOTE: The array Z may be set equal to first NEV columns of the
|
||||
c NOTE: The array Z may be set equal to first NEV columns of the
|
||||
c Lanczos basis vector array V computed by dsaupd. In this case
|
||||
c if RVEC=.TRUE., the first NCONV=IPARAM(5) columns of V contain
|
||||
c the desired Ritz vectors.
|
||||
c the desired Ritz vectors.
|
||||
c
|
||||
c LDV Integer. (INPUT)
|
||||
c Leading dimension of V exactly as declared in the calling
|
||||
c program.
|
||||
c
|
||||
c IPARAM Integer array of length 11. (INPUT/OUTPUT)
|
||||
c IPARAM(1) = ISHIFT:
|
||||
c IPARAM(1) = ISHIFT:
|
||||
c The shifts selected at each iteration are used to restart
|
||||
c the Arnoldi iteration in an implicit fashion.
|
||||
c It is set to 1 in this subroutine. The user do not need
|
||||
c to set this parameter.
|
||||
c ------------------------------------------------------------
|
||||
c ISHIFT = 1: exact shifts with respect to the reduced
|
||||
c tridiagonal matrix T. This is equivalent to
|
||||
c restarting the iteration with a starting vector
|
||||
c that is a linear combination of Ritz vectors
|
||||
c ISHIFT = 1: exact shifts with respect to the reduced
|
||||
c tridiagonal matrix T. This is equivalent to
|
||||
c restarting the iteration with a starting vector
|
||||
c that is a linear combination of Ritz vectors
|
||||
c associated with the "wanted" Ritz values.
|
||||
c -------------------------------------------------------------
|
||||
c
|
||||
c IPARAM(2) = No longer referenced.
|
||||
c IPARAM(2) = No longer referenced.
|
||||
c
|
||||
c IPARAM(3) = MXITER
|
||||
c On INPUT: max number of Arnoldi update iterations allowed.
|
||||
@@ -225,11 +225,11 @@ c This represents the number of Ritz values that satisfy
|
||||
c the convergence criterion.
|
||||
c
|
||||
c IPARAM(6) = IUPD
|
||||
c No longer referenced. Implicit restarting is ALWAYS used.
|
||||
c No longer referenced. Implicit restarting is ALWAYS used.
|
||||
c
|
||||
c IPARAM(7) = MODE
|
||||
c On INPUT determines what type of eigenproblem is being solved.
|
||||
c Must be 1,2,3,4,5; See under \Description of dsband for the
|
||||
c Must be 1,2,3,4,5; See under \Description of dsband for the
|
||||
c five modes available.
|
||||
c
|
||||
c IPARAM(8) = NP
|
||||
@@ -248,18 +248,18 @@ c LWORKL Integer. (INPUT)
|
||||
c LWORKL must be at least NCV**2 + 8*NCV.
|
||||
c
|
||||
c IWORK Integer array of dimension at least N. (WORKSPACE)
|
||||
c Used when IPARAM(7)=2,3,4,5 to store the pivot information in the
|
||||
c Used when IPARAM(7)=2,3,4,5 to store the pivot information in the
|
||||
c factorization of M or (A-SIGMA*M).
|
||||
c
|
||||
c
|
||||
c INFO Integer. (INPUT/OUTPUT)
|
||||
c Error flag on output.
|
||||
c = 0: Normal exit.
|
||||
c = 1: Maximum number of iterations taken.
|
||||
c All possible eigenvalues of OP has been found. IPARAM(5)
|
||||
c All possible eigenvalues of OP has been found. IPARAM(5)
|
||||
c returns the number of wanted converged Ritz values.
|
||||
c = 3: No shifts could be applied during a cycle of the
|
||||
c Implicitly restarted Arnoldi iteration. One possibility
|
||||
c is to increase the size of NCV relative to NEV.
|
||||
c = 3: No shifts could be applied during a cycle of the
|
||||
c Implicitly restarted Arnoldi iteration. One possibility
|
||||
c is to increase the size of NCV relative to NEV.
|
||||
c See remark 4 in DSAUPD.
|
||||
c
|
||||
c = -1: N must be positive.
|
||||
@@ -292,7 +292,7 @@ c 1. D.C. Sorensen, "Implicit Application of Polynomial Filters in
|
||||
c a k-Step Arnoldi Method", SIAM J. Matr. Anal. Apps., 13 (1992),
|
||||
c pp 357-385.
|
||||
c
|
||||
c 2. R.B. Lehoucq, "Analysis and Implementation of an Implicitly
|
||||
c 2. R.B. Lehoucq, "Analysis and Implementation of an Implicitly
|
||||
c Restarted Arnoldi Iteration", Ph.D thesis, TR95-13, Rice Univ,
|
||||
c May 1995.
|
||||
c
|
||||
@@ -301,7 +301,7 @@ c dsaupd ARPACK reverse communication interface routine.
|
||||
c dseupd ARPACK routine that returns Ritz values and (optionally)
|
||||
c Ritz vectors.
|
||||
c dgbtrf LAPACK band matrix factorization routine.
|
||||
c dgbtrs LAPACK band linear system solve routine.
|
||||
c dgbtrs LAPACK band linear system solve routine.
|
||||
c dlacpy LAPACK matrix copy routine.
|
||||
c dlapy2 LAPACK routine to compute sqrt(x**2+y**2) carefully.
|
||||
c dcopy Level 1 BLAS that copies one vector to another.
|
||||
@@ -310,13 +310,13 @@ c dnrm2 Level 1 BLAS that computes the norm of a vector.
|
||||
c dgbmv Level 2 BLAS that computes the band matrix vector product.
|
||||
c
|
||||
c\Remarks
|
||||
c 1. The converged Ritz values are always returned in increasing
|
||||
c 1. The converged Ritz values are always returned in increasing
|
||||
c (algebraic) order.
|
||||
c
|
||||
c 2. Currently only HOWMNY = 'A' is implemented. It is included at this
|
||||
c stage for the user who wants to incorporate it.
|
||||
c
|
||||
c\Author
|
||||
c\Author
|
||||
c Danny Sorensen
|
||||
c Richard Lehoucq
|
||||
c Chao Yang
|
||||
@@ -332,18 +332,18 @@ c\EndLib
|
||||
c
|
||||
c---------------------------------------------------------------------
|
||||
c
|
||||
subroutine dsband( rvec, howmny, select, d, z, ldz, sigma,
|
||||
& n, ab, mb, lda, rfac, kl, ku, which, bmat, nev,
|
||||
& tol, resid, ncv, v, ldv, iparam, workd, workl,
|
||||
subroutine dsband( rvec, howmny, select, d, z, ldz, sigma,
|
||||
& n, ab, mb, lda, rfac, kl, ku, which, bmat, nev,
|
||||
& tol, resid, ncv, v, ldv, iparam, workd, workl,
|
||||
& lworkl, iwork, info)
|
||||
c
|
||||
c %------------------%
|
||||
c | Scalar Arguments |
|
||||
c %------------------%
|
||||
c
|
||||
c
|
||||
character which*2, bmat, howmny
|
||||
integer n, lda, kl, ku, nev, ncv, ldv,
|
||||
& ldz, lworkl, info
|
||||
& ldz, lworkl, info
|
||||
Double precision
|
||||
& tol, sigma
|
||||
logical rvec
|
||||
@@ -356,7 +356,7 @@ c
|
||||
logical select(*)
|
||||
Double precision
|
||||
& d(*), resid(*), v(ldv,*), z(ldz,*),
|
||||
& ab(lda,*), mb(lda,*), rfac(lda,*),
|
||||
& ab(lda,*), mb(lda,*), rfac(lda,*),
|
||||
& workd(*), workl(*)
|
||||
c
|
||||
c %--------------%
|
||||
@@ -386,22 +386,22 @@ c %-----------------------------%
|
||||
c
|
||||
Double precision
|
||||
& ddot, dnrm2, dlapy2
|
||||
external ddot, dcopy, dgbmv, dgbtrf,
|
||||
external ddot, dcopy, dgbmv, dgbtrf,
|
||||
& dgbtrs, dnrm2, dlapy2, dlacpy
|
||||
c
|
||||
c %-----------------------%
|
||||
c | Executable Statements |
|
||||
c %-----------------------%
|
||||
c
|
||||
c
|
||||
c %----------------------------------------------------------------%
|
||||
c | Set type of the problem to be solved. Check consistency |
|
||||
c | between BMAT and IPARAM(7). |
|
||||
c | type = 1 --> Solving standard problem in regular mode. |
|
||||
c | type = 2 --> Solving standard problem in shift-invert mode. |
|
||||
c | type = 2 --> Solving standard problem in shift-invert mode. |
|
||||
c | type = 3 --> Solving generalized problem in regular mode. |
|
||||
c | type = 4 --> Solving generalized problem in shift-invert mode. |
|
||||
c | type = 5 --> Solving generalized problem in Buckling mode. |
|
||||
c | type = 6 --> Solving generalized problem in Cayley mode. |
|
||||
c | type = 6 --> Solving generalized problem in Cayley mode. |
|
||||
c %----------------------------------------------------------------%
|
||||
c
|
||||
if ( iparam(7) .eq. 1 ) then
|
||||
@@ -411,15 +411,15 @@ c
|
||||
else if ( iparam(7) .eq. 2 ) then
|
||||
type = 3
|
||||
else if ( iparam(7) .eq. 3 .and. bmat .eq. 'G') then
|
||||
type = 4
|
||||
type = 4
|
||||
else if ( iparam(7) .eq. 4 ) then
|
||||
type = 5
|
||||
else if ( iparam(7) .eq. 5 ) then
|
||||
else if ( iparam(7) .eq. 5 ) then
|
||||
type = 6
|
||||
else
|
||||
print*, ' '
|
||||
print*, 'BMAT is inconsistent with IPARAM(7).'
|
||||
print*, ' '
|
||||
print*, ' '
|
||||
go to 9000
|
||||
end if
|
||||
c
|
||||
@@ -432,9 +432,9 @@ c
|
||||
c
|
||||
c %----------------%
|
||||
c | Exact shift is |
|
||||
c | used. |
|
||||
c | used. |
|
||||
c %----------------%
|
||||
c
|
||||
c
|
||||
iparam(1) = 1
|
||||
c
|
||||
c %-----------------------------------%
|
||||
@@ -462,7 +462,7 @@ c
|
||||
10 continue
|
||||
call dgbtrf(n, n, kl, ku, rfac, lda, iwork, ierr )
|
||||
if (ierr .ne. 0) then
|
||||
print*, ' '
|
||||
print*, ' '
|
||||
print*, ' _SBAND: Error with _gbtrf. '
|
||||
print*, ' '
|
||||
go to 9000
|
||||
@@ -477,28 +477,28 @@ c | routine dgbtrf to factor M. |
|
||||
c %----------------------------------------------%
|
||||
c
|
||||
call dlacpy ('A', ibot, n, mb, lda, rfac, lda )
|
||||
call dgbtrf(n, n, kl, ku, rfac, lda, iwork, ierr)
|
||||
if (ierr .ne. 0) then
|
||||
call dgbtrf(n, n, kl, ku, rfac, lda, iwork, ierr)
|
||||
if (ierr .ne. 0) then
|
||||
print*, ' '
|
||||
print*,'_SBAND: Error with _gbtrf.'
|
||||
print*, ' '
|
||||
go to 9000
|
||||
print*,'_SBAND: Error with _gbtrf.'
|
||||
print*, ' '
|
||||
go to 9000
|
||||
end if
|
||||
c
|
||||
else if ( type .eq. 4 .or. type .eq. 5 .or. type .eq. 6
|
||||
else if ( type .eq. 4 .or. type .eq. 5 .or. type .eq. 6
|
||||
& .and. bmat .eq. 'G' ) then
|
||||
c
|
||||
c %-------------------------------------------%
|
||||
c | Solving generalized eigenvalue problem in |
|
||||
c | shift-invert, Buckling, or Cayley mode. |
|
||||
c %-------------------------------------------%
|
||||
c
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | Construct and factor (A - sigma*M). |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
do 60 j = 1,n
|
||||
do 50 i = itop, ibot
|
||||
do 50 i = itop, ibot
|
||||
rfac(i,j) = ab(i,j) - sigma*mb(i,j)
|
||||
50 continue
|
||||
60 continue
|
||||
@@ -510,14 +510,14 @@ c
|
||||
print*, ' '
|
||||
go to 9000
|
||||
end if
|
||||
c
|
||||
end if
|
||||
c
|
||||
end if
|
||||
c
|
||||
c %--------------------------------------------%
|
||||
c | M A I N L O O P (reverse communication) |
|
||||
c %--------------------------------------------%
|
||||
c
|
||||
90 continue
|
||||
90 continue
|
||||
c
|
||||
call dsaupd ( ido, bmat, n, which, nev, tol, resid, ncv,
|
||||
& v, ldv, iparam, ipntr, workd, workl, lworkl,
|
||||
@@ -531,8 +531,8 @@ c %----------------------------%
|
||||
c | Perform y <--- OP*x = A*x |
|
||||
c %----------------------------%
|
||||
c
|
||||
call dgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
call dgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
& workd(ipntr(2)), 1)
|
||||
c
|
||||
else if ( type .eq. 2 ) then
|
||||
@@ -548,7 +548,7 @@ c
|
||||
call dgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
|
||||
& iwork, workd(ipntr(2)), n, ierr)
|
||||
if ( ierr .ne. 0 ) then
|
||||
print*, ' '
|
||||
print*, ' '
|
||||
print*, ' _SBAND: Error with _bgtrs. '
|
||||
print*, ' '
|
||||
go to 9000
|
||||
@@ -558,15 +558,15 @@ c
|
||||
c
|
||||
c %-----------------------------------%
|
||||
c | Perform y <--- OP*x = inv[M]*A*x |
|
||||
c | to force the starting vector into |
|
||||
c | to force the starting vector into |
|
||||
c | the range of OP. |
|
||||
c %-----------------------------------%
|
||||
c
|
||||
call dgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
call dgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
& workd(ipntr(2)), 1)
|
||||
call dcopy(n, workd(ipntr(2)), 1, workd(ipntr(1)), 1)
|
||||
call dgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
|
||||
call dgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
|
||||
& iwork, workd(ipntr(2)), n, ierr)
|
||||
if (ierr .ne. 0) then
|
||||
print*, ' '
|
||||
@@ -579,36 +579,36 @@ c
|
||||
c
|
||||
c %-----------------------------------------%
|
||||
c | Perform y <-- OP*x |
|
||||
c | = inv[A-SIGMA*M]*M |
|
||||
c | = inv[A-SIGMA*M]*M |
|
||||
c | to force the starting vector into the |
|
||||
c | range of OP. |
|
||||
c %-----------------------------------------%
|
||||
c
|
||||
call dgbmv('Notranspose', n, n, kl, ku, one, mb(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
call dgbmv('Notranspose', n, n, kl, ku, one, mb(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
& workd(ipntr(2)), 1)
|
||||
call dgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
|
||||
call dgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
|
||||
& iwork, workd(ipntr(2)), n, ierr)
|
||||
if (ierr .ne. 0) then
|
||||
print*, ' '
|
||||
print*, ' '
|
||||
print*, '_SBAND: Error with _gbtrs.'
|
||||
print*, ' '
|
||||
print*, ' '
|
||||
go to 9000
|
||||
end if
|
||||
c
|
||||
else if ( type .eq. 5) then
|
||||
c
|
||||
c %---------------------------------------%
|
||||
c %---------------------------------------%
|
||||
c | Perform y <-- OP*x |
|
||||
c | = inv[A-SIGMA*M]*A |
|
||||
c | to force the starting vector into the |
|
||||
c | range of OP. |
|
||||
c %---------------------------------------%
|
||||
c
|
||||
call dgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
call dgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
& workd(ipntr(2)), 1)
|
||||
call dgbtrs('Notranspose', n, kl, ku, 1, rfac, lda,
|
||||
call dgbtrs('Notranspose', n, kl, ku, 1, rfac, lda,
|
||||
& iwork, workd(ipntr(2)), n, ierr)
|
||||
c
|
||||
if ( ierr .ne. 0 ) then
|
||||
@@ -622,31 +622,31 @@ c
|
||||
c
|
||||
c %---------------------------------------%
|
||||
c | Perform y <-- OP*x |
|
||||
c | = (inv[A-SIGMA*M])*(A+SIGMA*M)*x |
|
||||
c | = (inv[A-SIGMA*M])*(A+SIGMA*M)*x |
|
||||
c | to force the starting vector into the |
|
||||
c | range of OP. |
|
||||
c | range of OP. |
|
||||
c %---------------------------------------%
|
||||
c
|
||||
if ( bmat .eq. 'G' ) then
|
||||
call dgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& ab(itop,1), lda, workd(ipntr(1)), 1,
|
||||
call dgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& ab(itop,1), lda, workd(ipntr(1)), 1,
|
||||
& zero, workd(ipntr(2)), 1)
|
||||
call dgbmv('Notranspose', n, n, kl, ku, sigma,
|
||||
& mb(itop,1), lda, workd(ipntr(1)), 1,
|
||||
call dgbmv('Notranspose', n, n, kl, ku, sigma,
|
||||
& mb(itop,1), lda, workd(ipntr(1)), 1,
|
||||
& one, workd(ipntr(2)), 1)
|
||||
else
|
||||
else
|
||||
call dcopy(n, workd(ipntr(1)), 1, workd(ipntr(2)), 1)
|
||||
call dgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, sigma,
|
||||
call dgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, sigma,
|
||||
& workd(ipntr(2)), 1)
|
||||
end if
|
||||
end if
|
||||
c
|
||||
call dgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
|
||||
call dgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
|
||||
& iwork, workd(ipntr(2)), n, ierr)
|
||||
c
|
||||
if (ierr .ne. 0) then
|
||||
if (ierr .ne. 0) then
|
||||
print*, ' '
|
||||
print*, '_SBAND: Error with _gbtrs.'
|
||||
print*, '_SBAND: Error with _gbtrs.'
|
||||
print*, ' '
|
||||
go to 9000
|
||||
end if
|
||||
@@ -661,8 +661,8 @@ c %----------------------------%
|
||||
c | Perform y <--- OP*x = A*x |
|
||||
c %----------------------------%
|
||||
c
|
||||
call dgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
call dgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
& workd(ipntr(2)), 1)
|
||||
c
|
||||
else if ( type .eq. 2) then
|
||||
@@ -677,7 +677,7 @@ c
|
||||
& iwork, workd(ipntr(2)), n, ierr)
|
||||
if ( ierr .ne. 0 ) then
|
||||
print*, ' '
|
||||
print*, '_SBAND: Error with _gbtrs.'
|
||||
print*, '_SBAND: Error with _gbtrs.'
|
||||
print*, ' '
|
||||
go to 9000
|
||||
end if
|
||||
@@ -688,16 +688,16 @@ c %-----------------------------------%
|
||||
c | Perform y <--- OP*x = inv[M]*A*x |
|
||||
c %-----------------------------------%
|
||||
c
|
||||
call dgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
call dgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
& workd(ipntr(2)), 1)
|
||||
call dcopy(n, workd(ipntr(2)), 1, workd(ipntr(1)), 1)
|
||||
call dgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
|
||||
call dcopy(n, workd(ipntr(2)), 1, workd(ipntr(1)), 1)
|
||||
call dgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
|
||||
& iwork, workd(ipntr(2)), n, ierr)
|
||||
if (ierr .ne. 0) then
|
||||
print*, ' '
|
||||
print*, '_SBAND: error with _bgtrs.'
|
||||
print*, ' '
|
||||
print*, ' '
|
||||
go to 9000
|
||||
end if
|
||||
c
|
||||
@@ -706,22 +706,22 @@ c
|
||||
c %-------------------------------------%
|
||||
c | Perform y <-- inv(A-sigma*M)*(M*x). |
|
||||
c | (M*x) has been computed and stored |
|
||||
c | in workd(ipntr(3)). |
|
||||
c | in workd(ipntr(3)). |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
call dcopy(n, workd(ipntr(3)), 1, workd(ipntr(2)), 1)
|
||||
call dgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
|
||||
call dgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
|
||||
& iwork, workd(ipntr(2)), n, ierr)
|
||||
if (ierr .ne. 0) then
|
||||
if (ierr .ne. 0) then
|
||||
print*, ' '
|
||||
print*, '_SBAND: Error with _gbtrs.'
|
||||
print*, '_SBAND: Error with _gbtrs.'
|
||||
print*, ' '
|
||||
go to 9000
|
||||
end if
|
||||
c
|
||||
c
|
||||
else if ( type .eq. 5 ) then
|
||||
c
|
||||
c %-------------------------------%
|
||||
c %-------------------------------%
|
||||
c | Perform y <-- OP*x |
|
||||
c | = inv[A-SIGMA*M]*A*x |
|
||||
c | B*x = A*x has been computed |
|
||||
@@ -729,7 +729,7 @@ c | and saved in workd(ipntr(3)). |
|
||||
c %-------------------------------%
|
||||
c
|
||||
call dcopy (n, workd(ipntr(3)), 1, workd(ipntr(2)), 1)
|
||||
call dgbtrs('Notranspose', n, kl, ku, 1, rfac, lda,
|
||||
call dgbtrs('Notranspose', n, kl, ku, 1, rfac, lda,
|
||||
& iwork, workd(ipntr(2)), n, ierr)
|
||||
if ( ierr .ne. 0 ) then
|
||||
print*, ' '
|
||||
@@ -742,24 +742,24 @@ c
|
||||
c
|
||||
c %---------------------------------%
|
||||
c | Perform y <-- OP*x |
|
||||
c | = inv[A-SIGMA*M]*(A+SIGMA*M)*x. |
|
||||
c | = inv[A-SIGMA*M]*(A+SIGMA*M)*x. |
|
||||
c | (M*x) has been saved in |
|
||||
c | workd(ipntr(3)). |
|
||||
c %---------------------------------%
|
||||
c
|
||||
if ( bmat .eq. 'G' ) then
|
||||
call dgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& ab(itop,1), lda, workd(ipntr(1)), 1,
|
||||
call dgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& ab(itop,1), lda, workd(ipntr(1)), 1,
|
||||
& zero, workd(ipntr(2)), 1)
|
||||
call daxpy( n, sigma, workd(ipntr(3)), 1,
|
||||
call daxpy( n, sigma, workd(ipntr(3)), 1,
|
||||
& workd(ipntr(2)), 1 )
|
||||
else
|
||||
else
|
||||
call dcopy (n, workd(ipntr(1)), 1, workd(ipntr(2)), 1)
|
||||
call dgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, sigma,
|
||||
call dgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, sigma,
|
||||
& workd(ipntr(2)), 1)
|
||||
end if
|
||||
call dgbtrs('Notranspose', n, kl, ku, 1, rfac, lda,
|
||||
call dgbtrs('Notranspose', n, kl, ku, 1, rfac, lda,
|
||||
& iwork, workd(ipntr(2)), n, ierr)
|
||||
c
|
||||
end if
|
||||
@@ -767,9 +767,9 @@ c
|
||||
else if (ido .eq. 2) then
|
||||
c
|
||||
c %----------------------------------%
|
||||
c | Perform y <-- B*x |
|
||||
c | Perform y <-- B*x |
|
||||
c | Note when Buckling mode is used, |
|
||||
c | B = A, otherwise B=M. |
|
||||
c | B = A, otherwise B=M. |
|
||||
c %----------------------------------%
|
||||
c
|
||||
if (type .eq. 5) then
|
||||
@@ -778,20 +778,20 @@ c %---------------------%
|
||||
c | Buckling Mode, B=A. |
|
||||
c %---------------------%
|
||||
c
|
||||
call dgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& ab(itop,1), lda, workd(ipntr(1)), 1,
|
||||
call dgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& ab(itop,1), lda, workd(ipntr(1)), 1,
|
||||
& zero, workd(ipntr(2)), 1)
|
||||
else
|
||||
|
||||
call dgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& mb(itop,1), lda, workd(ipntr(1)), 1,
|
||||
call dgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& mb(itop,1), lda, workd(ipntr(1)), 1,
|
||||
& zero, workd(ipntr(2)), 1)
|
||||
end if
|
||||
c
|
||||
else
|
||||
else
|
||||
c
|
||||
c %-----------------------------------------%
|
||||
c | Either we have convergence, or there is |
|
||||
c | Either we have convergence, or there is |
|
||||
c | error. |
|
||||
c %-----------------------------------------%
|
||||
c
|
||||
@@ -808,7 +808,7 @@ c
|
||||
print *, ' '
|
||||
go to 9000
|
||||
c
|
||||
else
|
||||
else
|
||||
c
|
||||
if ( info .eq. 1) then
|
||||
print *, ' '
|
||||
@@ -823,22 +823,22 @@ c
|
||||
c
|
||||
if (iparam(5) .gt. 0) then
|
||||
c
|
||||
call dseupd ( rvec, 'A', select, d, z, ldz, sigma,
|
||||
& bmat, n, which, nev, tol, resid, ncv, v, ldv,
|
||||
& iparam, ipntr, workd, workl, lworkl, info )
|
||||
call dseupd ( rvec, 'A', select, d, z, ldz, sigma,
|
||||
& bmat, n, which, nev, tol, resid, ncv, v, ldv,
|
||||
& iparam, ipntr, workd, workl, lworkl, info )
|
||||
c
|
||||
if ( info .ne. 0) then
|
||||
c
|
||||
c
|
||||
c %------------------------------------%
|
||||
c | Check the documentation of dneupd. |
|
||||
c %------------------------------------%
|
||||
c
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
print *, ' Error with _neupd = ', info
|
||||
print *, ' Check the documentation of _neupd '
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
go to 9000
|
||||
c
|
||||
c
|
||||
end if
|
||||
c
|
||||
end if
|
||||
@@ -853,7 +853,7 @@ c %----------------------------------------%
|
||||
c | L O O P B A C K to call DSAUPD again. |
|
||||
c %----------------------------------------%
|
||||
c
|
||||
go to 90
|
||||
go to 90
|
||||
c
|
||||
9000 continue
|
||||
c
|
||||
|
||||
+42
-42
@@ -1,14 +1,14 @@
|
||||
program dsbdr1
|
||||
program dsbdr1
|
||||
c
|
||||
c ... Construct the matrix A in LAPACK-style band form.
|
||||
c The matrix A is derived from the discretization of
|
||||
c the 2-dimensional Laplacian on the unit square with
|
||||
c zero Dirichlet boundary condition using standard
|
||||
c the 2-dimensional Laplacian on the unit square with
|
||||
c zero Dirichlet boundary condition using standard
|
||||
c central difference.
|
||||
c
|
||||
c ... Call DSBAND to find eigenvalues LAMBDA such that
|
||||
c A*x = x*LAMBDA.
|
||||
c
|
||||
c
|
||||
c ... Use mode 1 of DSAUPD .
|
||||
c
|
||||
c\BeginLib
|
||||
@@ -47,13 +47,13 @@ c | MAXN - Maximum size of the matrix |
|
||||
c | MAXNEV - Maximum number of |
|
||||
c | eigenvalues to be computed |
|
||||
c | MAXNCV - Maximum number of Arnoldi |
|
||||
c | vectors stored |
|
||||
c | vectors stored |
|
||||
c | MAXBDW - Maximum bandwidth |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
integer maxn, maxnev, maxncv, maxbdw, lda,
|
||||
& lworkl, ldv
|
||||
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
|
||||
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
|
||||
& maxbdw=50, lda = maxbdw, ldv = maxn )
|
||||
c
|
||||
c %--------------%
|
||||
@@ -62,9 +62,9 @@ c %--------------%
|
||||
c
|
||||
integer iparam(11), iwork(maxn)
|
||||
logical select(maxncv)
|
||||
Double precision
|
||||
Double precision
|
||||
& a(lda,maxn), m(lda,maxn), rfac(lda,maxn),
|
||||
& workl(maxncv*maxncv+8*maxncv), workd(3*maxn),
|
||||
& workl(maxncv*maxncv+8*maxncv), workd(3*maxn),
|
||||
& v(ldv, maxncv), resid(maxn), d(maxncv, 2),
|
||||
& ax(maxn)
|
||||
c
|
||||
@@ -76,15 +76,15 @@ c
|
||||
integer nev, ncv, ku, kl, info, i, j, ido,
|
||||
& n, nx, lo, isub, isup, idiag, maxitr, mode,
|
||||
& nconv
|
||||
Double precision
|
||||
Double precision
|
||||
& tol, sigma, h2
|
||||
logical rvec
|
||||
c
|
||||
c
|
||||
c %------------%
|
||||
c | Parameters |
|
||||
c %------------%
|
||||
c
|
||||
Double precision
|
||||
Double precision
|
||||
& one, zero, two
|
||||
parameter (one = 1.0D+0 , zero = 0.0D+0 , two = 2.0D+0 )
|
||||
c
|
||||
@@ -92,9 +92,9 @@ c %-----------------------------%
|
||||
c | BLAS & LAPACK routines used |
|
||||
c %-----------------------------%
|
||||
c
|
||||
Double precision
|
||||
& dlapy2 , dnrm2
|
||||
external dlapy2 , dnrm2 , dgbmv , daxpy
|
||||
Double precision
|
||||
& dlapy2 , dnrm2
|
||||
external dlapy2 , dnrm2 , dgbmv , daxpy
|
||||
c
|
||||
c %--------------------%
|
||||
c | Intrinsic function |
|
||||
@@ -121,13 +121,13 @@ c | However, the following conditions must be |
|
||||
c | satisfied: |
|
||||
c | N <= MAXN |
|
||||
c | NEV <= MAXNEV |
|
||||
c | NEV + 1 <= NCV <= MAXNCV |
|
||||
c %-------------------------------------------------%
|
||||
c | NEV + 1 <= NCV <= MAXNCV |
|
||||
c %-------------------------------------------------%
|
||||
c
|
||||
nx = 10
|
||||
nx = 10
|
||||
n = nx*nx
|
||||
nev = 4
|
||||
ncv = 10
|
||||
nev = 4
|
||||
ncv = 10
|
||||
if ( n .gt. maxn ) then
|
||||
print *, ' ERROR with _SBDR1: N is greater than MAXN '
|
||||
go to 9000
|
||||
@@ -153,7 +153,7 @@ c | generated in DSAUPD to start the Arnoldi iteration. |
|
||||
c %-----------------------------------------------------%
|
||||
c
|
||||
lworkl = ncv**2+8*ncv
|
||||
tol = zero
|
||||
tol = zero
|
||||
ido = 0
|
||||
info = 0
|
||||
c
|
||||
@@ -169,7 +169,7 @@ c
|
||||
mode = 1
|
||||
c
|
||||
iparam(3) = maxitr
|
||||
iparam(7) = mode
|
||||
iparam(7) = mode
|
||||
c
|
||||
c %----------------------------------------%
|
||||
c | Construct the matrix A in LAPACK-style |
|
||||
@@ -190,10 +190,10 @@ c | and subdiagonals within the band of |
|
||||
c | matrices A and M. |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
kl = nx
|
||||
ku = nx
|
||||
kl = nx
|
||||
ku = nx
|
||||
c
|
||||
c %---------------%
|
||||
c %---------------%
|
||||
c | Main diagonal |
|
||||
c %---------------%
|
||||
c
|
||||
@@ -201,12 +201,12 @@ c
|
||||
idiag = kl+ku+1
|
||||
do 30 j = 1, n
|
||||
a(idiag,j) = 4.0D+0 / h2
|
||||
30 continue
|
||||
c
|
||||
30 continue
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | First subdiagonal and superdiagonal |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
c
|
||||
isup = kl+ku
|
||||
isub = kl+ku+2
|
||||
do 50 i = 1, nx
|
||||
@@ -214,8 +214,8 @@ c
|
||||
do 40 j = lo+1, lo+nx-1
|
||||
a(isup,j+1) = -one / h2
|
||||
a(isub,j) = -one / h2
|
||||
40 continue
|
||||
50 continue
|
||||
40 continue
|
||||
50 continue
|
||||
c
|
||||
c %------------------------------------%
|
||||
c | KL-th subdiagonal and KU-th super- |
|
||||
@@ -229,8 +229,8 @@ c
|
||||
do 70 j = lo+1, lo+nx
|
||||
a(isup,nx+j) = -one / h2
|
||||
a(isub,j) = -one / h2
|
||||
70 continue
|
||||
80 continue
|
||||
70 continue
|
||||
80 continue
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | Call DSBAND to find eigenvalues and |
|
||||
@@ -239,18 +239,18 @@ c | returned in the first column of D. |
|
||||
c | Eigenvectors are returned in the |
|
||||
c | first NCONV (=IPARAM(5)) columns of |
|
||||
c | V. |
|
||||
c %-------------------------------------%
|
||||
c %-------------------------------------%
|
||||
c
|
||||
rvec = .true.
|
||||
call dsband ( rvec, 'A', select, d, v, ldv, sigma, n, a, m, lda,
|
||||
& rfac, kl, ku, which, bmat, nev, tol,
|
||||
& resid, ncv, v, ldv, iparam, workd, workl, lworkl,
|
||||
call dsband ( rvec, 'A', select, d, v, ldv, sigma, n, a, m, lda,
|
||||
& rfac, kl, ku, which, bmat, nev, tol,
|
||||
& resid, ncv, v, ldv, iparam, workd, workl, lworkl,
|
||||
& iwork, info)
|
||||
c
|
||||
if ( info .eq. 0) then
|
||||
c
|
||||
nconv = iparam(5)
|
||||
c
|
||||
c
|
||||
c %-----------------------------------%
|
||||
c | Print out convergence information |
|
||||
c %-----------------------------------%
|
||||
@@ -278,18 +278,18 @@ c | || A*x - lambda*x || |
|
||||
c %----------------------------%
|
||||
c
|
||||
do 90 j = 1, nconv
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
& ax, 1)
|
||||
call daxpy (n, -d(j,1), v(1,j), 1, ax, 1)
|
||||
d(j,2) = dnrm2 (n, ax, 1)
|
||||
d(j,2) = d(j,2) / abs(d(j,1))
|
||||
c
|
||||
90 continue
|
||||
90 continue
|
||||
|
||||
call dmout (6, nconv, 2, d, maxncv, -6,
|
||||
& 'Ritz values and relative residuals')
|
||||
else
|
||||
else
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | Either convergence failed, or there |
|
||||
@@ -300,8 +300,8 @@ c
|
||||
print *, ' '
|
||||
print *, ' Error with _sband, info= ', info
|
||||
print *, ' Check the documentation of _sband '
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
c
|
||||
end if
|
||||
c
|
||||
9000 end
|
||||
9000 end
|
||||
|
||||
+41
-41
@@ -1,12 +1,12 @@
|
||||
program dsbdr2
|
||||
program dsbdr2
|
||||
c
|
||||
c ... Construct the matrix A in LAPACK-style band form.
|
||||
c The matrix A is derived from the discretization of
|
||||
c the 2-dimensional Laplacian on the unit square
|
||||
c the 2-dimensional Laplacian on the unit square
|
||||
c with zero Dirichlet boundary condition using standard
|
||||
c central difference.
|
||||
c
|
||||
c ... Call DSBAND to find eigenvalues LAMBDA closest to
|
||||
c ... Call DSBAND to find eigenvalues LAMBDA closest to
|
||||
c SIGMA such that
|
||||
c A*x = x*LAMBDA.
|
||||
c
|
||||
@@ -48,13 +48,13 @@ c | MAXN - Maximum size of the matrix |
|
||||
c | MAXNEV - Maximum number of |
|
||||
c | eigenvalues to be computed |
|
||||
c | MAXNCV - Maximum number of Arnoldi |
|
||||
c | vectors stored |
|
||||
c | vectors stored |
|
||||
c | MAXBDW - Maximum bandwidth |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
integer maxn, maxnev, maxncv, maxbdw, lda,
|
||||
& lworkl, ldv
|
||||
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
|
||||
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
|
||||
& maxbdw=50, lda = maxbdw, ldv = maxn )
|
||||
c
|
||||
c %--------------%
|
||||
@@ -63,10 +63,10 @@ c %--------------%
|
||||
c
|
||||
integer iparam(11), iwork(maxn)
|
||||
logical select(maxncv)
|
||||
Double precision
|
||||
Double precision
|
||||
& a(lda,maxn), m(lda,maxn), rfac(lda,maxn),
|
||||
& workl(3*maxncv*maxncv+6*maxncv), workd(3*maxn),
|
||||
& v(ldv, maxncv), resid(maxn), d(maxncv, 2),
|
||||
& workl(3*maxncv*maxncv+6*maxncv), workd(3*maxn),
|
||||
& v(ldv, maxncv), resid(maxn), d(maxncv, 2),
|
||||
& ax(maxn)
|
||||
c
|
||||
c %---------------%
|
||||
@@ -77,15 +77,15 @@ c
|
||||
integer nev, ncv, ku, kl, info, i, j, ido,
|
||||
& n, nx, lo, isub, isup, idiag, maxitr, mode,
|
||||
& nconv
|
||||
Double precision
|
||||
Double precision
|
||||
& tol, sigma, h2
|
||||
logical rvec
|
||||
c
|
||||
c
|
||||
c %------------%
|
||||
c | Parameters |
|
||||
c %------------%
|
||||
c
|
||||
Double precision
|
||||
Double precision
|
||||
& one, zero, two
|
||||
parameter (one = 1.0D+0 , zero = 0.0D+0 , two = 2.0D+0 )
|
||||
c
|
||||
@@ -93,9 +93,9 @@ c %-----------------------------%
|
||||
c | BLAS & LAPACK routines used |
|
||||
c %-----------------------------%
|
||||
c
|
||||
Double precision
|
||||
& dlapy2 , dnrm2
|
||||
external dlapy2 , dnrm2 , daxpy , dgbmv
|
||||
Double precision
|
||||
& dlapy2 , dnrm2
|
||||
external dlapy2 , dnrm2 , daxpy , dgbmv
|
||||
c
|
||||
c %-----------------------%
|
||||
c | Executable Statements |
|
||||
@@ -118,13 +118,13 @@ c | However, the following conditions must be |
|
||||
c | satisfied: |
|
||||
c | N <= MAXN |
|
||||
c | NEV <= MAXNEV |
|
||||
c | NEV + 1 <= NCV <= MAXNCV |
|
||||
c %--------------------------------------------------%
|
||||
c | NEV + 1 <= NCV <= MAXNCV |
|
||||
c %--------------------------------------------------%
|
||||
c
|
||||
nx = 10
|
||||
nx = 10
|
||||
n = nx*nx
|
||||
nev = 4
|
||||
ncv = 10
|
||||
nev = 4
|
||||
ncv = 10
|
||||
if ( n .gt. maxn ) then
|
||||
print *, ' ERROR with _SBDR2: N is greater than MAXN '
|
||||
go to 9000
|
||||
@@ -151,7 +151,7 @@ c | generated in DSAUPD to start the Arnoldi iteration. |
|
||||
c %-----------------------------------------------------%
|
||||
c
|
||||
lworkl = 3*ncv**2+6*ncv
|
||||
tol = zero
|
||||
tol = zero
|
||||
ido = 0
|
||||
info = 0
|
||||
c
|
||||
@@ -167,7 +167,7 @@ c
|
||||
mode = 3
|
||||
c
|
||||
iparam(3) = maxitr
|
||||
iparam(7) = mode
|
||||
iparam(7) = mode
|
||||
c
|
||||
c %----------------------------------------%
|
||||
c | Construct the matrix A in LAPACK-style |
|
||||
@@ -188,10 +188,10 @@ c | and subdiagonals within the band of |
|
||||
c | matrices A and M. |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
kl = nx
|
||||
ku = nx
|
||||
kl = nx
|
||||
ku = nx
|
||||
c
|
||||
c %---------------%
|
||||
c %---------------%
|
||||
c | Main diagonal |
|
||||
c %---------------%
|
||||
c
|
||||
@@ -199,12 +199,12 @@ c
|
||||
idiag = kl+ku+1
|
||||
do 30 j = 1, n
|
||||
a(idiag,j) = 4.0D+0 / h2
|
||||
30 continue
|
||||
c
|
||||
30 continue
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | First subdiagonal and superdiagonal |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
c
|
||||
isup = kl+ku
|
||||
isub = kl+ku+2
|
||||
do 50 i = 1, nx
|
||||
@@ -212,8 +212,8 @@ c
|
||||
do 40 j = lo+1, lo+nx-1
|
||||
a(isup,j+1) = -one / h2
|
||||
a(isub,j) = -one / h2
|
||||
40 continue
|
||||
50 continue
|
||||
40 continue
|
||||
50 continue
|
||||
c
|
||||
c %------------------------------------%
|
||||
c | KL-th subdiagonal and KU-th super- |
|
||||
@@ -227,8 +227,8 @@ c
|
||||
do 70 j = lo+1, lo+nx
|
||||
a(isup,nx+j) = -one / h2
|
||||
a(isub,j) = -one / h2
|
||||
70 continue
|
||||
80 continue
|
||||
70 continue
|
||||
80 continue
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | Call DSBAND to find eigenvalues and |
|
||||
@@ -239,10 +239,10 @@ c | first NCONV (=IPARAM(5)) columns of |
|
||||
c | V. |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
rvec = .true.
|
||||
call dsband ( rvec,'A', select, d, v, ldv, sigma, n, a, m,
|
||||
& lda, rfac, kl, ku, which, bmat, nev, tol,
|
||||
& resid, ncv, v, ldv, iparam, workd, workl, lworkl,
|
||||
rvec = .true.
|
||||
call dsband ( rvec,'A', select, d, v, ldv, sigma, n, a, m,
|
||||
& lda, rfac, kl, ku, which, bmat, nev, tol,
|
||||
& resid, ncv, v, ldv, iparam, workd, workl, lworkl,
|
||||
& iwork, info)
|
||||
c
|
||||
if ( info .eq. 0) then
|
||||
@@ -276,18 +276,18 @@ c | || A*x - lambda*x || |
|
||||
c %----------------------------%
|
||||
c
|
||||
do 90 j = 1, nconv
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
& ax, 1)
|
||||
call daxpy (n, -d(j,1), v(1,j), 1, ax, 1)
|
||||
d(j,2) = dnrm2 (n, ax, 1)
|
||||
d(j,2) = d(j,2) / abs(d(j,1))
|
||||
c
|
||||
90 continue
|
||||
90 continue
|
||||
|
||||
call dmout (6, nconv, 2, d, maxncv, -6,
|
||||
& 'Ritz values and relative residuals')
|
||||
else
|
||||
else
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | Either convergence failed, or there |
|
||||
@@ -298,8 +298,8 @@ c
|
||||
print *, ' '
|
||||
print *, ' Error with _sband, info= ', info
|
||||
print *, ' Check the documentation of _sband '
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
c
|
||||
end if
|
||||
c
|
||||
9000 end
|
||||
9000 end
|
||||
|
||||
+35
-35
@@ -1,11 +1,11 @@
|
||||
program dsbdr3
|
||||
program dsbdr3
|
||||
c
|
||||
c ... Construct the matrix A in LAPACK-style band form.
|
||||
c The matrix A is the 1-dimensional discrete Laplacian on [0,1]
|
||||
c with zero Dirichlet boundary condition, M is the mass
|
||||
c formed by using piecewise linear elements on [0,1].
|
||||
c
|
||||
c ... Call DSBAND with regular mode to find eigenvalues LAMBDA
|
||||
c ... Call DSBAND with regular mode to find eigenvalues LAMBDA
|
||||
c such that
|
||||
c A*x = LAMBDA*M*x.
|
||||
c
|
||||
@@ -46,13 +46,13 @@ c | MAXN - Maximum size of the matrix |
|
||||
c | MAXNEV - Maximum number of |
|
||||
c | eigenvalues to be computed |
|
||||
c | MAXNCV - Maximum number of Arnoldi |
|
||||
c | vectors stored |
|
||||
c | vectors stored |
|
||||
c | MAXBDW - Maximum bandwidth |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
integer maxn, maxnev, maxncv, maxbdw, lda,
|
||||
& lworkl, ldv
|
||||
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
|
||||
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
|
||||
& maxbdw=50, lda = maxbdw, ldv = maxn )
|
||||
c
|
||||
c %--------------%
|
||||
@@ -61,9 +61,9 @@ c %--------------%
|
||||
c
|
||||
integer iparam(11), iwork(maxn)
|
||||
logical select(maxncv)
|
||||
Double precision
|
||||
Double precision
|
||||
& a(lda,maxn), m(lda,maxn), rfac(lda,maxn),
|
||||
& workl(maxncv*maxncv+8*maxncv), workd(3*maxn),
|
||||
& workl(maxncv*maxncv+8*maxncv), workd(3*maxn),
|
||||
& v(ldv, maxncv), resid(maxn), d(maxncv, 2),
|
||||
& ax(maxn), mx(maxn)
|
||||
c
|
||||
@@ -74,15 +74,15 @@ c
|
||||
character which*2, bmat
|
||||
integer nev, ncv, ku, kl, info, j, ido,
|
||||
& n, isub, isup, idiag, maxitr, mode, nconv
|
||||
Double precision
|
||||
Double precision
|
||||
& tol, h, sigma, r1, r2
|
||||
logical rvec
|
||||
c
|
||||
c
|
||||
c %------------%
|
||||
c | Parameters |
|
||||
c %------------%
|
||||
c
|
||||
Double precision
|
||||
Double precision
|
||||
& one, zero, two, four, six
|
||||
parameter (one = 1.0D+0 , zero = 0.0D+0 , two = 2.0D+0 ,
|
||||
& four = 4.0D+0 , six = 6.0D+0 )
|
||||
@@ -91,9 +91,9 @@ c %-----------------------------%
|
||||
c | BLAS & LAPACK routines used |
|
||||
c %-----------------------------%
|
||||
c
|
||||
Double precision
|
||||
& dlapy2 , dnrm2
|
||||
external dlapy2 , dnrm2 , daxpy , dgbmv
|
||||
Double precision
|
||||
& dlapy2 , dnrm2
|
||||
external dlapy2 , dnrm2 , daxpy , dgbmv
|
||||
c
|
||||
c %--------------------%
|
||||
c | Intrinsic function |
|
||||
@@ -116,12 +116,12 @@ c | However, the following conditions must be |
|
||||
c | satisfied: |
|
||||
c | N <= MAXN |
|
||||
c | NEV <= MAXNEV |
|
||||
c | NEV + 1 <= NCV <= MAXNCV |
|
||||
c %-------------------------------------------------%
|
||||
c | NEV + 1 <= NCV <= MAXNCV |
|
||||
c %-------------------------------------------------%
|
||||
c
|
||||
n = 100
|
||||
nev = 4
|
||||
ncv = 10
|
||||
n = 100
|
||||
nev = 4
|
||||
ncv = 10
|
||||
if ( n .gt. maxn ) then
|
||||
print *, ' ERROR with _SBDR3: N is greater than MAXN '
|
||||
go to 9000
|
||||
@@ -147,7 +147,7 @@ c | generated in DSAUPD to start the Arnoldi iteration. |
|
||||
c %-----------------------------------------------------%
|
||||
c
|
||||
lworkl = ncv**2+8*ncv
|
||||
tol = zero
|
||||
tol = zero
|
||||
ido = 0
|
||||
info = 0
|
||||
c
|
||||
@@ -184,10 +184,10 @@ c | and subdiagonals within the band of |
|
||||
c | matrices A and M. |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
kl = 1
|
||||
ku = 1
|
||||
kl = 1
|
||||
ku = 1
|
||||
c
|
||||
c %---------------%
|
||||
c %---------------%
|
||||
c | Main diagonal |
|
||||
c %---------------%
|
||||
c
|
||||
@@ -197,12 +197,12 @@ c
|
||||
do 30 j = 1, n
|
||||
a(idiag,j) = two / h
|
||||
m(idiag,j) = r1 * h
|
||||
30 continue
|
||||
c
|
||||
30 continue
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | First subdiagonal and superdiagonal |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
c
|
||||
r2 = one / six
|
||||
isup = kl+ku
|
||||
isub = kl+ku+2
|
||||
@@ -223,9 +223,9 @@ c | V. |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
rvec = .true.
|
||||
call dsband ( rvec, 'A', select, d, v, ldv, sigma, n, a, m, lda,
|
||||
& rfac, kl, ku, which, bmat, nev, tol,
|
||||
& resid, ncv, v, ldv, iparam, workd, workl, lworkl,
|
||||
call dsband ( rvec, 'A', select, d, v, ldv, sigma, n, a, m, lda,
|
||||
& rfac, kl, ku, which, bmat, nev, tol,
|
||||
& resid, ncv, v, ldv, iparam, workd, workl, lworkl,
|
||||
& iwork, info)
|
||||
c
|
||||
if ( info .eq. 0) then
|
||||
@@ -259,21 +259,21 @@ c | || A*x - lambda*x || |
|
||||
c %----------------------------%
|
||||
c
|
||||
do 90 j = 1, nconv
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
& ax, 1)
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j), 1, zero,
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j), 1, zero,
|
||||
& mx, 1)
|
||||
call daxpy (n, -d(j,1), mx, 1, ax, 1)
|
||||
d(j,2) = dnrm2 (n, ax, 1)
|
||||
d(j,2) = d(j,2) / abs(d(j,1))
|
||||
c
|
||||
90 continue
|
||||
90 continue
|
||||
|
||||
call dmout (6, nconv, 2, d, maxncv, -6,
|
||||
& 'Ritz values and relative residuals')
|
||||
else
|
||||
else
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | Either convergence failed, or there |
|
||||
@@ -284,8 +284,8 @@ c
|
||||
print *, ' '
|
||||
print *, ' Error with _sband, info= ', info
|
||||
print *, ' Check the documentation of _sband '
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
c
|
||||
end if
|
||||
c
|
||||
9000 end
|
||||
9000 end
|
||||
|
||||
+36
-36
@@ -1,11 +1,11 @@
|
||||
program dsbdr4
|
||||
program dsbdr4
|
||||
c
|
||||
c ... Construct the matrix A in LAPACK-style band form.
|
||||
c The matrix A is the 1-dimensional discrete Laplacian on [0,1]
|
||||
c with zero Dirichlet boundary condition, M is the mass
|
||||
c formed by using piecewise linear elements on [0,1].
|
||||
c
|
||||
c ... Call DSBAND with shift-invert mode to find eigenvalues LAMBDA
|
||||
c ... Call DSBAND with shift-invert mode to find eigenvalues LAMBDA
|
||||
c closest to SIGMA such that
|
||||
c A*x = LAMBDA*M*x.
|
||||
c
|
||||
@@ -47,13 +47,13 @@ c | MAXN - Maximum size of the matrix |
|
||||
c | MAXNEV - Maximum number of |
|
||||
c | eigenvalues to be computed |
|
||||
c | MAXNCV - Maximum number of Arnoldi |
|
||||
c | vectors stored |
|
||||
c | vectors stored |
|
||||
c | MAXBDW - Maximum bandwidth |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
integer maxn, maxnev, maxncv, maxbdw, lda,
|
||||
& lworkl, ldv
|
||||
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
|
||||
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
|
||||
& maxbdw=50, lda = maxbdw, ldv = maxn )
|
||||
c
|
||||
c %--------------%
|
||||
@@ -62,9 +62,9 @@ c %--------------%
|
||||
c
|
||||
integer iparam(11), iwork(maxn)
|
||||
logical select(maxncv)
|
||||
Double precision
|
||||
Double precision
|
||||
& a(lda,maxn), m(lda,maxn), rfac(lda,maxn),
|
||||
& workl(maxncv*maxncv+8*maxncv), workd(3*maxn),
|
||||
& workl(maxncv*maxncv+8*maxncv), workd(3*maxn),
|
||||
& v(ldv, maxncv), resid(maxn), d(maxncv, 2),
|
||||
& ax(maxn), mx(maxn)
|
||||
c
|
||||
@@ -75,15 +75,15 @@ c
|
||||
character which*2, bmat
|
||||
integer nev, ncv, ku, kl, info, j, ido,
|
||||
& n, isub, isup, idiag, maxitr, mode, nconv
|
||||
Double precision
|
||||
Double precision
|
||||
& tol, h, sigma, r1, r2
|
||||
logical rvec
|
||||
c
|
||||
c
|
||||
c %------------%
|
||||
c | Parameters |
|
||||
c %------------%
|
||||
c
|
||||
Double precision
|
||||
Double precision
|
||||
& one, zero, two, four, six
|
||||
parameter (one = 1.0D+0 , zero = 0.0D+0 , two = 2.0D+0 ,
|
||||
& four = 4.0D+0 , six = 6.0D+0 )
|
||||
@@ -92,9 +92,9 @@ c %-----------------------------%
|
||||
c | BLAS & LAPACK routines used |
|
||||
c %-----------------------------%
|
||||
c
|
||||
Double precision
|
||||
& dlapy2 , dnrm2
|
||||
external dlapy2 , dnrm2 , daxpy , dgbmv
|
||||
Double precision
|
||||
& dlapy2 , dnrm2
|
||||
external dlapy2 , dnrm2 , daxpy , dgbmv
|
||||
c
|
||||
c %-----------------------%
|
||||
c | Executable Statements |
|
||||
@@ -113,12 +113,12 @@ c | However, the following conditions must be |
|
||||
c | satisfied: |
|
||||
c | N <= MAXN |
|
||||
c | NEV <= MAXNEV |
|
||||
c | NEV + 1 <= NCV <= MAXNCV |
|
||||
c %--------------------------------------------------%
|
||||
c | NEV + 1 <= NCV <= MAXNCV |
|
||||
c %--------------------------------------------------%
|
||||
c
|
||||
n = 100
|
||||
nev = 4
|
||||
ncv = 10
|
||||
nev = 4
|
||||
ncv = 10
|
||||
if ( n .gt. maxn ) then
|
||||
print *, ' ERROR with _SBDR4: N is greater than MAXN '
|
||||
go to 9000
|
||||
@@ -145,7 +145,7 @@ c | generated in DSAUPD to start the Arnoldi iteration. |
|
||||
c %-----------------------------------------------------%
|
||||
c
|
||||
lworkl = ncv**2+8*ncv
|
||||
tol = zero
|
||||
tol = zero
|
||||
ido = 0
|
||||
info = 0
|
||||
c
|
||||
@@ -182,10 +182,10 @@ c | and subdiagonals within the band of |
|
||||
c | matrices A and M. |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
kl = 1
|
||||
ku = 1
|
||||
kl = 1
|
||||
ku = 1
|
||||
c
|
||||
c %---------------%
|
||||
c %---------------%
|
||||
c | Main diagonal |
|
||||
c %---------------%
|
||||
c
|
||||
@@ -195,19 +195,19 @@ c
|
||||
do 30 j = 1, n
|
||||
a(idiag,j) = two / h
|
||||
m(idiag,j) = r1 * h
|
||||
30 continue
|
||||
c
|
||||
30 continue
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | First subdiagonal and superdiagonal |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
c
|
||||
r2 = one / six
|
||||
isup = kl+ku
|
||||
isub = kl+ku+2
|
||||
do 60 j = 1, n-1
|
||||
a(isup,j+1) = -one / h
|
||||
a(isub,j) = -one / h
|
||||
m(isup,j+1) = r2 * h
|
||||
m(isup,j+1) = r2 * h
|
||||
m(isub,j) = r2 * h
|
||||
60 continue
|
||||
c
|
||||
@@ -221,9 +221,9 @@ c | V. |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
rvec = .true.
|
||||
call dsband ( rvec, 'A', select, d, v, ldv, sigma, n, a, m,
|
||||
& lda, rfac, kl, ku, which, bmat, nev, tol,
|
||||
& resid, ncv, v, ldv, iparam, workd, workl, lworkl,
|
||||
call dsband ( rvec, 'A', select, d, v, ldv, sigma, n, a, m,
|
||||
& lda, rfac, kl, ku, which, bmat, nev, tol,
|
||||
& resid, ncv, v, ldv, iparam, workd, workl, lworkl,
|
||||
& iwork, info)
|
||||
c
|
||||
if ( info .eq. 0) then
|
||||
@@ -243,7 +243,7 @@ c
|
||||
print *, ' The number of Lanczos vectors generated',
|
||||
& ' (NCV) is ', ncv
|
||||
print *, ' The number of converged Ritz values is ',
|
||||
& nconv
|
||||
& nconv
|
||||
print *, ' What portion of the spectrum ', which
|
||||
print *, ' The number of Implicit Arnoldi',
|
||||
& ' update taken is ', iparam(3)
|
||||
@@ -257,21 +257,21 @@ c | || A*x - lambda*x || |
|
||||
c %----------------------------%
|
||||
c
|
||||
do 90 j = 1, nconv
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
& ax, 1)
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j), 1, zero,
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j), 1, zero,
|
||||
& mx, 1)
|
||||
call daxpy (n, -d(j,1), mx, 1, ax, 1)
|
||||
d(j,2) = dnrm2 (n, ax, 1)
|
||||
d(j,2) = d(j,2) / abs(d(j,1))
|
||||
c
|
||||
90 continue
|
||||
90 continue
|
||||
|
||||
call dmout (6, nconv, 2, d, maxncv, -6,
|
||||
& 'Ritz values and relative residuals')
|
||||
else
|
||||
else
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | Either convergence failed, or there |
|
||||
@@ -282,8 +282,8 @@ c
|
||||
print *, ' '
|
||||
print *, ' Error with _sband, info= ', info
|
||||
print *, ' Check the documentation of _sband '
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
c
|
||||
end if
|
||||
c
|
||||
9000 end
|
||||
9000 end
|
||||
|
||||
+35
-35
@@ -1,11 +1,11 @@
|
||||
program dsbdr5
|
||||
program dsbdr5
|
||||
c
|
||||
c ... Construct the matrix A in LAPACK-style band form.
|
||||
c The matrix A is the 1-dimensional discrete Laplacian on [0,1]
|
||||
c with zero Dirichlet boundary condition, KG is the mass
|
||||
c formed by using piecewise linear elements on [0,1].
|
||||
c formed by using piecewise linear elements on [0,1].
|
||||
c
|
||||
c ... Call DSBAND with Buckling mode to find eigenvalues LAMBDA
|
||||
c ... Call DSBAND with Buckling mode to find eigenvalues LAMBDA
|
||||
c such that
|
||||
c A*x = M*x*LAMBDA.
|
||||
c
|
||||
@@ -47,13 +47,13 @@ c | MAXN - Maximum size of the matrix |
|
||||
c | MAXNEV - Maximum number of |
|
||||
c | eigenvalues to be computed |
|
||||
c | MAXNCV - Maximum number of Arnoldi |
|
||||
c | vectors stored |
|
||||
c | vectors stored |
|
||||
c | MAXBDW - Maximum bandwidth |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
integer maxn, maxnev, maxncv, maxbdw, lda,
|
||||
& lworkl, ldv
|
||||
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
|
||||
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
|
||||
& maxbdw=50, lda = maxbdw, ldv = maxn )
|
||||
c
|
||||
c %--------------%
|
||||
@@ -62,9 +62,9 @@ c %--------------%
|
||||
c
|
||||
integer iparam(11), iwork(maxn)
|
||||
logical select(maxncv)
|
||||
Double precision
|
||||
Double precision
|
||||
& a(lda,maxn), m(lda,maxn), rfac(lda,maxn),
|
||||
& workl(maxncv*maxncv+8*maxncv), workd(3*maxn),
|
||||
& workl(maxncv*maxncv+8*maxncv), workd(3*maxn),
|
||||
& v(ldv, maxncv), resid(maxn), d(maxncv, 2),
|
||||
& ax(maxn), mx(maxn)
|
||||
c
|
||||
@@ -75,15 +75,15 @@ c
|
||||
character which*2, bmat
|
||||
integer nev, ncv, kl, ku, info, j, ido,
|
||||
& n, isub, isup, idiag, maxitr, mode, nconv
|
||||
Double precision
|
||||
Double precision
|
||||
& tol, h, sigma, r1, r2
|
||||
logical rvec
|
||||
c
|
||||
c
|
||||
c %------------%
|
||||
c | Parameters |
|
||||
c %------------%
|
||||
c
|
||||
Double precision
|
||||
Double precision
|
||||
& one, zero, two, four, six
|
||||
parameter (one = 1.0D+0 , zero = 0.0D+0 , two = 2.0D+0 ,
|
||||
& four = 4.0D+0 , six = 6.0D+0 )
|
||||
@@ -92,9 +92,9 @@ c %-----------------------------%
|
||||
c | BLAS & LAPACK routines used |
|
||||
c %-----------------------------%
|
||||
c
|
||||
Double precision
|
||||
& dlapy2 , dnrm2
|
||||
external dlapy2 , dnrm2 , dgbmv , daxpy
|
||||
Double precision
|
||||
& dlapy2 , dnrm2
|
||||
external dlapy2 , dnrm2 , dgbmv , daxpy
|
||||
c
|
||||
c %--------------------%
|
||||
c | Intrinsic function |
|
||||
@@ -118,12 +118,12 @@ c | the spectrum. However, the following conditions |
|
||||
c | must be satisfied: |
|
||||
c | N <= MAXN |
|
||||
c | NEV <= MAXNEV |
|
||||
c | NEV + 1 <= NCV <= MAXNCV |
|
||||
c %--------------------------------------------------%
|
||||
c | NEV + 1 <= NCV <= MAXNCV |
|
||||
c %--------------------------------------------------%
|
||||
c
|
||||
n = 100
|
||||
nev = 4
|
||||
ncv = 10
|
||||
nev = 4
|
||||
ncv = 10
|
||||
if ( n .gt. maxn ) then
|
||||
print *, ' ERROR with _SBDR5: N is greater than MAXN '
|
||||
go to 9000
|
||||
@@ -150,7 +150,7 @@ c | generated in DSAUPD to start the Arnoldi iteration. |
|
||||
c %-----------------------------------------------------%
|
||||
c
|
||||
lworkl = ncv**2+8*ncv
|
||||
tol = zero
|
||||
tol = zero
|
||||
ido = 0
|
||||
info = 0
|
||||
c
|
||||
@@ -187,10 +187,10 @@ c | and subdiagonals within the band of |
|
||||
c | matrices A and M. |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
kl = 1
|
||||
ku = 1
|
||||
kl = 1
|
||||
ku = 1
|
||||
c
|
||||
c %---------------%
|
||||
c %---------------%
|
||||
c | Main diagonal |
|
||||
c %---------------%
|
||||
c
|
||||
@@ -200,12 +200,12 @@ c
|
||||
do 30 j = 1, n
|
||||
a(idiag,j) = two / h
|
||||
m(idiag,j) = r1 * h
|
||||
30 continue
|
||||
c
|
||||
30 continue
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | First subdiagonal and superdiagonal |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
c
|
||||
r2 = one / six
|
||||
isup = kl+ku
|
||||
isub = kl+ku+2
|
||||
@@ -226,9 +226,9 @@ c | V. |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
rvec = .true.
|
||||
call dsband ( rvec, 'A', select, d, v, ldv, sigma, n, a, m, lda,
|
||||
& rfac, kl, ku, which, bmat, nev, tol,
|
||||
& resid, ncv, v, ldv, iparam, workd, workl, lworkl,
|
||||
call dsband ( rvec, 'A', select, d, v, ldv, sigma, n, a, m, lda,
|
||||
& rfac, kl, ku, which, bmat, nev, tol,
|
||||
& resid, ncv, v, ldv, iparam, workd, workl, lworkl,
|
||||
& iwork, info)
|
||||
c
|
||||
if ( info .eq. 0) then
|
||||
@@ -262,21 +262,21 @@ c | || A*x - lambda*x || |
|
||||
c %----------------------------%
|
||||
c
|
||||
do 90 j = 1, nconv
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
& ax, 1)
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j), 1, zero,
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j), 1, zero,
|
||||
& mx, 1)
|
||||
call daxpy (n, -d(j,1), mx, 1, ax, 1)
|
||||
d(j,2) = dnrm2 (n, ax, 1)
|
||||
d(j,2) = d(j,2) / abs(d(j,1))
|
||||
c
|
||||
90 continue
|
||||
90 continue
|
||||
|
||||
call dmout (6, nconv, 2, d, maxncv, -6,
|
||||
& 'Ritz values and relative residuals')
|
||||
else
|
||||
else
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | Either convergence failed, or there |
|
||||
@@ -287,8 +287,8 @@ c
|
||||
print *, ' '
|
||||
print *, ' Error with _sband, info= ', info
|
||||
print *, ' Check the documentation of _sband '
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
c
|
||||
end if
|
||||
c
|
||||
9000 end
|
||||
9000 end
|
||||
|
||||
+34
-34
@@ -1,10 +1,10 @@
|
||||
program dsbdr6
|
||||
program dsbdr6
|
||||
c
|
||||
c ... Construct the matrix A in LAPACK-style band form.
|
||||
c The matrix A is the 1-dimensional discrete Laplacian on [0,1]
|
||||
c with zero Dirichlet boundary condition, M is the mass
|
||||
c formed by using piecewise linear elements on [0,1].
|
||||
c
|
||||
c
|
||||
c ... Call DSBAND with Cayley mode to find eigenvalues LAMBDA such that
|
||||
c A*x = LAMBDA*M*x.
|
||||
c
|
||||
@@ -46,13 +46,13 @@ c | MAXN - Maximum size of the matrix |
|
||||
c | MAXNEV - Maximum number of |
|
||||
c | eigenvalues to be computed |
|
||||
c | MAXNCV - Maximum number of Arnoldi |
|
||||
c | vectors stored |
|
||||
c | vectors stored |
|
||||
c | MAXBDW - Maximum bandwidth |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
integer maxn, maxnev, maxncv, maxbdw, lda,
|
||||
& lworkl, ldv
|
||||
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
|
||||
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
|
||||
& maxbdw=50, lda = maxbdw, ldv = maxn )
|
||||
c
|
||||
c %--------------%
|
||||
@@ -61,9 +61,9 @@ c %--------------%
|
||||
c
|
||||
integer iparam(11), iwork(maxn)
|
||||
logical select(maxncv)
|
||||
Double precision
|
||||
Double precision
|
||||
& a(lda,maxn), m(lda,maxn), rfac(lda,maxn),
|
||||
& workl(maxncv*maxncv+8*maxncv), workd(3*maxn),
|
||||
& workl(maxncv*maxncv+8*maxncv), workd(3*maxn),
|
||||
& v(ldv, maxncv), resid(maxn), d(maxncv, 2),
|
||||
& ax(maxn), mx(maxn)
|
||||
c
|
||||
@@ -74,15 +74,15 @@ c
|
||||
character which*2, bmat
|
||||
integer nev, ncv, ku, kl, info, j, ido,
|
||||
& n, isub, isup, idiag, maxitr, mode, nconv
|
||||
Double precision
|
||||
Double precision
|
||||
& tol, h, sigma, r1, r2
|
||||
logical rvec
|
||||
c
|
||||
c
|
||||
c %------------%
|
||||
c | Parameters |
|
||||
c %------------%
|
||||
c
|
||||
Double precision
|
||||
Double precision
|
||||
& one, zero, two, four, six
|
||||
parameter (one = 1.0D+0 , zero = 0.0D+0 , two = 2.0D+0 ,
|
||||
& four = 4.0D+0 , six = 6.0D+0 )
|
||||
@@ -91,9 +91,9 @@ c %-----------------------------%
|
||||
c | BLAS & LAPACK routines used |
|
||||
c %-----------------------------%
|
||||
c
|
||||
Double precision
|
||||
& dlapy2 , dnrm2
|
||||
external dlapy2 , dnrm2 , daxpy , dgbmv
|
||||
Double precision
|
||||
& dlapy2 , dnrm2
|
||||
external dlapy2 , dnrm2 , daxpy , dgbmv
|
||||
c
|
||||
c %--------------------%
|
||||
c | Intrinsic function |
|
||||
@@ -117,12 +117,12 @@ c | the spectrum. However, the following conditions |
|
||||
c | must be satisfied: |
|
||||
c | N <= MAXN |
|
||||
c | NEV <= MAXNEV |
|
||||
c | NEV + 1 <= NCV <= MAXNCV |
|
||||
c %--------------------------------------------------%
|
||||
c | NEV + 1 <= NCV <= MAXNCV |
|
||||
c %--------------------------------------------------%
|
||||
c
|
||||
n = 100
|
||||
nev = 4
|
||||
ncv = 10
|
||||
nev = 4
|
||||
ncv = 10
|
||||
if ( n .gt. maxn ) then
|
||||
print *, ' ERROR with _SBDR6: N is greater than MAXN '
|
||||
go to 9000
|
||||
@@ -149,7 +149,7 @@ c | generated in DSAUPD to start the Arnoldi iteration. |
|
||||
c %-----------------------------------------------------%
|
||||
c
|
||||
lworkl = ncv**2+8*ncv
|
||||
tol = zero
|
||||
tol = zero
|
||||
ido = 0
|
||||
info = 0
|
||||
c
|
||||
@@ -186,10 +186,10 @@ c | and subdiagonals within the band of |
|
||||
c | matrices A and M. |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
kl = 1
|
||||
ku = 1
|
||||
kl = 1
|
||||
ku = 1
|
||||
c
|
||||
c %---------------%
|
||||
c %---------------%
|
||||
c | Main diagonal |
|
||||
c %---------------%
|
||||
c
|
||||
@@ -199,12 +199,12 @@ c
|
||||
do 30 j = 1, n
|
||||
a(idiag,j) = two / h
|
||||
m(idiag,j) = r1 * h
|
||||
30 continue
|
||||
c
|
||||
30 continue
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | First subdiagonal and superdiagonal |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
c
|
||||
r2 = one / six
|
||||
isup = kl+ku
|
||||
isub = kl+ku+2
|
||||
@@ -225,9 +225,9 @@ c | V. |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
rvec = .true.
|
||||
call dsband ( rvec, 'A', select, d, v, ldv, sigma, n, a, m, lda,
|
||||
& rfac, kl, ku, which, bmat, nev, tol,
|
||||
& resid, ncv, v, ldv, iparam, workd, workl, lworkl,
|
||||
call dsband ( rvec, 'A', select, d, v, ldv, sigma, n, a, m, lda,
|
||||
& rfac, kl, ku, which, bmat, nev, tol,
|
||||
& resid, ncv, v, ldv, iparam, workd, workl, lworkl,
|
||||
& iwork, info)
|
||||
c
|
||||
if ( info .eq. 0) then
|
||||
@@ -261,21 +261,21 @@ c | || A*x - lambda*x || |
|
||||
c %----------------------------%
|
||||
c
|
||||
do 90 j = 1, nconv
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
& ax, 1)
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j), 1, zero,
|
||||
call dgbmv ('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j), 1, zero,
|
||||
& mx, 1)
|
||||
call daxpy (n, -d(j,1), mx, 1, ax, 1)
|
||||
d(j,2) = dnrm2 (n, ax, 1)
|
||||
d(j,2) = d(j,2) / abs(d(j,1))
|
||||
c
|
||||
90 continue
|
||||
90 continue
|
||||
|
||||
call dmout (6, nconv, 2, d, maxncv, -6,
|
||||
& 'Ritz values and relative residuals')
|
||||
else
|
||||
else
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | Either convergence failed, or there |
|
||||
@@ -286,8 +286,8 @@ c
|
||||
print *, ' '
|
||||
print *, ' Error with _band, info= ', info
|
||||
print *, ' Check the documentation of _band '
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
c
|
||||
end if
|
||||
c
|
||||
9000 end
|
||||
9000 end
|
||||
|
||||
@@ -1,158 +0,0 @@
|
||||
#
|
||||
# makefile to run simple examples of the reverse communication
|
||||
# protocol.
|
||||
#
|
||||
# Modify if ARPACK library was built somewhere else.
|
||||
#
|
||||
# If ALIBS (defined in ../../ARmake.inc) contains the BLAS and LAPACK
|
||||
# libraries installed on your system, you DO NOT need to change this
|
||||
# makefile. OTHERWISE, you may need to modify the Makefile in the top level
|
||||
# ARPACK directory tree to include sdrv, ddrv, cdrv, or zdrv in the
|
||||
# definition of the PRECISION variable, and issue 'make lib' there.
|
||||
# For example:
|
||||
#
|
||||
# PRECISION = single double sdrv ddrv
|
||||
#
|
||||
#\SCCS Information: @(#)
|
||||
# FILE: makefile SID: 2.2 DATE OF SID: 9/24/96 RELEASE: 2
|
||||
#
|
||||
include ../../ARmake.inc
|
||||
|
||||
# Issue "make band" to make all 32 band drivers.
|
||||
# Issue "make ssbdr" to make 6 single precision symmetric band drivers.
|
||||
# Issue "make dsbdr" to make 6 double precision symmetric band drivers.
|
||||
# Issue "make snbdr" to make 6 single precision nonsymmetric band drivers.
|
||||
# Issue "make dnbdr" to make 6 double precision nonsymmetric band drivers.
|
||||
# Issue "make cnbdr" to make 4 single precision complex band drivers.
|
||||
# Issue "make znbdr" to make 4 double precision complex band drivers.
|
||||
#
|
||||
|
||||
band: ssbdr dsbdr snbdr dnbdr cnbdr znbdr
|
||||
|
||||
#
|
||||
#---------------------------------------------------------------------
|
||||
# Simple symetric problem using BAND solver (single precision)
|
||||
#
|
||||
ssbdr: ssbdr1 ssbdr2 ssbdr3 ssbdr4 ssbdr5 ssbdr6
|
||||
|
||||
ssbdr1: ssbdr1.o ssband.o
|
||||
$(FC) $(FFLAGS) ssbdr1.o ssband.o $(ALIBS) -o ssbdr1
|
||||
#
|
||||
ssbdr2: ssbdr2.o ssband.o
|
||||
$(FC) $(FFLAGS) ssbdr2.o ssband.o $(ALIBS) -o ssbdr2
|
||||
#
|
||||
ssbdr3: ssbdr3.o ssband.o
|
||||
$(FC) $(FFLAGS) ssbdr3.o ssband.o $(ALIBS) -o ssbdr3
|
||||
#
|
||||
ssbdr4: ssbdr4.o ssband.o
|
||||
$(FC) $(FFLAGS) ssbdr4.o ssband.o $(ALIBS) -o ssbdr4
|
||||
#
|
||||
ssbdr5: ssbdr5.o ssband.o
|
||||
$(FC) $(FFLAGS) ssbdr5.o ssband.o $(ALIBS) -o ssbdr5
|
||||
#
|
||||
ssbdr6: ssbdr6.o ssband.o
|
||||
$(FC) $(FFLAGS) ssbdr6.o ssband.o $(ALIBS) -o ssbdr6
|
||||
#
|
||||
#-------------------------------------------------------------
|
||||
#
|
||||
# Simple symmetric problem using BAND solver (double precision)
|
||||
#
|
||||
dsbdr: dsbdr1 dsbdr2 dsbdr3 dsbdr4 dsbdr5 dsbdr6
|
||||
|
||||
dsbdr1: dsbdr1.o dsband.o
|
||||
$(FC) $(FFLAGS) dsbdr1.o dsband.o $(ALIBS) -o dsbdr1
|
||||
#
|
||||
dsbdr2: dsbdr2.o dsband.o
|
||||
$(FC) $(FFLAGS) dsbdr2.o dsband.o $(ALIBS) -o dsbdr2
|
||||
#
|
||||
dsbdr3: dsbdr3.o dsband.o
|
||||
$(FC) $(FFLAGS) dsbdr3.o dsband.o $(ALIBS) -o dsbdr3
|
||||
#
|
||||
dsbdr4: dsbdr4.o dsband.o
|
||||
$(FC) $(FFLAGS) dsbdr4.o dsband.o $(ALIBS) -o dsbdr4
|
||||
#
|
||||
dsbdr5: dsbdr5.o dsband.o
|
||||
$(FC) $(FFLAGS) dsbdr5.o dsband.o $(ALIBS) -o dsbdr5
|
||||
#
|
||||
dsbdr6: dsbdr6.o dsband.o
|
||||
$(FC) $(FFLAGS) dsbdr6.o dsband.o $(ALIBS) -o dsbdr6
|
||||
#
|
||||
#----------------------------------------------------------------------
|
||||
# Simple nonsymmetric problem using BAND solver (single precision)
|
||||
#
|
||||
snbdr: snbdr1 snbdr2 snbdr3 snbdr4 snbdr5 snbdr6
|
||||
|
||||
snbdr1: snbdr1.o snband.o
|
||||
$(FC) $(FFLAGS) snbdr1.o snband.o $(ALIBS) -o snbdr1
|
||||
#
|
||||
snbdr2: snbdr2.o snband.o
|
||||
$(FC) $(FFLAGS) snbdr2.o snband.o $(ALIBS) -o snbdr2
|
||||
#
|
||||
snbdr3: snbdr3.o snband.o
|
||||
$(FC) $(FFLAGS) snbdr3.o snband.o $(ALIBS) -o snbdr3
|
||||
#
|
||||
snbdr4: snbdr4.o snband.o
|
||||
$(FC) $(FFLAGS) snbdr4.o snband.o $(ALIBS) -o snbdr4
|
||||
#
|
||||
snbdr5: snbdr5.o snband.o
|
||||
$(FC) $(FFLAGS) snbdr5.o snband.o $(ALIBS) -o snbdr5
|
||||
#
|
||||
snbdr6: snbdr6.o snband.o
|
||||
$(FC) $(FFLAGS) snbdr6.o snband.o $(ALIBS) -o snbdr6
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
# Simple nonsymmetric problem using BAND solver (double precision)
|
||||
#
|
||||
dnbdr: dnbdr1 dnbdr2 dnbdr3 dnbdr4 dnbdr5 dnbdr6
|
||||
|
||||
dnbdr1: dnbdr1.o dnband.o
|
||||
$(FC) $(FFLAGS) dnbdr1.o dnband.o $(ALIBS) -o dnbdr1
|
||||
#
|
||||
dnbdr2: dnbdr2.o dnband.o
|
||||
$(FC) $(FFLAGS) dnbdr2.o dnband.o $(ALIBS) -o dnbdr2
|
||||
#
|
||||
dnbdr3: dnbdr3.o dnband.o
|
||||
$(FC) $(FFLAGS) dnbdr3.o dnband.o $(ALIBS) -o dnbdr3
|
||||
#
|
||||
dnbdr4: dnbdr4.o dnband.o
|
||||
$(FC) $(FFLAGS) dnbdr4.o dnband.o $(ALIBS) -o dnbdr4
|
||||
#
|
||||
dnbdr5: dnbdr5.o dnband.o
|
||||
$(FC) $(FFLAGS) dnbdr5.o dnband.o $(ALIBS) -o dnbdr5
|
||||
#
|
||||
dnbdr6: dnbdr6.o dnband.o
|
||||
$(FC) $(FFLAGS) dnbdr6.o dnband.o $(ALIBS) -o dnbdr6
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
# Complex problem using BAND solver (single precision complex)
|
||||
#
|
||||
cnbdr: cnbdr1 cnbdr2 cnbdr3 cnbdr4
|
||||
|
||||
cnbdr1: cnbdr1.o cnband.o
|
||||
$(FC) $(FFLAGS) cnbdr1.o cnband.o $(ALIBS) -o cnbdr1
|
||||
#
|
||||
cnbdr2: cnbdr2.o cnband.o
|
||||
$(FC) $(FFLAGS) cnbdr2.o cnband.o $(ALIBS) -o cnbdr2
|
||||
#
|
||||
cnbdr3: cnbdr3.o cnband.o
|
||||
$(FC) $(FFLAGS) cnbdr3.o cnband.o $(ALIBS) -o cnbdr3
|
||||
#
|
||||
cnbdr4: cnbdr4.o cnband.o
|
||||
$(FC) $(FFLAGS) cnbdr4.o cnband.o $(ALIBS) -o cnbdr4
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
# Complex problem using BAND solver (double precision complex)
|
||||
#
|
||||
znbdr: znbdr1 znbdr2 znbdr3 znbdr4
|
||||
|
||||
znbdr1: znbdr1.o znband.o
|
||||
$(FC) $(FFLAGS) znbdr1.o znband.o $(ALIBS) -o znbdr1
|
||||
#
|
||||
znbdr2: znbdr2.o znband.o
|
||||
$(FC) $(FFLAGS) znbdr2.o znband.o $(ALIBS) -o znbdr2
|
||||
#
|
||||
znbdr3: znbdr3.o znband.o
|
||||
$(FC) $(FFLAGS) znbdr3.o znband.o $(ALIBS) -o znbdr3
|
||||
#
|
||||
znbdr4: znbdr4.o znband.o
|
||||
$(FC) $(FFLAGS) znbdr4.o znband.o $(ALIBS) -o znbdr4
|
||||
+201
-201
@@ -35,18 +35,18 @@ c Mode 2: A*z = lambda*M*z, M symmetric positive definite
|
||||
c ===> OP = inv[M]*A and B = M.
|
||||
c
|
||||
c Mode 3: A*z = lambda*M*z, M symmetric semi-definite
|
||||
c ===> OP = Real_Part{ inv[A - sigma*M]*M } and B = M.
|
||||
c ===> OP = Real_Part{ inv[A - sigma*M]*M } and B = M.
|
||||
c ===> shift-and-invert mode (in real arithmetic)
|
||||
c If OP*z = amu*z, then
|
||||
c If OP*z = amu*z, then
|
||||
c amu = 1/2 * [ 1/(lambda-sigma) + 1/(lambda-conjg(sigma)) ].
|
||||
c Note: If sigma is real, i.e. imaginary part of sigma is zero;
|
||||
c Real_Part{ inv[A - sigma*M]*M } == inv[A - sigma*M]*M
|
||||
c amu == 1/(lambda-sigma).
|
||||
c
|
||||
c Real_Part{ inv[A - sigma*M]*M } == inv[A - sigma*M]*M
|
||||
c amu == 1/(lambda-sigma).
|
||||
c
|
||||
c Mode 4: A*z = lambda*M*z, M symmetric semi-definite
|
||||
c ===> OP = Imaginary_Part{ inv[A - sigma*M]*M } and B = M.
|
||||
c ===> OP = Imaginary_Part{ inv[A - sigma*M]*M } and B = M.
|
||||
c ===> shift-and-invert mode (in real arithmetic)
|
||||
c If OP*z = amu*z, then
|
||||
c If OP*z = amu*z, then
|
||||
c amu = 1/2i * [ 1/(lambda-sigma) - 1/(lambda-conjg(sigma)) ].
|
||||
c
|
||||
c
|
||||
@@ -54,28 +54,28 @@ c The choice of mode must be specified in IPARAM(7) defined below.
|
||||
c
|
||||
c \Usage
|
||||
c call snband
|
||||
c ( RVEC, HOWMNY, SELECT, DR, DI, Z, LDZ, SIGMAR, SIGMAI,
|
||||
c WORKEV, V, N, AB, MB, LDA, RFAC, CFAC, KL, KU, WHICH,
|
||||
c BMAT, NEV, TOL, RESID, NCV, V, LDV, IPARAM, WORKD,
|
||||
c ( RVEC, HOWMNY, SELECT, DR, DI, Z, LDZ, SIGMAR, SIGMAI,
|
||||
c WORKEV, V, N, AB, MB, LDA, RFAC, CFAC, KL, KU, WHICH,
|
||||
c BMAT, NEV, TOL, RESID, NCV, V, LDV, IPARAM, WORKD,
|
||||
c WORKL, LWORKL, WORKC, IWORK, INFO )
|
||||
c
|
||||
c \Arguments
|
||||
c
|
||||
c RVEC LOGICAL (INPUT)
|
||||
c Specifies whether a basis for the invariant subspace corresponding
|
||||
c to the converged Ritz value approximations for the eigenproblem
|
||||
c
|
||||
c RVEC LOGICAL (INPUT)
|
||||
c Specifies whether a basis for the invariant subspace corresponding
|
||||
c to the converged Ritz value approximations for the eigenproblem
|
||||
c A*z = lambda*B*z is computed.
|
||||
c
|
||||
c RVEC = .FALSE. Compute Ritz values only.
|
||||
c
|
||||
c RVEC = .TRUE. Compute the Ritz vectors or Schur vectors.
|
||||
c See Remarks below.
|
||||
c See Remarks below.
|
||||
c
|
||||
c HOWMNY Character*1 (INPUT)
|
||||
c Specifies the form of the basis for the invariant subspace
|
||||
c HOWMNY Character*1 (INPUT)
|
||||
c Specifies the form of the basis for the invariant subspace
|
||||
c corresponding to the converged Ritz values that is to be computed.
|
||||
c
|
||||
c = 'A': Compute NEV Ritz vectors;
|
||||
c = 'A': Compute NEV Ritz vectors;
|
||||
c = 'P': Compute NEV Schur vectors;
|
||||
c = 'S': compute some of the Ritz vectors, specified
|
||||
c by the logical array SELECT.
|
||||
@@ -83,23 +83,23 @@ c
|
||||
c SELECT Logical array of dimension NCV. (INPUT)
|
||||
c If HOWMNY = 'S', SELECT specifies the Ritz vectors to be
|
||||
c computed. To select the Ritz vector corresponding to a
|
||||
c Ritz value (DR(j), DI(j)), SELECT(j) must be set to .TRUE..
|
||||
c Ritz value (DR(j), DI(j)), SELECT(j) must be set to .TRUE..
|
||||
c If HOWMNY = 'A' or 'P', SELECT is used as internal workspace.
|
||||
c
|
||||
c DR Real array of dimension NEV+1. (OUTPUT)
|
||||
c On exit, DR contains the real part of the Ritz value approximations
|
||||
c to the eigenvalues of A*z = lambda*B*z.
|
||||
c On exit, DR contains the real part of the Ritz value approximations
|
||||
c to the eigenvalues of A*z = lambda*B*z.
|
||||
c
|
||||
c DI Real array of dimension NEV+1. (OUTPUT)
|
||||
c On exit, DI contains the imaginary part of the Ritz value
|
||||
c On exit, DI contains the imaginary part of the Ritz value
|
||||
c approximations to the eigenvalues of A*z = lambda*B*z associated
|
||||
c with DR.
|
||||
c with DR.
|
||||
c
|
||||
c NOTE: When Ritz values are complex, they will come in complex
|
||||
c conjugate pairs. If eigenvectors are requested, the
|
||||
c corresponding Ritz vectors will also come in conjugate
|
||||
c pairs and the real and imaginary parts of these are
|
||||
c represented in two consecutive columns of the array Z
|
||||
c NOTE: When Ritz values are complex, they will come in complex
|
||||
c conjugate pairs. If eigenvectors are requested, the
|
||||
c corresponding Ritz vectors will also come in conjugate
|
||||
c pairs and the real and imaginary parts of these are
|
||||
c represented in two consecutive columns of the array Z
|
||||
c (see below).
|
||||
c
|
||||
c Z Real N by NEV+1 array if RVEC = .TRUE. and HOWMNY = 'A'. (OUTPUT)
|
||||
@@ -124,24 +124,24 @@ c the array Z may be set equal to first NEV+1 columns of the Arnoldi
|
||||
c basis array V computed by SNAUPD. In this case the Arnoldi basis
|
||||
c will be destroyed and overwritten with the eigenvector basis.
|
||||
c
|
||||
c LDZ Integer. (INPUT)
|
||||
c The leading dimension of the array Z. If Ritz vectors are
|
||||
c desired, then LDZ >= max( 1, N ). In any case, LDZ >= 1.
|
||||
c
|
||||
c SIGMAR Real (INPUT)
|
||||
c If IPARAM(7) = 3 or 4, represents the real part of the shift.
|
||||
c Not referenced if IPARAM(7) = 1 or 2.
|
||||
c
|
||||
c SIGMAI Real (INPUT)
|
||||
c If IPARAM(7) = 3 or 4, represents the imaginary part of the
|
||||
c shift.
|
||||
c Not referenced if IPARAM(7) = 1 or 2.
|
||||
c
|
||||
c WORKEV Real work array of dimension 3*NCV. (WORKSPACE)
|
||||
c
|
||||
c N Integer. (INPUT)
|
||||
c Dimension of the eigenproblem.
|
||||
c
|
||||
c LDZ Integer. (INPUT)
|
||||
c The leading dimension of the array Z. If Ritz vectors are
|
||||
c desired, then LDZ >= max( 1, N ). In any case, LDZ >= 1.
|
||||
c
|
||||
c SIGMAR Real (INPUT)
|
||||
c If IPARAM(7) = 3 or 4, represents the real part of the shift.
|
||||
c Not referenced if IPARAM(7) = 1 or 2.
|
||||
c
|
||||
c SIGMAI Real (INPUT)
|
||||
c If IPARAM(7) = 3 or 4, represents the imaginary part of the
|
||||
c shift.
|
||||
c Not referenced if IPARAM(7) = 1 or 2.
|
||||
c
|
||||
c WORKEV Real work array of dimension 3*NCV. (WORKSPACE)
|
||||
c
|
||||
c N Integer. (INPUT)
|
||||
c Dimension of the eigenproblem.
|
||||
c
|
||||
c AB Real array of dimension LDA by N. (INPUT)
|
||||
c The matrix A in band storage, in rows KL+1 to
|
||||
c 2*KL+KU+1; rows 1 to KL of the array need not be set.
|
||||
@@ -151,25 +151,25 @@ c AB(kl+ku+1+i-j,j) = A(i,j) for max(1,j-ku)<=i<=min(m,j+kl)
|
||||
c
|
||||
c MB Real array of dimension LDA by N. (INPUT)
|
||||
c The matrix M in band storage, in rows KL+1 to
|
||||
c 2*KL+KU+1; rows 1 to KL of the array need not be set.
|
||||
c 2*KL+KU+1; rows 1 to KL of the array need not be set.
|
||||
c The j-th column of M is stored in the j-th column of the
|
||||
c array AB as follows:
|
||||
c MB(kl+ku+1+i-j,j) = M(i,j) for max(1,j-ku)<=i<=min(m,j+kl)
|
||||
c Not referenced if IPARAM(7) = 1
|
||||
c
|
||||
c LDA Integer. (INPUT)
|
||||
c Leading dimension of AB, MB, RFAC and CFAC.
|
||||
c Leading dimension of AB, MB, RFAC and CFAC.
|
||||
c
|
||||
c RFAC Real array of LDA by N. (WORKSPACE/OUTPUT)
|
||||
c RFAC is used to store the LU factors of MB when IPARAM(7) = 2
|
||||
c RFAC is used to store the LU factors of MB when IPARAM(7) = 2
|
||||
c is invoked. It is used to store the LU factors of
|
||||
c (A-sigma*M) when IPARAM(7) = 3 is invoked with a real shift.
|
||||
c It is not referenced when IPARAM(7) = 1 or 4.
|
||||
c
|
||||
c CFAC Complex array of LDA by N. (WORKSPACE/OUTPUT)
|
||||
c CFAC is used to store (A-SIGMA*M) and its LU factors
|
||||
c when IPARAM(7) = 3 or 4 are used with a complex shift SIGMA.
|
||||
c On exit, it contains the LU factors of (A-SIGMA*M).
|
||||
c when IPARAM(7) = 3 or 4 are used with a complex shift SIGMA.
|
||||
c On exit, it contains the LU factors of (A-SIGMA*M).
|
||||
c It is not referenced when IPARAM(7) = 1 or 2.
|
||||
c
|
||||
c KL Integer. (INPUT)
|
||||
@@ -181,7 +181,7 @@ c
|
||||
c WHICH Character*2. (INPUT)
|
||||
c When IPARAM(7)= 1 or 2, WHICH can be set to any one of
|
||||
c the following.
|
||||
c
|
||||
c
|
||||
c 'LM' -> want the NEV eigenvalues of largest magnitude.
|
||||
c 'SM' -> want the NEV eigenvalues of smallest magnitude.
|
||||
c 'LR' -> want the NEV eigenvalues of largest real part.
|
||||
@@ -189,8 +189,8 @@ c 'SR' -> want the NEV eigenvalues of smallest real part.
|
||||
c 'LI' -> want the NEV eigenvalues of largest imaginary part.
|
||||
c 'SI' -> want the NEV eigenvalues of smallest imaginary part.
|
||||
c
|
||||
c When IPARAM(7) = 3 or 4, WHICH should be set to 'LM' only.
|
||||
c
|
||||
c When IPARAM(7) = 3 or 4, WHICH should be set to 'LM' only.
|
||||
c
|
||||
c BMAT Character*1. (INPUT)
|
||||
c BMAT specifies the type of the matrix B that defines the
|
||||
c semi-inner product for the operator OP.
|
||||
@@ -199,9 +199,9 @@ c BMAT = 'G' -> generalized eigenvalue problem A*z = lambda*M*z
|
||||
|
||||
c NEV Integer. (INPUT)
|
||||
c Number of eigenvalues to be computed.
|
||||
c
|
||||
c
|
||||
c TOL Real scalar. (INPUT)
|
||||
c Stopping criteria: the relative accuracy of the Ritz value
|
||||
c Stopping criteria: the relative accuracy of the Ritz value
|
||||
c is considered acceptable if BOUNDS(I) .LE. TOL*ABS(RITZ(I)).
|
||||
c If TOL .LE. 0. is passed a default is set:
|
||||
c DEFAULT = SLAMCH('EPS') (machine precision as computed
|
||||
@@ -221,12 +221,12 @@ c Represents the dimension of the Arnoldi basis constructed
|
||||
c by snaupd for OP.
|
||||
c
|
||||
c V Real array N by NCV+1. (OUTPUT)
|
||||
c Upon OUTPUT: If RVEC = .TRUE. the first NCONV=IPARAM(5) columns
|
||||
c represent approximate Schur vectors that span the
|
||||
c Upon OUTPUT: If RVEC = .TRUE. the first NCONV=IPARAM(5) columns
|
||||
c represent approximate Schur vectors that span the
|
||||
c desired invariant subspace.
|
||||
c NOTE: The array Z may be set equal to first NEV+1 columns of the
|
||||
c NOTE: The array Z may be set equal to first NEV+1 columns of the
|
||||
c Arnoldi basis vector array V computed by SNAUPD. In this case
|
||||
c if RVEC = .TRUE. and HOWMNY='A', then the first NCONV=IPARAM(5)
|
||||
c if RVEC = .TRUE. and HOWMNY='A', then the first NCONV=IPARAM(5)
|
||||
c are the desired Ritz vectors.
|
||||
c
|
||||
c LDV Integer. (INPUT)
|
||||
@@ -234,7 +234,7 @@ c Leading dimension of V exactly as declared in the calling
|
||||
c program.
|
||||
c
|
||||
c IPARAM Integer array of length 11. (INPUT/OUTPUT)
|
||||
c IPARAM(1) = ISHIFT:
|
||||
c IPARAM(1) = ISHIFT:
|
||||
c The shifts selected at each iteration are used to restart
|
||||
c the Arnoldi iteration in an implicit fashion.
|
||||
c It is set to 1 in this subroutine. The user do not need
|
||||
@@ -248,7 +248,7 @@ c combination of Ritz vectors associated with the
|
||||
c "wanted" eigenvalues.
|
||||
c -------------------------------------------------------------
|
||||
c
|
||||
c IPARAM(2) = No longer referenced.
|
||||
c IPARAM(2) = No longer referenced.
|
||||
c
|
||||
c IPARAM(3) = MXITER
|
||||
c On INPUT: max number of Arnoldi update iterations allowed.
|
||||
@@ -262,9 +262,9 @@ c
|
||||
c IPARAM(6) = IUPD
|
||||
c Not referenced. Implicit restarting is ALWAYS used.
|
||||
c
|
||||
c IPARAM(7) = IPARAM(7):
|
||||
c IPARAM(7) = IPARAM(7):
|
||||
c On INPUT determines what type of eigenproblem is being solved.
|
||||
c Must be 1,2,3,4; See under \Description of snband for the
|
||||
c Must be 1,2,3,4; See under \Description of snband for the
|
||||
c four modes available.
|
||||
c
|
||||
c IPARAM(9) = NUMOP, IPARAM(10) = NUMOPB, IPARAM(11) = NUMREO,
|
||||
@@ -280,22 +280,22 @@ c LWORKL Integer. (INPUT)
|
||||
c LWORKL must be at least 3*NCV**2 + 6*NCV.
|
||||
c
|
||||
c WORKC Complex array of length N. (WORKSPACE)
|
||||
c Workspace used when IPARAM(7) = 3 or 4 for storing a temporary
|
||||
c Workspace used when IPARAM(7) = 3 or 4 for storing a temporary
|
||||
c complex vector.
|
||||
c
|
||||
c IWORK Integer array of dimension at least N. (WORKSPACE)
|
||||
c Used when IPARAM(7)=2,3,4 to store the pivot information in the
|
||||
c Used when IPARAM(7)=2,3,4 to store the pivot information in the
|
||||
c factorization of M or (A-SIGMA*M).
|
||||
c
|
||||
c
|
||||
c INFO Integer. (INPUT/OUTPUT)
|
||||
c Error flag on output.
|
||||
c = 0: Normal exit.
|
||||
c = 1: The Schur form computed by LAPACK routine slahqr
|
||||
c could not be reordered by LAPACK routine strsen.
|
||||
c Re-enter subroutine SNEUPD with IPARAM(5)=NCV and
|
||||
c increase the size of the arrays DR and DI to have
|
||||
c dimension at least NCV and allocate at least NCV
|
||||
c columns for Z. NOTE: Not necessary if Z and V share
|
||||
c Re-enter subroutine SNEUPD with IPARAM(5)=NCV and
|
||||
c increase the size of the arrays DR and DI to have
|
||||
c dimension at least NCV and allocate at least NCV
|
||||
c columns for Z. NOTE: Not necessary if Z and V share
|
||||
c the same space. Please notify the authors.
|
||||
c
|
||||
c = -1: N must be positive.
|
||||
@@ -314,9 +314,9 @@ c = -12: HOWMNY = 'S' not yet implemented
|
||||
c = -13: HOWMNY must be one of 'A' or 'P'
|
||||
c = -14: SNAUPD did not find any eigenvalues to sufficient
|
||||
c accuracy.
|
||||
c = -15: Overflow occurs when we try to transform the Ritz
|
||||
c = -15: Overflow occurs when we try to transform the Ritz
|
||||
c values returned from SNAUPD to those of the original
|
||||
c problem using Rayleigh Quotient.
|
||||
c problem using Rayleigh Quotient.
|
||||
c = -9999: Could not build an Arnoldi factorization.
|
||||
c IPARAM(5) returns the size of the current
|
||||
c Arnoldi factorization.
|
||||
@@ -332,7 +332,7 @@ c 1. D.C. Sorensen, "Implicit Application of Polynomial Filters in
|
||||
c a k-Step Arnoldi Method", SIAM J. Matr. Anal. Apps., 13 (1992),
|
||||
c pp 357-385.
|
||||
c
|
||||
c 2. R.B. Lehoucq, "Analysis and Implementation of an Implicitly
|
||||
c 2. R.B. Lehoucq, "Analysis and Implementation of an Implicitly
|
||||
c Restarted Arnoldi Iteration", Ph.D thesis, TR95-13, Rice Univ,
|
||||
c May 1995.
|
||||
c
|
||||
@@ -363,9 +363,9 @@ c Ritz vectors. Thus, their numerical properties are often superior.
|
||||
c If RVEC = .TRUE. then the relationship
|
||||
c A * V(:,1:IPARAM(5)) = V(:,1:IPARAM(5)) * T, and
|
||||
c V(:,1:IPARAM(5))' * V(:,1:IPARAM(5)) = I are approximately satisfied.
|
||||
c Here T is the leading submatrix of order IPARAM(5) of the real
|
||||
c Here T is the leading submatrix of order IPARAM(5) of the real
|
||||
c upper quasi-triangular matrix stored workl(ipntr(12)). That is,
|
||||
c T is block upper triangular with 1-by-1 and 2-by-2 diagonal blocks;
|
||||
c T is block upper triangular with 1-by-1 and 2-by-2 diagonal blocks;
|
||||
c each 2-by-2 diagonal block has its diagonal elements equal and its
|
||||
c off-diagonal elements of opposite sign. Corresponding to each 2-by-2
|
||||
c diagonal block is a complex conjugate pair of Ritz values. The real
|
||||
@@ -387,20 +387,20 @@ c\EndLib
|
||||
c
|
||||
c---------------------------------------------------------------------
|
||||
c
|
||||
subroutine snband( rvec, howmny, select, dr, di, z, ldz, sigmar,
|
||||
& sigmai, workev, n, ab, mb, lda, rfac, cfac, kl, ku,
|
||||
& which, bmat, nev, tol, resid, ncv, v, ldv,
|
||||
subroutine snband( rvec, howmny, select, dr, di, z, ldz, sigmar,
|
||||
& sigmai, workev, n, ab, mb, lda, rfac, cfac, kl, ku,
|
||||
& which, bmat, nev, tol, resid, ncv, v, ldv,
|
||||
& iparam, workd, workl, lworkl, workc, iwork, info)
|
||||
c
|
||||
c %------------------%
|
||||
c | Scalar Arguments |
|
||||
c %------------------%
|
||||
c
|
||||
c
|
||||
character which*2, bmat, howmny
|
||||
integer n, lda, kl, ku, nev, ncv, ldv,
|
||||
& ldz, lworkl, info
|
||||
& ldz, lworkl, info
|
||||
Real
|
||||
& tol, sigmar, sigmai
|
||||
& tol, sigmar, sigmai
|
||||
c
|
||||
c %-----------------%
|
||||
c | Array Arguments |
|
||||
@@ -410,7 +410,7 @@ c
|
||||
logical select(*)
|
||||
Real
|
||||
& dr(*), di(*), resid(*), v(ldv,*), z(ldz,*),
|
||||
& ab(lda,*), mb(lda,*), rfac(lda,*),
|
||||
& ab(lda,*), mb(lda,*), rfac(lda,*),
|
||||
& workd(*), workl(*), workev(*)
|
||||
Complex
|
||||
& cfac(lda,*), workc(*)
|
||||
@@ -426,9 +426,9 @@ c | Local Scalars |
|
||||
c %---------------%
|
||||
c
|
||||
integer ido, i, j, type, imid, itop, ibot, ierr
|
||||
Real
|
||||
& numr, denr, deni, dmdul, safmin
|
||||
logical rvec, first
|
||||
Real
|
||||
& numr, denr, deni, dmdul, safmin
|
||||
logical rvec, first
|
||||
c
|
||||
c %------------%
|
||||
c | Parameters |
|
||||
@@ -445,7 +445,7 @@ c %-----------------------------%
|
||||
c
|
||||
Real
|
||||
& sdot, snrm2, slapy2, slamch
|
||||
external sdot, scopy, sgbmv, cgbtrf, cgbtrs, sgbtrf,
|
||||
external sdot, scopy, sgbmv, cgbtrf, cgbtrs, sgbtrf,
|
||||
& sgbtrs, snrm2, slapy2, slacpy, slamch
|
||||
c
|
||||
c %---------------------%
|
||||
@@ -464,17 +464,17 @@ c | that 1/sfmin does not overflow |
|
||||
c %--------------------------------%
|
||||
c
|
||||
safmin = slamch('safmin')
|
||||
c
|
||||
c
|
||||
c %----------------------------------------------------------------%
|
||||
c | Set type of the problem to be solved. Check consistency |
|
||||
c | between BMAT and IPARAM(7). |
|
||||
c | type = 1 --> Solving standard problem in regular mode. |
|
||||
c | type = 2 --> Solving standard problem in shift-invert mode. |
|
||||
c | type = 2 --> Solving standard problem in shift-invert mode. |
|
||||
c | type = 3 --> Solving generalized problem in regular mode. |
|
||||
c | type = 4 --> Solving generalized problem in shift-invert mode. |
|
||||
c | type = 5 --> Solving standard problem in shift-invert mode |
|
||||
c | using iparam(7) = 4 in SNAUPD. |
|
||||
c | type = 6 --> Solving generalized problem in shift-invert mode. |
|
||||
c | type = 6 --> Solving generalized problem in shift-invert mode. |
|
||||
c | using iparam(7) = 4 in SNAUPD. |
|
||||
c %----------------------------------------------------------------%
|
||||
c
|
||||
@@ -485,19 +485,19 @@ c
|
||||
else if ( iparam(7) .eq. 2 ) then
|
||||
type = 3
|
||||
else if ( iparam(7) .eq. 3 .and. bmat .eq. 'G') then
|
||||
type = 4
|
||||
type = 4
|
||||
else if ( iparam(7) .eq. 4 .and. bmat .eq. 'I') then
|
||||
type = 5
|
||||
else if ( iparam(7) .eq. 4 .and. bmat .eq. 'G') then
|
||||
else if ( iparam(7) .eq. 4 .and. bmat .eq. 'G') then
|
||||
type = 6
|
||||
else
|
||||
print*, ' '
|
||||
print*, 'BMAT is inconsistent with IPARAM(7).'
|
||||
print*, ' '
|
||||
print*, ' '
|
||||
go to 9000
|
||||
end if
|
||||
c
|
||||
c %----------------------------------%
|
||||
c %----------------------------------%
|
||||
c | When type = 5,6 are used, sigmai |
|
||||
c | must be nonzero. |
|
||||
c %----------------------------------%
|
||||
@@ -505,16 +505,16 @@ c
|
||||
if ( type .eq. 5 .or. type .eq. 6 ) then
|
||||
if ( sigmai .eq. zero ) then
|
||||
print*, ' '
|
||||
print*, '_NBAND: sigmai must be nonzero when type 5 or 6
|
||||
print*, '_NBAND: sigmai must be nonzero when type 5 or 6
|
||||
& is used. '
|
||||
print*, ' '
|
||||
go to 9000
|
||||
end if
|
||||
end if
|
||||
end if
|
||||
c
|
||||
c %------------------------%
|
||||
c | Initialize the reverse |
|
||||
c | communication flag. |
|
||||
c | communication flag. |
|
||||
c %------------------------%
|
||||
c
|
||||
ido = 0
|
||||
@@ -546,7 +546,7 @@ c | Factor (A-sigma*I). |
|
||||
c %-------------------------------%
|
||||
c
|
||||
if (sigmai .eq. zero) then
|
||||
c
|
||||
c
|
||||
c %-----------------------------------%
|
||||
c | Construct (A-sigmar*I) and factor |
|
||||
c | in real arithmetic. |
|
||||
@@ -558,7 +558,7 @@ c
|
||||
10 continue
|
||||
call sgbtrf(n, n, kl, ku, rfac, lda, iwork, ierr )
|
||||
if (ierr .ne. 0) then
|
||||
print*, ' '
|
||||
print*, ' '
|
||||
print*, ' _NBAND: Error with _gbtrf. '
|
||||
print*, ' '
|
||||
go to 9000
|
||||
@@ -574,24 +574,24 @@ c
|
||||
do 30 j = 1, n
|
||||
do 20 i = itop, ibot
|
||||
cfac(i,j) = cmplx(ab(i,j))
|
||||
20 continue
|
||||
20 continue
|
||||
30 continue
|
||||
c
|
||||
do 40 j = 1, n
|
||||
cfac(imid,j) = cfac(imid,j)
|
||||
cfac(imid,j) = cfac(imid,j)
|
||||
$ - cmplx(sigmar, sigmai)
|
||||
40 continue
|
||||
c
|
||||
call cgbtrf(n, n, kl, ku, cfac, lda, iwork, ierr )
|
||||
40 continue
|
||||
c
|
||||
call cgbtrf(n, n, kl, ku, cfac, lda, iwork, ierr )
|
||||
if ( ierr .ne. 0) then
|
||||
print*, ' '
|
||||
print*, ' _NBAND: Error with _gbtrf. '
|
||||
print*, ' '
|
||||
go to 9000
|
||||
end if
|
||||
c
|
||||
c
|
||||
end if
|
||||
|
||||
|
||||
else if ( type .eq. 3 ) then
|
||||
c
|
||||
c %-----------------------------------------------%
|
||||
@@ -603,7 +603,7 @@ c
|
||||
call slacpy ('A', ibot, n, mb, lda, rfac, lda )
|
||||
call sgbtrf(n, n, kl, ku, rfac, lda, iwork, ierr)
|
||||
if (ierr .ne. 0) then
|
||||
print*, ' '
|
||||
print*, ' '
|
||||
print*,'_NBAND: Error with _gbtrf.'
|
||||
print*, ' '
|
||||
go to 9000
|
||||
@@ -615,7 +615,7 @@ c %-------------------------------------------%
|
||||
c | Solving generalized eigenvalue problem in |
|
||||
c | shift-invert mode. |
|
||||
c %-------------------------------------------%
|
||||
c
|
||||
c
|
||||
if ( sigmai .eq. zero ) then
|
||||
c
|
||||
c %--------------------------------------------%
|
||||
@@ -624,7 +624,7 @@ c | arithmetic. |
|
||||
c %--------------------------------------------%
|
||||
c
|
||||
do 60 j = 1,n
|
||||
do 50 i = itop, ibot
|
||||
do 50 i = itop, ibot
|
||||
rfac(i,j) = ab(i,j) - sigmar*mb(i,j)
|
||||
50 continue
|
||||
60 continue
|
||||
@@ -642,13 +642,13 @@ c
|
||||
c %-----------------------------------------------%
|
||||
c | Construct (A - sigma*M) and factor in complex |
|
||||
c | arithmetic. |
|
||||
c %-----------------------------------------------%
|
||||
c %-----------------------------------------------%
|
||||
c
|
||||
do 80 j = 1,n
|
||||
do 70 i = itop, ibot
|
||||
cfac(i,j) = cmplx( ab(i,j)-sigmar*mb(i,j),
|
||||
do 70 i = itop, ibot
|
||||
cfac(i,j) = cmplx( ab(i,j)-sigmar*mb(i,j),
|
||||
& -sigmai*mb(i,j) )
|
||||
70 continue
|
||||
70 continue
|
||||
80 continue
|
||||
c
|
||||
call cgbtrf(n, n, kl, ku, cfac, lda, iwork, ierr)
|
||||
@@ -658,7 +658,7 @@ c
|
||||
print*, ' '
|
||||
go to 9000
|
||||
end if
|
||||
c
|
||||
c
|
||||
end if
|
||||
c
|
||||
end if
|
||||
@@ -667,7 +667,7 @@ c %--------------------------------------------%
|
||||
c | M A I N L O O P (reverse communication) |
|
||||
c %--------------------------------------------%
|
||||
c
|
||||
90 continue
|
||||
90 continue
|
||||
c
|
||||
call snaupd ( ido, bmat, n, which, nev, tol, resid, ncv,
|
||||
& v, ldv, iparam, ipntr, workd, workl, lworkl,
|
||||
@@ -681,8 +681,8 @@ c %----------------------------%
|
||||
c | Perform y <--- OP*x = A*x |
|
||||
c %----------------------------%
|
||||
c
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
& workd(ipntr(2)), 1)
|
||||
c
|
||||
else if ( type .eq. 2 ) then
|
||||
@@ -690,7 +690,7 @@ c
|
||||
if (sigmai .eq. zero) then
|
||||
c
|
||||
c %----------------------------------%
|
||||
c | Shift is real. Perform |
|
||||
c | Shift is real. Perform |
|
||||
c | y <--- OP*x = inv[A-sigmar*I]*x |
|
||||
c | to force the starting vector |
|
||||
c | into the range of OP. |
|
||||
@@ -700,7 +700,7 @@ c
|
||||
call sgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
|
||||
& iwork, workd(ipntr(2)), n, ierr)
|
||||
if ( ierr .ne. 0 ) then
|
||||
print*, ' '
|
||||
print*, ' '
|
||||
print*, ' _NBAND: Error with _bgtrs. '
|
||||
print*, ' '
|
||||
go to 9000
|
||||
@@ -711,8 +711,8 @@ c
|
||||
c %--------------------------------------------%
|
||||
c | Shift is COMPLEX. Perform |
|
||||
c | y <--- OP*x = Real_Part{inv[A-sigma*I]*x} |
|
||||
c | to force the starting vector into the |
|
||||
c | range of OP. |
|
||||
c | to force the starting vector into the |
|
||||
c | range of OP. |
|
||||
c %--------------------------------------------%
|
||||
c
|
||||
do 100 j = 1, n
|
||||
@@ -732,21 +732,21 @@ c
|
||||
workd(ipntr(2)+j-1) = real(workc(j))
|
||||
110 continue
|
||||
c
|
||||
end if
|
||||
c
|
||||
end if
|
||||
c
|
||||
else if ( type .eq. 3 ) then
|
||||
c
|
||||
c %-----------------------------------%
|
||||
c | Perform y <--- OP*x = inv[M]*A*x |
|
||||
c | to force the starting vector into |
|
||||
c | to force the starting vector into |
|
||||
c | the range of OP. |
|
||||
c %-----------------------------------%
|
||||
c
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
& workd(ipntr(2)), 1)
|
||||
c
|
||||
call sgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
|
||||
call sgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
|
||||
& iwork, workd(ipntr(2)), n, ierr)
|
||||
if (ierr .ne. 0) then
|
||||
print*, ' '
|
||||
@@ -759,13 +759,13 @@ c
|
||||
c
|
||||
c %-----------------------------------------%
|
||||
c | Perform y <-- OP*x |
|
||||
c | = Real_part{inv[A-SIGMA*M]*M}*x |
|
||||
c | = Real_part{inv[A-SIGMA*M]*M}*x |
|
||||
c | to force the starting vector into the |
|
||||
c | range of OP. |
|
||||
c %-----------------------------------------%
|
||||
c
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one, mb(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one, mb(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
& workd(ipntr(2)), 1)
|
||||
c
|
||||
if ( sigmai .eq. zero ) then
|
||||
@@ -773,14 +773,14 @@ c
|
||||
c %---------------------%
|
||||
c | Shift is real, stay |
|
||||
c | in real arithmetic. |
|
||||
c %---------------------%
|
||||
c %---------------------%
|
||||
c
|
||||
call sgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
|
||||
call sgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
|
||||
& iwork, workd(ipntr(2)), n, ierr)
|
||||
if (ierr .ne. 0) then
|
||||
print*, ' '
|
||||
print*, ' '
|
||||
print*, '_NBAND: Error with _gbtrs.'
|
||||
print*, ' '
|
||||
print*, ' '
|
||||
go to 9000
|
||||
end if
|
||||
c
|
||||
@@ -792,26 +792,26 @@ c %--------------------------%
|
||||
c
|
||||
do 120 i = 1,n
|
||||
workc(i) = cmplx(workd(ipntr(2)+i-1))
|
||||
120 continue
|
||||
120 continue
|
||||
c
|
||||
call cgbtrs ('Notranspose', n, kl, ku, 1, cfac, lda,
|
||||
call cgbtrs ('Notranspose', n, kl, ku, 1, cfac, lda,
|
||||
& iwork, workc, n, ierr)
|
||||
if (ierr .ne. 0) then
|
||||
if (ierr .ne. 0) then
|
||||
print*, ' '
|
||||
print*, '_NBAND: Error with _gbtrs.'
|
||||
print*, '_NBAND: Error with _gbtrs.'
|
||||
print*, ' '
|
||||
go to 9000
|
||||
end if
|
||||
c
|
||||
do 130 i = 1, n
|
||||
workd(ipntr(2)+i-1) = real(workc(i))
|
||||
130 continue
|
||||
130 continue
|
||||
c
|
||||
end if
|
||||
c
|
||||
else if ( type .eq. 5) then
|
||||
c
|
||||
c %---------------------------------------%
|
||||
c %---------------------------------------%
|
||||
c | Perform y <-- OP*x |
|
||||
c | = Imaginary_part{inv[A-SIGMA*I]}*x |
|
||||
c | to force the starting vector into the |
|
||||
@@ -839,32 +839,32 @@ c
|
||||
c
|
||||
c %----------------------------------------%
|
||||
c | Perform y <-- OP*x |
|
||||
c | Imaginary_part{inv[A-SIGMA*M]*M} |
|
||||
c | Imaginary_part{inv[A-SIGMA*M]*M} |
|
||||
c | to force the starting vector into the |
|
||||
c | range of OP. |
|
||||
c %----------------------------------------%
|
||||
c
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one, mb(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one, mb(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
& workd(ipntr(2)), 1)
|
||||
c
|
||||
do 160 i = 1,n
|
||||
workc(i) = cmplx(workd(ipntr(2)+i-1))
|
||||
160 continue
|
||||
160 continue
|
||||
c
|
||||
call cgbtrs ('Notranspose', n, kl, ku, 1, cfac, lda,
|
||||
call cgbtrs ('Notranspose', n, kl, ku, 1, cfac, lda,
|
||||
& iwork, workc, n, ierr)
|
||||
if (ierr .ne. 0) then
|
||||
if (ierr .ne. 0) then
|
||||
print*, ' '
|
||||
print*, '_NBAND: Error with _gbtrs.'
|
||||
print*, '_NBAND: Error with _gbtrs.'
|
||||
print*, ' '
|
||||
go to 9000
|
||||
end if
|
||||
c
|
||||
do 170 i = 1, n
|
||||
workd(ipntr(2)+i-1) = aimag(workc(i))
|
||||
170 continue
|
||||
c
|
||||
170 continue
|
||||
c
|
||||
end if
|
||||
c
|
||||
else if (ido .eq. 1) then
|
||||
@@ -875,8 +875,8 @@ c %----------------------------%
|
||||
c | Perform y <--- OP*x = A*x |
|
||||
c %----------------------------%
|
||||
c
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
& workd(ipntr(2)), 1)
|
||||
c
|
||||
else if ( type .eq. 2) then
|
||||
@@ -907,7 +907,7 @@ c
|
||||
& iwork, workc, n, ierr)
|
||||
if ( ierr .ne. 0 ) then
|
||||
print*, ' '
|
||||
print*, '_NBAND: Error with _gbtrs.'
|
||||
print*, '_NBAND: Error with _gbtrs.'
|
||||
print*, ' '
|
||||
go to 9000
|
||||
end if
|
||||
@@ -924,16 +924,16 @@ c %-----------------------------------%
|
||||
c | Perform y <--- OP*x = inv[M]*A*x |
|
||||
c %-----------------------------------%
|
||||
c
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
& workd(ipntr(2)), 1)
|
||||
c
|
||||
call sgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
|
||||
call sgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
|
||||
& iwork, workd(ipntr(2)), n, ierr)
|
||||
if (ierr .ne. 0) then
|
||||
print*, ' '
|
||||
print*, '_NBAND: Error with _bgtrs.'
|
||||
print*, ' '
|
||||
print*, ' '
|
||||
go to 9000
|
||||
end if
|
||||
c
|
||||
@@ -942,7 +942,7 @@ c
|
||||
c %--------------------------------------%
|
||||
c | Perform y <-- inv(A-sigma*M)*(M*x). |
|
||||
c | (M*x) has been computed and stored |
|
||||
c | in workd(ipntr(3)). |
|
||||
c | in workd(ipntr(3)). |
|
||||
c %--------------------------------------%
|
||||
c
|
||||
if ( sigmai .eq. zero ) then
|
||||
@@ -953,16 +953,16 @@ c | real arithmetic. |
|
||||
c %------------------------%
|
||||
c
|
||||
call scopy(n, workd(ipntr(3)), 1, workd(ipntr(2)), 1)
|
||||
call sgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
|
||||
call sgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
|
||||
& iwork, workd(ipntr(2)), n, ierr)
|
||||
if (ierr .ne. 0) then
|
||||
if (ierr .ne. 0) then
|
||||
print*, ' '
|
||||
print*, '_NBAND: Error with _gbtrs.'
|
||||
print*, '_NBAND: Error with _gbtrs.'
|
||||
print*, ' '
|
||||
go to 9000
|
||||
end if
|
||||
c
|
||||
else
|
||||
c
|
||||
else
|
||||
c
|
||||
c %---------------------------%
|
||||
c | Go to COMPLEX arithmetic. |
|
||||
@@ -970,26 +970,26 @@ c %---------------------------%
|
||||
c
|
||||
do 200 i = 1,n
|
||||
workc(i) = cmplx(workd(ipntr(3)+i-1))
|
||||
200 continue
|
||||
200 continue
|
||||
c
|
||||
call cgbtrs ('Notranspose', n, kl, ku, 1, cfac, lda,
|
||||
call cgbtrs ('Notranspose', n, kl, ku, 1, cfac, lda,
|
||||
& iwork, workc, n, ierr)
|
||||
if (ierr .ne. 0) then
|
||||
if (ierr .ne. 0) then
|
||||
print*, ' '
|
||||
print*, '_NBAND: Error in _gbtrs.'
|
||||
print*, ' '
|
||||
print*, '_NBAND: Error in _gbtrs.'
|
||||
print*, ' '
|
||||
go to 9000
|
||||
end if
|
||||
c
|
||||
do 210 i = 1,n
|
||||
workd(ipntr(2)+i-1) = real(workc(i))
|
||||
210 continue
|
||||
210 continue
|
||||
c
|
||||
end if
|
||||
c
|
||||
else if ( type .eq. 5 ) then
|
||||
c
|
||||
c %---------------------------------------%
|
||||
c %---------------------------------------%
|
||||
c | Perform y <-- OP*x |
|
||||
c | = Imaginary_part{inv[A-SIGMA*I]*x} |
|
||||
c %---------------------------------------%
|
||||
@@ -1015,25 +1015,25 @@ c
|
||||
c
|
||||
c %-----------------------------------------%
|
||||
c | Perform y <-- OP*x |
|
||||
c | = Imaginary_part{inv[A-SIGMA*M]*M}*x. |
|
||||
c | = Imaginary_part{inv[A-SIGMA*M]*M}*x. |
|
||||
c %-----------------------------------------%
|
||||
c
|
||||
do 240 i = 1,n
|
||||
workc(i) = cmplx(workd(ipntr(3)+i-1))
|
||||
240 continue
|
||||
240 continue
|
||||
c
|
||||
call cgbtrs ('Notranspose', n, kl, ku, 1, cfac, lda,
|
||||
call cgbtrs ('Notranspose', n, kl, ku, 1, cfac, lda,
|
||||
& iwork, workc, n, ierr)
|
||||
if (ierr .ne. 0) then
|
||||
if (ierr .ne. 0) then
|
||||
print*, ' '
|
||||
print*, '_NBAND: Error with _gbtrs.'
|
||||
print*, '_NBAND: Error with _gbtrs.'
|
||||
print*, ' '
|
||||
go to 9000
|
||||
end if
|
||||
c
|
||||
do 250 i = 1, n
|
||||
workd(ipntr(2)+i-1) = aimag(workc(i))
|
||||
250 continue
|
||||
250 continue
|
||||
c
|
||||
end if
|
||||
c
|
||||
@@ -1045,14 +1045,14 @@ c | Not used when |
|
||||
c | type = 1,2. |
|
||||
c %--------------------%
|
||||
c
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one, mb(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one, mb(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
& workd(ipntr(2)), 1)
|
||||
c
|
||||
else
|
||||
else
|
||||
c
|
||||
c %-----------------------------------------%
|
||||
c | Either we have convergence, or there is |
|
||||
c | Either we have convergence, or there is |
|
||||
c | error. |
|
||||
c %-----------------------------------------%
|
||||
c
|
||||
@@ -1069,7 +1069,7 @@ c
|
||||
print *, ' '
|
||||
go to 9000
|
||||
c
|
||||
else
|
||||
else
|
||||
c
|
||||
if ( info .eq. 1) then
|
||||
print *, ' '
|
||||
@@ -1084,29 +1084,29 @@ c
|
||||
c
|
||||
if (iparam(5) .gt. 0) then
|
||||
c
|
||||
call sneupd ( rvec, 'A', select, dr, di, z, ldz,
|
||||
& sigmar, sigmai, workev, bmat, n, which,
|
||||
call sneupd ( rvec, 'A', select, dr, di, z, ldz,
|
||||
& sigmar, sigmai, workev, bmat, n, which,
|
||||
& nev, tol, resid, ncv, v, ldv, iparam,
|
||||
& ipntr, workd, workl, lworkl, info )
|
||||
& ipntr, workd, workl, lworkl, info )
|
||||
c
|
||||
if ( info .ne. 0) then
|
||||
c
|
||||
c
|
||||
c %------------------------------------%
|
||||
c | Check the documentation of SNEUPD. |
|
||||
c %------------------------------------%
|
||||
c
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
print *, ' Error with _neupd = ', info
|
||||
print *, ' Check the documentation of _neupd '
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
go to 9000
|
||||
c
|
||||
else if ( sigmai .ne. zero ) then
|
||||
c
|
||||
else if ( sigmai .ne. zero ) then
|
||||
c
|
||||
if ( type .eq. 4 .or. type .eq. 6 ) then
|
||||
c
|
||||
c
|
||||
first = .true.
|
||||
do 270 j = 1, iparam(5)
|
||||
do 270 j = 1, iparam(5)
|
||||
c
|
||||
c %----------------------------------%
|
||||
c | Use Rayleigh Quotient to recover |
|
||||
@@ -1118,16 +1118,16 @@ c
|
||||
c
|
||||
c %--------------------------------------%
|
||||
c | Eigenvalue is real. Compute |
|
||||
c | d = (x'*inv[A-sigma*M]*M*x) / (x'*x) |
|
||||
c | d = (x'*inv[A-sigma*M]*M*x) / (x'*x) |
|
||||
c %--------------------------------------%
|
||||
c
|
||||
call sgbmv('Nontranspose', n, n, kl, ku, one,
|
||||
call sgbmv('Nontranspose', n, n, kl, ku, one,
|
||||
$ mb(itop,1), lda, z(1,j), 1, zero,
|
||||
$ workd, 1)
|
||||
do i = 1, n
|
||||
workc(i) = cmplx(workd(i))
|
||||
end do
|
||||
call cgbtrs ('Notranspose', n, kl, ku, 1,
|
||||
call cgbtrs ('Notranspose', n, kl, ku, 1,
|
||||
$ cfac, lda, iwork, workc, n, info)
|
||||
do i = 1, n
|
||||
workd(i) = real(workc(i))
|
||||
@@ -1151,7 +1151,7 @@ c
|
||||
go to 9000
|
||||
end if
|
||||
c
|
||||
else if (first) then
|
||||
else if (first) then
|
||||
c
|
||||
c %------------------------%
|
||||
c | Eigenvalue is complex. |
|
||||
@@ -1166,7 +1166,7 @@ c
|
||||
call sgbmv('Nontranspose', n, n, kl, ku,
|
||||
$ one, mb(itop,1), lda, z(1,j), 1, zero,
|
||||
$ workd, 1)
|
||||
call sgbmv('Nontranspose', n, n, kl, ku,
|
||||
call sgbmv('Nontranspose', n, n, kl, ku,
|
||||
$ one, mb(itop,1), lda, z(1,j+1), 1,
|
||||
$ zero, workd(n+1), 1)
|
||||
do i = 1, n
|
||||
@@ -1177,7 +1177,7 @@ c %----------------------------%
|
||||
c | Compute inv(A-sigma*M)*M*x |
|
||||
c %----------------------------%
|
||||
c
|
||||
call cgbtrs('Notranspose',n,kl,ku,1,cfac,
|
||||
call cgbtrs('Notranspose',n,kl,ku,1,cfac,
|
||||
$ lda, iwork, workc, n, info)
|
||||
c
|
||||
c %-------------------------------%
|
||||
@@ -1197,7 +1197,7 @@ c %----------------%
|
||||
c | Compute (x'*x) |
|
||||
c %----------------%
|
||||
c
|
||||
numr = slapy2( snrm2(n, z(1,j), 1),
|
||||
numr = slapy2( snrm2(n, z(1,j), 1),
|
||||
& snrm2(n, z(1, j+1), 1) )**2
|
||||
c
|
||||
c %----------------------------------------%
|
||||
@@ -1237,7 +1237,7 @@ c
|
||||
c
|
||||
end if
|
||||
c
|
||||
270 continue
|
||||
270 continue
|
||||
c
|
||||
else if ( type .eq. 2 .or. type .eq. 5) then
|
||||
c
|
||||
@@ -1260,7 +1260,7 @@ c
|
||||
do i = 1, n
|
||||
workc(i) = cmplx(z(i,j))
|
||||
end do
|
||||
call cgbtrs ('Notranspose', n, kl, ku, 1,
|
||||
call cgbtrs ('Notranspose', n, kl, ku, 1,
|
||||
$ cfac, lda, iwork, workc, n, info)
|
||||
do i = 1, n
|
||||
workd(i) = real(workc(i))
|
||||
@@ -1329,7 +1329,7 @@ c | Compute (x'x) / (x'*inv(A-sigma*I)*x). |
|
||||
c %----------------------------------------%
|
||||
c
|
||||
dmdul = slapy2(denr,deni)**2
|
||||
if (dmdul .ge. safmin) then
|
||||
if (dmdul .ge. safmin) then
|
||||
dr(j) = sigmar+numr*denr / dmdul
|
||||
di(j) = sigmai-numr*deni / dmdul
|
||||
first = .false.
|
||||
@@ -1378,7 +1378,7 @@ c %----------------------------------------%
|
||||
c | L O O P B A C K to call SNAUPD again. |
|
||||
c %----------------------------------------%
|
||||
c
|
||||
go to 90
|
||||
go to 90
|
||||
c
|
||||
9000 continue
|
||||
c
|
||||
|
||||
+49
-49
@@ -49,13 +49,13 @@ c | MAXN - Maximum size of the matrix |
|
||||
c | MAXNEV - Maximum number of |
|
||||
c | eigenvalues to be computed |
|
||||
c | MAXNCV - Maximum number of Arnoldi |
|
||||
c | vectors stored |
|
||||
c | vectors stored |
|
||||
c | MAXBDW - Maximum bandwidth |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
integer maxn, maxnev, maxncv, maxbdw, lda,
|
||||
& lworkl, ldv
|
||||
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
|
||||
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
|
||||
& maxbdw=50, lda = maxbdw, ldv = maxn )
|
||||
c
|
||||
c %--------------%
|
||||
@@ -64,12 +64,12 @@ c %--------------%
|
||||
c
|
||||
integer iparam(11), iwork(maxn)
|
||||
logical select(maxncv)
|
||||
Real
|
||||
Real
|
||||
& a(lda,maxn), m(lda,maxn), rfac(lda,maxn),
|
||||
& workl(3*maxncv*maxncv+6*maxncv), workd(3*maxn),
|
||||
& workl(3*maxncv*maxncv+6*maxncv), workd(3*maxn),
|
||||
& workev(3*maxncv), v(ldv, maxncv),
|
||||
& resid(maxn), d(maxncv, 3), ax(maxn)
|
||||
Complex
|
||||
Complex
|
||||
& cfac(lda, maxn), workc(maxn)
|
||||
c
|
||||
c %---------------%
|
||||
@@ -81,25 +81,25 @@ c
|
||||
& n, nx, lo, isub, isup, idiag, mode, maxitr,
|
||||
& nconv
|
||||
logical rvec, first
|
||||
Real
|
||||
Real
|
||||
& tol, rho, h, h2, sigmar, sigmai
|
||||
c
|
||||
c
|
||||
c %------------%
|
||||
c | Parameters |
|
||||
c %------------%
|
||||
c
|
||||
Real
|
||||
Real
|
||||
& one, zero, two
|
||||
parameter (one = 1.0E+0 , zero = 0.0E+0 ,
|
||||
parameter (one = 1.0E+0 , zero = 0.0E+0 ,
|
||||
& two = 2.0E+0 )
|
||||
c
|
||||
c %-----------------------------%
|
||||
c | BLAS & LAPACK routines used |
|
||||
c %-----------------------------%
|
||||
c
|
||||
Real
|
||||
Real
|
||||
& slapy2, snrm2
|
||||
external slapy2, snrm2, sgbmv, saxpy
|
||||
external slapy2, snrm2, sgbmv, saxpy
|
||||
c
|
||||
c %--------------------%
|
||||
c | Intrinsic function |
|
||||
@@ -115,7 +115,7 @@ c %-------------------------------------------------%
|
||||
c | The number NX is the number of interior points |
|
||||
c | in the discretization of the 2-dimensional |
|
||||
c | convection-diffusion operator on the unit |
|
||||
c | square with zero Dirichlet boundary condition. |
|
||||
c | square with zero Dirichlet boundary condition. |
|
||||
c | The number N(=NX*NX) is the dimension of the |
|
||||
c | matrix. A standard eigenvalue problem is |
|
||||
c | solved (BMAT = 'I'). NEV is the number of |
|
||||
@@ -126,13 +126,13 @@ c | spectrum. However, The following conditions |
|
||||
c | must be satisfied: |
|
||||
c | N <= MAXN |
|
||||
c | NEV <= MAXNEV |
|
||||
c | NEV + 2 <= NCV <= MAXNCV |
|
||||
c %-------------------------------------------------%
|
||||
c | NEV + 2 <= NCV <= MAXNCV |
|
||||
c %-------------------------------------------------%
|
||||
c
|
||||
nx = 10
|
||||
nx = 10
|
||||
n = nx*nx
|
||||
nev = 4
|
||||
ncv = 10
|
||||
nev = 4
|
||||
ncv = 10
|
||||
if ( n .gt. maxn ) then
|
||||
print *, ' ERROR with _NBDR1: N is greater than MAXN '
|
||||
go to 9000
|
||||
@@ -158,7 +158,7 @@ c | generated in SNAUPD to start the Arnoldi iteration. |
|
||||
c %-----------------------------------------------------%
|
||||
c
|
||||
lworkl = 3*ncv**2+6*ncv
|
||||
tol = zero
|
||||
tol = zero
|
||||
ido = 0
|
||||
info = 0
|
||||
c
|
||||
@@ -173,7 +173,7 @@ c
|
||||
maxitr = 300
|
||||
mode = 1
|
||||
c
|
||||
iparam(3) = maxitr
|
||||
iparam(3) = maxitr
|
||||
iparam(7) = mode
|
||||
c
|
||||
c %----------------------------------------%
|
||||
@@ -195,10 +195,10 @@ c | and subdiagonals within the band of |
|
||||
c | matrices A and M. |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
kl = nx
|
||||
ku = nx
|
||||
kl = nx
|
||||
ku = nx
|
||||
c
|
||||
c %---------------%
|
||||
c %---------------%
|
||||
c | Main diagonal |
|
||||
c %---------------%
|
||||
c
|
||||
@@ -208,13 +208,13 @@ c
|
||||
idiag = kl+ku+1
|
||||
do 30 j = 1, n
|
||||
a(idiag,j) = 4.0E+0 / h2
|
||||
30 continue
|
||||
c
|
||||
30 continue
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | First subdiagonal and superdiagonal |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
rho = 1.0E+2
|
||||
c
|
||||
rho = 1.0E+2
|
||||
isup = kl+ku
|
||||
isub = kl+ku+2
|
||||
do 50 i = 1, nx
|
||||
@@ -222,8 +222,8 @@ c
|
||||
do 40 j = lo+1, lo+nx-1
|
||||
a(isup,j+1) = -one/h2 + rho/two/h
|
||||
a(isub,j) = -one/h2 - rho/two/h
|
||||
40 continue
|
||||
50 continue
|
||||
40 continue
|
||||
50 continue
|
||||
c
|
||||
c %------------------------------------%
|
||||
c | KL-th subdiagonal and KU-th super- |
|
||||
@@ -237,8 +237,8 @@ c
|
||||
do 70 j = lo+1, lo+nx
|
||||
a(isup,nx+j) = -one / h2
|
||||
a(isub,j) = -one / h2
|
||||
70 continue
|
||||
80 continue
|
||||
70 continue
|
||||
80 continue
|
||||
c
|
||||
c %------------------------------------------------%
|
||||
c | Call ARPACK banded solver to find eigenvalues |
|
||||
@@ -247,12 +247,12 @@ c | eigenvalues are returned in the first column |
|
||||
c | of D, the imaginary parts are returned in the |
|
||||
c | second column of D. Eigenvectors are returned |
|
||||
c | in the first NCONV (=IPARAM(5)) columns of V. |
|
||||
c %------------------------------------------------%
|
||||
c %------------------------------------------------%
|
||||
c
|
||||
rvec = .true.
|
||||
call snband(rvec, 'A', select, d, d(1,2), v, ldv, sigmar, sigmai,
|
||||
& workev, n, a, m, lda, rfac, cfac, kl, ku, which,
|
||||
& bmat, nev, tol, resid, ncv, v, ldv, iparam, workd,
|
||||
rvec = .true.
|
||||
call snband(rvec, 'A', select, d, d(1,2), v, ldv, sigmar, sigmai,
|
||||
& workev, n, a, m, lda, rfac, cfac, kl, ku, which,
|
||||
& bmat, nev, tol, resid, ncv, v, ldv, iparam, workd,
|
||||
& workl, lworkl, workc, iwork, info)
|
||||
c
|
||||
if ( info .eq. 0) then
|
||||
@@ -285,8 +285,8 @@ c | Compute the residual norm. |
|
||||
c | || A*x - lambda*x || |
|
||||
c %----------------------------%
|
||||
c
|
||||
first = .true.
|
||||
do 90 j = 1, nconv
|
||||
first = .true.
|
||||
do 90 j = 1, nconv
|
||||
c
|
||||
if ( d(j,2) .eq. zero ) then
|
||||
c
|
||||
@@ -294,11 +294,11 @@ c %--------------------%
|
||||
c | Ritz value is real |
|
||||
c %--------------------%
|
||||
c
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
& ax, 1)
|
||||
call saxpy(n, -d(j,1), v(1,j), 1, ax, 1)
|
||||
d(j,3) = snrm2(n, ax, 1)
|
||||
d(j,3) = snrm2(n, ax, 1)
|
||||
d(j,3) = d(j,3) / abs(d(j,1))
|
||||
c
|
||||
else if ( first ) then
|
||||
@@ -307,17 +307,17 @@ c %------------------------%
|
||||
c | Ritz value is complex |
|
||||
c | Residual of one Ritz |
|
||||
c | value of the conjugate |
|
||||
c | pair is computed. |
|
||||
c | pair is computed. |
|
||||
c %------------------------%
|
||||
c
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
& ax, 1)
|
||||
call saxpy(n, -d(j,1), v(1,j), 1, ax, 1)
|
||||
call saxpy(n, d(j,2), v(1,j+1), 1, ax, 1)
|
||||
d(j,3) = snrm2(n, ax, 1)
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j+1), 1, zero,
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j+1), 1, zero,
|
||||
& ax, 1)
|
||||
call saxpy(n, -d(j,2), v(1,j), 1, ax, 1)
|
||||
call saxpy(n, -d(j,1), v(1,j+1), 1, ax, 1)
|
||||
@@ -329,11 +329,11 @@ c
|
||||
first = .true.
|
||||
end if
|
||||
c
|
||||
90 continue
|
||||
90 continue
|
||||
|
||||
call smout(6, nconv, 3, d, maxncv, -6,
|
||||
& 'Ritz values (Real,Imag) and relative residuals')
|
||||
else
|
||||
else
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | Either convergence failed, or there |
|
||||
@@ -344,8 +344,8 @@ c
|
||||
print *, ' '
|
||||
print *, ' Error with _nband, info= ', info
|
||||
print *, ' Check the documentation of _nband '
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
c
|
||||
end if
|
||||
c
|
||||
9000 end
|
||||
9000 end
|
||||
|
||||
+45
-45
@@ -53,13 +53,13 @@ c | MAXN - Maximum size of the matrix |
|
||||
c | MAXNEV - Maximum number of |
|
||||
c | eigenvalues to be computed |
|
||||
c | MAXNCV - Maximum number of Arnoldi |
|
||||
c | vectors stored |
|
||||
c | vectors stored |
|
||||
c | MAXBDW - Maximum bandwidth |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
integer maxn, maxnev, maxncv, maxbdw, lda,
|
||||
& lworkl, ldv
|
||||
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
|
||||
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
|
||||
& maxbdw=50, lda = maxbdw, ldv = maxn )
|
||||
c
|
||||
c %--------------%
|
||||
@@ -68,12 +68,12 @@ c %--------------%
|
||||
c
|
||||
integer iparam(11), iwork(maxn)
|
||||
logical select(maxncv)
|
||||
Real
|
||||
Real
|
||||
& a(lda,maxn), m(lda,maxn), rfac(lda,maxn),
|
||||
& workl(3*maxncv*maxncv+6*maxncv), workd(3*maxn),
|
||||
& workl(3*maxncv*maxncv+6*maxncv), workd(3*maxn),
|
||||
& workev(3*maxncv), v(ldv, maxncv),
|
||||
& resid(maxn), d(maxncv, 3), ax(maxn)
|
||||
Complex
|
||||
Complex
|
||||
& cfac(lda, maxn), workc(maxn)
|
||||
c
|
||||
c %---------------%
|
||||
@@ -85,25 +85,25 @@ c
|
||||
& n, nx, lo, idiag, isub, isup, mode, maxitr,
|
||||
& nconv
|
||||
logical rvec, first
|
||||
Real
|
||||
Real
|
||||
& tol, rho, h2, h, sigmar, sigmai
|
||||
c
|
||||
c
|
||||
c %------------%
|
||||
c | Parameters |
|
||||
c %------------%
|
||||
c
|
||||
Real
|
||||
Real
|
||||
& one, zero, two
|
||||
parameter (one = 1.0E+0 , zero = 0.0E+0 ,
|
||||
parameter (one = 1.0E+0 , zero = 0.0E+0 ,
|
||||
& two = 2.0E+0 )
|
||||
c
|
||||
c %-----------------------------%
|
||||
c | BLAS & LAPACK routines used |
|
||||
c %-----------------------------%
|
||||
c
|
||||
Real
|
||||
Real
|
||||
& slapy2, snrm2
|
||||
external slapy2, snrm2, saxpy, sgbmv
|
||||
external slapy2, snrm2, saxpy, sgbmv
|
||||
c
|
||||
c %--------------------%
|
||||
c | Intrinsic function |
|
||||
@@ -135,10 +135,10 @@ c | NEV <= MAXNEV |
|
||||
c | NEV + 2 <= NCV <= MAXNCV |
|
||||
c %-------------------------------------------------%
|
||||
c
|
||||
nx = 10
|
||||
nx = 10
|
||||
n = nx*nx
|
||||
nev = 4
|
||||
ncv = 20
|
||||
nev = 4
|
||||
ncv = 20
|
||||
if ( n .gt. maxn ) then
|
||||
print *, ' ERROR with _NBDR2: N is greater than MAXN '
|
||||
go to 9000
|
||||
@@ -151,8 +151,8 @@ c
|
||||
end if
|
||||
bmat = 'I'
|
||||
which = 'LM'
|
||||
sigmar = 1.0E+4
|
||||
sigmai = 0.0E+0
|
||||
sigmar = 1.0E+4
|
||||
sigmai = 0.0E+0
|
||||
c
|
||||
c %-----------------------------------------------------%
|
||||
c | The work array WORKL is used in SNAUPD as |
|
||||
@@ -166,7 +166,7 @@ c | generated in SNAUPD to start the Arnoldi iteration. |
|
||||
c %-----------------------------------------------------%
|
||||
c
|
||||
lworkl = 3*ncv**2+6*ncv
|
||||
tol = zero
|
||||
tol = zero
|
||||
ido = 0
|
||||
info = 0
|
||||
c
|
||||
@@ -181,7 +181,7 @@ c
|
||||
maxitr = 300
|
||||
mode = 3
|
||||
c
|
||||
iparam(3) = maxitr
|
||||
iparam(3) = maxitr
|
||||
iparam(7) = mode
|
||||
c
|
||||
c %----------------------------------------%
|
||||
@@ -203,10 +203,10 @@ c | and subdiagonals within the band of |
|
||||
c | matrices A. |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
kl = nx
|
||||
ku = nx
|
||||
kl = nx
|
||||
ku = nx
|
||||
c
|
||||
c %---------------%
|
||||
c %---------------%
|
||||
c | Main diagonal |
|
||||
c %---------------%
|
||||
c
|
||||
@@ -216,22 +216,22 @@ c
|
||||
idiag = kl+ku+1
|
||||
do 30 j = 1, n
|
||||
a(idiag,j) = 4.0E+0 / h2
|
||||
30 continue
|
||||
c
|
||||
30 continue
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | First subdiagonal and superdiagonal |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
c
|
||||
isup = kl+ku
|
||||
isub = kl+ku+2
|
||||
rho = 1.0E+1
|
||||
rho = 1.0E+1
|
||||
do 50 i = 1, nx
|
||||
lo = (i-1)*nx
|
||||
do 40 j = lo+1, lo+nx-1
|
||||
a(isub,j+1) = -one/h2 + rho/two/h
|
||||
a(isup,j) = -one/h2 - rho/two/h
|
||||
40 continue
|
||||
50 continue
|
||||
40 continue
|
||||
50 continue
|
||||
c
|
||||
c %------------------------------------%
|
||||
c | KL-th subdiagonal and KU-th super- |
|
||||
@@ -245,8 +245,8 @@ c
|
||||
do 70 j = lo+1, lo+nx
|
||||
a(isup,nx+j) = -one / h2
|
||||
a(isub,j) = -one / h2
|
||||
70 continue
|
||||
80 continue
|
||||
70 continue
|
||||
80 continue
|
||||
c
|
||||
c %------------------------------------------------%
|
||||
c | Call ARPACK banded solver to find eigenvalues |
|
||||
@@ -258,9 +258,9 @@ c | in the first NCONV (=IPARAM(5)) columns of V. |
|
||||
c %------------------------------------------------%
|
||||
c
|
||||
rvec = .true.
|
||||
call snband(rvec, 'A', select, d, d(1,2), v, ldv, sigmar,
|
||||
& sigmai, workev, n, a, m, lda, rfac, cfac, kl, ku,
|
||||
& which, bmat, nev, tol, resid, ncv, v, ldv, iparam,
|
||||
call snband(rvec, 'A', select, d, d(1,2), v, ldv, sigmar,
|
||||
& sigmai, workev, n, a, m, lda, rfac, cfac, kl, ku,
|
||||
& which, bmat, nev, tol, resid, ncv, v, ldv, iparam,
|
||||
& workd, workl, lworkl, workc, iwork, info)
|
||||
c
|
||||
if ( info .eq. 0) then
|
||||
@@ -293,8 +293,8 @@ c | Compute the residual norm. |
|
||||
c | || A*x - lambda*x || |
|
||||
c %----------------------------%
|
||||
c
|
||||
first = .true.
|
||||
do 90 j = 1, nconv
|
||||
first = .true.
|
||||
do 90 j = 1, nconv
|
||||
c
|
||||
if ( d(j,2) .eq. zero ) then
|
||||
c
|
||||
@@ -302,8 +302,8 @@ c %--------------------%
|
||||
c | Ritz value is real |
|
||||
c %--------------------%
|
||||
c
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
& ax, 1)
|
||||
call saxpy(n, -d(j,1), v(1,j), 1, ax, 1)
|
||||
d(j,3) = snrm2(n, ax, 1)
|
||||
@@ -315,17 +315,17 @@ c %------------------------%
|
||||
c | Ritz value is complex |
|
||||
c | Residual of one Ritz |
|
||||
c | value of the conjugate |
|
||||
c | pair is computed. |
|
||||
c | pair is computed. |
|
||||
c %------------------------%
|
||||
c
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
& ax, 1)
|
||||
call saxpy(n, -d(j,1), v(1,j), 1, ax, 1)
|
||||
call saxpy(n, d(j,2), v(1,j+1), 1, ax, 1)
|
||||
d(j,3) = snrm2(n, ax, 1)
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j+1), 1, zero,
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j+1), 1, zero,
|
||||
& ax, 1)
|
||||
call saxpy(n, -d(j,1), v(1,j+1), 1, ax, 1)
|
||||
call saxpy(n, -d(j,2), v(1,j), 1, ax, 1)
|
||||
@@ -337,11 +337,11 @@ c
|
||||
first = .true.
|
||||
end if
|
||||
c
|
||||
90 continue
|
||||
90 continue
|
||||
|
||||
call smout(6, nconv, 3, d, maxncv, -6,
|
||||
& 'Ritz values (Real,Imag) and relative residuals')
|
||||
else
|
||||
else
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | Either convergence failed, or there |
|
||||
@@ -352,8 +352,8 @@ c
|
||||
print *, ' '
|
||||
print *, ' Error with _nband, info= ', info
|
||||
print *, ' Check the documentation of _nband '
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
c
|
||||
end if
|
||||
c
|
||||
9000 end
|
||||
9000 end
|
||||
|
||||
+53
-53
@@ -2,7 +2,7 @@
|
||||
c
|
||||
c ... Construct matrices A and M in LAPACK-style band form.
|
||||
c The matrix A and M are derived from the finite element
|
||||
c discretization of the 1-dimensional convection-diffusion operator
|
||||
c discretization of the 1-dimensional convection-diffusion operator
|
||||
c (d^2u/dx^2) + rho*(du/dx)
|
||||
c on the interval [0,1] with zero boundary condition,
|
||||
|
||||
@@ -49,13 +49,13 @@ c | MAXN - Maximum size of the matrix |
|
||||
c | MAXNEV - Maximum number of |
|
||||
c | eigenvalues to be computed |
|
||||
c | MAXNCV - Maximum number of Arnoldi |
|
||||
c | vectors stored |
|
||||
c | vectors stored |
|
||||
c | MAXBDW - Maximum bandwidth |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
integer maxn, maxnev, maxncv, maxbdw, lda,
|
||||
& lworkl, ldv
|
||||
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
|
||||
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
|
||||
& maxbdw=50, lda = maxbdw, ldv = maxn)
|
||||
c
|
||||
c %--------------%
|
||||
@@ -64,12 +64,12 @@ c %--------------%
|
||||
c
|
||||
integer iparam(11), iwork(maxn)
|
||||
logical select(maxncv)
|
||||
Real
|
||||
Real
|
||||
& a(lda,maxn), m(lda,maxn), rfac(lda,maxn),
|
||||
& workl(3*maxncv*maxncv+6*maxncv), workd(3*maxn),
|
||||
& workl(3*maxncv*maxncv+6*maxncv), workd(3*maxn),
|
||||
& workev(3*maxncv), v(ldv, maxncv),
|
||||
& resid(maxn), d(maxncv, 3), ax(maxn), mx(maxn)
|
||||
Complex
|
||||
Complex
|
||||
& cfac(lda, maxn), workc(maxn)
|
||||
c
|
||||
c %---------------%
|
||||
@@ -81,25 +81,25 @@ c
|
||||
& n, idiag, isup, isub, mode, maxitr,
|
||||
& nconv
|
||||
logical rvec, first
|
||||
Real
|
||||
Real
|
||||
& tol, rho, h, sigmar, sigmai
|
||||
c
|
||||
c
|
||||
c %------------%
|
||||
c | Parameters |
|
||||
c %------------%
|
||||
c
|
||||
Real
|
||||
Real
|
||||
& one, zero, two
|
||||
parameter (one = 1.0E+0 , zero = 0.0E+0 ,
|
||||
parameter (one = 1.0E+0 , zero = 0.0E+0 ,
|
||||
& two = 2.0E+0 )
|
||||
c
|
||||
c %-----------------------------%
|
||||
c | BLAS & LAPACK routines used |
|
||||
c %-----------------------------%
|
||||
c
|
||||
Real
|
||||
Real
|
||||
& slapy2, snrm2
|
||||
external slapy2, snrm2, sgbmv, saxpy
|
||||
external slapy2, snrm2, sgbmv, saxpy
|
||||
c
|
||||
c %--------------------%
|
||||
c | Intrinsic function |
|
||||
@@ -126,8 +126,8 @@ c | NEV + 2 <= NCV <= MAXNCV |
|
||||
c %-------------------------------------------------%
|
||||
c
|
||||
n = 100
|
||||
nev = 4
|
||||
ncv = 10
|
||||
nev = 4
|
||||
ncv = 10
|
||||
if ( n .gt. maxn ) then
|
||||
print *, ' ERROR with _NBDR3: N is greater than MAXN '
|
||||
go to 9000
|
||||
@@ -142,7 +142,7 @@ c
|
||||
which = 'LM'
|
||||
c
|
||||
c %----------------------------------------------------%
|
||||
c | The work array WORKL is used in SNAUPD as |
|
||||
c | The work array WORKL is used in SNAUPD as |
|
||||
c | workspace. Its dimension LWORKL has to be set as |
|
||||
c | illustrated below. The parameter TOL determines |
|
||||
c | the stopping criterion. If TOL<=0, machine machine |
|
||||
@@ -150,12 +150,12 @@ c | precision is used. The number IDO is used for |
|
||||
c | reverse communication and has to be set to 0 at |
|
||||
c | the beginning. Setting INFO=0 indicates that we |
|
||||
c | using a randomly generated vector to start the |
|
||||
c | the ARNOLDI process. |
|
||||
c | the ARNOLDI process. |
|
||||
c %----------------------------------------------------%
|
||||
c
|
||||
lworkl = 3*ncv**2+6*ncv
|
||||
info = 0
|
||||
tol = zero
|
||||
tol = zero
|
||||
ido = 0
|
||||
c
|
||||
c %---------------------------------------------------%
|
||||
@@ -169,8 +169,8 @@ c
|
||||
mode = 2
|
||||
maxitr = 300
|
||||
c
|
||||
iparam(3) = maxitr
|
||||
iparam(7) = mode
|
||||
iparam(3) = maxitr
|
||||
iparam(7) = mode
|
||||
c
|
||||
c %--------------------------------------------%
|
||||
c | Construct matrices A and M in LAPACK-style |
|
||||
@@ -191,10 +191,10 @@ c | and subdiagonals within the band of |
|
||||
c | matrices A and M. |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
kl = 1
|
||||
ku = 1
|
||||
kl = 1
|
||||
ku = 1
|
||||
c
|
||||
c %---------------%
|
||||
c %---------------%
|
||||
c | Main diagonal |
|
||||
c %---------------%
|
||||
c
|
||||
@@ -204,21 +204,21 @@ c
|
||||
do 30 j = 1, n
|
||||
a(idiag,j) = 2.0E+0 / h
|
||||
m(idiag,j) = 4.0E+0 * h
|
||||
30 continue
|
||||
c
|
||||
30 continue
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | First subdiagonal and superdiagonal |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
c
|
||||
isup = kl+ku
|
||||
isub = kl+ku+2
|
||||
rho = 1.0E+1
|
||||
rho = 1.0E+1
|
||||
do 50 j = 1, n
|
||||
a(isup,j+1) = -one/h + rho/two
|
||||
a(isub,j) = -one/h - rho/two
|
||||
m(isup,j+1) = one*h
|
||||
m(isub,j) = one*h
|
||||
50 continue
|
||||
50 continue
|
||||
c
|
||||
c %------------------------------------------------%
|
||||
c | Call ARPACK banded solver to find eigenvalues |
|
||||
@@ -229,10 +229,10 @@ c | second column of D. Eigenvectors are returned |
|
||||
c | in the first NCONV (=IPARAM(5)) columns of V. |
|
||||
c %------------------------------------------------%
|
||||
c
|
||||
rvec = .true.
|
||||
call snband( rvec, 'A', select, d, d(1,2), v, ldv, sigmar,
|
||||
& sigmai, workev, n, A, M, lda, rfac, cfac, kl, ku,
|
||||
& which, bmat, nev, tol, resid, ncv, v, ldv, iparam,
|
||||
rvec = .true.
|
||||
call snband( rvec, 'A', select, d, d(1,2), v, ldv, sigmar,
|
||||
& sigmai, workev, n, A, M, lda, rfac, cfac, kl, ku,
|
||||
& which, bmat, nev, tol, resid, ncv, v, ldv, iparam,
|
||||
& workd, workl, lworkl, workc, iwork, info)
|
||||
c
|
||||
if ( info .eq. 0) then
|
||||
@@ -265,7 +265,7 @@ c | Compute the residual norm. |
|
||||
c | || A*x - lambda*x || |
|
||||
c %----------------------------%
|
||||
c
|
||||
first = .true.
|
||||
first = .true.
|
||||
do 90 j = 1, nconv
|
||||
c
|
||||
if ( d(j,2) .eq. zero ) then
|
||||
@@ -274,11 +274,11 @@ c %--------------------%
|
||||
c | Ritz value is real |
|
||||
c %--------------------%
|
||||
c
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
& ax, 1)
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j), 1, zero,
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j), 1, zero,
|
||||
& mx, 1)
|
||||
call saxpy(n, -d(j,1), mx, 1, ax, 1)
|
||||
d(j,3) = snrm2(n, ax, 1)
|
||||
@@ -290,30 +290,30 @@ c %------------------------%
|
||||
c | Ritz value is complex |
|
||||
c | Residual of one Ritz |
|
||||
c | value of the conjugate |
|
||||
c | pair is computed. |
|
||||
c | pair is computed. |
|
||||
c %------------------------%
|
||||
c
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
& ax, 1)
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j), 1, zero,
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j), 1, zero,
|
||||
& mx, 1)
|
||||
call saxpy(n, -d(j,1), mx, 1, ax, 1)
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j+1), 1, zero,
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j+1), 1, zero,
|
||||
& mx, 1)
|
||||
call saxpy(n, d(j,2), mx, 1, ax, 1)
|
||||
d(j,3) = snrm2(n, ax, 1)
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j+1), 1, zero,
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j+1), 1, zero,
|
||||
& ax, 1)
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j+1), 1, zero,
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j+1), 1, zero,
|
||||
& mx, 1)
|
||||
call saxpy(n, -d(j,1), mx, 1, ax, 1)
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j), 1, zero,
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j), 1, zero,
|
||||
& mx, 1)
|
||||
call saxpy(n, -d(j,2), mx, 1, ax, 1)
|
||||
d(j,3) = slapy2( d(j,3), snrm2(n, ax, 1) )
|
||||
@@ -324,11 +324,11 @@ c
|
||||
first = .true.
|
||||
end if
|
||||
c
|
||||
90 continue
|
||||
90 continue
|
||||
|
||||
call smout(6, nconv, 3, d, maxncv, -6,
|
||||
& 'Ritz values (Real,Imag) and relative residuals')
|
||||
else
|
||||
else
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | Either convergence failed, or there |
|
||||
@@ -339,8 +339,8 @@ c
|
||||
print *, ' '
|
||||
print *, ' Error with _nband, info= ', info
|
||||
print *, ' Check the documentation of _nband '
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
c
|
||||
end if
|
||||
c
|
||||
9000 end
|
||||
9000 end
|
||||
|
||||
+46
-46
@@ -50,14 +50,14 @@ c | MAXN - Maximum size of the matrix |
|
||||
c | MAXNEV - Maximum number of |
|
||||
c | eigenvalues to be computed |
|
||||
c | MAXNCV - Maximum number of Arnoldi |
|
||||
c | vectors stored |
|
||||
c | vectors stored |
|
||||
c | MAXBDW - Maximum bandwidth |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
integer maxn, maxnev, maxncv, maxbdw, lda,
|
||||
& lworkl, ldv
|
||||
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
|
||||
& maxbdw=50, lda = maxbdw, ldv = maxn)
|
||||
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
|
||||
& maxbdw=50, lda = maxbdw, ldv = maxn)
|
||||
c
|
||||
c %--------------%
|
||||
c | Local Arrays |
|
||||
@@ -67,10 +67,10 @@ c
|
||||
logical select(maxncv)
|
||||
Real
|
||||
& a(lda,maxn), m(lda,maxn), rfac(lda,maxn),
|
||||
& workl(3*maxncv*maxncv+6*maxncv), workd(3*maxn),
|
||||
& workl(3*maxncv*maxncv+6*maxncv), workd(3*maxn),
|
||||
& workev(3*maxncv), v(ldv, maxncv),
|
||||
& resid(maxn), d(maxncv, 3), ax(maxn), mx(maxn)
|
||||
Complex
|
||||
Complex
|
||||
& cfac(lda, maxn), workc(maxn)
|
||||
c
|
||||
c %---------------%
|
||||
@@ -82,16 +82,16 @@ c
|
||||
& n, idiag, isup, isub, mode, maxitr,
|
||||
& nconv
|
||||
logical rvec, first
|
||||
Real
|
||||
Real
|
||||
& tol, rho, h, sigmar, sigmai
|
||||
c
|
||||
c
|
||||
c %------------%
|
||||
c | Parameters |
|
||||
c %------------%
|
||||
c
|
||||
Real
|
||||
Real
|
||||
& one, zero, two, six
|
||||
parameter (one = 1.0E+0, zero = 0.0E+0,
|
||||
parameter (one = 1.0E+0, zero = 0.0E+0,
|
||||
& two = 2.0E+0, six = 6.0E+0)
|
||||
c
|
||||
c %-----------------------------%
|
||||
@@ -100,7 +100,7 @@ c %-----------------------------%
|
||||
c
|
||||
Real
|
||||
& slapy2, snrm2
|
||||
external slapy2, snrm2, sgbmv, saxpy
|
||||
external slapy2, snrm2, sgbmv, saxpy
|
||||
c
|
||||
c %--------------------%
|
||||
c | Intrinsic function |
|
||||
@@ -127,8 +127,8 @@ c | NEV + 2 <= NCV <= MAXNCV |
|
||||
c %-------------------------------------------------%
|
||||
c
|
||||
n = 100
|
||||
nev = 4
|
||||
ncv = 10
|
||||
nev = 4
|
||||
ncv = 10
|
||||
if ( n .gt. maxn ) then
|
||||
print *, ' ERROR with _NBDR4: N is greater than MAXN '
|
||||
go to 9000
|
||||
@@ -142,7 +142,7 @@ c
|
||||
bmat = 'G'
|
||||
which = 'LM'
|
||||
sigmar = 1.0E+1
|
||||
sigmai = 0.0E+0
|
||||
sigmai = 0.0E+0
|
||||
c
|
||||
c %-----------------------------------------------------%
|
||||
c | The work array WORKL is used in SNAUPD as |
|
||||
@@ -157,7 +157,7 @@ c %-----------------------------------------------------%
|
||||
c
|
||||
lworkl = 3*ncv**2+6*ncv
|
||||
info = 0
|
||||
tol = zero
|
||||
tol = zero
|
||||
ido = 0
|
||||
c
|
||||
c %---------------------------------------------------%
|
||||
@@ -171,7 +171,7 @@ c
|
||||
maxitr = 300
|
||||
mode = 3
|
||||
c
|
||||
iparam(3) = n
|
||||
iparam(3) = n
|
||||
iparam(7) = 3
|
||||
c
|
||||
c %--------------------------------------------%
|
||||
@@ -194,9 +194,9 @@ c | matrices A and M. |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
kl = 1
|
||||
ku = 1
|
||||
ku = 1
|
||||
c
|
||||
c %---------------%
|
||||
c %---------------%
|
||||
c | Main diagonal |
|
||||
c %---------------%
|
||||
c
|
||||
@@ -205,12 +205,12 @@ c
|
||||
do 30 j = 1, n
|
||||
a(idiag,j) = 2.0E+0 / h
|
||||
m(idiag,j) = 4.0E+0 * h / six
|
||||
30 continue
|
||||
c
|
||||
30 continue
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | First subdiagonal and superdiagonal |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
c
|
||||
isup = kl+ku
|
||||
isub = kl+ku+2
|
||||
rho = 1.0E+1
|
||||
@@ -218,8 +218,8 @@ c
|
||||
a(isup,j+1) = -one/h + rho/two
|
||||
a(isub,j) = -one/h - rho/two
|
||||
m(isup,j+1) = one*h/six
|
||||
m(isub,j) = one*h/six
|
||||
40 continue
|
||||
m(isub,j) = one*h/six
|
||||
40 continue
|
||||
c
|
||||
c %------------------------------------------------%
|
||||
c | Call ARPACK banded solver to find eigenvalues |
|
||||
@@ -231,9 +231,9 @@ c | in the first NCONV (=IPARAM(5)) columns of V. |
|
||||
c %------------------------------------------------%
|
||||
c
|
||||
rvec = .true.
|
||||
call snband(rvec, 'A', select, d, d(1,2), v, ldv, sigmar,
|
||||
call snband(rvec, 'A', select, d, d(1,2), v, ldv, sigmar,
|
||||
& sigmai, workev, n, A, M, lda, rfac, cfac, kl, ku,
|
||||
& which, bmat, nev, tol, resid, ncv, v, ldv, iparam,
|
||||
& which, bmat, nev, tol, resid, ncv, v, ldv, iparam,
|
||||
& workd, workl, lworkl, workc, iwork, info)
|
||||
c
|
||||
if ( info .eq. 0) then
|
||||
@@ -266,7 +266,7 @@ c | Compute the residual norm. |
|
||||
c | || A*x - lambda*x || |
|
||||
c %----------------------------%
|
||||
c
|
||||
first = .true.
|
||||
first = .true.
|
||||
do 50 j = 1, nconv
|
||||
c
|
||||
if ( d(j,2) .eq. zero ) then
|
||||
@@ -275,11 +275,11 @@ c %--------------------%
|
||||
c | Ritz value is real |
|
||||
c %--------------------%
|
||||
c
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
& ax, 1)
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j), 1, zero,
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j), 1, zero,
|
||||
& mx, 1)
|
||||
call saxpy(n, -d(j,1), mx, 1, ax, 1)
|
||||
d(j,3) = snrm2(n, ax, 1)
|
||||
@@ -291,30 +291,30 @@ c %------------------------%
|
||||
c | Ritz value is complex |
|
||||
c | Residual of one Ritz |
|
||||
c | value of the conjugate |
|
||||
c | pair is computed. |
|
||||
c | pair is computed. |
|
||||
c %------------------------%
|
||||
c
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
& ax, 1)
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j), 1, zero,
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j), 1, zero,
|
||||
& mx, 1)
|
||||
call saxpy(n, -d(j,1), mx, 1, ax, 1)
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j+1), 1, zero,
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j+1), 1, zero,
|
||||
& mx, 1)
|
||||
call saxpy(n, d(j,2), mx, 1, ax, 1)
|
||||
d(j,3) = snrm2(n, ax, 1)
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j+1), 1, zero,
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j+1), 1, zero,
|
||||
& ax, 1)
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j+1), 1, zero,
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j+1), 1, zero,
|
||||
& mx, 1)
|
||||
call saxpy(n, -d(j,1), mx, 1, ax, 1)
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j), 1, zero,
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j), 1, zero,
|
||||
& mx, 1)
|
||||
call saxpy(n, -d(j,2), mx, 1, ax, 1)
|
||||
d(j,3) = slapy2( d(j,3), snrm2(n, ax, 1) )
|
||||
@@ -325,11 +325,11 @@ c
|
||||
first = .true.
|
||||
end if
|
||||
c
|
||||
50 continue
|
||||
50 continue
|
||||
|
||||
call smout(6, nconv, 3, d, maxncv, -6,
|
||||
& 'Ritz values (Real,Imag) and relatve residuals')
|
||||
else
|
||||
else
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | Either convergence failed, or there |
|
||||
@@ -340,8 +340,8 @@ c
|
||||
print *, ' '
|
||||
print *, ' Error with _nband, info= ', info
|
||||
print *, ' Check the documentation of _nband '
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
c
|
||||
end if
|
||||
c
|
||||
9000 end
|
||||
9000 end
|
||||
|
||||
+46
-46
@@ -1,7 +1,7 @@
|
||||
program snbdr5
|
||||
c
|
||||
c ... Construct matrices A and M in LAPACK-style band form.
|
||||
c The matrix A is a block tridiagonal matrix. Each
|
||||
c The matrix A is a block tridiagonal matrix. Each
|
||||
c diagonal block is a tridiagonal matrix with
|
||||
c 4 on the diagonal, 1-rho*h/2 on the subdiagonal and
|
||||
c 1+rho*h/2 on the superdiagonal. Each off-diagonal block
|
||||
@@ -51,13 +51,13 @@ c | MAXN - Maximum size of the matrix |
|
||||
c | MAXNEV - Maximum number of |
|
||||
c | eigenvalues to be computed |
|
||||
c | MAXNCV - Maximum number of Arnoldi |
|
||||
c | vectors stored |
|
||||
c | vectors stored |
|
||||
c | MAXBDW - Maximum bandwidth |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
integer maxn, maxnev, maxncv, maxbdw, lda,
|
||||
& lworkl, ldv
|
||||
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
|
||||
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
|
||||
& maxbdw=50, lda = maxbdw, ldv = maxn )
|
||||
c
|
||||
c %--------------%
|
||||
@@ -66,12 +66,12 @@ c %--------------%
|
||||
c
|
||||
integer iparam(11), iwork(maxn)
|
||||
logical select(maxncv)
|
||||
Real
|
||||
Real
|
||||
& a(lda,maxn), m(lda,maxn), rfac(lda,maxn),
|
||||
& workl(3*maxncv*maxncv+6*maxncv), workd(3*maxn),
|
||||
& workl(3*maxncv*maxncv+6*maxncv), workd(3*maxn),
|
||||
& workev(3*maxncv), v(ldv, maxncv),
|
||||
& resid(maxn), d(maxncv, 3), ax(maxn)
|
||||
Complex
|
||||
Complex
|
||||
& cfac(lda, maxn), workc(maxn)
|
||||
c
|
||||
c %---------------%
|
||||
@@ -83,25 +83,25 @@ c
|
||||
& n, nx, lo, idiag, isup, isub, mode, maxitr,
|
||||
& nconv
|
||||
logical rvec, first
|
||||
Real
|
||||
Real
|
||||
& tol, rho, h, sigmar, sigmai
|
||||
c
|
||||
c
|
||||
c %------------%
|
||||
c | Parameters |
|
||||
c %------------%
|
||||
c
|
||||
Real
|
||||
Real
|
||||
& one, zero, two
|
||||
parameter (one = 1.0E+0 , zero = 0.0E+0 ,
|
||||
parameter (one = 1.0E+0 , zero = 0.0E+0 ,
|
||||
& two = 2.0E+0 )
|
||||
c
|
||||
c %-----------------------------%
|
||||
c | BLAS & LAPACK routines used |
|
||||
c %-----------------------------%
|
||||
c
|
||||
Real
|
||||
Real
|
||||
& slapy2, snrm2
|
||||
external slapy2, snrm2, sgbmv, saxpy
|
||||
external slapy2, snrm2, sgbmv, saxpy
|
||||
c
|
||||
c %--------------------%
|
||||
c | Intrinsic function |
|
||||
@@ -132,8 +132,8 @@ c %--------------------------------------------------%
|
||||
c
|
||||
nx = 10
|
||||
n = nx*nx
|
||||
nev = 4
|
||||
ncv = 10
|
||||
nev = 4
|
||||
ncv = 10
|
||||
if ( n .gt. maxn ) then
|
||||
print *, ' ERROR with _NBDR5: N is greater than MAXN '
|
||||
go to 9000
|
||||
@@ -146,8 +146,8 @@ c
|
||||
end if
|
||||
bmat = 'I'
|
||||
which = 'LM'
|
||||
sigmar = 4.0E-1
|
||||
sigmai = 6.0E-1
|
||||
sigmar = 4.0E-1
|
||||
sigmai = 6.0E-1
|
||||
c
|
||||
c %-----------------------------------------------------%
|
||||
c | The work array WORKL is used in SNAUPD as |
|
||||
@@ -161,7 +161,7 @@ c | generated in SNAUPD to start the Arnoldi iteration. |
|
||||
c %-----------------------------------------------------%
|
||||
c
|
||||
lworkl = 3*ncv**2+6*ncv
|
||||
tol = zero
|
||||
tol = zero
|
||||
ido = 0
|
||||
info = 0
|
||||
c
|
||||
@@ -198,34 +198,34 @@ c | and subdiagonals within the band of |
|
||||
c | matrices A and M. |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
kl = nx
|
||||
ku = nx
|
||||
kl = nx
|
||||
ku = nx
|
||||
c
|
||||
c %---------------%
|
||||
c %---------------%
|
||||
c | Main diagonal |
|
||||
c %---------------%
|
||||
c
|
||||
idiag = kl+ku+1
|
||||
do 30 j = 1, n
|
||||
a(idiag,j) = 4.0E+0
|
||||
m(idiag,j) = 4.0E+0
|
||||
30 continue
|
||||
c
|
||||
a(idiag,j) = 4.0E+0
|
||||
m(idiag,j) = 4.0E+0
|
||||
30 continue
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | First subdiagonal and superdiagonal |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
c
|
||||
isup = kl+ku
|
||||
isub = kl+kl+2
|
||||
h = one / real (nx+1)
|
||||
rho = 1.0E+2
|
||||
rho = 1.0E+2
|
||||
do 50 i = 1, nx
|
||||
lo = (i-1)*nx
|
||||
do 40 j = lo+1, lo+nx-1
|
||||
a(isup,j+1) = -one+h*rho/two
|
||||
a(isub,j) = -one-h*rho/two
|
||||
40 continue
|
||||
50 continue
|
||||
40 continue
|
||||
50 continue
|
||||
c
|
||||
do 60 j = 1, n-1
|
||||
m(isup,j+1) = one
|
||||
@@ -244,8 +244,8 @@ c
|
||||
do 70 j = lo+1, lo+nx
|
||||
a(isup,nx+j) = -one
|
||||
a(isub,j) = -one
|
||||
70 continue
|
||||
80 continue
|
||||
70 continue
|
||||
80 continue
|
||||
c
|
||||
c %------------------------------------------------%
|
||||
c | Call ARPACK banded solver to find eigenvalues |
|
||||
@@ -253,13 +253,13 @@ c | and eigenvectors. The real parts of the |
|
||||
c | eigenvalues are returned in the first column |
|
||||
c | of D, the imaginary parts are returned in the |
|
||||
c | second column of D. Eigenvectors are returned |
|
||||
c | in the first NCONV (=IPARAM(5)) columns of V. |
|
||||
c | in the first NCONV (=IPARAM(5)) columns of V. |
|
||||
c %------------------------------------------------%
|
||||
c
|
||||
rvec = .true.
|
||||
call snband(rvec, 'A', select, d, d(1,2), v, ldv, sigmar,
|
||||
& sigmai, workev, n, a, m, lda, rfac, cfac, ku, kl,
|
||||
& which, bmat, nev, tol, resid, ncv, v, ldv, iparam,
|
||||
call snband(rvec, 'A', select, d, d(1,2), v, ldv, sigmar,
|
||||
& sigmai, workev, n, a, m, lda, rfac, cfac, ku, kl,
|
||||
& which, bmat, nev, tol, resid, ncv, v, ldv, iparam,
|
||||
& workd, workl, lworkl, workc, iwork, info)
|
||||
c
|
||||
if ( info .eq. 0) then
|
||||
@@ -292,7 +292,7 @@ c | Compute the residual norm. |
|
||||
c | || A*x - lambda*x || |
|
||||
c %----------------------------%
|
||||
c
|
||||
first = .true.
|
||||
first = .true.
|
||||
do 90 j = 1, nconv
|
||||
c
|
||||
if ( d(j,2) .eq. zero ) then
|
||||
@@ -301,8 +301,8 @@ c %--------------------%
|
||||
c | Ritz value is real |
|
||||
c %--------------------%
|
||||
c
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
& ax, 1)
|
||||
call saxpy(n, -d(j,1), v(1,j), 1, ax, 1)
|
||||
d(j,3) = snrm2(n, ax, 1)
|
||||
@@ -314,17 +314,17 @@ c %------------------------%
|
||||
c | Ritz value is complex |
|
||||
c | Residual of one Ritz |
|
||||
c | value of the conjugate |
|
||||
c | pair is computed. |
|
||||
c | pair is computed. |
|
||||
c %------------------------%
|
||||
c
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
& ax, 1)
|
||||
call saxpy(n, -d(j,1), v(1,j), 1, ax, 1)
|
||||
call saxpy(n, d(j,2), v(1,j+1), 1, ax, 1)
|
||||
d(j,3) = snrm2(n, ax, 1)
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j+1), 1, zero,
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j+1), 1, zero,
|
||||
& ax, 1)
|
||||
call saxpy(n, -d(j,1), v(1,j+1), 1, ax, 1)
|
||||
call saxpy(n, -d(j,2), v(1,j), 1, ax, 1)
|
||||
@@ -336,11 +336,11 @@ c
|
||||
first = .true.
|
||||
end if
|
||||
c
|
||||
90 continue
|
||||
90 continue
|
||||
|
||||
call smout(6, nconv, 3, d, maxncv, -6,
|
||||
& 'Ritz values (Real,Imag) and relative residuals')
|
||||
else
|
||||
else
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | Either convergence failed, or there |
|
||||
@@ -351,8 +351,8 @@ c
|
||||
print *, ' '
|
||||
print *, ' Error with _nband, info= ', info
|
||||
print *, ' Check the documentation of _nband '
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
c
|
||||
end if
|
||||
c
|
||||
9000 end
|
||||
9000 end
|
||||
|
||||
+59
-59
@@ -1,7 +1,7 @@
|
||||
program snbdr6
|
||||
c
|
||||
c ... Construct matrices A and M in LAPACK-style band form.
|
||||
c The matrix A is a block tridiagonal matrix. Each
|
||||
c The matrix A is a block tridiagonal matrix. Each
|
||||
c diagonal block is a tridiagonal matrix with
|
||||
c 4 on the diagonal, 1-rho*h/2 on the subdiagonal and
|
||||
c 1+rho*h/2 on the superdiagonal. Each subdiagonal block
|
||||
@@ -53,13 +53,13 @@ c | MAXN - Maximum size of the matrix |
|
||||
c | MAXNEV - Maximum number of |
|
||||
c | eigenvalues to be computed |
|
||||
c | MAXNCV - Maximum number of Arnoldi |
|
||||
c | vectors stored |
|
||||
c | vectors stored |
|
||||
c | MAXBDW - Maximum bandwidth |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
integer maxn, maxnev, maxncv, maxbdw, lda,
|
||||
& lworkl, ldv
|
||||
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
|
||||
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
|
||||
& maxbdw=50, lda = maxbdw, ldv = maxn )
|
||||
c
|
||||
c %--------------%
|
||||
@@ -68,12 +68,12 @@ c %--------------%
|
||||
c
|
||||
integer iparam(11), iwork(maxn)
|
||||
logical select(maxncv)
|
||||
Real
|
||||
Real
|
||||
& a(lda,maxn), m(lda,maxn), rfac(lda,maxn),
|
||||
& workl(3*maxncv*maxncv+6*maxncv), workd(3*maxn),
|
||||
& workl(3*maxncv*maxncv+6*maxncv), workd(3*maxn),
|
||||
& workev(3*maxncv), v(ldv, maxncv),
|
||||
& resid(maxn), d(maxncv, 3), ax(maxn), mx(maxn)
|
||||
Complex
|
||||
Complex
|
||||
& cfac(lda, maxn), workc(maxn)
|
||||
c
|
||||
c %---------------%
|
||||
@@ -85,16 +85,16 @@ c
|
||||
& n, nx, lo, idiag, isup, isub, mode, maxitr,
|
||||
& nconv
|
||||
logical rvec, first
|
||||
Real
|
||||
Real
|
||||
& tol, rho, h, sigmar, sigmai
|
||||
c
|
||||
c
|
||||
c %------------%
|
||||
c | Parameters |
|
||||
c %------------%
|
||||
c
|
||||
Real
|
||||
Real
|
||||
& one, zero, two
|
||||
parameter (one = 1.0E+0 , zero = 0.0E+0 ,
|
||||
parameter (one = 1.0E+0 , zero = 0.0E+0 ,
|
||||
& two = 2.0E+0 )
|
||||
c
|
||||
c %--------------------%
|
||||
@@ -107,9 +107,9 @@ c %-----------------------------%
|
||||
c | BLAS & LAPACK routines used |
|
||||
c %-----------------------------%
|
||||
c
|
||||
Real
|
||||
Real
|
||||
& slapy2, snrm2
|
||||
external slapy2, snrm2, sgbmv, saxpy
|
||||
external slapy2, snrm2, sgbmv, saxpy
|
||||
c
|
||||
c %-----------------------%
|
||||
c | Executable Statements |
|
||||
@@ -129,13 +129,13 @@ c | to get different parts the spectrum. However, the |
|
||||
c | following rules must be satisfied: |
|
||||
c | N <= MAXN |
|
||||
c | NEV <= MAXNEV |
|
||||
c | NEV + 2 <= NCV <= MAXNCV |
|
||||
c %-----------------------------------------------------%
|
||||
c | NEV + 2 <= NCV <= MAXNCV |
|
||||
c %-----------------------------------------------------%
|
||||
c
|
||||
nx = 10
|
||||
nx = 10
|
||||
n = nx*nx
|
||||
nev = 4
|
||||
ncv = 10
|
||||
nev = 4
|
||||
ncv = 10
|
||||
if ( n .gt. maxn ) then
|
||||
print *, ' ERROR with _NBDR6: N is greater than MAXN '
|
||||
go to 9000
|
||||
@@ -148,8 +148,8 @@ c
|
||||
end if
|
||||
bmat = 'G'
|
||||
which = 'LM'
|
||||
sigmar = 4.0E-1
|
||||
sigmai = 6.0E-1
|
||||
sigmar = 4.0E-1
|
||||
sigmai = 6.0E-1
|
||||
c
|
||||
c %-----------------------------------------------------%
|
||||
c | The work array WORKL is used in SNAUPD as |
|
||||
@@ -163,7 +163,7 @@ c | generated in SNAUPD to start the Arnoldi iteration. |
|
||||
c %-----------------------------------------------------%
|
||||
c
|
||||
lworkl = 3*ncv**2+6*ncv
|
||||
tol = zero
|
||||
tol = zero
|
||||
ido = 0
|
||||
info = 0
|
||||
c
|
||||
@@ -178,7 +178,7 @@ c
|
||||
maxitr = 300
|
||||
mode = 4
|
||||
c
|
||||
iparam(3) = maxitr
|
||||
iparam(3) = maxitr
|
||||
iparam(7) = mode
|
||||
c
|
||||
c %--------------------------------------------%
|
||||
@@ -200,34 +200,34 @@ c | and subdiagonals within the band of |
|
||||
c | matrices A and M. |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
kl = nx
|
||||
ku = nx
|
||||
kl = nx
|
||||
ku = nx
|
||||
c
|
||||
c %---------------%
|
||||
c %---------------%
|
||||
c | Main diagonal |
|
||||
c %---------------%
|
||||
c
|
||||
idiag = kl+ku+1
|
||||
do 30 j = 1, n
|
||||
a(idiag,j) = 4.0E+0
|
||||
m(idiag,j) = 4.0E+0
|
||||
30 continue
|
||||
c
|
||||
a(idiag,j) = 4.0E+0
|
||||
m(idiag,j) = 4.0E+0
|
||||
30 continue
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | First subdiagonal and superdiagonal |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
c
|
||||
isup = kl+ku
|
||||
isub = kl+ku+2
|
||||
h = one / real (nx+1)
|
||||
rho = 1.0E+2
|
||||
rho = 1.0E+2
|
||||
do 50 i = 1, nx
|
||||
lo = (i-1)*nx
|
||||
do 40 j = lo+1, lo+nx-1
|
||||
a(isub,j+1) = -one+h*rho/two
|
||||
a(isup,j) = -one-h*rho/two
|
||||
40 continue
|
||||
50 continue
|
||||
40 continue
|
||||
50 continue
|
||||
c
|
||||
do 60 j = 1, n-1
|
||||
m(isub,j+1) = one
|
||||
@@ -246,8 +246,8 @@ c
|
||||
do 70 j = lo+1, lo+nx
|
||||
a(isup,nx+j) = -one
|
||||
a(isub,j) = -one
|
||||
70 continue
|
||||
80 continue
|
||||
70 continue
|
||||
80 continue
|
||||
c
|
||||
c %------------------------------------------------%
|
||||
c | Call ARPACK banded solver to find eigenvalues |
|
||||
@@ -259,9 +259,9 @@ c | in the first NCONV (=IPARAM(5)) columns of V. |
|
||||
c %------------------------------------------------%
|
||||
c
|
||||
rvec = .true.
|
||||
call snband(rvec, 'A', select, d, d(1,2), v, ldv, sigmar,
|
||||
& sigmai, workev, n, a, m, lda, rfac, cfac, ku, kl,
|
||||
& which, bmat, nev, tol, resid, ncv, v, ldv, iparam,
|
||||
call snband(rvec, 'A', select, d, d(1,2), v, ldv, sigmar,
|
||||
& sigmai, workev, n, a, m, lda, rfac, cfac, ku, kl,
|
||||
& which, bmat, nev, tol, resid, ncv, v, ldv, iparam,
|
||||
& workd, workl, lworkl, workc, iwork, info)
|
||||
c
|
||||
if ( info .eq. 0) then
|
||||
@@ -294,7 +294,7 @@ c | Compute the residual norm. |
|
||||
c | || A*x - lambda*x || |
|
||||
c %----------------------------%
|
||||
c
|
||||
first = .true.
|
||||
first = .true.
|
||||
do 90 j = 1, nconv
|
||||
c
|
||||
if ( d(j,2) .eq. zero ) then
|
||||
@@ -303,11 +303,11 @@ c %--------------------%
|
||||
c | Ritz value is real |
|
||||
c %--------------------%
|
||||
c
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
& ax, 1)
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j), 1, zero,
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j), 1, zero,
|
||||
& mx, 1)
|
||||
call saxpy(n, -d(j,1), mx, 1, ax, 1)
|
||||
d(j,3) = snrm2(n, ax, 1)
|
||||
@@ -319,30 +319,30 @@ c %------------------------%
|
||||
c | Ritz value is complex |
|
||||
c | Residual of one Ritz |
|
||||
c | value of the conjugate |
|
||||
c | pair is computed. |
|
||||
c | pair is computed. |
|
||||
c %------------------------%
|
||||
c
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
& ax, 1)
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j), 1, zero,
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j), 1, zero,
|
||||
& mx, 1)
|
||||
call saxpy(n, -d(j,1), mx, 1, ax, 1)
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j+1), 1, zero,
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j+1), 1, zero,
|
||||
& mx, 1)
|
||||
call saxpy(n, d(j,2), mx, 1, ax, 1)
|
||||
d(j,3) = snrm2(n, ax, 1)
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j+1), 1, zero,
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j+1), 1, zero,
|
||||
& ax, 1)
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j+1), 1, zero,
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j+1), 1, zero,
|
||||
& mx, 1)
|
||||
call saxpy(n, -d(j,1), mx, 1, ax, 1)
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j), 1, zero,
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j), 1, zero,
|
||||
& mx, 1)
|
||||
call saxpy(n, -d(j,2), mx, 1, ax, 1)
|
||||
d(j,3) = slapy2( d(j,3), snrm2(n, ax, 1) )
|
||||
@@ -353,11 +353,11 @@ c
|
||||
first = .true.
|
||||
end if
|
||||
c
|
||||
90 continue
|
||||
90 continue
|
||||
|
||||
call smout(6, nconv, 3, d, maxncv, -6,
|
||||
& 'Ritz values (Real,Imag) and relative residuals')
|
||||
else
|
||||
else
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | Either convergence failed, or there |
|
||||
@@ -368,8 +368,8 @@ c
|
||||
print *, ' '
|
||||
print *, ' Error with _nband, info= ', info
|
||||
print *, ' Check the documentation of _nband '
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
c
|
||||
end if
|
||||
c
|
||||
9000 end
|
||||
9000 end
|
||||
|
||||
+152
-152
@@ -17,19 +17,19 @@ c
|
||||
c Matrices A and B are stored in LAPACK-style band form.
|
||||
c
|
||||
c There is negligible additional cost to obtain eigenvectors. An orthonormal
|
||||
c (Lanczos) basis is always computed. There is an additional storage cost
|
||||
c of n*nev if both are requested (in this case a separate array Z must be
|
||||
c (Lanczos) basis is always computed. There is an additional storage cost
|
||||
c of n*nev if both are requested (in this case a separate array Z must be
|
||||
c supplied).
|
||||
c
|
||||
c The approximate eigenvalues and eigenvectors of A*z = lambda*B*z
|
||||
c are called Ritz values and Ritz vectors respectively. They are referred
|
||||
c to as such in the comments that follow. The computed orthonormal basis
|
||||
c for the invariant subspace corresponding to these Ritz values is referred
|
||||
c are called Ritz values and Ritz vectors respectively. They are referred
|
||||
c to as such in the comments that follow. The computed orthonormal basis
|
||||
c for the invariant subspace corresponding to these Ritz values is referred
|
||||
c to as a Lanczos basis.
|
||||
c
|
||||
c ssband can be called with one of the following modes:
|
||||
c
|
||||
c Mode 1: A*x = lambda*x, A symmetric
|
||||
c Mode 1: A*x = lambda*x, A symmetric
|
||||
c ===> OP = A and B = I.
|
||||
c
|
||||
c Mode 2: A*x = lambda*M*x, A symmetric, M symmetric positive definite
|
||||
@@ -37,10 +37,10 @@ c ===> OP = inv[M]*A and B = M.
|
||||
c ===> (If M can be factored see remark 3 in SSAUPD)
|
||||
c
|
||||
c Mode 3: K*x = lambda*M*x, K symmetric, M symmetric positive semi-definite
|
||||
c ===> OP = (inv[K - sigma*M])*M and B = M.
|
||||
c ===> OP = (inv[K - sigma*M])*M and B = M.
|
||||
c ===> Shift-and-Invert mode
|
||||
c
|
||||
c Mode 4: K*x = lambda*KG*x, K symmetric positive semi-definite,
|
||||
c Mode 4: K*x = lambda*KG*x, K symmetric positive semi-definite,
|
||||
c KG symmetric indefinite
|
||||
c ===> OP = (inv[K - sigma*KG])*K and B = K.
|
||||
c ===> Buckling mode
|
||||
@@ -53,21 +53,21 @@ c The choice of mode must be specified in IPARAM(7) defined below.
|
||||
c
|
||||
c \Usage
|
||||
c call ssband
|
||||
c ( RVEC, HOWMNY, SELECT, D, Z, LDZ, SIGMA, N, AB, MB, LDA,
|
||||
c RFAC, KL, KU, WHICH, BMAT, NEV, TOL, RESID, NCV, V,
|
||||
c ( RVEC, HOWMNY, SELECT, D, Z, LDZ, SIGMA, N, AB, MB, LDA,
|
||||
c RFAC, KL, KU, WHICH, BMAT, NEV, TOL, RESID, NCV, V,
|
||||
c LDV, IPARAM, WORKD, WORKL, LWORKL, IWORK, INFO )
|
||||
c
|
||||
c \Arguments
|
||||
c
|
||||
c RVEC Logical (INPUT)
|
||||
c Specifies whether Ritz vectors corresponding to the Ritz value
|
||||
c Specifies whether Ritz vectors corresponding to the Ritz value
|
||||
c approximations to the eigenproblem A*z = lambda*B*z are computed.
|
||||
c
|
||||
c RVEC = .FALSE. Compute Ritz values only.
|
||||
c
|
||||
c RVEC = .TRUE. Compute the associated Ritz vectors.
|
||||
c RVEC = .TRUE. Compute the associated Ritz vectors.
|
||||
c
|
||||
c HOWMNY Character*1 (INPUT)
|
||||
c HOWMNY Character*1 (INPUT)
|
||||
c Specifies how many Ritz vectors are wanted and the form of Z
|
||||
c the matrix of Ritz vectors. See remark 1 below.
|
||||
c = 'A': compute all Ritz vectors;
|
||||
@@ -77,7 +77,7 @@ c
|
||||
c SELECT Logical array of dimension NCV. (INPUT)
|
||||
c If HOWMNY = 'S', SELECT specifies the Ritz vectors to be
|
||||
c computed. To select the Ritz vector corresponding to a
|
||||
c Ritz value D(j), SELECT(j) must be set to .TRUE..
|
||||
c Ritz value D(j), SELECT(j) must be set to .TRUE..
|
||||
c If HOWMNY = 'A' , SELECT is not referenced.
|
||||
c
|
||||
c D Real array of dimension NEV. (OUTPUT)
|
||||
@@ -85,8 +85,8 @@ c On exit, D contains the Ritz value approximations to the
|
||||
c eigenvalues of A*z = lambda*B*z. The values are returned
|
||||
c in ascending order. If IPARAM(7) = 3,4,5 then D represents
|
||||
c the Ritz values of OP computed by ssaupd transformed to
|
||||
c those of the original eigensystem A*z = lambda*B*z. If
|
||||
c IPARAM(7) = 1,2 then the Ritz values of OP are the same
|
||||
c those of the original eigensystem A*z = lambda*B*z. If
|
||||
c IPARAM(7) = 1,2 then the Ritz values of OP are the same
|
||||
c as the those of A*z = lambda*B*z.
|
||||
c
|
||||
c Z Real N by NEV array if HOWMNY = 'A'. (OUTPUT)
|
||||
@@ -95,20 +95,20 @@ c eigensystem A*z = lambda*B*z corresponding to the Ritz
|
||||
c value approximations.
|
||||
c
|
||||
c If RVEC = .FALSE. then Z is not referenced.
|
||||
c NOTE: The array Z may be set equal to first NEV columns of the
|
||||
c NOTE: The array Z may be set equal to first NEV columns of the
|
||||
c Lanczos basis array V computed by SSAUPD.
|
||||
c
|
||||
c LDZ Integer. (INPUT)
|
||||
c LDZ Integer. (INPUT)
|
||||
c The leading dimension of the array Z. If Ritz vectors are
|
||||
c desired, then LDZ .ge. max( 1, N ). In any case, LDZ .ge. 1.
|
||||
c
|
||||
c SIGMA Real (INPUT)
|
||||
c If IPARAM(7) = 3,4,5 represents the shift. Not referenced if
|
||||
c IPARAM(7) = 1 or 2.
|
||||
c
|
||||
c N Integer. (INPUT)
|
||||
c Dimension of the eigenproblem.
|
||||
c
|
||||
c
|
||||
c N Integer. (INPUT)
|
||||
c Dimension of the eigenproblem.
|
||||
c
|
||||
c AB Real array of dimension LDA by N. (INPUT)
|
||||
c The matrix A in band storage, in rows KL+1 to
|
||||
c 2*KL+KU+1; rows 1 to KL of the array need not be set.
|
||||
@@ -118,7 +118,7 @@ c AB(kl+ku+1+i-j,j) = A(i,j) for max(1,j-ku)<=i<=min(m,j+kl)
|
||||
c
|
||||
c MB Real array of dimension LDA by N. (INPUT)
|
||||
c The matrix M in band storage, in rows KL+1 to
|
||||
c 2*KL+KU+1; rows 1 to KL of the array need not be set.
|
||||
c 2*KL+KU+1; rows 1 to KL of the array need not be set.
|
||||
c The j-th column of M is stored in the j-th column of the
|
||||
c array AB as follows:
|
||||
c MB(kl+ku+1+i-j,j) = M(i,j) for max(1,j-ku)<=i<=min(m,j+kl)
|
||||
@@ -128,7 +128,7 @@ c LDA Integer. (INPUT)
|
||||
c Leading dimension of AB, MB, RFAC.
|
||||
c
|
||||
c RFAC Real array of LDA by N. (WORKSPACE/OUTPUT)
|
||||
c RFAC is used to store the LU factors of MB when IPARAM(7) = 2
|
||||
c RFAC is used to store the LU factors of MB when IPARAM(7) = 2
|
||||
c is invoked. It is used to store the LU factors of
|
||||
c (A-sigma*M) when IPARAM(7) = 3,4,5 is invoked.
|
||||
c It is not referenced when IPARAM(7) = 1.
|
||||
@@ -142,17 +142,17 @@ c
|
||||
c WHICH Character*2. (INPUT)
|
||||
c When IPARAM(7)= 1 or 2, WHICH can be set to any one of
|
||||
c the following.
|
||||
c
|
||||
c
|
||||
c 'LM' -> want the NEV eigenvalues of largest magnitude.
|
||||
c 'SM' -> want the NEV eigenvalues of smallest magnitude.
|
||||
c 'LA' -> want the NEV eigenvalues of largest REAL part.
|
||||
c 'SA' -> want the NEV eigenvalues of smallest REAL part.
|
||||
c 'BE' -> Compute NEV eigenvalues, half from each end of the
|
||||
c spectrum. When NEV is odd, compute one more from
|
||||
c the high end than from the low end.
|
||||
c 'BE' -> Compute NEV eigenvalues, half from each end of the
|
||||
c spectrum. When NEV is odd, compute one more from
|
||||
c the high end than from the low end.
|
||||
c
|
||||
c When IPARAM(7) = 3, 4, or 5, WHICH should be set to 'LM' only.
|
||||
c
|
||||
c When IPARAM(7) = 3, 4, or 5, WHICH should be set to 'LM' only.
|
||||
c
|
||||
c BMAT Character*1. (INPUT)
|
||||
c BMAT specifies the type of the matrix B that defines the
|
||||
c semi-inner product for the operator OP.
|
||||
@@ -161,9 +161,9 @@ c BMAT = 'G' -> generalized eigenvalue problem A*x = lambda*M*x
|
||||
|
||||
c NEV Integer. (INPUT)
|
||||
c Number of eigenvalues of OP to be computed.
|
||||
c
|
||||
c
|
||||
c TOL Real scalar. (INPUT)
|
||||
c Stopping criterion: the relative accuracy of the Ritz value
|
||||
c Stopping criterion: the relative accuracy of the Ritz value
|
||||
c is considered acceptable if BOUNDS(I) .LE. TOL*ABS(RITZ(I)).
|
||||
c If TOL .LE. 0. is passed a default is set:
|
||||
c DEFAULT = SLAMCH('EPS') (machine precision as computed
|
||||
@@ -183,35 +183,35 @@ c Represents the dimension of the Lanczos basis constructed
|
||||
c by ssaupd for OP.
|
||||
c
|
||||
c V Real array N by NCV. (OUTPUT)
|
||||
c Upon INPUT: the NCV columns of V contain the Lanczos basis
|
||||
c Upon INPUT: the NCV columns of V contain the Lanczos basis
|
||||
c vectors as constructed by ssaupd for OP.
|
||||
c Upon OUTPUT: If RVEC = .TRUE. the first NCONV=IPARAM(5) columns
|
||||
c represent the Ritz vectors that span the desired
|
||||
c Upon OUTPUT: If RVEC = .TRUE. the first NCONV=IPARAM(5) columns
|
||||
c represent the Ritz vectors that span the desired
|
||||
c invariant subspace.
|
||||
c NOTE: The array Z may be set equal to first NEV columns of the
|
||||
c NOTE: The array Z may be set equal to first NEV columns of the
|
||||
c Lanczos basis vector array V computed by ssaupd. In this case
|
||||
c if RVEC=.TRUE., the first NCONV=IPARAM(5) columns of V contain
|
||||
c the desired Ritz vectors.
|
||||
c the desired Ritz vectors.
|
||||
c
|
||||
c LDV Integer. (INPUT)
|
||||
c Leading dimension of V exactly as declared in the calling
|
||||
c program.
|
||||
c
|
||||
c IPARAM Integer array of length 11. (INPUT/OUTPUT)
|
||||
c IPARAM(1) = ISHIFT:
|
||||
c IPARAM(1) = ISHIFT:
|
||||
c The shifts selected at each iteration are used to restart
|
||||
c the Arnoldi iteration in an implicit fashion.
|
||||
c It is set to 1 in this subroutine. The user do not need
|
||||
c to set this parameter.
|
||||
c ------------------------------------------------------------
|
||||
c ISHIFT = 1: exact shifts with respect to the reduced
|
||||
c tridiagonal matrix T. This is equivalent to
|
||||
c restarting the iteration with a starting vector
|
||||
c that is a linear combination of Ritz vectors
|
||||
c ISHIFT = 1: exact shifts with respect to the reduced
|
||||
c tridiagonal matrix T. This is equivalent to
|
||||
c restarting the iteration with a starting vector
|
||||
c that is a linear combination of Ritz vectors
|
||||
c associated with the "wanted" Ritz values.
|
||||
c -------------------------------------------------------------
|
||||
c
|
||||
c IPARAM(2) = No longer referenced.
|
||||
c IPARAM(2) = No longer referenced.
|
||||
c
|
||||
c IPARAM(3) = MXITER
|
||||
c On INPUT: max number of Arnoldi update iterations allowed.
|
||||
@@ -225,11 +225,11 @@ c This represents the number of Ritz values that satisfy
|
||||
c the convergence criterion.
|
||||
c
|
||||
c IPARAM(6) = IUPD
|
||||
c No longer referenced. Implicit restarting is ALWAYS used.
|
||||
c No longer referenced. Implicit restarting is ALWAYS used.
|
||||
c
|
||||
c IPARAM(7) = MODE
|
||||
c On INPUT determines what type of eigenproblem is being solved.
|
||||
c Must be 1,2,3,4,5; See under \Description of ssband for the
|
||||
c Must be 1,2,3,4,5; See under \Description of ssband for the
|
||||
c five modes available.
|
||||
c
|
||||
c IPARAM(8) = NP
|
||||
@@ -248,18 +248,18 @@ c LWORKL Integer. (INPUT)
|
||||
c LWORKL must be at least NCV**2 + 8*NCV.
|
||||
c
|
||||
c IWORK Integer array of dimension at least N. (WORKSPACE)
|
||||
c Used when IPARAM(7)=2,3,4,5 to store the pivot information in the
|
||||
c Used when IPARAM(7)=2,3,4,5 to store the pivot information in the
|
||||
c factorization of M or (A-SIGMA*M).
|
||||
c
|
||||
c
|
||||
c INFO Integer. (INPUT/OUTPUT)
|
||||
c Error flag on output.
|
||||
c = 0: Normal exit.
|
||||
c = 1: Maximum number of iterations taken.
|
||||
c All possible eigenvalues of OP has been found. IPARAM(5)
|
||||
c All possible eigenvalues of OP has been found. IPARAM(5)
|
||||
c returns the number of wanted converged Ritz values.
|
||||
c = 3: No shifts could be applied during a cycle of the
|
||||
c Implicitly restarted Arnoldi iteration. One possibility
|
||||
c is to increase the size of NCV relative to NEV.
|
||||
c = 3: No shifts could be applied during a cycle of the
|
||||
c Implicitly restarted Arnoldi iteration. One possibility
|
||||
c is to increase the size of NCV relative to NEV.
|
||||
c See remark 4 in SSAUPD.
|
||||
c
|
||||
c = -1: N must be positive.
|
||||
@@ -292,7 +292,7 @@ c 1. D.C. Sorensen, "Implicit Application of Polynomial Filters in
|
||||
c a k-Step Arnoldi Method", SIAM J. Matr. Anal. Apps., 13 (1992),
|
||||
c pp 357-385.
|
||||
c
|
||||
c 2. R.B. Lehoucq, "Analysis and Implementation of an Implicitly
|
||||
c 2. R.B. Lehoucq, "Analysis and Implementation of an Implicitly
|
||||
c Restarted Arnoldi Iteration", Ph.D thesis, TR95-13, Rice Univ,
|
||||
c May 1995.
|
||||
c
|
||||
@@ -301,7 +301,7 @@ c ssaupd ARPACK reverse communication interface routine.
|
||||
c sseupd ARPACK routine that returns Ritz values and (optionally)
|
||||
c Ritz vectors.
|
||||
c sgbtrf LAPACK band matrix factorization routine.
|
||||
c sgbtrs LAPACK band linear system solve routine.
|
||||
c sgbtrs LAPACK band linear system solve routine.
|
||||
c slacpy LAPACK matrix copy routine.
|
||||
c slapy2 LAPACK routine to compute sqrt(x**2+y**2) carefully.
|
||||
c scopy Level 1 BLAS that copies one vector to another.
|
||||
@@ -310,13 +310,13 @@ c snrm2 Level 1 BLAS that computes the norm of a vector.
|
||||
c sgbmv Level 2 BLAS that computes the band matrix vector product.
|
||||
c
|
||||
c\Remarks
|
||||
c 1. The converged Ritz values are always returned in increasing
|
||||
c 1. The converged Ritz values are always returned in increasing
|
||||
c (algebraic) order.
|
||||
c
|
||||
c 2. Currently only HOWMNY = 'A' is implemented. It is included at this
|
||||
c stage for the user who wants to incorporate it.
|
||||
c
|
||||
c\Author
|
||||
c\Author
|
||||
c Danny Sorensen
|
||||
c Richard Lehoucq
|
||||
c Chao Yang
|
||||
@@ -332,18 +332,18 @@ c\EndLib
|
||||
c
|
||||
c---------------------------------------------------------------------
|
||||
c
|
||||
subroutine ssband( rvec, howmny, select, d, z, ldz, sigma,
|
||||
& n, ab, mb, lda, rfac, kl, ku, which, bmat, nev,
|
||||
& tol, resid, ncv, v, ldv, iparam, workd, workl,
|
||||
subroutine ssband( rvec, howmny, select, d, z, ldz, sigma,
|
||||
& n, ab, mb, lda, rfac, kl, ku, which, bmat, nev,
|
||||
& tol, resid, ncv, v, ldv, iparam, workd, workl,
|
||||
& lworkl, iwork, info)
|
||||
c
|
||||
c %------------------%
|
||||
c | Scalar Arguments |
|
||||
c %------------------%
|
||||
c
|
||||
c
|
||||
character which*2, bmat, howmny
|
||||
integer n, lda, kl, ku, nev, ncv, ldv,
|
||||
& ldz, lworkl, info
|
||||
& ldz, lworkl, info
|
||||
Real
|
||||
& tol, sigma
|
||||
logical rvec
|
||||
@@ -356,7 +356,7 @@ c
|
||||
logical select(*)
|
||||
Real
|
||||
& d(*), resid(*), v(ldv,*), z(ldz,*),
|
||||
& ab(lda,*), mb(lda,*), rfac(lda,*),
|
||||
& ab(lda,*), mb(lda,*), rfac(lda,*),
|
||||
& workd(*), workl(*)
|
||||
c
|
||||
c %--------------%
|
||||
@@ -386,22 +386,22 @@ c %-----------------------------%
|
||||
c
|
||||
Real
|
||||
& sdot, snrm2, slapy2
|
||||
external sdot, scopy, sgbmv, sgbtrf,
|
||||
external sdot, scopy, sgbmv, sgbtrf,
|
||||
& sgbtrs, snrm2, slapy2, slacpy
|
||||
c
|
||||
c %-----------------------%
|
||||
c | Executable Statements |
|
||||
c %-----------------------%
|
||||
c
|
||||
c
|
||||
c %----------------------------------------------------------------%
|
||||
c | Set type of the problem to be solved. Check consistency |
|
||||
c | between BMAT and IPARAM(7). |
|
||||
c | type = 1 --> Solving standard problem in regular mode. |
|
||||
c | type = 2 --> Solving standard problem in shift-invert mode. |
|
||||
c | type = 2 --> Solving standard problem in shift-invert mode. |
|
||||
c | type = 3 --> Solving generalized problem in regular mode. |
|
||||
c | type = 4 --> Solving generalized problem in shift-invert mode. |
|
||||
c | type = 5 --> Solving generalized problem in Buckling mode. |
|
||||
c | type = 6 --> Solving generalized problem in Cayley mode. |
|
||||
c | type = 6 --> Solving generalized problem in Cayley mode. |
|
||||
c %----------------------------------------------------------------%
|
||||
c
|
||||
if ( iparam(7) .eq. 1 ) then
|
||||
@@ -411,15 +411,15 @@ c
|
||||
else if ( iparam(7) .eq. 2 ) then
|
||||
type = 3
|
||||
else if ( iparam(7) .eq. 3 .and. bmat .eq. 'G') then
|
||||
type = 4
|
||||
type = 4
|
||||
else if ( iparam(7) .eq. 4 ) then
|
||||
type = 5
|
||||
else if ( iparam(7) .eq. 5 ) then
|
||||
else if ( iparam(7) .eq. 5 ) then
|
||||
type = 6
|
||||
else
|
||||
print*, ' '
|
||||
print*, 'BMAT is inconsistent with IPARAM(7).'
|
||||
print*, ' '
|
||||
print*, ' '
|
||||
go to 9000
|
||||
end if
|
||||
c
|
||||
@@ -432,9 +432,9 @@ c
|
||||
c
|
||||
c %----------------%
|
||||
c | Exact shift is |
|
||||
c | used. |
|
||||
c | used. |
|
||||
c %----------------%
|
||||
c
|
||||
c
|
||||
iparam(1) = 1
|
||||
c
|
||||
c %-----------------------------------%
|
||||
@@ -462,7 +462,7 @@ c
|
||||
10 continue
|
||||
call sgbtrf(n, n, kl, ku, rfac, lda, iwork, ierr )
|
||||
if (ierr .ne. 0) then
|
||||
print*, ' '
|
||||
print*, ' '
|
||||
print*, ' _SBAND: Error with _gbtrf. '
|
||||
print*, ' '
|
||||
go to 9000
|
||||
@@ -477,28 +477,28 @@ c | routine sgbtrf to factor M. |
|
||||
c %----------------------------------------------%
|
||||
c
|
||||
call slacpy ('A', ibot, n, mb, lda, rfac, lda )
|
||||
call sgbtrf(n, n, kl, ku, rfac, lda, iwork, ierr)
|
||||
if (ierr .ne. 0) then
|
||||
call sgbtrf(n, n, kl, ku, rfac, lda, iwork, ierr)
|
||||
if (ierr .ne. 0) then
|
||||
print*, ' '
|
||||
print*,'_SBAND: Error with _gbtrf.'
|
||||
print*, ' '
|
||||
go to 9000
|
||||
print*,'_SBAND: Error with _gbtrf.'
|
||||
print*, ' '
|
||||
go to 9000
|
||||
end if
|
||||
c
|
||||
else if ( type .eq. 4 .or. type .eq. 5 .or. type .eq. 6
|
||||
else if ( type .eq. 4 .or. type .eq. 5 .or. type .eq. 6
|
||||
& .and. bmat .eq. 'G' ) then
|
||||
c
|
||||
c %-------------------------------------------%
|
||||
c | Solving generalized eigenvalue problem in |
|
||||
c | shift-invert, Buckling, or Cayley mode. |
|
||||
c %-------------------------------------------%
|
||||
c
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | Construct and factor (A - sigma*M). |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
do 60 j = 1,n
|
||||
do 50 i = itop, ibot
|
||||
do 50 i = itop, ibot
|
||||
rfac(i,j) = ab(i,j) - sigma*mb(i,j)
|
||||
50 continue
|
||||
60 continue
|
||||
@@ -510,14 +510,14 @@ c
|
||||
print*, ' '
|
||||
go to 9000
|
||||
end if
|
||||
c
|
||||
end if
|
||||
c
|
||||
end if
|
||||
c
|
||||
c %--------------------------------------------%
|
||||
c | M A I N L O O P (reverse communication) |
|
||||
c %--------------------------------------------%
|
||||
c
|
||||
90 continue
|
||||
90 continue
|
||||
c
|
||||
call ssaupd ( ido, bmat, n, which, nev, tol, resid, ncv,
|
||||
& v, ldv, iparam, ipntr, workd, workl, lworkl,
|
||||
@@ -531,8 +531,8 @@ c %----------------------------%
|
||||
c | Perform y <--- OP*x = A*x |
|
||||
c %----------------------------%
|
||||
c
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
& workd(ipntr(2)), 1)
|
||||
c
|
||||
else if ( type .eq. 2 ) then
|
||||
@@ -548,7 +548,7 @@ c
|
||||
call sgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
|
||||
& iwork, workd(ipntr(2)), n, ierr)
|
||||
if ( ierr .ne. 0 ) then
|
||||
print*, ' '
|
||||
print*, ' '
|
||||
print*, ' _SBAND: Error with _bgtrs. '
|
||||
print*, ' '
|
||||
go to 9000
|
||||
@@ -558,15 +558,15 @@ c
|
||||
c
|
||||
c %-----------------------------------%
|
||||
c | Perform y <--- OP*x = inv[M]*A*x |
|
||||
c | to force the starting vector into |
|
||||
c | to force the starting vector into |
|
||||
c | the range of OP. |
|
||||
c %-----------------------------------%
|
||||
c
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
& workd(ipntr(2)), 1)
|
||||
call scopy(n, workd(ipntr(2)), 1, workd(ipntr(1)), 1)
|
||||
call sgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
|
||||
call sgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
|
||||
& iwork, workd(ipntr(2)), n, ierr)
|
||||
if (ierr .ne. 0) then
|
||||
print*, ' '
|
||||
@@ -579,36 +579,36 @@ c
|
||||
c
|
||||
c %-----------------------------------------%
|
||||
c | Perform y <-- OP*x |
|
||||
c | = inv[A-SIGMA*M]*M |
|
||||
c | = inv[A-SIGMA*M]*M |
|
||||
c | to force the starting vector into the |
|
||||
c | range of OP. |
|
||||
c %-----------------------------------------%
|
||||
c
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one, mb(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one, mb(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
& workd(ipntr(2)), 1)
|
||||
call sgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
|
||||
call sgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
|
||||
& iwork, workd(ipntr(2)), n, ierr)
|
||||
if (ierr .ne. 0) then
|
||||
print*, ' '
|
||||
print*, ' '
|
||||
print*, '_SBAND: Error with _gbtrs.'
|
||||
print*, ' '
|
||||
print*, ' '
|
||||
go to 9000
|
||||
end if
|
||||
c
|
||||
else if ( type .eq. 5) then
|
||||
c
|
||||
c %---------------------------------------%
|
||||
c %---------------------------------------%
|
||||
c | Perform y <-- OP*x |
|
||||
c | = inv[A-SIGMA*M]*A |
|
||||
c | to force the starting vector into the |
|
||||
c | range of OP. |
|
||||
c %---------------------------------------%
|
||||
c
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
& workd(ipntr(2)), 1)
|
||||
call sgbtrs('Notranspose', n, kl, ku, 1, rfac, lda,
|
||||
call sgbtrs('Notranspose', n, kl, ku, 1, rfac, lda,
|
||||
& iwork, workd(ipntr(2)), n, ierr)
|
||||
c
|
||||
if ( ierr .ne. 0 ) then
|
||||
@@ -622,31 +622,31 @@ c
|
||||
c
|
||||
c %---------------------------------------%
|
||||
c | Perform y <-- OP*x |
|
||||
c | = (inv[A-SIGMA*M])*(A+SIGMA*M)*x |
|
||||
c | = (inv[A-SIGMA*M])*(A+SIGMA*M)*x |
|
||||
c | to force the starting vector into the |
|
||||
c | range of OP. |
|
||||
c | range of OP. |
|
||||
c %---------------------------------------%
|
||||
c
|
||||
if ( bmat .eq. 'G' ) then
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& ab(itop,1), lda, workd(ipntr(1)), 1,
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& ab(itop,1), lda, workd(ipntr(1)), 1,
|
||||
& zero, workd(ipntr(2)), 1)
|
||||
call sgbmv('Notranspose', n, n, kl, ku, sigma,
|
||||
& mb(itop,1), lda, workd(ipntr(1)), 1,
|
||||
call sgbmv('Notranspose', n, n, kl, ku, sigma,
|
||||
& mb(itop,1), lda, workd(ipntr(1)), 1,
|
||||
& one, workd(ipntr(2)), 1)
|
||||
else
|
||||
else
|
||||
call scopy(n, workd(ipntr(1)), 1, workd(ipntr(2)), 1)
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, sigma,
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, sigma,
|
||||
& workd(ipntr(2)), 1)
|
||||
end if
|
||||
end if
|
||||
c
|
||||
call sgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
|
||||
call sgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
|
||||
& iwork, workd(ipntr(2)), n, ierr)
|
||||
c
|
||||
if (ierr .ne. 0) then
|
||||
if (ierr .ne. 0) then
|
||||
print*, ' '
|
||||
print*, '_SBAND: Error with _gbtrs.'
|
||||
print*, '_SBAND: Error with _gbtrs.'
|
||||
print*, ' '
|
||||
go to 9000
|
||||
end if
|
||||
@@ -661,8 +661,8 @@ c %----------------------------%
|
||||
c | Perform y <--- OP*x = A*x |
|
||||
c %----------------------------%
|
||||
c
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
& workd(ipntr(2)), 1)
|
||||
c
|
||||
else if ( type .eq. 2) then
|
||||
@@ -677,7 +677,7 @@ c
|
||||
& iwork, workd(ipntr(2)), n, ierr)
|
||||
if ( ierr .ne. 0 ) then
|
||||
print*, ' '
|
||||
print*, '_SBAND: Error with _gbtrs.'
|
||||
print*, '_SBAND: Error with _gbtrs.'
|
||||
print*, ' '
|
||||
go to 9000
|
||||
end if
|
||||
@@ -688,16 +688,16 @@ c %-----------------------------------%
|
||||
c | Perform y <--- OP*x = inv[M]*A*x |
|
||||
c %-----------------------------------%
|
||||
c
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
& workd(ipntr(2)), 1)
|
||||
call scopy(n, workd(ipntr(2)), 1, workd(ipntr(1)), 1)
|
||||
call sgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
|
||||
call scopy(n, workd(ipntr(2)), 1, workd(ipntr(1)), 1)
|
||||
call sgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
|
||||
& iwork, workd(ipntr(2)), n, ierr)
|
||||
if (ierr .ne. 0) then
|
||||
print*, ' '
|
||||
print*, '_SBAND: error with _bgtrs.'
|
||||
print*, ' '
|
||||
print*, ' '
|
||||
go to 9000
|
||||
end if
|
||||
c
|
||||
@@ -706,22 +706,22 @@ c
|
||||
c %-------------------------------------%
|
||||
c | Perform y <-- inv(A-sigma*M)*(M*x). |
|
||||
c | (M*x) has been computed and stored |
|
||||
c | in workd(ipntr(3)). |
|
||||
c | in workd(ipntr(3)). |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
call scopy(n, workd(ipntr(3)), 1, workd(ipntr(2)), 1)
|
||||
call sgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
|
||||
call sgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
|
||||
& iwork, workd(ipntr(2)), n, ierr)
|
||||
if (ierr .ne. 0) then
|
||||
if (ierr .ne. 0) then
|
||||
print*, ' '
|
||||
print*, '_SBAND: Error with _gbtrs.'
|
||||
print*, '_SBAND: Error with _gbtrs.'
|
||||
print*, ' '
|
||||
go to 9000
|
||||
end if
|
||||
c
|
||||
c
|
||||
else if ( type .eq. 5 ) then
|
||||
c
|
||||
c %-------------------------------%
|
||||
c %-------------------------------%
|
||||
c | Perform y <-- OP*x |
|
||||
c | = inv[A-SIGMA*M]*A*x |
|
||||
c | B*x = A*x has been computed |
|
||||
@@ -729,7 +729,7 @@ c | and saved in workd(ipntr(3)). |
|
||||
c %-------------------------------%
|
||||
c
|
||||
call scopy (n, workd(ipntr(3)), 1, workd(ipntr(2)), 1)
|
||||
call sgbtrs('Notranspose', n, kl, ku, 1, rfac, lda,
|
||||
call sgbtrs('Notranspose', n, kl, ku, 1, rfac, lda,
|
||||
& iwork, workd(ipntr(2)), n, ierr)
|
||||
if ( ierr .ne. 0 ) then
|
||||
print*, ' '
|
||||
@@ -742,24 +742,24 @@ c
|
||||
c
|
||||
c %---------------------------------%
|
||||
c | Perform y <-- OP*x |
|
||||
c | = inv[A-SIGMA*M]*(A+SIGMA*M)*x. |
|
||||
c | = inv[A-SIGMA*M]*(A+SIGMA*M)*x. |
|
||||
c | (M*x) has been saved in |
|
||||
c | workd(ipntr(3)). |
|
||||
c %---------------------------------%
|
||||
c
|
||||
if ( bmat .eq. 'G' ) then
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& ab(itop,1), lda, workd(ipntr(1)), 1,
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& ab(itop,1), lda, workd(ipntr(1)), 1,
|
||||
& zero, workd(ipntr(2)), 1)
|
||||
call saxpy( n, sigma, workd(ipntr(3)), 1,
|
||||
call saxpy( n, sigma, workd(ipntr(3)), 1,
|
||||
& workd(ipntr(2)), 1 )
|
||||
else
|
||||
else
|
||||
call scopy (n, workd(ipntr(1)), 1, workd(ipntr(2)), 1)
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, sigma,
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, sigma,
|
||||
& workd(ipntr(2)), 1)
|
||||
end if
|
||||
call sgbtrs('Notranspose', n, kl, ku, 1, rfac, lda,
|
||||
call sgbtrs('Notranspose', n, kl, ku, 1, rfac, lda,
|
||||
& iwork, workd(ipntr(2)), n, ierr)
|
||||
c
|
||||
end if
|
||||
@@ -767,9 +767,9 @@ c
|
||||
else if (ido .eq. 2) then
|
||||
c
|
||||
c %----------------------------------%
|
||||
c | Perform y <-- B*x |
|
||||
c | Perform y <-- B*x |
|
||||
c | Note when Buckling mode is used, |
|
||||
c | B = A, otherwise B=M. |
|
||||
c | B = A, otherwise B=M. |
|
||||
c %----------------------------------%
|
||||
c
|
||||
if (type .eq. 5) then
|
||||
@@ -778,20 +778,20 @@ c %---------------------%
|
||||
c | Buckling Mode, B=A. |
|
||||
c %---------------------%
|
||||
c
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& ab(itop,1), lda, workd(ipntr(1)), 1,
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& ab(itop,1), lda, workd(ipntr(1)), 1,
|
||||
& zero, workd(ipntr(2)), 1)
|
||||
else
|
||||
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& mb(itop,1), lda, workd(ipntr(1)), 1,
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& mb(itop,1), lda, workd(ipntr(1)), 1,
|
||||
& zero, workd(ipntr(2)), 1)
|
||||
end if
|
||||
c
|
||||
else
|
||||
else
|
||||
c
|
||||
c %-----------------------------------------%
|
||||
c | Either we have convergence, or there is |
|
||||
c | Either we have convergence, or there is |
|
||||
c | error. |
|
||||
c %-----------------------------------------%
|
||||
c
|
||||
@@ -808,7 +808,7 @@ c
|
||||
print *, ' '
|
||||
go to 9000
|
||||
c
|
||||
else
|
||||
else
|
||||
c
|
||||
if ( info .eq. 1) then
|
||||
print *, ' '
|
||||
@@ -823,22 +823,22 @@ c
|
||||
c
|
||||
if (iparam(5) .gt. 0) then
|
||||
c
|
||||
call sseupd ( rvec, 'A', select, d, z, ldz, sigma,
|
||||
& bmat, n, which, nev, tol, resid, ncv, v, ldv,
|
||||
& iparam, ipntr, workd, workl, lworkl, info )
|
||||
call sseupd ( rvec, 'A', select, d, z, ldz, sigma,
|
||||
& bmat, n, which, nev, tol, resid, ncv, v, ldv,
|
||||
& iparam, ipntr, workd, workl, lworkl, info )
|
||||
c
|
||||
if ( info .ne. 0) then
|
||||
c
|
||||
c
|
||||
c %------------------------------------%
|
||||
c | Check the documentation of sneupd. |
|
||||
c %------------------------------------%
|
||||
c
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
print *, ' Error with _neupd = ', info
|
||||
print *, ' Check the documentation of _neupd '
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
go to 9000
|
||||
c
|
||||
c
|
||||
end if
|
||||
c
|
||||
end if
|
||||
@@ -853,7 +853,7 @@ c %----------------------------------------%
|
||||
c | L O O P B A C K to call SSAUPD again. |
|
||||
c %----------------------------------------%
|
||||
c
|
||||
go to 90
|
||||
go to 90
|
||||
c
|
||||
9000 continue
|
||||
c
|
||||
|
||||
+40
-40
@@ -2,13 +2,13 @@
|
||||
c
|
||||
c ... Construct the matrix A in LAPACK-style band form.
|
||||
c The matrix A is derived from the discretization of
|
||||
c the 2-dimensional Laplacian on the unit square with
|
||||
c zero Dirichlet boundary condition using standard
|
||||
c the 2-dimensional Laplacian on the unit square with
|
||||
c zero Dirichlet boundary condition using standard
|
||||
c central difference.
|
||||
c
|
||||
c ... Call SSBAND to find eigenvalues LAMBDA such that
|
||||
c A*x = x*LAMBDA.
|
||||
c
|
||||
c
|
||||
c ... Use mode 1 of SSAUPD.
|
||||
c
|
||||
c\BeginLib
|
||||
@@ -47,13 +47,13 @@ c | MAXN - Maximum size of the matrix |
|
||||
c | MAXNEV - Maximum number of |
|
||||
c | eigenvalues to be computed |
|
||||
c | MAXNCV - Maximum number of Arnoldi |
|
||||
c | vectors stored |
|
||||
c | vectors stored |
|
||||
c | MAXBDW - Maximum bandwidth |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
integer maxn, maxnev, maxncv, maxbdw, lda,
|
||||
& lworkl, ldv
|
||||
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
|
||||
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
|
||||
& maxbdw=50, lda = maxbdw, ldv = maxn )
|
||||
c
|
||||
c %--------------%
|
||||
@@ -62,9 +62,9 @@ c %--------------%
|
||||
c
|
||||
integer iparam(11), iwork(maxn)
|
||||
logical select(maxncv)
|
||||
Real
|
||||
Real
|
||||
& a(lda,maxn), m(lda,maxn), rfac(lda,maxn),
|
||||
& workl(maxncv*maxncv+8*maxncv), workd(3*maxn),
|
||||
& workl(maxncv*maxncv+8*maxncv), workd(3*maxn),
|
||||
& v(ldv, maxncv), resid(maxn), d(maxncv, 2),
|
||||
& ax(maxn)
|
||||
c
|
||||
@@ -76,15 +76,15 @@ c
|
||||
integer nev, ncv, ku, kl, info, i, j, ido,
|
||||
& n, nx, lo, isub, isup, idiag, maxitr, mode,
|
||||
& nconv
|
||||
Real
|
||||
Real
|
||||
& tol, sigma, h2
|
||||
logical rvec
|
||||
c
|
||||
c
|
||||
c %------------%
|
||||
c | Parameters |
|
||||
c %------------%
|
||||
c
|
||||
Real
|
||||
Real
|
||||
& one, zero, two
|
||||
parameter (one = 1.0E+0 , zero = 0.0E+0 , two = 2.0E+0 )
|
||||
c
|
||||
@@ -92,9 +92,9 @@ c %-----------------------------%
|
||||
c | BLAS & LAPACK routines used |
|
||||
c %-----------------------------%
|
||||
c
|
||||
Real
|
||||
Real
|
||||
& slapy2, snrm2
|
||||
external slapy2, snrm2, sgbmv, saxpy
|
||||
external slapy2, snrm2, sgbmv, saxpy
|
||||
c
|
||||
c %--------------------%
|
||||
c | Intrinsic function |
|
||||
@@ -121,13 +121,13 @@ c | However, the following conditions must be |
|
||||
c | satisfied: |
|
||||
c | N <= MAXN |
|
||||
c | NEV <= MAXNEV |
|
||||
c | NEV + 1 <= NCV <= MAXNCV |
|
||||
c %-------------------------------------------------%
|
||||
c | NEV + 1 <= NCV <= MAXNCV |
|
||||
c %-------------------------------------------------%
|
||||
c
|
||||
nx = 10
|
||||
nx = 10
|
||||
n = nx*nx
|
||||
nev = 4
|
||||
ncv = 10
|
||||
nev = 4
|
||||
ncv = 10
|
||||
if ( n .gt. maxn ) then
|
||||
print *, ' ERROR with _SBDR1: N is greater than MAXN '
|
||||
go to 9000
|
||||
@@ -153,7 +153,7 @@ c | generated in SSAUPD to start the Arnoldi iteration. |
|
||||
c %-----------------------------------------------------%
|
||||
c
|
||||
lworkl = ncv**2+8*ncv
|
||||
tol = zero
|
||||
tol = zero
|
||||
ido = 0
|
||||
info = 0
|
||||
c
|
||||
@@ -169,7 +169,7 @@ c
|
||||
mode = 1
|
||||
c
|
||||
iparam(3) = maxitr
|
||||
iparam(7) = mode
|
||||
iparam(7) = mode
|
||||
c
|
||||
c %----------------------------------------%
|
||||
c | Construct the matrix A in LAPACK-style |
|
||||
@@ -190,10 +190,10 @@ c | and subdiagonals within the band of |
|
||||
c | matrices A and M. |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
kl = nx
|
||||
ku = nx
|
||||
kl = nx
|
||||
ku = nx
|
||||
c
|
||||
c %---------------%
|
||||
c %---------------%
|
||||
c | Main diagonal |
|
||||
c %---------------%
|
||||
c
|
||||
@@ -201,12 +201,12 @@ c
|
||||
idiag = kl+ku+1
|
||||
do 30 j = 1, n
|
||||
a(idiag,j) = 4.0E+0 / h2
|
||||
30 continue
|
||||
c
|
||||
30 continue
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | First subdiagonal and superdiagonal |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
c
|
||||
isup = kl+ku
|
||||
isub = kl+ku+2
|
||||
do 50 i = 1, nx
|
||||
@@ -214,8 +214,8 @@ c
|
||||
do 40 j = lo+1, lo+nx-1
|
||||
a(isup,j+1) = -one / h2
|
||||
a(isub,j) = -one / h2
|
||||
40 continue
|
||||
50 continue
|
||||
40 continue
|
||||
50 continue
|
||||
c
|
||||
c %------------------------------------%
|
||||
c | KL-th subdiagonal and KU-th super- |
|
||||
@@ -229,8 +229,8 @@ c
|
||||
do 70 j = lo+1, lo+nx
|
||||
a(isup,nx+j) = -one / h2
|
||||
a(isub,j) = -one / h2
|
||||
70 continue
|
||||
80 continue
|
||||
70 continue
|
||||
80 continue
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | Call SSBAND to find eigenvalues and |
|
||||
@@ -239,18 +239,18 @@ c | returned in the first column of D. |
|
||||
c | Eigenvectors are returned in the |
|
||||
c | first NCONV (=IPARAM(5)) columns of |
|
||||
c | V. |
|
||||
c %-------------------------------------%
|
||||
c %-------------------------------------%
|
||||
c
|
||||
rvec = .true.
|
||||
call ssband( rvec, 'A', select, d, v, ldv, sigma, n, a, m, lda,
|
||||
& rfac, kl, ku, which, bmat, nev, tol,
|
||||
& resid, ncv, v, ldv, iparam, workd, workl, lworkl,
|
||||
call ssband( rvec, 'A', select, d, v, ldv, sigma, n, a, m, lda,
|
||||
& rfac, kl, ku, which, bmat, nev, tol,
|
||||
& resid, ncv, v, ldv, iparam, workd, workl, lworkl,
|
||||
& iwork, info)
|
||||
c
|
||||
if ( info .eq. 0) then
|
||||
c
|
||||
nconv = iparam(5)
|
||||
c
|
||||
c
|
||||
c %-----------------------------------%
|
||||
c | Print out convergence information |
|
||||
c %-----------------------------------%
|
||||
@@ -278,18 +278,18 @@ c | || A*x - lambda*x || |
|
||||
c %----------------------------%
|
||||
c
|
||||
do 90 j = 1, nconv
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
& ax, 1)
|
||||
call saxpy(n, -d(j,1), v(1,j), 1, ax, 1)
|
||||
d(j,2) = snrm2(n, ax, 1)
|
||||
d(j,2) = d(j,2) / abs(d(j,1))
|
||||
c
|
||||
90 continue
|
||||
90 continue
|
||||
|
||||
call smout(6, nconv, 2, d, maxncv, -6,
|
||||
& 'Ritz values and relative residuals')
|
||||
else
|
||||
else
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | Either convergence failed, or there |
|
||||
@@ -300,8 +300,8 @@ c
|
||||
print *, ' '
|
||||
print *, ' Error with _sband, info= ', info
|
||||
print *, ' Check the documentation of _sband '
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
c
|
||||
end if
|
||||
c
|
||||
9000 end
|
||||
9000 end
|
||||
|
||||
+39
-39
@@ -2,11 +2,11 @@
|
||||
c
|
||||
c ... Construct the matrix A in LAPACK-style band form.
|
||||
c The matrix A is derived from the discretization of
|
||||
c the 2-dimensional Laplacian on the unit square
|
||||
c the 2-dimensional Laplacian on the unit square
|
||||
c with zero Dirichlet boundary condition using standard
|
||||
c central difference.
|
||||
c
|
||||
c ... Call SSBAND to find eigenvalues LAMBDA closest to
|
||||
c ... Call SSBAND to find eigenvalues LAMBDA closest to
|
||||
c SIGMA such that
|
||||
c A*x = x*LAMBDA.
|
||||
c
|
||||
@@ -48,13 +48,13 @@ c | MAXN - Maximum size of the matrix |
|
||||
c | MAXNEV - Maximum number of |
|
||||
c | eigenvalues to be computed |
|
||||
c | MAXNCV - Maximum number of Arnoldi |
|
||||
c | vectors stored |
|
||||
c | vectors stored |
|
||||
c | MAXBDW - Maximum bandwidth |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
integer maxn, maxnev, maxncv, maxbdw, lda,
|
||||
& lworkl, ldv
|
||||
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
|
||||
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
|
||||
& maxbdw=50, lda = maxbdw, ldv = maxn )
|
||||
c
|
||||
c %--------------%
|
||||
@@ -63,10 +63,10 @@ c %--------------%
|
||||
c
|
||||
integer iparam(11), iwork(maxn)
|
||||
logical select(maxncv)
|
||||
Real
|
||||
Real
|
||||
& a(lda,maxn), m(lda,maxn), rfac(lda,maxn),
|
||||
& workl(3*maxncv*maxncv+6*maxncv), workd(3*maxn),
|
||||
& v(ldv, maxncv), resid(maxn), d(maxncv, 2),
|
||||
& workl(3*maxncv*maxncv+6*maxncv), workd(3*maxn),
|
||||
& v(ldv, maxncv), resid(maxn), d(maxncv, 2),
|
||||
& ax(maxn)
|
||||
c
|
||||
c %---------------%
|
||||
@@ -77,15 +77,15 @@ c
|
||||
integer nev, ncv, ku, kl, info, i, j, ido,
|
||||
& n, nx, lo, isub, isup, idiag, maxitr, mode,
|
||||
& nconv
|
||||
Real
|
||||
Real
|
||||
& tol, sigma, h2
|
||||
logical rvec
|
||||
c
|
||||
c
|
||||
c %------------%
|
||||
c | Parameters |
|
||||
c %------------%
|
||||
c
|
||||
Real
|
||||
Real
|
||||
& one, zero, two
|
||||
parameter (one = 1.0E+0 , zero = 0.0E+0 , two = 2.0E+0 )
|
||||
c
|
||||
@@ -93,9 +93,9 @@ c %-----------------------------%
|
||||
c | BLAS & LAPACK routines used |
|
||||
c %-----------------------------%
|
||||
c
|
||||
Real
|
||||
Real
|
||||
& slapy2, snrm2
|
||||
external slapy2, snrm2, saxpy, sgbmv
|
||||
external slapy2, snrm2, saxpy, sgbmv
|
||||
c
|
||||
c %-----------------------%
|
||||
c | Executable Statements |
|
||||
@@ -118,13 +118,13 @@ c | However, the following conditions must be |
|
||||
c | satisfied: |
|
||||
c | N <= MAXN |
|
||||
c | NEV <= MAXNEV |
|
||||
c | NEV + 1 <= NCV <= MAXNCV |
|
||||
c %--------------------------------------------------%
|
||||
c | NEV + 1 <= NCV <= MAXNCV |
|
||||
c %--------------------------------------------------%
|
||||
c
|
||||
nx = 10
|
||||
nx = 10
|
||||
n = nx*nx
|
||||
nev = 4
|
||||
ncv = 10
|
||||
nev = 4
|
||||
ncv = 10
|
||||
if ( n .gt. maxn ) then
|
||||
print *, ' ERROR with _SBDR2: N is greater than MAXN '
|
||||
go to 9000
|
||||
@@ -151,7 +151,7 @@ c | generated in SSAUPD to start the Arnoldi iteration. |
|
||||
c %-----------------------------------------------------%
|
||||
c
|
||||
lworkl = 3*ncv**2+6*ncv
|
||||
tol = zero
|
||||
tol = zero
|
||||
ido = 0
|
||||
info = 0
|
||||
c
|
||||
@@ -167,7 +167,7 @@ c
|
||||
mode = 3
|
||||
c
|
||||
iparam(3) = maxitr
|
||||
iparam(7) = mode
|
||||
iparam(7) = mode
|
||||
c
|
||||
c %----------------------------------------%
|
||||
c | Construct the matrix A in LAPACK-style |
|
||||
@@ -188,10 +188,10 @@ c | and subdiagonals within the band of |
|
||||
c | matrices A and M. |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
kl = nx
|
||||
ku = nx
|
||||
kl = nx
|
||||
ku = nx
|
||||
c
|
||||
c %---------------%
|
||||
c %---------------%
|
||||
c | Main diagonal |
|
||||
c %---------------%
|
||||
c
|
||||
@@ -199,12 +199,12 @@ c
|
||||
idiag = kl+ku+1
|
||||
do 30 j = 1, n
|
||||
a(idiag,j) = 4.0E+0 / h2
|
||||
30 continue
|
||||
c
|
||||
30 continue
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | First subdiagonal and superdiagonal |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
c
|
||||
isup = kl+ku
|
||||
isub = kl+ku+2
|
||||
do 50 i = 1, nx
|
||||
@@ -212,8 +212,8 @@ c
|
||||
do 40 j = lo+1, lo+nx-1
|
||||
a(isup,j+1) = -one / h2
|
||||
a(isub,j) = -one / h2
|
||||
40 continue
|
||||
50 continue
|
||||
40 continue
|
||||
50 continue
|
||||
c
|
||||
c %------------------------------------%
|
||||
c | KL-th subdiagonal and KU-th super- |
|
||||
@@ -227,8 +227,8 @@ c
|
||||
do 70 j = lo+1, lo+nx
|
||||
a(isup,nx+j) = -one / h2
|
||||
a(isub,j) = -one / h2
|
||||
70 continue
|
||||
80 continue
|
||||
70 continue
|
||||
80 continue
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | Call SSBAND to find eigenvalues and |
|
||||
@@ -239,10 +239,10 @@ c | first NCONV (=IPARAM(5)) columns of |
|
||||
c | V. |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
rvec = .true.
|
||||
call ssband( rvec,'A', select, d, v, ldv, sigma, n, a, m,
|
||||
& lda, rfac, kl, ku, which, bmat, nev, tol,
|
||||
& resid, ncv, v, ldv, iparam, workd, workl, lworkl,
|
||||
rvec = .true.
|
||||
call ssband( rvec,'A', select, d, v, ldv, sigma, n, a, m,
|
||||
& lda, rfac, kl, ku, which, bmat, nev, tol,
|
||||
& resid, ncv, v, ldv, iparam, workd, workl, lworkl,
|
||||
& iwork, info)
|
||||
c
|
||||
if ( info .eq. 0) then
|
||||
@@ -276,18 +276,18 @@ c | || A*x - lambda*x || |
|
||||
c %----------------------------%
|
||||
c
|
||||
do 90 j = 1, nconv
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
& ax, 1)
|
||||
call saxpy(n, -d(j,1), v(1,j), 1, ax, 1)
|
||||
d(j,2) = snrm2(n, ax, 1)
|
||||
d(j,2) = d(j,2) / abs(d(j,1))
|
||||
c
|
||||
90 continue
|
||||
90 continue
|
||||
|
||||
call smout(6, nconv, 2, d, maxncv, -6,
|
||||
& 'Ritz values and relative residuals')
|
||||
else
|
||||
else
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | Either convergence failed, or there |
|
||||
@@ -298,8 +298,8 @@ c
|
||||
print *, ' '
|
||||
print *, ' Error with _sband, info= ', info
|
||||
print *, ' Check the documentation of _sband '
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
c
|
||||
end if
|
||||
c
|
||||
9000 end
|
||||
9000 end
|
||||
|
||||
+33
-33
@@ -5,7 +5,7 @@ c The matrix A is the 1-dimensional discrete Laplacian on [0,1]
|
||||
c with zero Dirichlet boundary condition, M is the mass
|
||||
c formed by using piecewise linear elements on [0,1].
|
||||
c
|
||||
c ... Call SSBAND with regular mode to find eigenvalues LAMBDA
|
||||
c ... Call SSBAND with regular mode to find eigenvalues LAMBDA
|
||||
c such that
|
||||
c A*x = LAMBDA*M*x.
|
||||
c
|
||||
@@ -46,13 +46,13 @@ c | MAXN - Maximum size of the matrix |
|
||||
c | MAXNEV - Maximum number of |
|
||||
c | eigenvalues to be computed |
|
||||
c | MAXNCV - Maximum number of Arnoldi |
|
||||
c | vectors stored |
|
||||
c | vectors stored |
|
||||
c | MAXBDW - Maximum bandwidth |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
integer maxn, maxnev, maxncv, maxbdw, lda,
|
||||
& lworkl, ldv
|
||||
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
|
||||
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
|
||||
& maxbdw=50, lda = maxbdw, ldv = maxn )
|
||||
c
|
||||
c %--------------%
|
||||
@@ -61,9 +61,9 @@ c %--------------%
|
||||
c
|
||||
integer iparam(11), iwork(maxn)
|
||||
logical select(maxncv)
|
||||
Real
|
||||
Real
|
||||
& a(lda,maxn), m(lda,maxn), rfac(lda,maxn),
|
||||
& workl(maxncv*maxncv+8*maxncv), workd(3*maxn),
|
||||
& workl(maxncv*maxncv+8*maxncv), workd(3*maxn),
|
||||
& v(ldv, maxncv), resid(maxn), d(maxncv, 2),
|
||||
& ax(maxn), mx(maxn)
|
||||
c
|
||||
@@ -74,15 +74,15 @@ c
|
||||
character which*2, bmat
|
||||
integer nev, ncv, ku, kl, info, j, ido,
|
||||
& n, isub, isup, idiag, maxitr, mode, nconv
|
||||
Real
|
||||
Real
|
||||
& tol, h, sigma, r1, r2
|
||||
logical rvec
|
||||
c
|
||||
c
|
||||
c %------------%
|
||||
c | Parameters |
|
||||
c %------------%
|
||||
c
|
||||
Real
|
||||
Real
|
||||
& one, zero, two, four, six
|
||||
parameter (one = 1.0E+0 , zero = 0.0E+0 , two = 2.0E+0 ,
|
||||
& four = 4.0E+0 , six = 6.0E+0 )
|
||||
@@ -91,9 +91,9 @@ c %-----------------------------%
|
||||
c | BLAS & LAPACK routines used |
|
||||
c %-----------------------------%
|
||||
c
|
||||
Real
|
||||
Real
|
||||
& slapy2, snrm2
|
||||
external slapy2, snrm2, saxpy, sgbmv
|
||||
external slapy2, snrm2, saxpy, sgbmv
|
||||
c
|
||||
c %--------------------%
|
||||
c | Intrinsic function |
|
||||
@@ -116,12 +116,12 @@ c | However, the following conditions must be |
|
||||
c | satisfied: |
|
||||
c | N <= MAXN |
|
||||
c | NEV <= MAXNEV |
|
||||
c | NEV + 1 <= NCV <= MAXNCV |
|
||||
c %-------------------------------------------------%
|
||||
c | NEV + 1 <= NCV <= MAXNCV |
|
||||
c %-------------------------------------------------%
|
||||
c
|
||||
n = 100
|
||||
nev = 4
|
||||
ncv = 10
|
||||
n = 100
|
||||
nev = 4
|
||||
ncv = 10
|
||||
if ( n .gt. maxn ) then
|
||||
print *, ' ERROR with _SBDR3: N is greater than MAXN '
|
||||
go to 9000
|
||||
@@ -147,7 +147,7 @@ c | generated in SSAUPD to start the Arnoldi iteration. |
|
||||
c %-----------------------------------------------------%
|
||||
c
|
||||
lworkl = ncv**2+8*ncv
|
||||
tol = zero
|
||||
tol = zero
|
||||
ido = 0
|
||||
info = 0
|
||||
c
|
||||
@@ -184,10 +184,10 @@ c | and subdiagonals within the band of |
|
||||
c | matrices A and M. |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
kl = 1
|
||||
ku = 1
|
||||
kl = 1
|
||||
ku = 1
|
||||
c
|
||||
c %---------------%
|
||||
c %---------------%
|
||||
c | Main diagonal |
|
||||
c %---------------%
|
||||
c
|
||||
@@ -197,12 +197,12 @@ c
|
||||
do 30 j = 1, n
|
||||
a(idiag,j) = two / h
|
||||
m(idiag,j) = r1 * h
|
||||
30 continue
|
||||
c
|
||||
30 continue
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | First subdiagonal and superdiagonal |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
c
|
||||
r2 = one / six
|
||||
isup = kl+ku
|
||||
isub = kl+ku+2
|
||||
@@ -223,9 +223,9 @@ c | V. |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
rvec = .true.
|
||||
call ssband( rvec, 'A', select, d, v, ldv, sigma, n, a, m, lda,
|
||||
& rfac, kl, ku, which, bmat, nev, tol,
|
||||
& resid, ncv, v, ldv, iparam, workd, workl, lworkl,
|
||||
call ssband( rvec, 'A', select, d, v, ldv, sigma, n, a, m, lda,
|
||||
& rfac, kl, ku, which, bmat, nev, tol,
|
||||
& resid, ncv, v, ldv, iparam, workd, workl, lworkl,
|
||||
& iwork, info)
|
||||
c
|
||||
if ( info .eq. 0) then
|
||||
@@ -259,21 +259,21 @@ c | || A*x - lambda*x || |
|
||||
c %----------------------------%
|
||||
c
|
||||
do 90 j = 1, nconv
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
& ax, 1)
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j), 1, zero,
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j), 1, zero,
|
||||
& mx, 1)
|
||||
call saxpy(n, -d(j,1), mx, 1, ax, 1)
|
||||
d(j,2) = snrm2(n, ax, 1)
|
||||
d(j,2) = d(j,2) / abs(d(j,1))
|
||||
c
|
||||
90 continue
|
||||
90 continue
|
||||
|
||||
call smout(6, nconv, 2, d, maxncv, -6,
|
||||
& 'Ritz values and relative residuals')
|
||||
else
|
||||
else
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | Either convergence failed, or there |
|
||||
@@ -284,8 +284,8 @@ c
|
||||
print *, ' '
|
||||
print *, ' Error with _sband, info= ', info
|
||||
print *, ' Check the documentation of _sband '
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
c
|
||||
end if
|
||||
c
|
||||
9000 end
|
||||
9000 end
|
||||
|
||||
+34
-34
@@ -5,7 +5,7 @@ c The matrix A is the 1-dimensional discrete Laplacian on [0,1]
|
||||
c with zero Dirichlet boundary condition, M is the mass
|
||||
c formed by using piecewise linear elements on [0,1].
|
||||
c
|
||||
c ... Call SSBAND with shift-invert mode to find eigenvalues LAMBDA
|
||||
c ... Call SSBAND with shift-invert mode to find eigenvalues LAMBDA
|
||||
c closest to SIGMA such that
|
||||
c A*x = LAMBDA*M*x.
|
||||
c
|
||||
@@ -47,13 +47,13 @@ c | MAXN - Maximum size of the matrix |
|
||||
c | MAXNEV - Maximum number of |
|
||||
c | eigenvalues to be computed |
|
||||
c | MAXNCV - Maximum number of Arnoldi |
|
||||
c | vectors stored |
|
||||
c | vectors stored |
|
||||
c | MAXBDW - Maximum bandwidth |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
integer maxn, maxnev, maxncv, maxbdw, lda,
|
||||
& lworkl, ldv
|
||||
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
|
||||
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
|
||||
& maxbdw=50, lda = maxbdw, ldv = maxn )
|
||||
c
|
||||
c %--------------%
|
||||
@@ -62,9 +62,9 @@ c %--------------%
|
||||
c
|
||||
integer iparam(11), iwork(maxn)
|
||||
logical select(maxncv)
|
||||
Real
|
||||
Real
|
||||
& a(lda,maxn), m(lda,maxn), rfac(lda,maxn),
|
||||
& workl(maxncv*maxncv+8*maxncv), workd(3*maxn),
|
||||
& workl(maxncv*maxncv+8*maxncv), workd(3*maxn),
|
||||
& v(ldv, maxncv), resid(maxn), d(maxncv, 2),
|
||||
& ax(maxn), mx(maxn)
|
||||
c
|
||||
@@ -75,15 +75,15 @@ c
|
||||
character which*2, bmat
|
||||
integer nev, ncv, ku, kl, info, j, ido,
|
||||
& n, isub, isup, idiag, maxitr, mode, nconv
|
||||
Real
|
||||
Real
|
||||
& tol, h, sigma, r1, r2
|
||||
logical rvec
|
||||
c
|
||||
c
|
||||
c %------------%
|
||||
c | Parameters |
|
||||
c %------------%
|
||||
c
|
||||
Real
|
||||
Real
|
||||
& one, zero, two, four, six
|
||||
parameter (one = 1.0E+0 , zero = 0.0E+0 , two = 2.0E+0 ,
|
||||
& four = 4.0E+0 , six = 6.0E+0 )
|
||||
@@ -92,9 +92,9 @@ c %-----------------------------%
|
||||
c | BLAS & LAPACK routines used |
|
||||
c %-----------------------------%
|
||||
c
|
||||
Real
|
||||
Real
|
||||
& slapy2, snrm2
|
||||
external slapy2, snrm2, saxpy, sgbmv
|
||||
external slapy2, snrm2, saxpy, sgbmv
|
||||
c
|
||||
c %-----------------------%
|
||||
c | Executable Statements |
|
||||
@@ -113,12 +113,12 @@ c | However, the following conditions must be |
|
||||
c | satisfied: |
|
||||
c | N <= MAXN |
|
||||
c | NEV <= MAXNEV |
|
||||
c | NEV + 1 <= NCV <= MAXNCV |
|
||||
c %--------------------------------------------------%
|
||||
c | NEV + 1 <= NCV <= MAXNCV |
|
||||
c %--------------------------------------------------%
|
||||
c
|
||||
n = 100
|
||||
nev = 4
|
||||
ncv = 10
|
||||
nev = 4
|
||||
ncv = 10
|
||||
if ( n .gt. maxn ) then
|
||||
print *, ' ERROR with _SBDR4: N is greater than MAXN '
|
||||
go to 9000
|
||||
@@ -145,7 +145,7 @@ c | generated in SSAUPD to start the Arnoldi iteration. |
|
||||
c %-----------------------------------------------------%
|
||||
c
|
||||
lworkl = ncv**2+8*ncv
|
||||
tol = zero
|
||||
tol = zero
|
||||
ido = 0
|
||||
info = 0
|
||||
c
|
||||
@@ -182,10 +182,10 @@ c | and subdiagonals within the band of |
|
||||
c | matrices A and M. |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
kl = 1
|
||||
ku = 1
|
||||
kl = 1
|
||||
ku = 1
|
||||
c
|
||||
c %---------------%
|
||||
c %---------------%
|
||||
c | Main diagonal |
|
||||
c %---------------%
|
||||
c
|
||||
@@ -195,19 +195,19 @@ c
|
||||
do 30 j = 1, n
|
||||
a(idiag,j) = two / h
|
||||
m(idiag,j) = r1 * h
|
||||
30 continue
|
||||
c
|
||||
30 continue
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | First subdiagonal and superdiagonal |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
c
|
||||
r2 = one / six
|
||||
isup = kl+ku
|
||||
isub = kl+ku+2
|
||||
do 60 j = 1, n-1
|
||||
a(isup,j+1) = -one / h
|
||||
a(isub,j) = -one / h
|
||||
m(isup,j+1) = r2 * h
|
||||
m(isup,j+1) = r2 * h
|
||||
m(isub,j) = r2 * h
|
||||
60 continue
|
||||
c
|
||||
@@ -221,9 +221,9 @@ c | V. |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
rvec = .true.
|
||||
call ssband( rvec, 'A', select, d, v, ldv, sigma, n, a, m,
|
||||
& lda, rfac, kl, ku, which, bmat, nev, tol,
|
||||
& resid, ncv, v, ldv, iparam, workd, workl, lworkl,
|
||||
call ssband( rvec, 'A', select, d, v, ldv, sigma, n, a, m,
|
||||
& lda, rfac, kl, ku, which, bmat, nev, tol,
|
||||
& resid, ncv, v, ldv, iparam, workd, workl, lworkl,
|
||||
& iwork, info)
|
||||
c
|
||||
if ( info .eq. 0) then
|
||||
@@ -243,7 +243,7 @@ c
|
||||
print *, ' The number of Lanczos vectors generated',
|
||||
& ' (NCV) is ', ncv
|
||||
print *, ' The number of converged Ritz values is ',
|
||||
& nconv
|
||||
& nconv
|
||||
print *, ' What portion of the spectrum ', which
|
||||
print *, ' The number of Implicit Arnoldi',
|
||||
& ' update taken is ', iparam(3)
|
||||
@@ -257,21 +257,21 @@ c | || A*x - lambda*x || |
|
||||
c %----------------------------%
|
||||
c
|
||||
do 90 j = 1, nconv
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
& ax, 1)
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j), 1, zero,
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j), 1, zero,
|
||||
& mx, 1)
|
||||
call saxpy(n, -d(j,1), mx, 1, ax, 1)
|
||||
d(j,2) = snrm2(n, ax, 1)
|
||||
d(j,2) = d(j,2) / abs(d(j,1))
|
||||
c
|
||||
90 continue
|
||||
90 continue
|
||||
|
||||
call smout(6, nconv, 2, d, maxncv, -6,
|
||||
& 'Ritz values and relative residuals')
|
||||
else
|
||||
else
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | Either convergence failed, or there |
|
||||
@@ -282,8 +282,8 @@ c
|
||||
print *, ' '
|
||||
print *, ' Error with _sband, info= ', info
|
||||
print *, ' Check the documentation of _sband '
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
c
|
||||
end if
|
||||
c
|
||||
9000 end
|
||||
9000 end
|
||||
|
||||
+33
-33
@@ -3,9 +3,9 @@ c
|
||||
c ... Construct the matrix A in LAPACK-style band form.
|
||||
c The matrix A is the 1-dimensional discrete Laplacian on [0,1]
|
||||
c with zero Dirichlet boundary condition, KG is the mass
|
||||
c formed by using piecewise linear elements on [0,1].
|
||||
c formed by using piecewise linear elements on [0,1].
|
||||
c
|
||||
c ... Call SSBAND with Buckling mode to find eigenvalues LAMBDA
|
||||
c ... Call SSBAND with Buckling mode to find eigenvalues LAMBDA
|
||||
c such that
|
||||
c A*x = M*x*LAMBDA.
|
||||
c
|
||||
@@ -47,13 +47,13 @@ c | MAXN - Maximum size of the matrix |
|
||||
c | MAXNEV - Maximum number of |
|
||||
c | eigenvalues to be computed |
|
||||
c | MAXNCV - Maximum number of Arnoldi |
|
||||
c | vectors stored |
|
||||
c | vectors stored |
|
||||
c | MAXBDW - Maximum bandwidth |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
integer maxn, maxnev, maxncv, maxbdw, lda,
|
||||
& lworkl, ldv
|
||||
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
|
||||
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
|
||||
& maxbdw=50, lda = maxbdw, ldv = maxn )
|
||||
c
|
||||
c %--------------%
|
||||
@@ -62,9 +62,9 @@ c %--------------%
|
||||
c
|
||||
integer iparam(11), iwork(maxn)
|
||||
logical select(maxncv)
|
||||
Real
|
||||
Real
|
||||
& a(lda,maxn), m(lda,maxn), rfac(lda,maxn),
|
||||
& workl(maxncv*maxncv+8*maxncv), workd(3*maxn),
|
||||
& workl(maxncv*maxncv+8*maxncv), workd(3*maxn),
|
||||
& v(ldv, maxncv), resid(maxn), d(maxncv, 2),
|
||||
& ax(maxn), mx(maxn)
|
||||
c
|
||||
@@ -75,15 +75,15 @@ c
|
||||
character which*2, bmat
|
||||
integer nev, ncv, kl, ku, info, j, ido,
|
||||
& n, isub, isup, idiag, maxitr, mode, nconv
|
||||
Real
|
||||
Real
|
||||
& tol, h, sigma, r1, r2
|
||||
logical rvec
|
||||
c
|
||||
c
|
||||
c %------------%
|
||||
c | Parameters |
|
||||
c %------------%
|
||||
c
|
||||
Real
|
||||
Real
|
||||
& one, zero, two, four, six
|
||||
parameter (one = 1.0E+0 , zero = 0.0E+0 , two = 2.0E+0 ,
|
||||
& four = 4.0E+0 , six = 6.0E+0 )
|
||||
@@ -92,9 +92,9 @@ c %-----------------------------%
|
||||
c | BLAS & LAPACK routines used |
|
||||
c %-----------------------------%
|
||||
c
|
||||
Real
|
||||
Real
|
||||
& slapy2, snrm2
|
||||
external slapy2, snrm2, sgbmv, saxpy
|
||||
external slapy2, snrm2, sgbmv, saxpy
|
||||
c
|
||||
c %--------------------%
|
||||
c | Intrinsic function |
|
||||
@@ -118,12 +118,12 @@ c | the spectrum. However, the following conditions |
|
||||
c | must be satisfied: |
|
||||
c | N <= MAXN |
|
||||
c | NEV <= MAXNEV |
|
||||
c | NEV + 1 <= NCV <= MAXNCV |
|
||||
c %--------------------------------------------------%
|
||||
c | NEV + 1 <= NCV <= MAXNCV |
|
||||
c %--------------------------------------------------%
|
||||
c
|
||||
n = 100
|
||||
nev = 4
|
||||
ncv = 10
|
||||
nev = 4
|
||||
ncv = 10
|
||||
if ( n .gt. maxn ) then
|
||||
print *, ' ERROR with _SBDR5: N is greater than MAXN '
|
||||
go to 9000
|
||||
@@ -150,7 +150,7 @@ c | generated in SSAUPD to start the Arnoldi iteration. |
|
||||
c %-----------------------------------------------------%
|
||||
c
|
||||
lworkl = ncv**2+8*ncv
|
||||
tol = zero
|
||||
tol = zero
|
||||
ido = 0
|
||||
info = 0
|
||||
c
|
||||
@@ -187,10 +187,10 @@ c | and subdiagonals within the band of |
|
||||
c | matrices A and M. |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
kl = 1
|
||||
ku = 1
|
||||
kl = 1
|
||||
ku = 1
|
||||
c
|
||||
c %---------------%
|
||||
c %---------------%
|
||||
c | Main diagonal |
|
||||
c %---------------%
|
||||
c
|
||||
@@ -200,12 +200,12 @@ c
|
||||
do 30 j = 1, n
|
||||
a(idiag,j) = two / h
|
||||
m(idiag,j) = r1 * h
|
||||
30 continue
|
||||
c
|
||||
30 continue
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | First subdiagonal and superdiagonal |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
c
|
||||
r2 = one / six
|
||||
isup = kl+ku
|
||||
isub = kl+ku+2
|
||||
@@ -226,9 +226,9 @@ c | V. |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
rvec = .true.
|
||||
call ssband( rvec, 'A', select, d, v, ldv, sigma, n, a, m, lda,
|
||||
& rfac, kl, ku, which, bmat, nev, tol,
|
||||
& resid, ncv, v, ldv, iparam, workd, workl, lworkl,
|
||||
call ssband( rvec, 'A', select, d, v, ldv, sigma, n, a, m, lda,
|
||||
& rfac, kl, ku, which, bmat, nev, tol,
|
||||
& resid, ncv, v, ldv, iparam, workd, workl, lworkl,
|
||||
& iwork, info)
|
||||
c
|
||||
if ( info .eq. 0) then
|
||||
@@ -262,21 +262,21 @@ c | || A*x - lambda*x || |
|
||||
c %----------------------------%
|
||||
c
|
||||
do 90 j = 1, nconv
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
& ax, 1)
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j), 1, zero,
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j), 1, zero,
|
||||
& mx, 1)
|
||||
call saxpy(n, -d(j,1), mx, 1, ax, 1)
|
||||
d(j,2) = snrm2(n, ax, 1)
|
||||
d(j,2) = d(j,2) / abs(d(j,1))
|
||||
c
|
||||
90 continue
|
||||
90 continue
|
||||
|
||||
call smout(6, nconv, 2, d, maxncv, -6,
|
||||
& 'Ritz values and relative residuals')
|
||||
else
|
||||
else
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | Either convergence failed, or there |
|
||||
@@ -287,8 +287,8 @@ c
|
||||
print *, ' '
|
||||
print *, ' Error with _sband, info= ', info
|
||||
print *, ' Check the documentation of _sband '
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
c
|
||||
end if
|
||||
c
|
||||
9000 end
|
||||
9000 end
|
||||
|
||||
+32
-32
@@ -4,7 +4,7 @@ c ... Construct the matrix A in LAPACK-style band form.
|
||||
c The matrix A is the 1-dimensional discrete Laplacian on [0,1]
|
||||
c with zero Dirichlet boundary condition, M is the mass
|
||||
c formed by using piecewise linear elements on [0,1].
|
||||
c
|
||||
c
|
||||
c ... Call SSBAND with Cayley mode to find eigenvalues LAMBDA such that
|
||||
c A*x = LAMBDA*M*x.
|
||||
c
|
||||
@@ -46,13 +46,13 @@ c | MAXN - Maximum size of the matrix |
|
||||
c | MAXNEV - Maximum number of |
|
||||
c | eigenvalues to be computed |
|
||||
c | MAXNCV - Maximum number of Arnoldi |
|
||||
c | vectors stored |
|
||||
c | vectors stored |
|
||||
c | MAXBDW - Maximum bandwidth |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
integer maxn, maxnev, maxncv, maxbdw, lda,
|
||||
& lworkl, ldv
|
||||
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
|
||||
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
|
||||
& maxbdw=50, lda = maxbdw, ldv = maxn )
|
||||
c
|
||||
c %--------------%
|
||||
@@ -61,9 +61,9 @@ c %--------------%
|
||||
c
|
||||
integer iparam(11), iwork(maxn)
|
||||
logical select(maxncv)
|
||||
Real
|
||||
Real
|
||||
& a(lda,maxn), m(lda,maxn), rfac(lda,maxn),
|
||||
& workl(maxncv*maxncv+8*maxncv), workd(3*maxn),
|
||||
& workl(maxncv*maxncv+8*maxncv), workd(3*maxn),
|
||||
& v(ldv, maxncv), resid(maxn), d(maxncv, 2),
|
||||
& ax(maxn), mx(maxn)
|
||||
c
|
||||
@@ -74,15 +74,15 @@ c
|
||||
character which*2, bmat
|
||||
integer nev, ncv, ku, kl, info, j, ido,
|
||||
& n, isub, isup, idiag, maxitr, mode, nconv
|
||||
Real
|
||||
Real
|
||||
& tol, h, sigma, r1, r2
|
||||
logical rvec
|
||||
c
|
||||
c
|
||||
c %------------%
|
||||
c | Parameters |
|
||||
c %------------%
|
||||
c
|
||||
Real
|
||||
Real
|
||||
& one, zero, two, four, six
|
||||
parameter (one = 1.0E+0 , zero = 0.0E+0 , two = 2.0E+0 ,
|
||||
& four = 4.0E+0 , six = 6.0E+0 )
|
||||
@@ -91,9 +91,9 @@ c %-----------------------------%
|
||||
c | BLAS & LAPACK routines used |
|
||||
c %-----------------------------%
|
||||
c
|
||||
Real
|
||||
Real
|
||||
& slapy2, snrm2
|
||||
external slapy2, snrm2, saxpy, sgbmv
|
||||
external slapy2, snrm2, saxpy, sgbmv
|
||||
c
|
||||
c %--------------------%
|
||||
c | Intrinsic function |
|
||||
@@ -117,12 +117,12 @@ c | the spectrum. However, the following conditions |
|
||||
c | must be satisfied: |
|
||||
c | N <= MAXN |
|
||||
c | NEV <= MAXNEV |
|
||||
c | NEV + 1 <= NCV <= MAXNCV |
|
||||
c %--------------------------------------------------%
|
||||
c | NEV + 1 <= NCV <= MAXNCV |
|
||||
c %--------------------------------------------------%
|
||||
c
|
||||
n = 100
|
||||
nev = 4
|
||||
ncv = 10
|
||||
nev = 4
|
||||
ncv = 10
|
||||
if ( n .gt. maxn ) then
|
||||
print *, ' ERROR with _SBDR6: N is greater than MAXN '
|
||||
go to 9000
|
||||
@@ -149,7 +149,7 @@ c | generated in SSAUPD to start the Arnoldi iteration. |
|
||||
c %-----------------------------------------------------%
|
||||
c
|
||||
lworkl = ncv**2+8*ncv
|
||||
tol = zero
|
||||
tol = zero
|
||||
ido = 0
|
||||
info = 0
|
||||
c
|
||||
@@ -186,10 +186,10 @@ c | and subdiagonals within the band of |
|
||||
c | matrices A and M. |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
kl = 1
|
||||
ku = 1
|
||||
kl = 1
|
||||
ku = 1
|
||||
c
|
||||
c %---------------%
|
||||
c %---------------%
|
||||
c | Main diagonal |
|
||||
c %---------------%
|
||||
c
|
||||
@@ -199,12 +199,12 @@ c
|
||||
do 30 j = 1, n
|
||||
a(idiag,j) = two / h
|
||||
m(idiag,j) = r1 * h
|
||||
30 continue
|
||||
c
|
||||
30 continue
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | First subdiagonal and superdiagonal |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
c
|
||||
r2 = one / six
|
||||
isup = kl+ku
|
||||
isub = kl+ku+2
|
||||
@@ -225,9 +225,9 @@ c | V. |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
rvec = .true.
|
||||
call ssband( rvec, 'A', select, d, v, ldv, sigma, n, a, m, lda,
|
||||
& rfac, kl, ku, which, bmat, nev, tol,
|
||||
& resid, ncv, v, ldv, iparam, workd, workl, lworkl,
|
||||
call ssband( rvec, 'A', select, d, v, ldv, sigma, n, a, m, lda,
|
||||
& rfac, kl, ku, which, bmat, nev, tol,
|
||||
& resid, ncv, v, ldv, iparam, workd, workl, lworkl,
|
||||
& iwork, info)
|
||||
c
|
||||
if ( info .eq. 0) then
|
||||
@@ -261,21 +261,21 @@ c | || A*x - lambda*x || |
|
||||
c %----------------------------%
|
||||
c
|
||||
do 90 j = 1, nconv
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& a(kl+1,1), lda, v(1,j), 1, zero,
|
||||
& ax, 1)
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j), 1, zero,
|
||||
call sgbmv('Notranspose', n, n, kl, ku, one,
|
||||
& m(kl+1,1), lda, v(1,j), 1, zero,
|
||||
& mx, 1)
|
||||
call saxpy(n, -d(j,1), mx, 1, ax, 1)
|
||||
d(j,2) = snrm2(n, ax, 1)
|
||||
d(j,2) = d(j,2) / abs(d(j,1))
|
||||
c
|
||||
90 continue
|
||||
90 continue
|
||||
|
||||
call smout(6, nconv, 2, d, maxncv, -6,
|
||||
& 'Ritz values and relative residuals')
|
||||
else
|
||||
else
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | Either convergence failed, or there |
|
||||
@@ -286,8 +286,8 @@ c
|
||||
print *, ' '
|
||||
print *, ' Error with _band, info= ', info
|
||||
print *, ' Check the documentation of _band '
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
c
|
||||
end if
|
||||
c
|
||||
9000 end
|
||||
9000 end
|
||||
|
||||
+101
-101
@@ -1,29 +1,29 @@
|
||||
c \BeginDoc
|
||||
c
|
||||
c \Name: znband
|
||||
c \Name: znband
|
||||
c
|
||||
c \Description:
|
||||
c This subroutine returns the converged approximations to eigenvalues
|
||||
c of A*z = lambda*B*z and (optionally):
|
||||
c
|
||||
c (1) The corresponding approximate eigenvectors;
|
||||
c
|
||||
c (2) An orthonormal basis for the associated approximate
|
||||
c invariant subspace;
|
||||
c
|
||||
c (3) Both.
|
||||
c This subroutine returns the converged approximations to eigenvalues
|
||||
c of A*z = lambda*B*z and (optionally):
|
||||
c
|
||||
c (1) The corresponding approximate eigenvectors;
|
||||
c
|
||||
c (2) An orthonormal basis for the associated approximate
|
||||
c invariant subspace;
|
||||
c
|
||||
c (3) Both.
|
||||
c
|
||||
c Matrices A and B are stored in LAPACK-style banded form.
|
||||
c
|
||||
c There is negligible additional cost to obtain eigenvectors. An orthonormal
|
||||
c There is negligible additional cost to obtain eigenvectors. An orthonormal
|
||||
c basis is always computed. There is an additional storage cost of n*nev
|
||||
c if both are requested (in this case a separate array Z must be supplied).
|
||||
c if both are requested (in this case a separate array Z must be supplied).
|
||||
c
|
||||
c The approximate eigenvalues and eigenvectors of A*z = lambda*B*z
|
||||
c are commonly called Ritz values and Ritz vectors respectively. They are
|
||||
c referred to as such in the comments that follow. The computed orthonormal
|
||||
c basis for the invariant subspace corresponding to these Ritz values is
|
||||
c referred to as a Schur basis.
|
||||
c are commonly called Ritz values and Ritz vectors respectively. They are
|
||||
c referred to as such in the comments that follow. The computed orthonormal
|
||||
c basis for the invariant subspace corresponding to these Ritz values is
|
||||
c referred to as a Schur basis.
|
||||
c
|
||||
c znband can be called with one of the following modes:
|
||||
c
|
||||
@@ -40,15 +40,15 @@ c
|
||||
c Choice of different modes can be specified in IPARAM(7) defined below.
|
||||
c
|
||||
c \Usage
|
||||
c call znband
|
||||
c ( RVEC, HOWMNY, SELECT, D , Z, LDZ, SIGMA, WORKEV, N, AB,
|
||||
c MB, LDA, FAC, KL, KU, WHICH, BMAT, NEV, TOL, RESID, NCV,
|
||||
c call znband
|
||||
c ( RVEC, HOWMNY, SELECT, D , Z, LDZ, SIGMA, WORKEV, N, AB,
|
||||
c MB, LDA, FAC, KL, KU, WHICH, BMAT, NEV, TOL, RESID, NCV,
|
||||
c V, LDV, IPARAM, WORKD, WORKL, LWORKL, RWORK, IWORK, INFO )
|
||||
c
|
||||
c \Arguments
|
||||
c RVEC LOGICAL (INPUT)
|
||||
c RVEC LOGICAL (INPUT)
|
||||
c Specifies whether a basis for the invariant subspace corresponding
|
||||
c to the converged Ritz value approximations for the eigenproblem
|
||||
c to the converged Ritz value approximations for the eigenproblem
|
||||
c A*z = lambda*B*z is computed.
|
||||
c
|
||||
c RVEC = .FALSE. Compute Ritz values only.
|
||||
@@ -56,8 +56,8 @@ c
|
||||
c RVEC = .TRUE. Compute Ritz vectors or Schur vectors.
|
||||
c See Remarks below.
|
||||
c
|
||||
c HOWMNY Character*1 (INPUT)
|
||||
c Specifies the form of the invariant subspace to be computed
|
||||
c HOWMNY Character*1 (INPUT)
|
||||
c Specifies the form of the invariant subspace to be computed
|
||||
c corresponding to the converged Ritz values.
|
||||
c = 'A': Compute NEV Ritz vectors;
|
||||
c = 'P': Compute NEV Schur vectors;
|
||||
@@ -67,7 +67,7 @@ c
|
||||
c SELECT Logical array of dimension NCV. (INPUT)
|
||||
c If HOWMNY = 'S', SELECT specifies the Ritz vectors to be
|
||||
c computed. To select the real Ritz vector corresponding to a
|
||||
c Ritz value D(j), SELECT(j) must be set to .TRUE..
|
||||
c Ritz value D(j), SELECT(j) must be set to .TRUE..
|
||||
c If HOWMNY = 'A' or 'P', SELECT need not be initialized
|
||||
c but it is used as internal workspace.
|
||||
c
|
||||
@@ -76,16 +76,16 @@ c On exit, D contains the Ritz approximations
|
||||
c to the eigenvalues lambda for A*z = lambda*B*z.
|
||||
c
|
||||
c Z Complex*16 N by NEV array (OUTPUT)
|
||||
c On exit, if RVEC = .TRUE. and HOWMNY = 'A', then the columns of
|
||||
c Z represents approximate eigenvectors (Ritz vectors) corresponding
|
||||
c On exit, if RVEC = .TRUE. and HOWMNY = 'A', then the columns of
|
||||
c Z represents approximate eigenvectors (Ritz vectors) corresponding
|
||||
c to the NCONV=IPARAM(5) Ritz values for eigensystem
|
||||
c A*z = lambda*B*z.
|
||||
c
|
||||
c If RVEC = .FALSE. or HOWMNY = 'P', then Z is NOT REFERENCED.
|
||||
c
|
||||
c NOTE: If if RVEC = .TRUE. and a Schur basis is not required,
|
||||
c the array Z may be set equal to first NEV columns of the
|
||||
c array V.
|
||||
c NOTE: If if RVEC = .TRUE. and a Schur basis is not required,
|
||||
c the array Z may be set equal to first NEV columns of the
|
||||
c array V.
|
||||
c
|
||||
c LDZ Integer. (INPUT)
|
||||
c The leading dimension of the array Z. If Ritz vectors are
|
||||
@@ -97,7 +97,7 @@ c If IPARAM(7) = 3 then SIGMA represents the shift.
|
||||
c Not referenced if IPARAM(7) = 1 or 2.
|
||||
c
|
||||
c WORKEV Complex*16 work array of dimension NCV. (WORKSPACE)
|
||||
c
|
||||
c
|
||||
c N Integer. (INPUT)
|
||||
c Dimension of the eigenproblem.
|
||||
c
|
||||
@@ -110,7 +110,7 @@ c AB(kl+ku+1+i-j,j) = A(i,j) for max(1,j-ku)<=i<=min(m,j+kl)
|
||||
c
|
||||
c MB Complex*16 array of dimension LDA by N. (INPUT)
|
||||
c The matrix M in band storage, in rows KL+1 to
|
||||
c 2*KL+KU+1; rows 1 to KL of the array need not be set.
|
||||
c 2*KL+KU+1; rows 1 to KL of the array need not be set.
|
||||
c The j-th column of M is stored in the j-th column of the
|
||||
c array MB as follows:
|
||||
c MB(kl+ku+1+i-j,j) = M(i,j) for max(1,j-ku)<=i<=min(m,j+kl)
|
||||
@@ -134,7 +134,7 @@ c
|
||||
c WHICH Character*2. (INPUT)
|
||||
c When mode 1,2 are used, WHICH can be set to any one of
|
||||
c the following.
|
||||
c
|
||||
c
|
||||
c 'LM' -> want the NEV eigenvalues of largest magnitude.
|
||||
c 'SM' -> want the NEV eigenvalues of smallest magnitude.
|
||||
c 'LR' -> want the NEV eigenvalues of largest real part.
|
||||
@@ -142,8 +142,8 @@ c 'SR' -> want the NEV eigenvalues of smallest real part.
|
||||
c 'LI' -> want the NEV eigenvalues of largest imaginary part.
|
||||
c 'SI' -> want the NEV eigenvalues of smallest imaginary part.
|
||||
c
|
||||
c When mode 3 is used, WHICH should be set to 'LM' only.
|
||||
c
|
||||
c When mode 3 is used, WHICH should be set to 'LM' only.
|
||||
c
|
||||
c BMAT Character*1. (INPUT)
|
||||
c BMAT specifies the type of the matrix B that defines the
|
||||
c semi-inner product for the operator OP.
|
||||
@@ -152,13 +152,13 @@ c BMAT = 'G' -> generalized eigenvalue problem A*x = lambda*M*x
|
||||
|
||||
c NEV Integer. (INPUT)
|
||||
c Number of eigenvalues of to be computed.
|
||||
c
|
||||
c
|
||||
c TOL Double precision scalar. (INPUT)
|
||||
c Stopping criteria: the relative accuracy of the Ritz value
|
||||
c is considered acceptable if BOUNDS(I) .LE. TOL*ABS(RITZ(I))
|
||||
c where ABS(RITZ(I)) is the magnitude when RITZ(I) is complex.
|
||||
c DEFAULT = dlamch ('EPS') (machine precision as computed
|
||||
c by the LAPACK auxilliary subroutine dlamch ).
|
||||
c by the LAPACK auxiliary subroutine dlamch ).
|
||||
c
|
||||
c RESID Complex*16 array of length N. (INPUT/OUTPUT)
|
||||
c On INPUT:
|
||||
@@ -171,12 +171,12 @@ c
|
||||
c NCV Integer. (INPUT)
|
||||
c Number of columns of the matrix V. NCV must satisfy the two
|
||||
c inequalities 2 <= NCV-NEV and NCV <= N.
|
||||
c This will indicate how many Arnoldi vectors are generated
|
||||
c at each iteration. After the startup phase in which NEV
|
||||
c Arnoldi vectors are generated, the algorithm generates
|
||||
c approximately NCV-NEV Arnoldi vectors at each subsequent update
|
||||
c iteration. Most of the cost in generating each Arnoldi vector is
|
||||
c in the matrix-vector operation OP*x.
|
||||
c This will indicate how many Arnoldi vectors are generated
|
||||
c at each iteration. After the startup phase in which NEV
|
||||
c Arnoldi vectors are generated, the algorithm generates
|
||||
c approximately NCV-NEV Arnoldi vectors at each subsequent update
|
||||
c iteration. Most of the cost in generating each Arnoldi vector is
|
||||
c in the matrix-vector operation OP*x.
|
||||
c
|
||||
c V Complex*16 array N by NCV. (OUTPUT)
|
||||
c Upon OUTPUT: If RVEC = .TRUE. the first NCONV=IPARAM(5) columns
|
||||
@@ -184,8 +184,8 @@ c contain approximate Schur vectors that span the
|
||||
c desired invariant subspace.
|
||||
c
|
||||
c NOTE: If the array Z has been set equal to first NEV+1 columns
|
||||
c of the array V and RVEC=.TRUE. and HOWMNY= 'A', then
|
||||
c the first NCONV=IPARAM(5) columns of V will contain Ritz vectors
|
||||
c of the array V and RVEC=.TRUE. and HOWMNY= 'A', then
|
||||
c the first NCONV=IPARAM(5) columns of V will contain Ritz vectors
|
||||
c of the eigensystem A*z = lambda*B*z.
|
||||
c
|
||||
c LDV Integer. (INPUT)
|
||||
@@ -193,7 +193,7 @@ c Leading dimension of V exactly as declared in the calling
|
||||
c program. LDV must be great than or equal to N.
|
||||
c
|
||||
c IPARAM Integer array of length 11. (INPUT/OUTPUT)
|
||||
c IPARAM(1) = ISHIFT:
|
||||
c IPARAM(1) = ISHIFT:
|
||||
c The shifts selected at each iteration are used to restart
|
||||
c the Arnoldi iteration in an implicit fashion.
|
||||
c It is set to 1 in this subroutine. The user do not need
|
||||
@@ -223,12 +223,12 @@ c Not referenced. Implicit restarting is ALWAYS used.
|
||||
c
|
||||
c IPARAM(7) = MODE
|
||||
c On INPUT determines what type of eigenproblem is being solved.
|
||||
c Must be 1,2 or 3; See under \Description of znband for the
|
||||
c Must be 1,2 or 3; See under \Description of znband for the
|
||||
c three modes available.
|
||||
c
|
||||
c WORKD Complex*16 work array of length at least 3*n. (WORKSPACE)
|
||||
c
|
||||
c WORKL Complex*16 work array of length LWORKL. (WORKSPACE)
|
||||
c WORKL Complex*16 work array of length LWORKL. (WORKSPACE)
|
||||
c
|
||||
c LWORKL Integer. (INPUT)
|
||||
c LWORKL must be at least 3*NCV**2 + 5*NCV.
|
||||
@@ -237,9 +237,9 @@ c RWORK Double precision array of length N (WORKSPACE)
|
||||
c Workspace used in znaupd .
|
||||
c
|
||||
c IWORK Integer array of dimension at least N. (WORKSPACE)
|
||||
c Used to mode 2,3. Store the pivot information in the
|
||||
c Used to mode 2,3. Store the pivot information in the
|
||||
c factorization of M or (A-SIGMA*M).
|
||||
c
|
||||
c
|
||||
c INFO Integer. (INPUT/OUTPUT)
|
||||
c Error flag on output.
|
||||
c = 0: Normal exit.
|
||||
@@ -300,21 +300,21 @@ c
|
||||
c-----------------------------------------------------------------------
|
||||
c
|
||||
subroutine znband (rvec, howmny, select, d , z, ldz, sigma,
|
||||
& workev, n, ab, mb, lda, fac, kl, ku, which,
|
||||
& bmat, nev, tol, resid, ncv, v, ldv, iparam,
|
||||
& workev, n, ab, mb, lda, fac, kl, ku, which,
|
||||
& bmat, nev, tol, resid, ncv, v, ldv, iparam,
|
||||
& workd, workl, lworkl, rwork, iwork, info )
|
||||
c
|
||||
c %------------------%
|
||||
c | Scalar Arguments |
|
||||
c %------------------%
|
||||
c
|
||||
c
|
||||
Character which*2, bmat, howmny
|
||||
Logical rvec
|
||||
Integer n, lda, kl, ku, nev, ncv, ldv,
|
||||
& ldz, lworkl, info
|
||||
Complex*16
|
||||
& sigma
|
||||
Double precision
|
||||
& ldz, lworkl, info
|
||||
Complex*16
|
||||
& sigma
|
||||
Double precision
|
||||
& tol
|
||||
c
|
||||
c %-----------------%
|
||||
@@ -323,11 +323,11 @@ c %-----------------%
|
||||
c
|
||||
Integer iparam(*), iwork(*)
|
||||
Logical select(*)
|
||||
Complex*16
|
||||
Complex*16
|
||||
& d(*), resid(*), v(ldv,*), z(ldz,*),
|
||||
& ab(lda,*), mb(lda,*), fac(lda,*),
|
||||
& ab(lda,*), mb(lda,*), fac(lda,*),
|
||||
& workd(*), workl(*), workev(*)
|
||||
Double precision
|
||||
Double precision
|
||||
& rwork(*)
|
||||
c
|
||||
c %--------------%
|
||||
@@ -346,7 +346,7 @@ c %------------%
|
||||
c | Parameters |
|
||||
c %------------%
|
||||
c
|
||||
Complex*16
|
||||
Complex*16
|
||||
& one, zero
|
||||
parameter (one = (1.0D+0, 0.0D+0) ,
|
||||
& zero = (0.0D+0, 0.0D+0) )
|
||||
@@ -355,14 +355,14 @@ c %-----------------------------%
|
||||
c | LAPACK & BLAS routines used |
|
||||
c %-----------------------------%
|
||||
c
|
||||
Double precision
|
||||
& dznrm2
|
||||
external zcopy , zgbmv , zgbtrf , zgbtrs , dznrm2 , zlacpy
|
||||
Double precision
|
||||
& dznrm2
|
||||
external zcopy , zgbmv , zgbtrf , zgbtrs , dznrm2 , zlacpy
|
||||
c
|
||||
c %-----------------------%
|
||||
c | Executable Statements |
|
||||
c %-----------------------%
|
||||
c
|
||||
c
|
||||
mode = iparam(7)
|
||||
c
|
||||
c %------------------------%
|
||||
@@ -398,9 +398,9 @@ c | to factor M. |
|
||||
c %-----------------------------------------------%
|
||||
c
|
||||
call zlacpy ('A', ibot, n, mb, lda, fac, lda )
|
||||
call zgbtrf (n, n, kl, ku, fac, lda, iwork, ierr)
|
||||
call zgbtrf (n, n, kl, ku, fac, lda, iwork, ierr)
|
||||
if (ierr .ne. 0) then
|
||||
print*, ' '
|
||||
print*, ' '
|
||||
print*,'_band: error in _gbtrf'
|
||||
print*, ' '
|
||||
go to 9000
|
||||
@@ -426,7 +426,7 @@ c | Construct (A - sigma*M) |
|
||||
c %---------------------------%
|
||||
c
|
||||
do 30 j = 1,n
|
||||
do 20 i = itop, ibot
|
||||
do 20 i = itop, ibot
|
||||
fac(i,j) = ab(i,j) - sigma*mb(i,j)
|
||||
20 continue
|
||||
30 continue
|
||||
@@ -451,7 +451,7 @@ c %--------------------------------------------%
|
||||
c | M A I N L O O P (reverse communication) |
|
||||
c %--------------------------------------------%
|
||||
c
|
||||
40 continue
|
||||
40 continue
|
||||
c
|
||||
call znaupd ( ido, bmat, n, which, nev, tol, resid, ncv,
|
||||
& v, ldv, iparam, ipntr, workd, workl, lworkl,
|
||||
@@ -466,8 +466,8 @@ c %----------------------------%
|
||||
c | Perform y <--- OP*x = A*x |
|
||||
c %----------------------------%
|
||||
c
|
||||
call zgbmv ('Notranspose', n, n, kl, ku, one, ab(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
call zgbmv ('Notranspose', n, n, kl, ku, one, ab(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
& workd(ipntr(2)), 1)
|
||||
c
|
||||
else if ( mode .eq. 2 ) then
|
||||
@@ -476,11 +476,11 @@ c %-----------------------------------%
|
||||
c | Perform y <--- OP*x = inv[M]*A*x |
|
||||
c %-----------------------------------%
|
||||
c
|
||||
call zgbmv ('Notranspose', n, n, kl, ku, one, ab(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
call zgbmv ('Notranspose', n, n, kl, ku, one, ab(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
& workd(ipntr(2)), 1)
|
||||
c
|
||||
call zgbtrs ('Notranspose', n, kl, ku, 1, fac, lda,
|
||||
call zgbtrs ('Notranspose', n, kl, ku, 1, fac, lda,
|
||||
& iwork, workd(ipntr(2)), n, ierr)
|
||||
if (ierr .ne. 0) then
|
||||
print*, ' '
|
||||
@@ -493,21 +493,21 @@ c
|
||||
c
|
||||
c %-----------------------------------------%
|
||||
c | Perform y <-- OP*x |
|
||||
c | = inv[A-SIGMA*M]*M* x
|
||||
c | = inv[A-SIGMA*M]*M* x
|
||||
c | to force the starting vector into the |
|
||||
c | range of OP. |
|
||||
c %-----------------------------------------%
|
||||
c
|
||||
call zgbmv ('Notranspose', n, n, kl, ku, one, mb(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
call zgbmv ('Notranspose', n, n, kl, ku, one, mb(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
& workd(ipntr(2)), 1)
|
||||
c
|
||||
call zgbtrs ('Notranspose', n, kl, ku, 1, fac, lda,
|
||||
call zgbtrs ('Notranspose', n, kl, ku, 1, fac, lda,
|
||||
& iwork, workd(ipntr(2)), n, ierr)
|
||||
if (ierr .ne. 0) then
|
||||
print*, ' '
|
||||
print*, ' '
|
||||
print*, '_band: error in _gbtrs.'
|
||||
print*, ' '
|
||||
print*, ' '
|
||||
go to 9000
|
||||
end if
|
||||
c
|
||||
@@ -521,8 +521,8 @@ c %----------------------------%
|
||||
c | Perform y <--- OP*x = A*x |
|
||||
c %----------------------------%
|
||||
c
|
||||
call zgbmv ('Notranspose', n, n, kl, ku, one, ab(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
call zgbmv ('Notranspose', n, n, kl, ku, one, ab(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
& workd(ipntr(2)), 1)
|
||||
c
|
||||
else if ( mode .eq. 2 ) then
|
||||
@@ -531,16 +531,16 @@ c %-----------------------------------%
|
||||
c | Perform y <--- OP*x = inv[M]*A*x |
|
||||
c %-----------------------------------%
|
||||
c
|
||||
call zgbmv ('Notranspose', n, n, kl, ku, one, ab(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
call zgbmv ('Notranspose', n, n, kl, ku, one, ab(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
& workd(ipntr(2)), 1)
|
||||
c
|
||||
call zgbtrs ('Notranspose', n, kl, ku, 1, fac, lda,
|
||||
call zgbtrs ('Notranspose', n, kl, ku, 1, fac, lda,
|
||||
& iwork, workd(ipntr(2)), ldv, ierr)
|
||||
if (ierr .ne. 0) then
|
||||
print*, ' '
|
||||
print*, '_band: error in sbgtrs.'
|
||||
print*, ' '
|
||||
print*, ' '
|
||||
go to 9000
|
||||
end if
|
||||
c
|
||||
@@ -563,19 +563,19 @@ c
|
||||
end if
|
||||
c
|
||||
else
|
||||
c
|
||||
c
|
||||
c %--------------------------------------%
|
||||
c | Perform y <-- inv(A-sigma*M)*(M*x). |
|
||||
c | (M*x) has been computed and stored |
|
||||
c | in workd(ipntr(3)). |
|
||||
c | in workd(ipntr(3)). |
|
||||
c %--------------------------------------%
|
||||
c
|
||||
call zcopy (n, workd(ipntr(3)), 1, workd(ipntr(2)), 1)
|
||||
call zgbtrs ('Notranspose', n, kl, ku, 1, fac, lda,
|
||||
call zgbtrs ('Notranspose', n, kl, ku, 1, fac, lda,
|
||||
& iwork, workd(ipntr(2)), n, ierr)
|
||||
if (ierr .ne. 0) then
|
||||
if (ierr .ne. 0) then
|
||||
print*, ' '
|
||||
print*, '_band: error in _gbtrs.'
|
||||
print*, '_band: error in _gbtrs.'
|
||||
print*, ' '
|
||||
go to 9000
|
||||
end if
|
||||
@@ -590,14 +590,14 @@ c %--------------------%
|
||||
c | Perform y <-- M*x |
|
||||
c %--------------------%
|
||||
c
|
||||
call zgbmv ('Notranspose', n, n, kl, ku, one, mb(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
call zgbmv ('Notranspose', n, n, kl, ku, one, mb(itop,1),
|
||||
& lda, workd(ipntr(1)), 1, zero,
|
||||
& workd(ipntr(2)), 1)
|
||||
c
|
||||
else
|
||||
else
|
||||
c
|
||||
c %-------------------------------------------%
|
||||
c | Either we have convergence, or there is |
|
||||
c | Either we have convergence, or there is |
|
||||
c | error. |
|
||||
c %-------------------------------------------%
|
||||
c
|
||||
@@ -613,7 +613,7 @@ c
|
||||
print *, ' Check the documentation of _naupd '
|
||||
print *, ' '
|
||||
c
|
||||
else
|
||||
else
|
||||
c
|
||||
call zneupd (rvec, howmny , select, d, z, ldz, sigma,
|
||||
& workev, bmat, n, which, nev, tol,
|
||||
@@ -621,17 +621,17 @@ c
|
||||
& workl, lworkl, rwork, info)
|
||||
c
|
||||
if ( info .ne. 0) then
|
||||
c
|
||||
c
|
||||
c %------------------------------------%
|
||||
c | Check the documentation of zneupd . |
|
||||
c %------------------------------------%
|
||||
c
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
print *, ' Error with _neupd = ', info
|
||||
print *, ' Check the documentation of _neupd '
|
||||
print *, ' '
|
||||
c
|
||||
endif
|
||||
print *, ' '
|
||||
c
|
||||
endif
|
||||
c
|
||||
end if
|
||||
c
|
||||
@@ -643,7 +643,7 @@ c %----------------------------------------%
|
||||
c | L O O P B A C K to call znaupd again. |
|
||||
c %----------------------------------------%
|
||||
c
|
||||
go to 40
|
||||
go to 40
|
||||
c
|
||||
9000 continue
|
||||
c
|
||||
|
||||
+41
-41
@@ -1,4 +1,4 @@
|
||||
program znbdr1
|
||||
program znbdr1
|
||||
c
|
||||
c ... Construct the matrix A in LAPACK-style band form.
|
||||
c The matrix A is derived from the discretization of
|
||||
@@ -49,13 +49,13 @@ c | MAXN - Maximum size of the matrix |
|
||||
c | MAXNEV - Maximum number of |
|
||||
c | eigenvalues to be computed |
|
||||
c | MAXNCV - Maximum number of Arnoldi |
|
||||
c | vectors stored |
|
||||
c | vectors stored |
|
||||
c | MAXBDW - Maximum bandwidth |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
integer maxn, maxnev, maxncv, maxbdw, lda,
|
||||
& lworkl, ldv
|
||||
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
|
||||
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
|
||||
& maxbdw=50, lda = maxbdw, ldv = maxn )
|
||||
c
|
||||
c %--------------%
|
||||
@@ -64,12 +64,12 @@ c %--------------%
|
||||
c
|
||||
integer iparam(11), iwork(maxn)
|
||||
logical select(maxncv)
|
||||
Complex*16
|
||||
Complex*16
|
||||
& a(lda,maxn), m(lda,maxn), fac(lda,maxn),
|
||||
& workl(3*maxncv*maxncv+5*maxncv), workd(3*maxn),
|
||||
& workl(3*maxncv*maxncv+5*maxncv), workd(3*maxn),
|
||||
& workev(2*maxncv), v(ldv, maxncv),
|
||||
& resid(maxn), d(maxncv), ax(maxn)
|
||||
Double precision
|
||||
Double precision
|
||||
& rwork(maxn), rd(maxncv,3)
|
||||
c
|
||||
c %---------------%
|
||||
@@ -81,28 +81,28 @@ c
|
||||
& n, nx, lo, isub, isup, idiag, maxitr, mode,
|
||||
& nconv
|
||||
logical rvec
|
||||
Double precision
|
||||
Double precision
|
||||
& tol
|
||||
Complex*16
|
||||
Complex*16
|
||||
& rho, h, h2, sigma
|
||||
c
|
||||
c
|
||||
c %------------%
|
||||
c | Parameters |
|
||||
c %------------%
|
||||
c
|
||||
Complex*16
|
||||
Complex*16
|
||||
& one, zero, two
|
||||
parameter ( one = (1.0D+0, 0.0D+0) ,
|
||||
& zero = (0.0D+0, 0.0D+0) ,
|
||||
parameter ( one = (1.0D+0, 0.0D+0) ,
|
||||
& zero = (0.0D+0, 0.0D+0) ,
|
||||
& two = (2.0D+0, 0.0D+0) )
|
||||
c
|
||||
c %-----------------------------%
|
||||
c | BLAS & LAPACK routines used |
|
||||
c %-----------------------------%
|
||||
c
|
||||
Double precision
|
||||
& dznrm2 , dlapy2
|
||||
external dznrm2 , zgbmv , zaxpy , dlapy2 , zlaset
|
||||
Double precision
|
||||
& dznrm2 , dlapy2
|
||||
external dznrm2 , zgbmv , zaxpy , dlapy2 , zlaset
|
||||
c
|
||||
c %-----------------------%
|
||||
c | Executable Statements |
|
||||
@@ -112,7 +112,7 @@ c %-------------------------------------------------%
|
||||
c | The number NX is the number of interior points |
|
||||
c | in the discretization of the 2-dimensional |
|
||||
c | convection-diffusion operator on the unit |
|
||||
c | square with zero Dirichlet boundary condition. |
|
||||
c | square with zero Dirichlet boundary condition. |
|
||||
c | The number N(=NX*NX) is the dimension of the |
|
||||
c | matrix. A standard eigenvalue problem is |
|
||||
c | solved (BMAT = 'I'). NEV is the number of |
|
||||
@@ -123,13 +123,13 @@ c | the spectrum. However, the following |
|
||||
c | conditions must be satisfied: |
|
||||
c | N <= MAXN |
|
||||
c | NEV <= MAXNEV |
|
||||
c | NEV + 2 <= NCV <= MAXNCV |
|
||||
c %-------------------------------------------------%
|
||||
c | NEV + 2 <= NCV <= MAXNCV |
|
||||
c %-------------------------------------------------%
|
||||
c
|
||||
nx = 10
|
||||
nx = 10
|
||||
n = nx*nx
|
||||
nev = 4
|
||||
ncv = 10
|
||||
nev = 4
|
||||
ncv = 10
|
||||
if ( n .gt. maxn ) then
|
||||
print *, ' ERROR with _NBDR1: N is greater than MAXN '
|
||||
go to 9000
|
||||
@@ -154,7 +154,7 @@ c | Arnoldi iteration. |
|
||||
c %-----------------------------------------------------%
|
||||
c
|
||||
lworkl = 3*ncv**2+5*ncv
|
||||
tol = 0.0
|
||||
tol = 0.0
|
||||
info = 0
|
||||
c
|
||||
c %---------------------------------------------------%
|
||||
@@ -168,7 +168,7 @@ c
|
||||
maxitr = 300
|
||||
mode = 1
|
||||
c
|
||||
iparam(3) = maxitr
|
||||
iparam(3) = maxitr
|
||||
iparam(7) = mode
|
||||
c
|
||||
c %----------------------------------------%
|
||||
@@ -190,10 +190,10 @@ c | and subdiagonals within the band of |
|
||||
c | matrices A and M. |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
kl = nx
|
||||
ku = nx
|
||||
kl = nx
|
||||
ku = nx
|
||||
c
|
||||
c %---------------%
|
||||
c %---------------%
|
||||
c | Main diagonal |
|
||||
c %---------------%
|
||||
c
|
||||
@@ -203,13 +203,13 @@ c
|
||||
idiag = kl+ku+1
|
||||
do 30 j = 1, n
|
||||
a(idiag,j) = (4.0D+0, 0.0D+0) / h2
|
||||
30 continue
|
||||
c
|
||||
30 continue
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | First subdiagonal and superdiagonal |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
rho = (1.0D+2, 0.0D+0)
|
||||
c
|
||||
rho = (1.0D+2, 0.0D+0)
|
||||
isup = kl+ku
|
||||
isub = kl+ku+2
|
||||
do 50 i = 1, nx
|
||||
@@ -217,8 +217,8 @@ c
|
||||
do 40 j = lo+1, lo+nx-1
|
||||
a(isup,j+1) = -one/h2 + rho/two/h
|
||||
a(isub,j) = -one/h2 - rho/two/h
|
||||
40 continue
|
||||
50 continue
|
||||
40 continue
|
||||
50 continue
|
||||
c
|
||||
c %------------------------------------%
|
||||
c | KL-th subdiagonal and KU-th super- |
|
||||
@@ -232,8 +232,8 @@ c
|
||||
do 70 j = lo+1, lo+nx
|
||||
a(isup,nx+j) = -one / h2
|
||||
a(isub,j) = -one / h2
|
||||
70 continue
|
||||
80 continue
|
||||
70 continue
|
||||
80 continue
|
||||
c
|
||||
c %-----------------------------------------------%
|
||||
c | Call ARPACK banded solver to find eigenvalues |
|
||||
@@ -241,11 +241,11 @@ c | and eigenvectors. Eigenvalues are returned in |
|
||||
c | the one dimensional array D. Eigenvectors |
|
||||
c | are returned in the first NCONV (=IPARAM(5)) |
|
||||
c | columns of V. |
|
||||
c %-----------------------------------------------%
|
||||
c %-----------------------------------------------%
|
||||
c
|
||||
rvec = .true.
|
||||
rvec = .true.
|
||||
call znband (rvec, 'A', select, d, v, ldv, sigma,
|
||||
& workev, n, a, m, lda, fac, kl, ku, which,
|
||||
& workev, n, a, m, lda, fac, kl, ku, which,
|
||||
& bmat, nev, tol, resid, ncv, v, ldv, iparam,
|
||||
& workd, workl, lworkl, rwork, iwork, info)
|
||||
c
|
||||
@@ -294,11 +294,11 @@ c
|
||||
rd(j,2) = dimag (d(j))
|
||||
rd(j,3) = dznrm2 (n, ax, 1)
|
||||
rd(j,3) = rd(j,3) / dlapy2 (rd(j,1),rd(j,2))
|
||||
90 continue
|
||||
90 continue
|
||||
|
||||
call dmout (6, nconv, 3, rd, maxncv, -6,
|
||||
& 'Ritz values (Real,Imag) and relative residuals')
|
||||
else
|
||||
else
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | Either convergence failed, or there |
|
||||
@@ -309,8 +309,8 @@ c
|
||||
print *, ' '
|
||||
print *, ' Error with _nband, info= ', info
|
||||
print *, ' Check the documentation of _nband '
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
c
|
||||
end if
|
||||
c
|
||||
9000 end
|
||||
9000 end
|
||||
|
||||
+40
-40
@@ -1,4 +1,4 @@
|
||||
program znbdr2
|
||||
program znbdr2
|
||||
c
|
||||
c ... Construct the matrix A in LAPACK-style band form.
|
||||
c The matrix A is derived from the discretization of
|
||||
@@ -49,13 +49,13 @@ c | MAXN - Maximum size of the matrix |
|
||||
c | MAXNEV - Maximum number of |
|
||||
c | eigenvalues to be computed |
|
||||
c | MAXNCV - Maximum number of Arnoldi |
|
||||
c | vectors stored |
|
||||
c | vectors stored |
|
||||
c | MAXBDW - Maximum bandwidth |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
integer maxn, maxnev, maxncv, maxbdw, lda,
|
||||
& lworkl, ldv
|
||||
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
|
||||
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
|
||||
& maxbdw=50, lda = maxbdw, ldv = maxn )
|
||||
c
|
||||
c %--------------%
|
||||
@@ -64,12 +64,12 @@ c %--------------%
|
||||
c
|
||||
integer iparam(11), iwork(maxn)
|
||||
logical select(maxncv)
|
||||
Complex*16
|
||||
Complex*16
|
||||
& a(lda,maxn), m(lda,maxn), fac(lda,maxn),
|
||||
& workl(3*maxncv*maxncv+5*maxncv), workd(3*maxn),
|
||||
& workl(3*maxncv*maxncv+5*maxncv), workd(3*maxn),
|
||||
& workev(2*maxncv), v(ldv, maxncv),
|
||||
& resid(maxn), d(maxncv), ax(maxn)
|
||||
Double precision
|
||||
Double precision
|
||||
& rwork(maxn), rd(maxncv,3)
|
||||
c
|
||||
c %---------------%
|
||||
@@ -81,18 +81,18 @@ c
|
||||
& n, nxi, lo, isub, isup, idiag, maxitr, mode,
|
||||
& nconv
|
||||
logical rvec
|
||||
Double precision
|
||||
Double precision
|
||||
& tol
|
||||
Complex*16
|
||||
Complex*16
|
||||
& rho, h, h2, sigma
|
||||
c
|
||||
c
|
||||
c %------------%
|
||||
c | Parameters |
|
||||
c %------------%
|
||||
c
|
||||
Complex*16
|
||||
Complex*16
|
||||
& one, zero, two
|
||||
parameter (one = (1.0D+0, 0.0D+0) ,
|
||||
parameter (one = (1.0D+0, 0.0D+0) ,
|
||||
& zero = (0.0D+0, 0.0D+0) ,
|
||||
& two = (2.0D+0, 0.0D+0) )
|
||||
c
|
||||
@@ -100,9 +100,9 @@ c %-----------------------------%
|
||||
c | BLAS & LAPACK routines used |
|
||||
c %-----------------------------%
|
||||
c
|
||||
Double precision
|
||||
& dznrm2 , dlapy2
|
||||
external dznrm2 , zgbmv , zaxpy , dlapy2 , zlaset
|
||||
Double precision
|
||||
& dznrm2 , dlapy2
|
||||
external dznrm2 , zgbmv , zaxpy , dlapy2 , zlaset
|
||||
c
|
||||
c %-----------------------%
|
||||
c | Executable Statements |
|
||||
@@ -112,7 +112,7 @@ c %-------------------------------------------------%
|
||||
c | The number NX is the number of interior points |
|
||||
c | in the discretization of the 2-dimensional |
|
||||
c | convection-diffusion operator on the unit |
|
||||
c | square with zero Dirichlet boundary condition. |
|
||||
c | square with zero Dirichlet boundary condition. |
|
||||
c | The number N(=NX*NX) is the dimension of the |
|
||||
c | matrix. A standard eigenvalue problem is |
|
||||
c | solved (BMAT = 'I'). NEV is the number of |
|
||||
@@ -122,16 +122,16 @@ c | is used, WHICH is set to 'LM'. The user can |
|
||||
c | modify NX, NEV and NCV to solve problems of |
|
||||
c | different sizes, and to get different parts the |
|
||||
c | spectrum. However, the following conditions |
|
||||
c | must be satisfied: |
|
||||
c | must be satisfied: |
|
||||
c | N <= MAXN |
|
||||
c | NEV <= MAXNEV |
|
||||
c | NEV + 2 <= NCV <= MAXNCV |
|
||||
c %-------------------------------------------------%
|
||||
c | NEV + 2 <= NCV <= MAXNCV |
|
||||
c %-------------------------------------------------%
|
||||
c
|
||||
nxi = 10
|
||||
nxi = 10
|
||||
n = nxi*nxi
|
||||
nev = 4
|
||||
ncv = 10
|
||||
nev = 4
|
||||
ncv = 10
|
||||
if ( n .gt. maxn ) then
|
||||
print *, ' ERROR with _NBDR2: N is greater than MAXN '
|
||||
go to 9000
|
||||
@@ -157,7 +157,7 @@ c | Arnoldi iteration. |
|
||||
c %-----------------------------------------------------%
|
||||
c
|
||||
lworkl = 3*ncv**2+5*ncv
|
||||
tol = 0.0
|
||||
tol = 0.0
|
||||
info = 0
|
||||
c
|
||||
c %---------------------------------------------------%
|
||||
@@ -193,10 +193,10 @@ c | and subdiagonals within the band of |
|
||||
c | matrices A and M. |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
kl = nxi
|
||||
ku = nxi
|
||||
kl = nxi
|
||||
ku = nxi
|
||||
c
|
||||
c %---------------%
|
||||
c %---------------%
|
||||
c | Main diagonal |
|
||||
c %---------------%
|
||||
c
|
||||
@@ -206,13 +206,13 @@ c
|
||||
idiag = kl+ku+1
|
||||
do 30 j = 1, n
|
||||
a(idiag,j) = (4.0D+0, 0.0D+0) / h2
|
||||
30 continue
|
||||
c
|
||||
30 continue
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | First subdiagonal and superdiagonal |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
rho = (1.0D+2, 0.0D+0)
|
||||
c
|
||||
rho = (1.0D+2, 0.0D+0)
|
||||
isup = kl+ku
|
||||
isub = kl+ku+2
|
||||
do 50 i = 1, nxi
|
||||
@@ -220,8 +220,8 @@ c
|
||||
do 40 j = lo+1, lo+nxi-1
|
||||
a(isup,j+1) = -one/h2 + rho/two/h
|
||||
a(isub,j) = -one/h2 - rho/two/h
|
||||
40 continue
|
||||
50 continue
|
||||
40 continue
|
||||
50 continue
|
||||
c
|
||||
c %------------------------------------%
|
||||
c | KL-th subdiagonal and KU-th super- |
|
||||
@@ -235,8 +235,8 @@ c
|
||||
do 70 j = lo+1, lo+nxi
|
||||
a(isup,nxi+j) = -one / h2
|
||||
a(isub,j) = -one / h2
|
||||
70 continue
|
||||
80 continue
|
||||
70 continue
|
||||
80 continue
|
||||
c
|
||||
c %-----------------------------------------------%
|
||||
c | Call ARPACK banded solver to find eigenvalues |
|
||||
@@ -244,11 +244,11 @@ c | and eigenvectors. Eigenvalues are returned in |
|
||||
c | the one dimensional array D. Eigenvectors |
|
||||
c | are returned in the first NCONV (=IPARAM(5)) |
|
||||
c | columns of V. |
|
||||
c %-----------------------------------------------%
|
||||
c %-----------------------------------------------%
|
||||
c
|
||||
rvec = .true.
|
||||
rvec = .true.
|
||||
call znband (rvec, 'A', select, d, v, ldv, sigma,
|
||||
& workev, n, a, m, lda, fac, kl, ku, which,
|
||||
& workev, n, a, m, lda, fac, kl, ku, which,
|
||||
& bmat, nev, tol, resid, ncv, v, ldv, iparam,
|
||||
& workd, workl, lworkl, rwork, iwork, info)
|
||||
c
|
||||
@@ -297,11 +297,11 @@ c
|
||||
rd(j,2) = dimag (d(j))
|
||||
rd(j,3) = dznrm2 (n, ax, 1)
|
||||
rd(j,3) = rd(j,3) / dlapy2 (rd(j,1),rd(j,2))
|
||||
90 continue
|
||||
90 continue
|
||||
|
||||
call dmout (6, nconv, 3, rd, maxncv, -6,
|
||||
& 'Ritz values (Real,Imag) and relative residuals')
|
||||
else
|
||||
else
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | Either convergence failed, or there |
|
||||
@@ -312,8 +312,8 @@ c
|
||||
print *, ' '
|
||||
print *, ' Error with _nband, info= ', info
|
||||
print *, ' Check the documentation of _nband '
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
c
|
||||
end if
|
||||
c
|
||||
9000 end
|
||||
9000 end
|
||||
|
||||
+35
-35
@@ -1,9 +1,9 @@
|
||||
program znbdr3
|
||||
program znbdr3
|
||||
c
|
||||
c ... Construct matrices A and M in LAPACK-style band form.
|
||||
c Matrices A and M are derived from the finite
|
||||
c element discretization of the 1-dimensional
|
||||
c convection-diffusion operator
|
||||
c Matrices A and M are derived from the finite
|
||||
c element discretization of the 1-dimensional
|
||||
c convection-diffusion operator
|
||||
c (d^2u/dx^2) + rho*(du/dx)
|
||||
c on the interval [0,1] with zero boundary condition using
|
||||
c piecewise linear elements.
|
||||
@@ -51,13 +51,13 @@ c | MAXN - Maximum size of the matrix |
|
||||
c | MAXNEV - Maximum number of |
|
||||
c | eigenvalues to be computed |
|
||||
c | MAXNCV - Maximum number of Arnoldi |
|
||||
c | vectors stored |
|
||||
c | vectors stored |
|
||||
c | MAXBDW - Maximum bandwidth |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
integer maxn, maxnev, maxncv, maxbdw, lda,
|
||||
& lworkl, ldv
|
||||
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
|
||||
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
|
||||
& maxbdw=50, lda = maxbdw, ldv = maxn)
|
||||
c
|
||||
c %--------------%
|
||||
@@ -66,12 +66,12 @@ c %--------------%
|
||||
c
|
||||
integer iparam(11), iwork(maxn)
|
||||
logical select(maxncv)
|
||||
Complex*16
|
||||
Complex*16
|
||||
& a(lda,maxn), m(lda,maxn), fac(lda,maxn),
|
||||
& workl(3*maxncv*maxncv+5*maxncv), workd(3*maxn),
|
||||
& workl(3*maxncv*maxncv+5*maxncv), workd(3*maxn),
|
||||
& workev(2*maxncv), v(ldv, maxncv),
|
||||
& resid(maxn), d(maxncv), ax(maxn), mx(maxn)
|
||||
Double precision
|
||||
Double precision
|
||||
& rwork(maxn), rd(maxncv,3)
|
||||
c
|
||||
c %---------------%
|
||||
@@ -83,16 +83,16 @@ c
|
||||
& n, idiag, isup, isub, maxitr,
|
||||
& mode, nconv
|
||||
logical rvec
|
||||
Double precision
|
||||
Double precision
|
||||
& tol
|
||||
Complex*16
|
||||
Complex*16
|
||||
& rho, h, sigma
|
||||
c
|
||||
c
|
||||
c %------------%
|
||||
c | Parameters |
|
||||
c %------------%
|
||||
c
|
||||
Complex*16
|
||||
Complex*16
|
||||
& one, zero, two
|
||||
parameter (one = (1.0D+0, 0.0D+0) ,
|
||||
& zero = (0.0D+0, 0.0D+0) ,
|
||||
@@ -102,9 +102,9 @@ c %-----------------------------%
|
||||
c | BLAS & LAPACK routines used |
|
||||
c %-----------------------------%
|
||||
c
|
||||
Double precision
|
||||
& dznrm2 , dlapy2
|
||||
external dznrm2 , zgbmv , zaxpy , dlapy2 , zlaset
|
||||
Double precision
|
||||
& dznrm2 , dlapy2
|
||||
external dznrm2 , zgbmv , zaxpy , dlapy2 , zlaset
|
||||
c
|
||||
c %-----------------------%
|
||||
c | Executable Statements |
|
||||
@@ -129,8 +129,8 @@ c | NEV + 2 <= NCV <= MAXNCV |
|
||||
c %-------------------------------------------------%
|
||||
c
|
||||
n = 100
|
||||
nev = 4
|
||||
ncv = 10
|
||||
nev = 4
|
||||
ncv = 10
|
||||
if ( n .gt. maxn ) then
|
||||
print *, ' ERROR with _NBDR3: N is greater than MAXN '
|
||||
go to 9000
|
||||
@@ -146,13 +146,13 @@ c
|
||||
sigma = zero
|
||||
c
|
||||
c %----------------------------------------------------%
|
||||
c | The work array WORKL is used in ZNAUPD as |
|
||||
c | The work array WORKL is used in ZNAUPD as |
|
||||
c | workspace. Its dimension LWORKL has to be set as |
|
||||
c | illustrated below. The parameter TOL determines |
|
||||
c | the stopping criterion. If TOL<=0, machine machine |
|
||||
c | precision is used. Setting INFO=0 indicates that |
|
||||
c | using a randomly generated vector to start the |
|
||||
c | the ARNOLDI process. |
|
||||
c | the ARNOLDI process. |
|
||||
c %----------------------------------------------------%
|
||||
c
|
||||
lworkl = 3*ncv**2+5*ncv
|
||||
@@ -195,7 +195,7 @@ c
|
||||
kl = 1
|
||||
ku = 1
|
||||
c
|
||||
c %---------------%
|
||||
c %---------------%
|
||||
c | Main diagonal |
|
||||
c %---------------%
|
||||
c
|
||||
@@ -203,23 +203,23 @@ c
|
||||
c
|
||||
idiag = kl+ku+1
|
||||
do 30 j = 1, n
|
||||
a(idiag,j) = (2.0D+0, 0.0D+0) / h
|
||||
m(idiag,j) = (4.0D+0, 0.0D+0) * h
|
||||
30 continue
|
||||
c
|
||||
a(idiag,j) = (2.0D+0, 0.0D+0) / h
|
||||
m(idiag,j) = (4.0D+0, 0.0D+0) * h
|
||||
30 continue
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | First subdiagonal and superdiagonal |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
c
|
||||
isup = kl+ku
|
||||
isub = kl+ku+2
|
||||
rho = (1.0D+1, 0.0D+0)
|
||||
rho = (1.0D+1, 0.0D+0)
|
||||
do 40 j = 1, n-1
|
||||
a(isup,j+1) = -one/h + rho/two
|
||||
a(isub,j) = -one/h - rho/two
|
||||
m(isup,j+1) = one*h
|
||||
m(isub,j) = one*h
|
||||
40 continue
|
||||
40 continue
|
||||
c
|
||||
c %-----------------------------------------------%
|
||||
c | Call ARPACK banded solver to find eigenvalues |
|
||||
@@ -229,7 +229,7 @@ c | are returned in the first NCONV (=IPARAM(5)) |
|
||||
c | columns of V. |
|
||||
c %-----------------------------------------------%
|
||||
c
|
||||
rvec = .true.
|
||||
rvec = .true.
|
||||
call znband (rvec, 'A', select, d, v, ldv, sigma,
|
||||
& workev, n, a, m, lda, fac, kl, ku, which,
|
||||
& bmat, nev, tol, resid, ncv, v, ldv, iparam,
|
||||
@@ -277,24 +277,24 @@ c
|
||||
rd(j,1) = dble (d(j))
|
||||
rd(j,2) = dimag (d(j))
|
||||
rd(j,3) = dznrm2 (n, ax, 1)
|
||||
rd(j,3) = rd(j,3) / dlapy2 (rd(j,1), rd(j,2))
|
||||
50 continue
|
||||
rd(j,3) = rd(j,3) / dlapy2 (rd(j,1), rd(j,2))
|
||||
50 continue
|
||||
|
||||
call dmout (6, nconv, 3, rd, maxncv, -6,
|
||||
& 'Ritz values (Real,Imag) and relative residuals')
|
||||
else
|
||||
else
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | Either convergence failed, or there |
|
||||
c | is error. Check the documentation |
|
||||
c | for znband . |
|
||||
c | for znband . |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
print *, ' '
|
||||
print *, ' Error with _band, info= ', info
|
||||
print *, ' Check the documentation of _band '
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
c
|
||||
end if
|
||||
c
|
||||
9000 end
|
||||
9000 end
|
||||
|
||||
+31
-31
@@ -1,4 +1,4 @@
|
||||
program zndrv4
|
||||
program zndrv4
|
||||
c
|
||||
c ... Construct matrices A and M in LAPACK-style band form.
|
||||
c Matries A and M are derived from the finite
|
||||
@@ -49,13 +49,13 @@ c | MAXN - Maximum size of the matrix |
|
||||
c | MAXNEV - Maximum number of |
|
||||
c | eigenvalues to be computed |
|
||||
c | MAXNCV - Maximum number of Arnoldi |
|
||||
c | vectors stored |
|
||||
c | vectors stored |
|
||||
c | MAXBDW - Maximum bandwidth |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
integer maxn, maxnev, maxncv, maxbdw, lda,
|
||||
& lworkl, ldv
|
||||
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
|
||||
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
|
||||
& maxbdw=50, lda = maxbdw, ldv = maxn)
|
||||
c
|
||||
c %--------------%
|
||||
@@ -64,12 +64,12 @@ c %--------------%
|
||||
c
|
||||
integer iparam(11), iwork(maxn)
|
||||
logical select(maxncv)
|
||||
Complex*16
|
||||
Complex*16
|
||||
& a(lda,maxn), m(lda,maxn), fac(lda,maxn),
|
||||
& workl(3*maxncv*maxncv+5*maxncv), workd(3*maxn),
|
||||
& workl(3*maxncv*maxncv+5*maxncv), workd(3*maxn),
|
||||
& workev(2*maxncv), v(ldv, maxncv),
|
||||
& resid(maxn), d(maxncv), ax(maxn), mx(maxn)
|
||||
Double precision
|
||||
Double precision
|
||||
& rwork(maxn), rd(maxncv,3)
|
||||
c
|
||||
c %---------------%
|
||||
@@ -81,16 +81,16 @@ c
|
||||
& n, idiag, isup, isub, maxitr, mode,
|
||||
& nconv
|
||||
logical rvec
|
||||
Double precision
|
||||
Double precision
|
||||
& tol
|
||||
Complex*16
|
||||
Complex*16
|
||||
& rho, h, sigma
|
||||
c
|
||||
c
|
||||
c %------------%
|
||||
c | Parameters |
|
||||
c %------------%
|
||||
c
|
||||
Complex*16
|
||||
Complex*16
|
||||
& one, zero, two, four, six
|
||||
parameter (one = (1.0D+0, 0.0D+0) ,
|
||||
& zero = (0.0D+0, 0.0D+0) ,
|
||||
@@ -102,9 +102,9 @@ c %-----------------------------%
|
||||
c | BLAS & LAPACK routines used |
|
||||
c %-----------------------------%
|
||||
c
|
||||
Double precision
|
||||
& dznrm2 , dlapy2
|
||||
external dznrm2 , zgbmv , zaxpy , dlapy2 , zlaset
|
||||
Double precision
|
||||
& dznrm2 , dlapy2
|
||||
external dznrm2 , zgbmv , zaxpy , dlapy2 , zlaset
|
||||
c
|
||||
c %-----------------------%
|
||||
c | Executable Statements |
|
||||
@@ -121,7 +121,7 @@ c | solved (BMAT = 'G'). NEV is the number of |
|
||||
c | eigenvalues (closest to the shift SIGMA) to be |
|
||||
c | approximated. Since the shift and invert mode |
|
||||
c | is used, WHICH is set to 'LM'. The user can |
|
||||
c | modify NX, NEV and NCV to solve problems of |
|
||||
c | modify NX, NEV and NCV to solve problems of |
|
||||
c | different sizes, and to get different parts the |
|
||||
c | spectrum. However, the following conditions |
|
||||
c | must be satisfied: |
|
||||
@@ -131,8 +131,8 @@ c | NEV + 2 <= NCV <= MAXNCV |
|
||||
c %-------------------------------------------------%
|
||||
c
|
||||
n = 100
|
||||
nev = 4
|
||||
ncv = 10
|
||||
nev = 4
|
||||
ncv = 10
|
||||
if ( n .gt. maxn ) then
|
||||
print *, ' ERROR with _NBDR4: N is greater than MAXN '
|
||||
go to 9000
|
||||
@@ -145,16 +145,16 @@ c
|
||||
end if
|
||||
bmat = 'G'
|
||||
which = 'LM'
|
||||
sigma = (1.0D+1, 0.0D+0)
|
||||
sigma = (1.0D+1, 0.0D+0)
|
||||
c
|
||||
c %----------------------------------------------------%
|
||||
c | The work array WORKL is used in ZNAUPD as |
|
||||
c | The work array WORKL is used in ZNAUPD as |
|
||||
c | workspace. Its dimension LWORKL has to be set as |
|
||||
c | illustrated below. The parameter TOL determines |
|
||||
c | the stopping criterion. If TOL<=0, machine machine |
|
||||
c | precision is used. Setting INFO=0 indicates that |
|
||||
c | we using a randomly generated vector to start the |
|
||||
c | the ARNOLDI process. |
|
||||
c | the ARNOLDI process. |
|
||||
c %----------------------------------------------------%
|
||||
c
|
||||
lworkl = 3*ncv**2+5*ncv
|
||||
@@ -197,30 +197,30 @@ c
|
||||
kl = 1
|
||||
ku = 1
|
||||
c
|
||||
c %---------------%
|
||||
c %---------------%
|
||||
c | Main diagonal |
|
||||
c %---------------%
|
||||
c
|
||||
h = one / dcmplx (n+1)
|
||||
idiag = kl+ku+1
|
||||
do 30 j = 1, n
|
||||
a(idiag,j) = two / h
|
||||
a(idiag,j) = two / h
|
||||
m(idiag,j) = four * h / six
|
||||
30 continue
|
||||
c
|
||||
30 continue
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | First subdiagonal and superdiagonal |
|
||||
c %-------------------------------------%
|
||||
c
|
||||
c
|
||||
isup = kl+ku
|
||||
isub = kl+ku+2
|
||||
rho = (1.0D+1, 0.0D+0)
|
||||
rho = (1.0D+1, 0.0D+0)
|
||||
do 40 j = 1, n-1
|
||||
a(isup,j+1) = -one/h + rho/two
|
||||
a(isub,j) = -one/h - rho/two
|
||||
m(isup,j+1) = one*h / six
|
||||
m(isub,j) = one*h / six
|
||||
40 continue
|
||||
40 continue
|
||||
c
|
||||
c %-----------------------------------------------%
|
||||
c | Call ARPACK banded solver to find eigenvalues |
|
||||
@@ -230,7 +230,7 @@ c | are returned in the first NCONV (=IPARAM(5)) |
|
||||
c | columns of V. |
|
||||
c %-----------------------------------------------%
|
||||
c
|
||||
rvec = .true.
|
||||
rvec = .true.
|
||||
call znband (rvec, 'A', select, d, v, ldv, sigma,
|
||||
& workev, n, a, m, lda, fac, kl, ku, which,
|
||||
& bmat, nev, tol, resid, ncv, v, ldv, iparam,
|
||||
@@ -279,11 +279,11 @@ c
|
||||
rd(j,2) = dimag (d(j))
|
||||
rd(j,3) = dznrm2 (n, ax, 1)
|
||||
rd(j,3) = rd(j,3) / dlapy2 (rd(j,1), rd(j,2))
|
||||
90 continue
|
||||
90 continue
|
||||
|
||||
call dmout (6, nconv, 3, rd, maxncv, -6,
|
||||
& 'Ritz values (Real,Imag) and relative residuals')
|
||||
else
|
||||
else
|
||||
c
|
||||
c %-------------------------------------%
|
||||
c | Either convergence failed, or there |
|
||||
@@ -294,8 +294,8 @@ c
|
||||
print *, ' '
|
||||
print *, ' Error with _band, info= ', info
|
||||
print *, ' Check the documentation of _band '
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
c
|
||||
end if
|
||||
c
|
||||
9000 end
|
||||
9000 end
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
LDADD = $(top_builddir)/SRC/libarpack$(LIBSUFFIX)$(ITF64SUFFIX).la $(LAPACK_LIBS) $(BLAS_LIBS)
|
||||
|
||||
CNDRV = cndrv1 cndrv2 cndrv3 cndrv4
|
||||
ZNDRV = zndrv1 zndrv2 zndrv3 zndrv4
|
||||
COMPLEX = $(CNDRV) $(ZNDRV)
|
||||
|
||||
check_PROGRAMS = $(COMPLEX)
|
||||
TESTS = $(check_PROGRAMS)
|
||||
|
||||
EXTRA_DIST = README
|
||||
|
||||
# Complex problem using single complex
|
||||
cndrv1_SOURCES = cndrv1.f
|
||||
cndrv2_SOURCES = cndrv2.f
|
||||
cndrv3_SOURCES = cndrv3.f
|
||||
cndrv4_SOURCES = cndrv4.f
|
||||
|
||||
# Complex problem using double complex
|
||||
zndrv1_SOURCES = zndrv1.f
|
||||
zndrv2_SOURCES = zndrv2.f
|
||||
zndrv3_SOURCES = zndrv3.f
|
||||
zndrv4_SOURCES = zndrv4.f
|
||||
+53
-53
@@ -1,14 +1,14 @@
|
||||
program cndrv1
|
||||
program cndrv1
|
||||
c
|
||||
c Example program to illustrate the idea of reverse communication
|
||||
c for a standard complex nonsymmetric eigenvalue problem.
|
||||
c for a standard complex nonsymmetric eigenvalue problem.
|
||||
c
|
||||
c We implement example one of ex-complex.doc in DOCUMENTS directory
|
||||
c
|
||||
c\Example-1
|
||||
c ... Suppose we want to solve A*x = lambda*x in regular mode,
|
||||
c where A is obtained from the standard central difference
|
||||
c discretization of the convection-diffusion operator
|
||||
c discretization of the convection-diffusion operator
|
||||
c (Laplacian u) + rho*(du / dx)
|
||||
c on the unit squre [0,1]x[0,1] with zero Dirichlet boundary
|
||||
c condition.
|
||||
@@ -69,12 +69,12 @@ c %--------------%
|
||||
c
|
||||
integer iparam(11), ipntr(14)
|
||||
logical select(maxncv)
|
||||
Complex
|
||||
& ax(maxn), d(maxncv),
|
||||
& v(ldv,maxncv), workd(3*maxn),
|
||||
& workev(3*maxncv), resid(maxn),
|
||||
Complex
|
||||
& ax(maxn), d(maxncv),
|
||||
& v(ldv,maxncv), workd(3*maxn),
|
||||
& workev(3*maxncv), resid(maxn),
|
||||
& workl(3*maxncv*maxncv+5*maxncv)
|
||||
Real
|
||||
Real
|
||||
& rwork(maxncv), rd(maxncv,3)
|
||||
c
|
||||
c %---------------%
|
||||
@@ -84,9 +84,9 @@ c
|
||||
character bmat*1, which*2
|
||||
integer ido, n, nx, nev, ncv, lworkl, info, j,
|
||||
& ierr, nconv, maxitr, ishfts, mode
|
||||
Complex
|
||||
Complex
|
||||
& sigma
|
||||
Real
|
||||
Real
|
||||
& tol
|
||||
logical rvec
|
||||
c
|
||||
@@ -94,19 +94,19 @@ c %-----------------------------%
|
||||
c | BLAS & LAPACK routines used |
|
||||
c %-----------------------------%
|
||||
c
|
||||
Real
|
||||
Real
|
||||
& scnrm2, slapy2
|
||||
external scnrm2, caxpy, slapy2
|
||||
external scnrm2, caxpy, slapy2
|
||||
c
|
||||
c %-----------------------%
|
||||
c | Executable Statements |
|
||||
c %-----------------------%
|
||||
c
|
||||
c
|
||||
c %--------------------------------------------------%
|
||||
c | The number NX is the number of interior points |
|
||||
c | in the discretization of the 2-dimensional |
|
||||
c | convection-diffusion operator on the unit |
|
||||
c | square with zero Dirichlet boundary condition. |
|
||||
c | square with zero Dirichlet boundary condition. |
|
||||
c | The number N(=NX*NX) is the dimension of the |
|
||||
c | matrix. A standard eigenvalue problem is |
|
||||
c | solved (BMAT = 'I'). NEV is the number of |
|
||||
@@ -117,13 +117,13 @@ c | the spectrum. However, The following |
|
||||
c | conditions must be satisfied: |
|
||||
c | N <= MAXN |
|
||||
c | NEV <= MAXNEV |
|
||||
c | NEV + 2 <= NCV <= MAXNCV |
|
||||
c %--------------------------------------------------%
|
||||
c | NEV + 2 <= NCV <= MAXNCV |
|
||||
c %--------------------------------------------------%
|
||||
c
|
||||
nx = 10
|
||||
n = nx*nx
|
||||
nx = 10
|
||||
n = nx*nx
|
||||
nev = 4
|
||||
ncv = 20
|
||||
ncv = 20
|
||||
if ( n .gt. maxn ) then
|
||||
print *, ' ERROR with _NDRV1: N is greater than MAXN '
|
||||
go to 9000
|
||||
@@ -138,18 +138,18 @@ c
|
||||
which = 'LM'
|
||||
c
|
||||
c %---------------------------------------------------%
|
||||
c | The work array WORKL is used in CNAUPD as |
|
||||
c | The work array WORKL is used in CNAUPD as |
|
||||
c | workspace. Its dimension LWORKL is set as |
|
||||
c | illustrated below. The parameter TOL determines |
|
||||
c | the stopping criterion. If TOL<=0, machine |
|
||||
c | precision is used. The variable IDO is used for |
|
||||
c | reverse communication, and is initially set to 0. |
|
||||
c | Setting INFO=0 indicates that a random vector is |
|
||||
c | generated to start the ARNOLDI iteration. |
|
||||
c | generated to start the ARNOLDI iteration. |
|
||||
c %---------------------------------------------------%
|
||||
c
|
||||
lworkl = 3*ncv**2+5*ncv
|
||||
tol = 0.0
|
||||
lworkl = 3*ncv**2+5*ncv
|
||||
tol = 0.0
|
||||
ido = 0
|
||||
info = 0
|
||||
c
|
||||
@@ -168,11 +168,11 @@ c
|
||||
mode = 1
|
||||
c
|
||||
iparam(1) = ishfts
|
||||
iparam(3) = maxitr
|
||||
iparam(7) = mode
|
||||
iparam(3) = maxitr
|
||||
iparam(7) = mode
|
||||
c
|
||||
c %-------------------------------------------%
|
||||
c | M A I N L O O P (Reverse communication) |
|
||||
c | M A I N L O O P (Reverse communication) |
|
||||
c %-------------------------------------------%
|
||||
c
|
||||
10 continue
|
||||
@@ -197,7 +197,7 @@ c | The user should supply his/her own |
|
||||
c | matrix vector multiplication routine here |
|
||||
c | that takes workd(ipntr(1)) as the input |
|
||||
c | vector, and return the matrix vector |
|
||||
c | product to workd(ipntr(2)). |
|
||||
c | product to workd(ipntr(2)). |
|
||||
c %-------------------------------------------%
|
||||
c
|
||||
call av (nx, workd(ipntr(1)), workd(ipntr(2)))
|
||||
@@ -209,7 +209,7 @@ c
|
||||
go to 10
|
||||
|
||||
end if
|
||||
c
|
||||
c
|
||||
c %----------------------------------------%
|
||||
c | Either we have convergence or there is |
|
||||
c | an error. |
|
||||
@@ -227,7 +227,7 @@ c
|
||||
print *, ' Check the documentation of _naupd'
|
||||
print *, ' '
|
||||
c
|
||||
else
|
||||
else
|
||||
c
|
||||
c %-------------------------------------------%
|
||||
c | No fatal errors occurred. |
|
||||
@@ -241,16 +241,16 @@ c %-------------------------------------------%
|
||||
c
|
||||
rvec = .true.
|
||||
c
|
||||
call cneupd (rvec, 'A', select, d, v, ldv, sigma,
|
||||
& workev, bmat, n, which, nev, tol, resid, ncv,
|
||||
& v, ldv, iparam, ipntr, workd, workl, lworkl,
|
||||
call cneupd (rvec, 'A', select, d, v, ldv, sigma,
|
||||
& workev, bmat, n, which, nev, tol, resid, ncv,
|
||||
& v, ldv, iparam, ipntr, workd, workl, lworkl,
|
||||
& rwork, ierr)
|
||||
c
|
||||
c %----------------------------------------------%
|
||||
c | Eigenvalues are returned in the one |
|
||||
c | dimensional array D. The corresponding |
|
||||
c | eigenvectors are returned in the first NCONV |
|
||||
c | (=IPARAM(5)) columns of the two dimensional |
|
||||
c | (=IPARAM(5)) columns of the two dimensional |
|
||||
c | array V if requested. Otherwise, an |
|
||||
c | orthogonal basis for the invariant subspace |
|
||||
c | corresponding to the eigenvalues in D is |
|
||||
@@ -258,7 +258,7 @@ c | returned in V. |
|
||||
c %----------------------------------------------%
|
||||
c
|
||||
if ( ierr .ne. 0) then
|
||||
c
|
||||
c
|
||||
c %------------------------------------%
|
||||
c | Error condition: |
|
||||
c | Check the documentation of CNEUPD. |
|
||||
@@ -312,11 +312,11 @@ c
|
||||
print *, ' Maximum number of iterations reached.'
|
||||
print *, ' '
|
||||
else if ( info .eq. 3) then
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
print *, ' No shifts could be applied during implicit',
|
||||
& ' Arnoldi update, try increasing NCV.'
|
||||
print *, ' '
|
||||
end if
|
||||
end if
|
||||
c
|
||||
print *, ' '
|
||||
print *, '_NDRV1'
|
||||
@@ -327,8 +327,8 @@ c
|
||||
print *, ' The number of Arnoldi vectors generated',
|
||||
& ' (NCV) is ', ncv
|
||||
print *, ' What portion of the spectrum: ', which
|
||||
print *, ' The number of converged Ritz values is ',
|
||||
& nconv
|
||||
print *, ' The number of converged Ritz values is ',
|
||||
& nconv
|
||||
print *, ' The number of Implicit Arnoldi update',
|
||||
& ' iterations taken is ', iparam(3)
|
||||
print *, ' The number of OP*x is ', iparam(9)
|
||||
@@ -344,7 +344,7 @@ c
|
||||
9000 continue
|
||||
c
|
||||
end
|
||||
c
|
||||
c
|
||||
c==========================================================================
|
||||
c
|
||||
c matrix vector subroutine
|
||||
@@ -354,21 +354,21 @@ c discretized using centered difference.
|
||||
c
|
||||
subroutine av (nx, v, w)
|
||||
integer nx, j, lo
|
||||
Complex
|
||||
Complex
|
||||
& v(nx*nx), w(nx*nx), one, h2
|
||||
parameter (one = (1.0E+0, 0.0E+0) )
|
||||
external caxpy, tv
|
||||
c
|
||||
c Computes w <--- OP*v, where OP is the nx*nx by nx*nx block
|
||||
c Computes w <--- OP*v, where OP is the nx*nx by nx*nx block
|
||||
c tridiagonal matrix
|
||||
c
|
||||
c | T -I |
|
||||
c | T -I |
|
||||
c |-I T -I |
|
||||
c OP = | -I T |
|
||||
c | ... -I|
|
||||
c | -I T|
|
||||
c
|
||||
c derived from the standard central difference discretization
|
||||
c derived from the standard central difference discretization
|
||||
c of the convection-diffusion operator (Laplacian u) + rho*(du/dx)
|
||||
c with zero boundary condition.
|
||||
c
|
||||
@@ -385,7 +385,7 @@ c
|
||||
call tv(nx, v(lo+1), w(lo+1))
|
||||
call caxpy(nx, -one/h2, v(lo-nx+1), 1, w(lo+1), 1)
|
||||
call caxpy(nx, -one/h2, v(lo+nx+1), 1, w(lo+1), 1)
|
||||
10 continue
|
||||
10 continue
|
||||
c
|
||||
lo = (nx-1)*nx
|
||||
call tv(nx, v(lo+1), w(lo+1))
|
||||
@@ -396,29 +396,29 @@ c
|
||||
c=========================================================================
|
||||
subroutine tv (nx, x, y)
|
||||
c
|
||||
integer nx, j
|
||||
Complex
|
||||
integer nx, j
|
||||
Complex
|
||||
& x(nx), y(nx), h, h2, dd, dl, du
|
||||
c
|
||||
Complex
|
||||
Complex
|
||||
& one, rho
|
||||
parameter (one = (1.0E+0, 0.0E+0) ,
|
||||
& rho = (1.0E+2, 0.0E+0) )
|
||||
c
|
||||
c Compute the matrix vector multiplication y<---T*x
|
||||
c where T is a nx by nx tridiagonal matrix with DD on the
|
||||
c where T is a nx by nx tridiagonal matrix with DD on the
|
||||
c diagonal, DL on the subdiagonal, and DU on the superdiagonal
|
||||
c
|
||||
c
|
||||
h = one / cmplx(nx+1)
|
||||
h2 = h*h
|
||||
dd = (4.0E+0, 0.0E+0) / h2
|
||||
dl = -one/h2 - (5.0E-1, 0.0E+0) *rho/h
|
||||
du = -one/h2 + (5.0E-1, 0.0E+0) *rho/h
|
||||
c
|
||||
c
|
||||
y(1) = dd*x(1) + du*x(2)
|
||||
do 10 j = 2,nx-1
|
||||
y(j) = dl*x(j-1) + dd*x(j) + du*x(j+1)
|
||||
10 continue
|
||||
y(nx) = dl*x(nx-1) + dd*x(nx)
|
||||
y(j) = dl*x(j-1) + dd*x(j) + du*x(j+1)
|
||||
10 continue
|
||||
y(nx) = dl*x(nx-1) + dd*x(nx)
|
||||
return
|
||||
end
|
||||
|
||||
+41
-41
@@ -1,7 +1,7 @@
|
||||
program cndrv2
|
||||
c
|
||||
c Simple program to illustrate the idea of reverse communication
|
||||
c in shift-invert mode for a standard complex nonsymmetric eigenvalue
|
||||
c in shift-invert mode for a standard complex nonsymmetric eigenvalue
|
||||
c problem.
|
||||
c
|
||||
c We implement example two of ex-complex.doc in DOCUMENTS directory
|
||||
@@ -60,7 +60,7 @@ c | MAXNCV: Maximum NCV allowed |
|
||||
c %-----------------------------%
|
||||
c
|
||||
integer maxn, maxnev, maxncv, ldv
|
||||
parameter (maxn=256, maxnev=10, maxncv=25,
|
||||
parameter (maxn=256, maxnev=10, maxncv=25,
|
||||
& ldv=maxn )
|
||||
c
|
||||
c %--------------%
|
||||
@@ -69,14 +69,14 @@ c %--------------%
|
||||
c
|
||||
integer iparam(11), ipntr(14), ipiv(maxn)
|
||||
logical select(maxncv)
|
||||
Complex
|
||||
Complex
|
||||
& ax(maxn), d(maxncv), resid(maxn),
|
||||
& v(ldv, maxncv), workd(3*maxn),
|
||||
& workev(2*maxncv),
|
||||
& workl(3*maxncv*maxncv+5*maxncv),
|
||||
& dd(maxn), dl(maxn), du(maxn),
|
||||
& du2(maxn)
|
||||
Real
|
||||
Real
|
||||
& rwork(maxn), rd(maxncv,3)
|
||||
c
|
||||
c %---------------%
|
||||
@@ -86,11 +86,11 @@ c
|
||||
character bmat*1, which*2
|
||||
integer ido, n, nev, ncv, lworkl, info, j, ierr,
|
||||
& nconv, maxitr, ishfts, mode
|
||||
Complex
|
||||
Complex
|
||||
& h, h2, s, sigma, s1, s2, s3, rho
|
||||
common /convct/ rho
|
||||
c
|
||||
Real
|
||||
Real
|
||||
& tol
|
||||
logical rvec
|
||||
c
|
||||
@@ -98,9 +98,9 @@ c %------------%
|
||||
c | Parameters |
|
||||
c %------------%
|
||||
c
|
||||
Complex
|
||||
& one, zero, two
|
||||
parameter (one = (1.0E+0, 0.0E+0) ,
|
||||
Complex
|
||||
& one, zero, two
|
||||
parameter (one = (1.0E+0, 0.0E+0) ,
|
||||
& zero = (0.0E+0, 0.0E+0) ,
|
||||
& two = (2.0E+0, 0.0E+0) )
|
||||
c
|
||||
@@ -108,7 +108,7 @@ c %-----------------------------%
|
||||
c | BLAS & LAPACK routines used |
|
||||
c %-----------------------------%
|
||||
c
|
||||
Real
|
||||
Real
|
||||
& scnrm2, slapy2
|
||||
external cgttrf, cgttrs, caxpy, ccopy, scnrm2,
|
||||
& slapy2
|
||||
@@ -160,22 +160,22 @@ c | the interval [0, 1] with zero Dirichlet boundary |
|
||||
c | condition. |
|
||||
c %----------------------------------------------------%
|
||||
c
|
||||
rho = (1.0E+1, 0.0E+0)
|
||||
rho = (1.0E+1, 0.0E+0)
|
||||
h = one / cmplx(n+1)
|
||||
h2 = h*h
|
||||
s = rho / two
|
||||
c
|
||||
s1 = -one/h2 - s/h
|
||||
s1 = -one/h2 - s/h
|
||||
s2 = two/h2 - sigma
|
||||
s3 = -one/h2 + s/h
|
||||
s3 = -one/h2 + s/h
|
||||
c
|
||||
do 10 j = 1, n-1
|
||||
dl(j) = s1
|
||||
dl(j) = s1
|
||||
dd(j) = s2
|
||||
du(j) = s3
|
||||
10 continue
|
||||
dd(n) = s2
|
||||
c
|
||||
10 continue
|
||||
dd(n) = s2
|
||||
c
|
||||
call cgttrf(n, dl, dd, du, du2, ipiv, ierr)
|
||||
if ( ierr .ne. 0 ) then
|
||||
print*, ' '
|
||||
@@ -195,8 +195,8 @@ c | Setting INFO=0 indicates that a random vector is |
|
||||
c | generated in CNAUPD to start the Arnoldi iteration. |
|
||||
c %-----------------------------------------------------%
|
||||
c
|
||||
lworkl = 3*ncv**2+5*ncv
|
||||
tol = 0.0
|
||||
lworkl = 3*ncv**2+5*ncv
|
||||
tol = 0.0
|
||||
ido = 0
|
||||
info = 0
|
||||
c
|
||||
@@ -214,18 +214,18 @@ c
|
||||
maxitr = 300
|
||||
mode = 3
|
||||
c
|
||||
iparam(1) = ishfts
|
||||
iparam(3) = maxitr
|
||||
iparam(7) = mode
|
||||
iparam(1) = ishfts
|
||||
iparam(3) = maxitr
|
||||
iparam(7) = mode
|
||||
c
|
||||
c %-------------------------------------------%
|
||||
c | M A I N L O O P (Reverse communication) |
|
||||
c | M A I N L O O P (Reverse communication) |
|
||||
c %-------------------------------------------%
|
||||
c
|
||||
20 continue
|
||||
c
|
||||
c %---------------------------------------------%
|
||||
c | Repeatedly call the routine CNAUPD and take |
|
||||
c | Repeatedly call the routine CNAUPD and take |
|
||||
c | actions indicated by parameter IDO until |
|
||||
c | either convergence is indicated or maxitr |
|
||||
c | has been exceeded. |
|
||||
@@ -247,8 +247,8 @@ c %-------------------------------------------%
|
||||
c
|
||||
call ccopy( n, workd(ipntr(1)),1, workd(ipntr(2)), 1)
|
||||
c
|
||||
call cgttrs('N', n, 1, dl, dd, du, du2, ipiv,
|
||||
& workd(ipntr(2)), n, ierr)
|
||||
call cgttrs('N', n, 1, dl, dd, du, du2, ipiv,
|
||||
& workd(ipntr(2)), n, ierr)
|
||||
if ( ierr .ne. 0 ) then
|
||||
print*, ' '
|
||||
print*, ' ERROR with _gttrs in _NDRV2.'
|
||||
@@ -279,23 +279,23 @@ c
|
||||
print *, ' '
|
||||
print *, ' Error with _naupd, info = ',info
|
||||
print *, ' Check the documentation in _naupd.'
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
c
|
||||
else
|
||||
else
|
||||
c
|
||||
c %-------------------------------------------%
|
||||
c | No fatal errors occurred. |
|
||||
c | Post-Process using CNEUPD. |
|
||||
c | |
|
||||
c | Computed eigenvalues may be extracted. |
|
||||
c | Computed eigenvalues may be extracted. |
|
||||
c | |
|
||||
c | Eigenvectors may also be computed now if |
|
||||
c | desired. (indicated by rvec = .true.) |
|
||||
c | desired. (indicated by rvec = .true.) |
|
||||
c %-------------------------------------------%
|
||||
c
|
||||
c
|
||||
rvec = .true.
|
||||
c
|
||||
call cneupd (rvec, 'A', select, d, v, ldv, sigma,
|
||||
call cneupd (rvec, 'A', select, d, v, ldv, sigma,
|
||||
& workev, bmat, n, which, nev, tol,
|
||||
& resid, ncv, v, ldv, iparam, ipntr, workd,
|
||||
& workl, lworkl, rwork, ierr)
|
||||
@@ -312,19 +312,19 @@ c | returned in V. |
|
||||
c %----------------------------------------------%
|
||||
c
|
||||
if ( ierr .ne. 0) then
|
||||
c
|
||||
c
|
||||
c %------------------------------------%
|
||||
c | Error condition: |
|
||||
c | Error condition: |
|
||||
c | Check the documentation of CNEUPD. |
|
||||
c %------------------------------------%
|
||||
c
|
||||
c
|
||||
print *, ' '
|
||||
print *, ' Error with _neupd, info = ', ierr
|
||||
print *, ' Check the documentation of _neupd. '
|
||||
print *, ' '
|
||||
else
|
||||
c
|
||||
nconv = iparam(5)
|
||||
nconv = iparam(5)
|
||||
do 60 j=1, nconv
|
||||
c
|
||||
c %---------------------------%
|
||||
@@ -366,11 +366,11 @@ c
|
||||
print *, ' Maximum number of iterations reached.'
|
||||
print *, ' '
|
||||
else if ( info .eq. 3) then
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
print *, ' No shifts could be applied during implicit',
|
||||
& ' Arnoldi update, try increasing NCV.'
|
||||
print *, ' '
|
||||
end if
|
||||
end if
|
||||
c
|
||||
print *, ' '
|
||||
print *, '_NDRV2 '
|
||||
@@ -381,8 +381,8 @@ c
|
||||
print *, ' The number of Arnoldi vectors generated',
|
||||
& ' (NCV) is ', ncv
|
||||
print *, ' What portion of the spectrum: ', which
|
||||
print *, ' The number of converged Ritz values is ',
|
||||
& nconv
|
||||
print *, ' The number of converged Ritz values is ',
|
||||
& nconv
|
||||
print *, ' The number of Implicit Arnoldi update',
|
||||
& ' iterations taken is ', iparam(3)
|
||||
print *, ' The number of OP*x is ', iparam(9)
|
||||
@@ -405,7 +405,7 @@ c matrix vector multiplication subroutine
|
||||
c
|
||||
subroutine av (n, v, w)
|
||||
integer n, j
|
||||
Complex
|
||||
Complex
|
||||
& v(n), w(n), rho, two, one, dd, dl, du, s, h,
|
||||
& h2
|
||||
parameter (one = (1.0E+0, 0.0E+0) ,
|
||||
|
||||
+57
-57
@@ -1,7 +1,7 @@
|
||||
program cndrv3
|
||||
c
|
||||
c Simple program to illustrate the idea of reverse communication
|
||||
c in inverse mode for a generalized complex nonsymmetric eigenvalue
|
||||
c in inverse mode for a generalized complex nonsymmetric eigenvalue
|
||||
c problem.
|
||||
c
|
||||
c We implement example three of ex-complex.doc in DOCUMENTS directory
|
||||
@@ -11,8 +11,8 @@ c ... Suppose we want to solve A*x = lambda*B*x in regular mode,
|
||||
c where A and B are derived from the finite element discretization
|
||||
c of the 1-dimensional convection-diffusion operator
|
||||
c (d^2u/dx^2) + rho*(du/dx)
|
||||
c on the interval [0,1] with zero boundary condition using
|
||||
c piecewise linear elements.
|
||||
c on the interval [0,1] with zero boundary condition using
|
||||
c piecewise linear elements.
|
||||
c
|
||||
c ... OP = inv[M]*A and B = M.
|
||||
c
|
||||
@@ -60,7 +60,7 @@ c | MAXNCV: Maximum NCV allowed |
|
||||
c %-----------------------------%
|
||||
c
|
||||
integer maxn, maxnev, maxncv, ldv
|
||||
parameter (maxn=256, maxnev=10, maxncv=25,
|
||||
parameter (maxn=256, maxnev=10, maxncv=25,
|
||||
& ldv=maxn )
|
||||
c
|
||||
c %--------------%
|
||||
@@ -69,13 +69,13 @@ c %--------------%
|
||||
c
|
||||
integer iparam(11), ipntr(14), ipiv(maxn)
|
||||
logical select(maxncv)
|
||||
Complex
|
||||
Complex
|
||||
& ax(maxn), mx(maxn), d(maxncv), resid(maxn),
|
||||
& v(ldv,maxncv), workd(3*maxn),
|
||||
& v(ldv,maxncv), workd(3*maxn),
|
||||
& workev(2*maxncv),
|
||||
& workl(3*maxncv*maxncv+5*maxncv),
|
||||
& dd(maxn), dl(maxn), du(maxn), du2(maxn)
|
||||
Real
|
||||
Real
|
||||
& rwork(maxn), rd(maxncv,3)
|
||||
c
|
||||
c %---------------%
|
||||
@@ -85,9 +85,9 @@ c
|
||||
character bmat*1, which*2
|
||||
integer ido, n, nev, ncv, lworkl, info, ierr, j,
|
||||
& nconv, maxitr, ishfts, mode
|
||||
Complex
|
||||
Complex
|
||||
& sigma, h
|
||||
Real
|
||||
Real
|
||||
& tol
|
||||
logical rvec
|
||||
c
|
||||
@@ -95,7 +95,7 @@ c %------------%
|
||||
c | Parameters |
|
||||
c %------------%
|
||||
c
|
||||
Complex
|
||||
Complex
|
||||
& zero, one
|
||||
parameter (zero = (0.0E+0, 0.0E+0) ,
|
||||
& one = (1.0E+0, 0.0E+0) )
|
||||
@@ -104,7 +104,7 @@ c %-----------------------------%
|
||||
c | BLAS & LAPACK routines used |
|
||||
c %-----------------------------%
|
||||
c
|
||||
Real
|
||||
Real
|
||||
& scnrm2, slapy2
|
||||
external caxpy, ccopy, scnrm2, cgttrf, cgttrs,
|
||||
& slapy2
|
||||
@@ -126,9 +126,9 @@ c | NEV <= MAXNEV, |
|
||||
c | NEV + 2 <= NCV <= MAXNCV |
|
||||
c %----------------------------------------------------%
|
||||
c
|
||||
n = 100
|
||||
nev = 4
|
||||
ncv = 20
|
||||
n = 100
|
||||
nev = 4
|
||||
ncv = 20
|
||||
if ( n .gt. maxn ) then
|
||||
print *, ' ERROR with _NDRV3: N is greater than MAXN '
|
||||
go to 9000
|
||||
@@ -154,15 +154,15 @@ c
|
||||
do 20 j = 1, n-1
|
||||
dl(j) = one*h
|
||||
dd(j) = (4.0E+0, 0.0E+0) *h
|
||||
du(j) = one*h
|
||||
20 continue
|
||||
dd(n) = (4.0E+0, 0.0E+0) *h
|
||||
du(j) = one*h
|
||||
20 continue
|
||||
dd(n) = (4.0E+0, 0.0E+0) *h
|
||||
c
|
||||
call cgttrf(n, dl, dd, du, du2, ipiv, ierr)
|
||||
call cgttrf(n, dl, dd, du, du2, ipiv, ierr)
|
||||
if ( ierr .ne. 0 ) then
|
||||
print*, ' '
|
||||
print*, ' ERROR with _gttrf. '
|
||||
print*, ' '
|
||||
print*, ' ERROR with _gttrf. '
|
||||
print*, ' '
|
||||
go to 9000
|
||||
end if
|
||||
c
|
||||
@@ -177,8 +177,8 @@ c | Setting INFO=0 indicates that a random vector is |
|
||||
c | generated in CNAUPD to start the Arnoldi iteration. |
|
||||
c %-----------------------------------------------------%
|
||||
c
|
||||
lworkl = 3*ncv**2+5*ncv
|
||||
tol = 0.0
|
||||
lworkl = 3*ncv**2+5*ncv
|
||||
tol = 0.0
|
||||
ido = 0
|
||||
info = 0
|
||||
c
|
||||
@@ -197,8 +197,8 @@ c
|
||||
mode = 2
|
||||
c
|
||||
iparam(1) = ishfts
|
||||
iparam(3) = maxitr
|
||||
iparam(7) = mode
|
||||
iparam(3) = maxitr
|
||||
iparam(7) = mode
|
||||
c
|
||||
c %-------------------------------------------%
|
||||
c | M A I N L O O P (Reverse communication) |
|
||||
@@ -207,14 +207,14 @@ c
|
||||
10 continue
|
||||
c
|
||||
c %---------------------------------------------%
|
||||
c | Repeatedly call the routine CNAUPD and take |
|
||||
c | Repeatedly call the routine CNAUPD and take |
|
||||
c | actions indicated by parameter IDO until |
|
||||
c | either convergence is indicated or maxitr |
|
||||
c | has been exceeded. |
|
||||
c %---------------------------------------------%
|
||||
c
|
||||
call cnaupd ( ido, bmat, n, which, nev, tol, resid, ncv,
|
||||
& v, ldv, iparam, ipntr, workd, workl, lworkl,
|
||||
call cnaupd ( ido, bmat, n, which, nev, tol, resid, ncv,
|
||||
& v, ldv, iparam, ipntr, workd, workl, lworkl,
|
||||
& rwork, info )
|
||||
c
|
||||
if (ido .eq. -1 .or. ido .eq. 1) then
|
||||
@@ -233,8 +233,8 @@ c
|
||||
call cgttrs('N', n, 1, dl, dd, du, du2, ipiv,
|
||||
& workd(ipntr(2)), n, ierr)
|
||||
if ( ierr .ne. 0 ) then
|
||||
print*, ' '
|
||||
print*, ' ERROR with _gttrs. '
|
||||
print*, ' '
|
||||
print*, ' ERROR with _gttrs. '
|
||||
print*, ' '
|
||||
go to 9000
|
||||
end if
|
||||
@@ -268,7 +268,7 @@ c
|
||||
c %-----------------------------------------%
|
||||
c | Either we have convergence, or there is |
|
||||
c | an error. |
|
||||
c %-----------------------------------------%
|
||||
c %-----------------------------------------%
|
||||
c
|
||||
if ( info .lt. 0 ) then
|
||||
c
|
||||
@@ -280,24 +280,24 @@ c
|
||||
print *, ' '
|
||||
print *, ' Error with _naupd, info = ',info
|
||||
print *, ' Check the documentation of _naupd.'
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
c
|
||||
else
|
||||
else
|
||||
c
|
||||
c %-------------------------------------------%
|
||||
c | No fatal errors occurred. |
|
||||
c | Post-Process using CNEUPD. |
|
||||
c | |
|
||||
c | Computed eigenvalues may be extracted. |
|
||||
c | Computed eigenvalues may be extracted. |
|
||||
c | |
|
||||
c | Eigenvectors may also be computed now if |
|
||||
c | desired. (indicated by rvec = .true.) |
|
||||
c | desired. (indicated by rvec = .true.) |
|
||||
c %-------------------------------------------%
|
||||
c
|
||||
rvec = .true.
|
||||
c
|
||||
call cneupd ( rvec, 'A', select, d, v, ldv, sigma,
|
||||
& workev, bmat, n, which, nev, tol, resid, ncv, v,
|
||||
call cneupd ( rvec, 'A', select, d, v, ldv, sigma,
|
||||
& workev, bmat, n, which, nev, tol, resid, ncv, v,
|
||||
& ldv, iparam, ipntr, workd, workl, lworkl, rwork,
|
||||
& ierr )
|
||||
c
|
||||
@@ -318,8 +318,8 @@ c %------------------------------------%
|
||||
c | Error condition: |
|
||||
c | Check the documentation of CNEUPD. |
|
||||
c %------------------------------------%
|
||||
c
|
||||
print *, ' '
|
||||
c
|
||||
print *, ' '
|
||||
print *, ' Error with _neupd, info = ', ierr
|
||||
print *, ' Check the documentation of _neupd'
|
||||
print *, ' '
|
||||
@@ -327,7 +327,7 @@ c
|
||||
else
|
||||
c
|
||||
nconv = iparam(5)
|
||||
do 80 j=1, nconv
|
||||
do 80 j=1, nconv
|
||||
c
|
||||
c %---------------------------%
|
||||
c | Compute the residual norm |
|
||||
@@ -369,11 +369,11 @@ c
|
||||
print *, ' Maximum number of iterations reached.'
|
||||
print *, ' '
|
||||
else if ( info .eq. 3) then
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
print *, ' No shifts could be applied during implicit',
|
||||
& ' Arnoldi update, try increasing NCV.'
|
||||
print *, ' '
|
||||
end if
|
||||
end if
|
||||
c
|
||||
print *, ' '
|
||||
print *, '_NDRV3 '
|
||||
@@ -384,8 +384,8 @@ c
|
||||
print *, ' The number of Arnoldi vectors generated ',
|
||||
& ' (NCV) is ', ncv
|
||||
print *, ' What portion of the spectrum: ', which
|
||||
print *, ' The number of converged Ritz values is ',
|
||||
& nconv
|
||||
print *, ' The number of converged Ritz values is ',
|
||||
& nconv
|
||||
print *, ' The number of Implicit Arnoldi update',
|
||||
& ' iterations taken is ', iparam(3)
|
||||
print *, ' The number of OP*x is ', iparam(9)
|
||||
@@ -397,21 +397,21 @@ c
|
||||
9000 continue
|
||||
c
|
||||
end
|
||||
c
|
||||
c
|
||||
c==========================================================================
|
||||
c
|
||||
c matrix vector multiplication subroutine
|
||||
c
|
||||
subroutine av (n, v, w)
|
||||
integer n, j
|
||||
Complex
|
||||
& v(n), w(n), one, two, dd, dl, du, s, h, rho
|
||||
Complex
|
||||
& v(n), w(n), one, two, dd, dl, du, s, h, rho
|
||||
parameter (one = (1.0E+0, 0.0E+0) ,
|
||||
& two = (2.0E+0, 0.0E+0) ,
|
||||
& rho = (1.0E+1, 0.0E+0) )
|
||||
c
|
||||
c Compute the matrix vector multiplication y<---A*x
|
||||
c where A is the stiffness matrix formed by using piecewise linear
|
||||
c where A is the stiffness matrix formed by using piecewise linear
|
||||
c elements on [0,1].
|
||||
c
|
||||
h = one / cmplx(n+1)
|
||||
@@ -422,28 +422,28 @@ c
|
||||
c
|
||||
w(1) = dd*v(1) + du*v(2)
|
||||
do 10 j = 2,n-1
|
||||
w(j) = dl*v(j-1) + dd*v(j) + du*v(j+1)
|
||||
10 continue
|
||||
w(n) = dl*v(n-1) + dd*v(n)
|
||||
w(j) = dl*v(j-1) + dd*v(j) + du*v(j+1)
|
||||
10 continue
|
||||
w(n) = dl*v(n-1) + dd*v(n)
|
||||
return
|
||||
end
|
||||
c------------------------------------------------------------------------
|
||||
subroutine mv (n, v, w)
|
||||
integer n, j
|
||||
Complex
|
||||
Complex
|
||||
& v(n), w(n), one, four, h
|
||||
parameter (one = (1.0E+0, 0.0E+0) ,
|
||||
parameter (one = (1.0E+0, 0.0E+0) ,
|
||||
& four = (4.0E+0, 0.0E+0) )
|
||||
c
|
||||
c Compute the matrix vector multiplication y<---M*x
|
||||
c where M is the mass matrix formed by using piecewise linear elements
|
||||
c where M is the mass matrix formed by using piecewise linear elements
|
||||
c on [0,1].
|
||||
c
|
||||
c
|
||||
w(1) = four*v(1) + one*v(2)
|
||||
do 10 j = 2,n-1
|
||||
w(j) = one*v(j-1) + four*v(j) + one*v(j+1)
|
||||
10 continue
|
||||
w(n) = one*v(n-1) + four*v(n)
|
||||
w(j) = one*v(j-1) + four*v(j) + one*v(j+1)
|
||||
10 continue
|
||||
w(n) = one*v(n-1) + four*v(n)
|
||||
c
|
||||
h = one / cmplx(n+1)
|
||||
call cscal(n, h, w, 1)
|
||||
|
||||
+53
-53
@@ -1,7 +1,7 @@
|
||||
program cndrv4
|
||||
c
|
||||
c Simple program to illustrate the idea of reverse communication
|
||||
c in shift and invert mode for a generalized complex nonsymmetric
|
||||
c in shift and invert mode for a generalized complex nonsymmetric
|
||||
c eigenvalue problem.
|
||||
c
|
||||
c We implement example four of ex-complex.doc in DOCUMENTS directory
|
||||
@@ -11,7 +11,7 @@ c ... Suppose we want to solve A*x = lambda*B*x in shift-invert mode,
|
||||
c where A and B are derived from a finite element discretization
|
||||
c of a 1-dimensional convection-diffusion operator
|
||||
c (d^2u/dx^2) + rho*(du/dx)
|
||||
c on the interval [0,1] with zero boundary condition using
|
||||
c on the interval [0,1] with zero boundary condition using
|
||||
c piecewise linear elements.
|
||||
c
|
||||
c ... where the shift sigma is a complex number.
|
||||
@@ -36,15 +36,15 @@ c av Matrix vector multiplication routine that computes A*x.
|
||||
c mv Matrix vector multiplication routine that computes M*x.
|
||||
c
|
||||
c\Author
|
||||
c Danny Sorensen
|
||||
c Richard Lehoucq
|
||||
c Chao Yang
|
||||
c Dept. of Computational &
|
||||
c Applied Mathematics
|
||||
c Rice University
|
||||
c Houston, Texas
|
||||
c Danny Sorensen
|
||||
c Richard Lehoucq
|
||||
c Chao Yang
|
||||
c Dept. of Computational &
|
||||
c Applied Mathematics
|
||||
c Rice University
|
||||
c Houston, Texas
|
||||
c
|
||||
c\SCCS Information: @(#)
|
||||
c\SCCS Information: @(#)
|
||||
c FILE: ndrv4.F SID: 2.4 DATE OF SID: 10/18/00 RELEASE: 2
|
||||
c
|
||||
c\Remarks
|
||||
@@ -63,7 +63,7 @@ c | MAXNCV: Maximum NCV allowed |
|
||||
c %-----------------------------%
|
||||
c
|
||||
integer maxn, maxnev, maxncv, ldv
|
||||
parameter (maxn=256, maxnev=10, maxncv=25,
|
||||
parameter (maxn=256, maxnev=10, maxncv=25,
|
||||
& ldv=maxn )
|
||||
c
|
||||
c %--------------%
|
||||
@@ -72,14 +72,14 @@ c %--------------%
|
||||
c
|
||||
integer iparam(11), ipntr(14), ipiv(maxn)
|
||||
logical select(maxncv)
|
||||
Complex
|
||||
& ax(maxn), mx(maxn), d(maxncv),
|
||||
Complex
|
||||
& ax(maxn), mx(maxn), d(maxncv),
|
||||
& v(ldv,maxncv), workd(3*maxn), resid(maxn),
|
||||
& workev(2*maxncv),
|
||||
& workl(3*maxncv*maxncv+5*maxncv),
|
||||
& dd(maxn), dl(maxn), du(maxn),
|
||||
& du2(maxn)
|
||||
Real
|
||||
Real
|
||||
& rwork(maxn), rd(maxncv,3)
|
||||
c
|
||||
c %---------------%
|
||||
@@ -89,20 +89,20 @@ c
|
||||
character bmat*1, which*2
|
||||
integer ido, n, nev, ncv, lworkl, info, j, ierr,
|
||||
& nconv, maxitr, ishfts, mode
|
||||
Complex
|
||||
Complex
|
||||
& rho, h, s,
|
||||
& sigma, s1, s2, s3
|
||||
common /convct/ rho
|
||||
c
|
||||
Real
|
||||
Real
|
||||
& tol
|
||||
logical rvec
|
||||
c
|
||||
logical rvec
|
||||
c
|
||||
c %-----------------------------%
|
||||
c | BLAS & LAPACK routines used |
|
||||
c %-----------------------------%
|
||||
c
|
||||
Real
|
||||
Real
|
||||
& scnrm2, slapy2
|
||||
external scnrm2, caxpy, ccopy, cgttrf, cgttrs,
|
||||
& slapy2
|
||||
@@ -111,10 +111,10 @@ c %------------%
|
||||
c | Parameters |
|
||||
c %------------%
|
||||
c
|
||||
Complex
|
||||
Complex
|
||||
& one, zero, two, four, six
|
||||
parameter (one = (1.0E+0, 0.0E+0) ,
|
||||
& zero = (0.0E+0, 0.0E+0) ,
|
||||
& zero = (0.0E+0, 0.0E+0) ,
|
||||
& two = (2.0E+0, 0.0E+0) ,
|
||||
& four = (4.0E+0, 0.0E+0) ,
|
||||
& six = (6.0E+0, 0.0E+0) )
|
||||
@@ -138,7 +138,7 @@ c | NEV <= MAXNEV, |
|
||||
c | NEV + 2 <= NCV <= MAXNCV |
|
||||
c %----------------------------------------------------%
|
||||
c
|
||||
n = 100
|
||||
n = 100
|
||||
nev = 4
|
||||
ncv = 20
|
||||
if ( n .gt. maxn ) then
|
||||
@@ -153,7 +153,7 @@ c
|
||||
end if
|
||||
bmat = 'G'
|
||||
which = 'LM'
|
||||
sigma = one
|
||||
sigma = one
|
||||
c
|
||||
c %--------------------------------------------------%
|
||||
c | Construct C = A - SIGMA*M in COMPLEX arithmetic. |
|
||||
@@ -164,11 +164,11 @@ c | central difference discretization of the 1-d |
|
||||
c | convection-diffusion operator u``+ rho*u` on the |
|
||||
c | interval [0, 1] with zero Dirichlet boundary |
|
||||
c | condition. The matrix M is chosen to be the |
|
||||
c | symmetric tridiagonal matrix with 4.0 on the |
|
||||
c | diagonal and 1.0 on the off-diagonals. |
|
||||
c | symmetric tridiagonal matrix with 4.0 on the |
|
||||
c | diagonal and 1.0 on the off-diagonals. |
|
||||
c %--------------------------------------------------%
|
||||
c
|
||||
rho = (1.0E+1, 0.0E+0)
|
||||
rho = (1.0E+1, 0.0E+0)
|
||||
h = one / cmplx(n+1)
|
||||
s = rho / two
|
||||
c
|
||||
@@ -177,12 +177,12 @@ c
|
||||
s3 = -one/h + s - sigma*h/six
|
||||
c
|
||||
do 10 j = 1, n-1
|
||||
dl(j) = s1
|
||||
dl(j) = s1
|
||||
dd(j) = s2
|
||||
du(j) = s3
|
||||
10 continue
|
||||
dd(n) = s2
|
||||
c
|
||||
10 continue
|
||||
dd(n) = s2
|
||||
c
|
||||
call cgttrf(n, dl, dd, du, du2, ipiv, ierr)
|
||||
if ( ierr .ne. 0 ) then
|
||||
print*, ' '
|
||||
@@ -202,7 +202,7 @@ c | Setting INFO=0 indicates that a random vector is |
|
||||
c | generated in CNAUPD to start the Arnoldi iteration. |
|
||||
c %-----------------------------------------------------%
|
||||
c
|
||||
lworkl = 3*ncv**2+5*ncv
|
||||
lworkl = 3*ncv**2+5*ncv
|
||||
tol = 0.0
|
||||
ido = 0
|
||||
info = 0
|
||||
@@ -222,11 +222,11 @@ c
|
||||
mode = 3
|
||||
c
|
||||
iparam(1) = ishfts
|
||||
iparam(3) = maxitr
|
||||
iparam(7) = mode
|
||||
iparam(3) = maxitr
|
||||
iparam(7) = mode
|
||||
c
|
||||
c %------------------------------------------%
|
||||
c | M A I N L O O P(Reverse communication) |
|
||||
c | M A I N L O O P(Reverse communication) |
|
||||
c %------------------------------------------%
|
||||
c
|
||||
20 continue
|
||||
@@ -258,14 +258,14 @@ c | workd(ipntr(2)). |
|
||||
c %-------------------------------------------%
|
||||
c
|
||||
call mv (n, workd(ipntr(1)), workd(ipntr(2)))
|
||||
call cgttrs('N', n, 1, dl, dd, du, du2, ipiv,
|
||||
call cgttrs('N', n, 1, dl, dd, du, du2, ipiv,
|
||||
& workd(ipntr(2)), n, ierr)
|
||||
if ( ierr .ne. 0 ) then
|
||||
print*, ' '
|
||||
print*, ' ERROR with _gttrs in _NDRV4.'
|
||||
print*, ' '
|
||||
go to 9000
|
||||
end if
|
||||
end if
|
||||
c
|
||||
c %-----------------------------------------%
|
||||
c | L O O P B A C K to call CNAUPD again. |
|
||||
@@ -285,7 +285,7 @@ c | workd(ipntr(2)). |
|
||||
c %-----------------------------------------%
|
||||
c
|
||||
call ccopy( n, workd(ipntr(3)), 1, workd(ipntr(2)), 1)
|
||||
call cgttrs ('N', n, 1, dl, dd, du, du2, ipiv,
|
||||
call cgttrs ('N', n, 1, dl, dd, du, du2, ipiv,
|
||||
& workd(ipntr(2)), n, ierr)
|
||||
if ( ierr .ne. 0 ) then
|
||||
print*, ' '
|
||||
@@ -317,8 +317,8 @@ c %-----------------------------------------%
|
||||
c
|
||||
go to 20
|
||||
c
|
||||
end if
|
||||
c
|
||||
end if
|
||||
c
|
||||
c %-----------------------------------------%
|
||||
c | Either we have convergence, or there is |
|
||||
c | an error. |
|
||||
@@ -334,9 +334,9 @@ c
|
||||
print *, ' '
|
||||
print *, ' Error with _naupd, info = ', info
|
||||
print *, ' Check the documentation of _naupd.'
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
c
|
||||
else
|
||||
else
|
||||
c
|
||||
c %-------------------------------------------%
|
||||
c | No fatal errors occurred. |
|
||||
@@ -350,9 +350,9 @@ c %-------------------------------------------%
|
||||
c
|
||||
rvec = .true.
|
||||
c
|
||||
call cneupd (rvec, 'A', select, d, v, ldv, sigma,
|
||||
& workev, bmat, n, which, nev, tol, resid, ncv, v,
|
||||
& ldv, iparam, ipntr, workd, workl, lworkl, rwork,
|
||||
call cneupd (rvec, 'A', select, d, v, ldv, sigma,
|
||||
& workev, bmat, n, which, nev, tol, resid, ncv, v,
|
||||
& ldv, iparam, ipntr, workd, workl, lworkl, rwork,
|
||||
& ierr)
|
||||
c
|
||||
c %----------------------------------------------%
|
||||
@@ -367,7 +367,7 @@ c | returned in V. |
|
||||
c %----------------------------------------------%
|
||||
c
|
||||
if ( ierr .ne. 0) then
|
||||
c
|
||||
c
|
||||
c %------------------------------------%
|
||||
c | Error condition: |
|
||||
c | Check the documentation of CNEUPD. |
|
||||
@@ -438,27 +438,27 @@ c
|
||||
9000 continue
|
||||
c
|
||||
end
|
||||
c
|
||||
c
|
||||
c==========================================================================
|
||||
c
|
||||
c matrix vector multiplication subroutine
|
||||
c
|
||||
subroutine mv (n, v, w)
|
||||
integer n, j
|
||||
Complex
|
||||
Complex
|
||||
& v(n), w(n), one, four, six, h
|
||||
parameter (one = (1.0E+0, 0.0E+0) ,
|
||||
& four = (4.0E+0, 0.0E+0) ,
|
||||
& six = (6.0E+0, 0.0E+0) )
|
||||
c
|
||||
c Compute the matrix vector multiplication y<---M*x
|
||||
c where M is a n by n symmetric tridiagonal matrix with 4 on the
|
||||
c where M is a n by n symmetric tridiagonal matrix with 4 on the
|
||||
c diagonal, 1 on the subdiagonal and superdiagonal.
|
||||
c
|
||||
c
|
||||
w(1) = ( four*v(1) + one*v(2) ) / six
|
||||
do 40 j = 2,n-1
|
||||
w(j) = ( one*v(j-1) + four*v(j) + one*v(j+1) ) / six
|
||||
40 continue
|
||||
40 continue
|
||||
w(n) = ( one*v(n-1) + four*v(n) ) / six
|
||||
c
|
||||
h = one / cmplx(n+1)
|
||||
@@ -468,9 +468,9 @@ c
|
||||
c------------------------------------------------------------------
|
||||
subroutine av (n, v, w)
|
||||
integer n, j
|
||||
Complex
|
||||
& v(n), w(n), one, two, dd, dl, du, s, h, rho
|
||||
parameter (one = (1.0E+0, 0.0E+0) ,
|
||||
Complex
|
||||
& v(n), w(n), one, two, dd, dl, du, s, h, rho
|
||||
parameter (one = (1.0E+0, 0.0E+0) ,
|
||||
& two = (2.0E+0, 0.0E+0) )
|
||||
common /convct/ rho
|
||||
c
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
#
|
||||
# makefile to run simple examples of the reverse communication
|
||||
# protocol.
|
||||
#
|
||||
# Modify if ALIBS library was built somewhere else.
|
||||
#
|
||||
# If ALIBS (defined in ../../ARmake.inc) contains the BLAS and LAPACK
|
||||
# libraries installed on your system, you DO NOT need to change this
|
||||
# makefile. OTHERWISE, you may need to modify the Makefile in the top level
|
||||
# ARPACK directory tree to include cdrv and/or zdrv in the
|
||||
# definition of the PRECISION variable, and issue 'make lib' from there.
|
||||
# For example:
|
||||
#
|
||||
# PRECISION = single double sdrv ddrv
|
||||
#
|
||||
#\SCCS Information: @(#)
|
||||
# FILE: makefile SID: 2.2 DATE OF SID: 9/24/96 RELEASE: 2
|
||||
#
|
||||
include ../../ARmake.inc
|
||||
#
|
||||
# Issue "complex" to make all 8 complex drivers.
|
||||
# Issue "cndrv" to make 4 single precision complex drivers.
|
||||
# Issue "zndrv" to make 4 double precision complex drivers.
|
||||
#
|
||||
|
||||
complex: cndrv zndrv
|
||||
|
||||
#-----------------------------------------------------------------------
|
||||
# Complex problem using single complex
|
||||
#
|
||||
cndrv: cndrv1 cndrv2 cndrv3 cndrv4
|
||||
|
||||
cndrv1: cndrv1.o
|
||||
$(FC) $(FFLAGS) cndrv1.o $(ALIBS) -o cndrv1
|
||||
#
|
||||
cndrv2: cndrv2.o
|
||||
$(FC) $(FFLAGS) cndrv2.o $(ALIBS) -o cndrv2
|
||||
#
|
||||
cndrv3: cndrv3.o
|
||||
$(FC) $(FFLAGS) cndrv3.o $(ALIBS) -o cndrv3
|
||||
#
|
||||
cndrv4: cndrv4.o
|
||||
$(FC) $(FFLAGS) cndrv4.o $(ALIBS) -o cndrv4
|
||||
#
|
||||
#----------------------------------------------------------------------
|
||||
# Complex problem using double complex
|
||||
#
|
||||
zndrv: zndrv1 zndrv2 zndrv3 zndrv4
|
||||
|
||||
zndrv1: zndrv1.o
|
||||
$(FC) $(FFLAGS) zndrv1.o $(ALIBS) -o zndrv1
|
||||
#
|
||||
zndrv2: zndrv2.o
|
||||
$(FC) $(FFLAGS) zndrv2.o $(ALIBS) -o zndrv2
|
||||
#
|
||||
zndrv3: zndrv3.o
|
||||
$(FC) $(FFLAGS) zndrv3.o $(ALIBS) -o zndrv3
|
||||
#
|
||||
zndrv4: zndrv4.o
|
||||
$(FC) $(FFLAGS) zndrv4.o $(ALIBS) -o zndrv4
|
||||
+54
-54
@@ -1,14 +1,14 @@
|
||||
program zndrv1
|
||||
program zndrv1
|
||||
c
|
||||
c Example program to illustrate the idea of reverse communication
|
||||
c for a standard complex nonsymmetric eigenvalue problem.
|
||||
c for a standard complex nonsymmetric eigenvalue problem.
|
||||
c
|
||||
c We implement example one of ex-complex.doc in DOCUMENTS directory
|
||||
c
|
||||
c\Example-1
|
||||
c ... Suppose we want to solve A*x = lambda*x in regular mode,
|
||||
c where A is obtained from the standard central difference
|
||||
c discretization of the convection-diffusion operator
|
||||
c discretization of the convection-diffusion operator
|
||||
c (Laplacian u) + rho*(du / dx)
|
||||
c on the unit squre [0,1]x[0,1] with zero Dirichlet boundary
|
||||
c condition.
|
||||
@@ -69,12 +69,12 @@ c %--------------%
|
||||
c
|
||||
integer iparam(11), ipntr(14)
|
||||
logical select(maxncv)
|
||||
Complex*16
|
||||
& ax(maxn), d(maxncv),
|
||||
& v(ldv,maxncv), workd(3*maxn),
|
||||
& workev(3*maxncv), resid(maxn),
|
||||
Complex*16
|
||||
& ax(maxn), d(maxncv),
|
||||
& v(ldv,maxncv), workd(3*maxn),
|
||||
& workev(3*maxncv), resid(maxn),
|
||||
& workl(3*maxncv*maxncv+5*maxncv)
|
||||
Double precision
|
||||
Double precision
|
||||
& rwork(maxncv), rd(maxncv,3)
|
||||
c
|
||||
c %---------------%
|
||||
@@ -84,9 +84,9 @@ c
|
||||
character bmat*1, which*2
|
||||
integer ido, n, nx, nev, ncv, lworkl, info, j,
|
||||
& ierr, nconv, maxitr, ishfts, mode
|
||||
Complex*16
|
||||
Complex*16
|
||||
& sigma
|
||||
Double precision
|
||||
Double precision
|
||||
& tol
|
||||
logical rvec
|
||||
c
|
||||
@@ -94,19 +94,19 @@ c %-----------------------------%
|
||||
c | BLAS & LAPACK routines used |
|
||||
c %-----------------------------%
|
||||
c
|
||||
Double precision
|
||||
& dznrm2 , dlapy2
|
||||
external dznrm2 , zaxpy , dlapy2
|
||||
Double precision
|
||||
& dznrm2 , dlapy2
|
||||
external dznrm2 , zaxpy , dlapy2
|
||||
c
|
||||
c %-----------------------%
|
||||
c | Executable Statements |
|
||||
c %-----------------------%
|
||||
c
|
||||
c
|
||||
c %--------------------------------------------------%
|
||||
c | The number NX is the number of interior points |
|
||||
c | in the discretization of the 2-dimensional |
|
||||
c | convection-diffusion operator on the unit |
|
||||
c | square with zero Dirichlet boundary condition. |
|
||||
c | square with zero Dirichlet boundary condition. |
|
||||
c | The number N(=NX*NX) is the dimension of the |
|
||||
c | matrix. A standard eigenvalue problem is |
|
||||
c | solved (BMAT = 'I'). NEV is the number of |
|
||||
@@ -117,13 +117,13 @@ c | the spectrum. However, The following |
|
||||
c | conditions must be satisfied: |
|
||||
c | N <= MAXN |
|
||||
c | NEV <= MAXNEV |
|
||||
c | NEV + 2 <= NCV <= MAXNCV |
|
||||
c %--------------------------------------------------%
|
||||
c | NEV + 2 <= NCV <= MAXNCV |
|
||||
c %--------------------------------------------------%
|
||||
c
|
||||
nx = 10
|
||||
n = nx*nx
|
||||
nx = 10
|
||||
n = nx*nx
|
||||
nev = 4
|
||||
ncv = 20
|
||||
ncv = 20
|
||||
if ( n .gt. maxn ) then
|
||||
print *, ' ERROR with _NDRV1: N is greater than MAXN '
|
||||
go to 9000
|
||||
@@ -138,18 +138,18 @@ c
|
||||
which = 'LM'
|
||||
c
|
||||
c %---------------------------------------------------%
|
||||
c | The work array WORKL is used in ZNAUPD as |
|
||||
c | The work array WORKL is used in ZNAUPD as |
|
||||
c | workspace. Its dimension LWORKL is set as |
|
||||
c | illustrated below. The parameter TOL determines |
|
||||
c | the stopping criterion. If TOL<=0, machine |
|
||||
c | precision is used. The variable IDO is used for |
|
||||
c | reverse communication, and is initially set to 0. |
|
||||
c | Setting INFO=0 indicates that a random vector is |
|
||||
c | generated to start the ARNOLDI iteration. |
|
||||
c | generated to start the ARNOLDI iteration. |
|
||||
c %---------------------------------------------------%
|
||||
c
|
||||
lworkl = 3*ncv**2+5*ncv
|
||||
tol = 0.0
|
||||
lworkl = 3*ncv**2+5*ncv
|
||||
tol = 0.0
|
||||
ido = 0
|
||||
info = 0
|
||||
c
|
||||
@@ -168,11 +168,11 @@ c
|
||||
mode = 1
|
||||
c
|
||||
iparam(1) = ishfts
|
||||
iparam(3) = maxitr
|
||||
iparam(7) = mode
|
||||
iparam(3) = maxitr
|
||||
iparam(7) = mode
|
||||
c
|
||||
c %-------------------------------------------%
|
||||
c | M A I N L O O P (Reverse communication) |
|
||||
c | M A I N L O O P (Reverse communication) |
|
||||
c %-------------------------------------------%
|
||||
c
|
||||
10 continue
|
||||
@@ -197,7 +197,7 @@ c | The user should supply his/her own |
|
||||
c | matrix vector multiplication routine here |
|
||||
c | that takes workd(ipntr(1)) as the input |
|
||||
c | vector, and return the matrix vector |
|
||||
c | product to workd(ipntr(2)). |
|
||||
c | product to workd(ipntr(2)). |
|
||||
c %-------------------------------------------%
|
||||
c
|
||||
call av (nx, workd(ipntr(1)), workd(ipntr(2)))
|
||||
@@ -209,7 +209,7 @@ c
|
||||
go to 10
|
||||
|
||||
end if
|
||||
c
|
||||
c
|
||||
c %----------------------------------------%
|
||||
c | Either we have convergence or there is |
|
||||
c | an error. |
|
||||
@@ -227,7 +227,7 @@ c
|
||||
print *, ' Check the documentation of _naupd'
|
||||
print *, ' '
|
||||
c
|
||||
else
|
||||
else
|
||||
c
|
||||
c %-------------------------------------------%
|
||||
c | No fatal errors occurred. |
|
||||
@@ -241,16 +241,16 @@ c %-------------------------------------------%
|
||||
c
|
||||
rvec = .true.
|
||||
c
|
||||
call zneupd (rvec, 'A', select, d, v, ldv, sigma,
|
||||
& workev, bmat, n, which, nev, tol, resid, ncv,
|
||||
& v, ldv, iparam, ipntr, workd, workl, lworkl,
|
||||
call zneupd (rvec, 'A', select, d, v, ldv, sigma,
|
||||
& workev, bmat, n, which, nev, tol, resid, ncv,
|
||||
& v, ldv, iparam, ipntr, workd, workl, lworkl,
|
||||
& rwork, ierr)
|
||||
c
|
||||
c %----------------------------------------------%
|
||||
c | Eigenvalues are returned in the one |
|
||||
c | dimensional array D. The corresponding |
|
||||
c | eigenvectors are returned in the first NCONV |
|
||||
c | (=IPARAM(5)) columns of the two dimensional |
|
||||
c | (=IPARAM(5)) columns of the two dimensional |
|
||||
c | array V if requested. Otherwise, an |
|
||||
c | orthogonal basis for the invariant subspace |
|
||||
c | corresponding to the eigenvalues in D is |
|
||||
@@ -258,7 +258,7 @@ c | returned in V. |
|
||||
c %----------------------------------------------%
|
||||
c
|
||||
if ( ierr .ne. 0) then
|
||||
c
|
||||
c
|
||||
c %------------------------------------%
|
||||
c | Error condition: |
|
||||
c | Check the documentation of ZNEUPD . |
|
||||
@@ -312,11 +312,11 @@ c
|
||||
print *, ' Maximum number of iterations reached.'
|
||||
print *, ' '
|
||||
else if ( info .eq. 3) then
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
print *, ' No shifts could be applied during implicit',
|
||||
& ' Arnoldi update, try increasing NCV.'
|
||||
print *, ' '
|
||||
end if
|
||||
end if
|
||||
c
|
||||
print *, ' '
|
||||
print *, '_NDRV1'
|
||||
@@ -327,8 +327,8 @@ c
|
||||
print *, ' The number of Arnoldi vectors generated',
|
||||
& ' (NCV) is ', ncv
|
||||
print *, ' What portion of the spectrum: ', which
|
||||
print *, ' The number of converged Ritz values is ',
|
||||
& nconv
|
||||
print *, ' The number of converged Ritz values is ',
|
||||
& nconv
|
||||
print *, ' The number of Implicit Arnoldi update',
|
||||
& ' iterations taken is ', iparam(3)
|
||||
print *, ' The number of OP*x is ', iparam(9)
|
||||
@@ -344,7 +344,7 @@ c
|
||||
9000 continue
|
||||
c
|
||||
end
|
||||
c
|
||||
c
|
||||
c==========================================================================
|
||||
c
|
||||
c matrix vector subroutine
|
||||
@@ -354,21 +354,21 @@ c discretized using centered difference.
|
||||
c
|
||||
subroutine av (nx, v, w)
|
||||
integer nx, j, lo
|
||||
Complex*16
|
||||
Complex*16
|
||||
& v(nx*nx), w(nx*nx), one, h2
|
||||
parameter (one = (1.0D+0, 0.0D+0) )
|
||||
external zaxpy , tv
|
||||
c
|
||||
c Computes w <--- OP*v, where OP is the nx*nx by nx*nx block
|
||||
c Computes w <--- OP*v, where OP is the nx*nx by nx*nx block
|
||||
c tridiagonal matrix
|
||||
c
|
||||
c | T -I |
|
||||
c | T -I |
|
||||
c |-I T -I |
|
||||
c OP = | -I T |
|
||||
c | ... -I|
|
||||
c | -I T|
|
||||
c
|
||||
c derived from the standard central difference discretization
|
||||
c derived from the standard central difference discretization
|
||||
c of the convection-diffusion operator (Laplacian u) + rho*(du/dx)
|
||||
c with zero boundary condition.
|
||||
c
|
||||
@@ -385,7 +385,7 @@ c
|
||||
call tv(nx, v(lo+1), w(lo+1))
|
||||
call zaxpy (nx, -one/h2, v(lo-nx+1), 1, w(lo+1), 1)
|
||||
call zaxpy (nx, -one/h2, v(lo+nx+1), 1, w(lo+1), 1)
|
||||
10 continue
|
||||
10 continue
|
||||
c
|
||||
lo = (nx-1)*nx
|
||||
call tv(nx, v(lo+1), w(lo+1))
|
||||
@@ -396,29 +396,29 @@ c
|
||||
c=========================================================================
|
||||
subroutine tv (nx, x, y)
|
||||
c
|
||||
integer nx, j
|
||||
Complex*16
|
||||
integer nx, j
|
||||
Complex*16
|
||||
& x(nx), y(nx), h, h2, dd, dl, du
|
||||
c
|
||||
Complex*16
|
||||
Complex*16
|
||||
& one, rho
|
||||
parameter (one = (1.0D+0, 0.0D+0) ,
|
||||
& rho = (1.0D+2, 0.0D+0) )
|
||||
c
|
||||
c Compute the matrix vector multiplication y<---T*x
|
||||
c where T is a nx by nx tridiagonal matrix with DD on the
|
||||
c where T is a nx by nx tridiagonal matrix with DD on the
|
||||
c diagonal, DL on the subdiagonal, and DU on the superdiagonal
|
||||
c
|
||||
c
|
||||
h = one / dcmplx (nx+1)
|
||||
h2 = h*h
|
||||
dd = (4.0D+0, 0.0D+0) / h2
|
||||
dl = -one/h2 - (5.0D-1, 0.0D+0) *rho/h
|
||||
du = -one/h2 + (5.0D-1, 0.0D+0) *rho/h
|
||||
c
|
||||
c
|
||||
y(1) = dd*x(1) + du*x(2)
|
||||
do 10 j = 2,nx-1
|
||||
y(j) = dl*x(j-1) + dd*x(j) + du*x(j+1)
|
||||
10 continue
|
||||
y(nx) = dl*x(nx-1) + dd*x(nx)
|
||||
y(j) = dl*x(j-1) + dd*x(j) + du*x(j+1)
|
||||
10 continue
|
||||
y(nx) = dl*x(nx-1) + dd*x(nx)
|
||||
return
|
||||
end
|
||||
|
||||
+44
-44
@@ -1,7 +1,7 @@
|
||||
program zndrv2
|
||||
program zndrv2
|
||||
c
|
||||
c Simple program to illustrate the idea of reverse communication
|
||||
c in shift-invert mode for a standard complex nonsymmetric eigenvalue
|
||||
c in shift-invert mode for a standard complex nonsymmetric eigenvalue
|
||||
c problem.
|
||||
c
|
||||
c We implement example two of ex-complex.doc in DOCUMENTS directory
|
||||
@@ -60,7 +60,7 @@ c | MAXNCV: Maximum NCV allowed |
|
||||
c %-----------------------------%
|
||||
c
|
||||
integer maxn, maxnev, maxncv, ldv
|
||||
parameter (maxn=256, maxnev=10, maxncv=25,
|
||||
parameter (maxn=256, maxnev=10, maxncv=25,
|
||||
& ldv=maxn )
|
||||
c
|
||||
c %--------------%
|
||||
@@ -69,14 +69,14 @@ c %--------------%
|
||||
c
|
||||
integer iparam(11), ipntr(14), ipiv(maxn)
|
||||
logical select(maxncv)
|
||||
Complex*16
|
||||
Complex*16
|
||||
& ax(maxn), d(maxncv), resid(maxn),
|
||||
& v(ldv, maxncv), workd(3*maxn),
|
||||
& workev(2*maxncv),
|
||||
& workl(3*maxncv*maxncv+5*maxncv),
|
||||
& dd(maxn), dl(maxn), du(maxn),
|
||||
& du2(maxn)
|
||||
Double precision
|
||||
Double precision
|
||||
& rwork(maxn), rd(maxncv,3)
|
||||
c
|
||||
c %---------------%
|
||||
@@ -86,11 +86,11 @@ c
|
||||
character bmat*1, which*2
|
||||
integer ido, n, nev, ncv, lworkl, info, j, ierr,
|
||||
& nconv, maxitr, ishfts, mode
|
||||
Complex*16
|
||||
Complex*16
|
||||
& h, h2, s, sigma, s1, s2, s3, rho
|
||||
common /convct/ rho
|
||||
c
|
||||
Double precision
|
||||
Double precision
|
||||
& tol
|
||||
logical rvec
|
||||
c
|
||||
@@ -98,9 +98,9 @@ c %------------%
|
||||
c | Parameters |
|
||||
c %------------%
|
||||
c
|
||||
Complex*16
|
||||
& one, zero, two
|
||||
parameter (one = (1.0D+0, 0.0D+0) ,
|
||||
Complex*16
|
||||
& one, zero, two
|
||||
parameter (one = (1.0D+0, 0.0D+0) ,
|
||||
& zero = (0.0D+0, 0.0D+0) ,
|
||||
& two = (2.0D+0, 0.0D+0) )
|
||||
c
|
||||
@@ -108,10 +108,10 @@ c %-----------------------------%
|
||||
c | BLAS & LAPACK routines used |
|
||||
c %-----------------------------%
|
||||
c
|
||||
Double precision
|
||||
& dznrm2 , dlapy2
|
||||
Double precision
|
||||
& dznrm2 , dlapy2
|
||||
external zgttrf , zgttrs , zaxpy , zcopy , dznrm2 ,
|
||||
& dlapy2
|
||||
& dlapy2
|
||||
c
|
||||
c %-----------------------%
|
||||
c | Executable statements |
|
||||
@@ -160,22 +160,22 @@ c | the interval [0, 1] with zero Dirichlet boundary |
|
||||
c | condition. |
|
||||
c %----------------------------------------------------%
|
||||
c
|
||||
rho = (1.0D+1, 0.0D+0)
|
||||
rho = (1.0D+1, 0.0D+0)
|
||||
h = one / dcmplx (n+1)
|
||||
h2 = h*h
|
||||
s = rho / two
|
||||
c
|
||||
s1 = -one/h2 - s/h
|
||||
s1 = -one/h2 - s/h
|
||||
s2 = two/h2 - sigma
|
||||
s3 = -one/h2 + s/h
|
||||
s3 = -one/h2 + s/h
|
||||
c
|
||||
do 10 j = 1, n-1
|
||||
dl(j) = s1
|
||||
dl(j) = s1
|
||||
dd(j) = s2
|
||||
du(j) = s3
|
||||
10 continue
|
||||
dd(n) = s2
|
||||
c
|
||||
10 continue
|
||||
dd(n) = s2
|
||||
c
|
||||
call zgttrf (n, dl, dd, du, du2, ipiv, ierr)
|
||||
if ( ierr .ne. 0 ) then
|
||||
print*, ' '
|
||||
@@ -195,8 +195,8 @@ c | Setting INFO=0 indicates that a random vector is |
|
||||
c | generated in ZNAUPD to start the Arnoldi iteration. |
|
||||
c %-----------------------------------------------------%
|
||||
c
|
||||
lworkl = 3*ncv**2+5*ncv
|
||||
tol = 0.0
|
||||
lworkl = 3*ncv**2+5*ncv
|
||||
tol = 0.0
|
||||
ido = 0
|
||||
info = 0
|
||||
c
|
||||
@@ -214,18 +214,18 @@ c
|
||||
maxitr = 300
|
||||
mode = 3
|
||||
c
|
||||
iparam(1) = ishfts
|
||||
iparam(3) = maxitr
|
||||
iparam(7) = mode
|
||||
iparam(1) = ishfts
|
||||
iparam(3) = maxitr
|
||||
iparam(7) = mode
|
||||
c
|
||||
c %-------------------------------------------%
|
||||
c | M A I N L O O P (Reverse communication) |
|
||||
c | M A I N L O O P (Reverse communication) |
|
||||
c %-------------------------------------------%
|
||||
c
|
||||
20 continue
|
||||
c
|
||||
c %---------------------------------------------%
|
||||
c | Repeatedly call the routine ZNAUPD and take |
|
||||
c | Repeatedly call the routine ZNAUPD and take |
|
||||
c | actions indicated by parameter IDO until |
|
||||
c | either convergence is indicated or maxitr |
|
||||
c | has been exceeded. |
|
||||
@@ -247,8 +247,8 @@ c %-------------------------------------------%
|
||||
c
|
||||
call zcopy ( n, workd(ipntr(1)),1, workd(ipntr(2)), 1)
|
||||
c
|
||||
call zgttrs ('N', n, 1, dl, dd, du, du2, ipiv,
|
||||
& workd(ipntr(2)), n, ierr)
|
||||
call zgttrs ('N', n, 1, dl, dd, du, du2, ipiv,
|
||||
& workd(ipntr(2)), n, ierr)
|
||||
if ( ierr .ne. 0 ) then
|
||||
print*, ' '
|
||||
print*, ' ERROR with _gttrs in _NDRV2.'
|
||||
@@ -279,23 +279,23 @@ c
|
||||
print *, ' '
|
||||
print *, ' Error with _naupd, info = ',info
|
||||
print *, ' Check the documentation in _naupd.'
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
c
|
||||
else
|
||||
else
|
||||
c
|
||||
c %-------------------------------------------%
|
||||
c | No fatal errors occurred. |
|
||||
c | Post-Process using ZNEUPD . |
|
||||
c | |
|
||||
c | Computed eigenvalues may be extracted. |
|
||||
c | Computed eigenvalues may be extracted. |
|
||||
c | |
|
||||
c | Eigenvectors may also be computed now if |
|
||||
c | desired. (indicated by rvec = .true.) |
|
||||
c | desired. (indicated by rvec = .true.) |
|
||||
c %-------------------------------------------%
|
||||
c
|
||||
c
|
||||
rvec = .true.
|
||||
c
|
||||
call zneupd (rvec, 'A', select, d, v, ldv, sigma,
|
||||
call zneupd (rvec, 'A', select, d, v, ldv, sigma,
|
||||
& workev, bmat, n, which, nev, tol,
|
||||
& resid, ncv, v, ldv, iparam, ipntr, workd,
|
||||
& workl, lworkl, rwork, ierr)
|
||||
@@ -312,19 +312,19 @@ c | returned in V. |
|
||||
c %----------------------------------------------%
|
||||
c
|
||||
if ( ierr .ne. 0) then
|
||||
c
|
||||
c
|
||||
c %------------------------------------%
|
||||
c | Error condition: |
|
||||
c | Error condition: |
|
||||
c | Check the documentation of ZNEUPD . |
|
||||
c %------------------------------------%
|
||||
c
|
||||
c
|
||||
print *, ' '
|
||||
print *, ' Error with _neupd, info = ', ierr
|
||||
print *, ' Check the documentation of _neupd. '
|
||||
print *, ' '
|
||||
else
|
||||
c
|
||||
nconv = iparam(5)
|
||||
nconv = iparam(5)
|
||||
do 60 j=1, nconv
|
||||
c
|
||||
c %---------------------------%
|
||||
@@ -366,11 +366,11 @@ c
|
||||
print *, ' Maximum number of iterations reached.'
|
||||
print *, ' '
|
||||
else if ( info .eq. 3) then
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
print *, ' No shifts could be applied during implicit',
|
||||
& ' Arnoldi update, try increasing NCV.'
|
||||
print *, ' '
|
||||
end if
|
||||
end if
|
||||
c
|
||||
print *, ' '
|
||||
print *, '_NDRV2 '
|
||||
@@ -381,8 +381,8 @@ c
|
||||
print *, ' The number of Arnoldi vectors generated',
|
||||
& ' (NCV) is ', ncv
|
||||
print *, ' What portion of the spectrum: ', which
|
||||
print *, ' The number of converged Ritz values is ',
|
||||
& nconv
|
||||
print *, ' The number of converged Ritz values is ',
|
||||
& nconv
|
||||
print *, ' The number of Implicit Arnoldi update',
|
||||
& ' iterations taken is ', iparam(3)
|
||||
print *, ' The number of OP*x is ', iparam(9)
|
||||
@@ -405,7 +405,7 @@ c matrix vector multiplication subroutine
|
||||
c
|
||||
subroutine av (n, v, w)
|
||||
integer n, j
|
||||
Complex*16
|
||||
Complex*16
|
||||
& v(n), w(n), rho, two, one, dd, dl, du, s, h,
|
||||
& h2
|
||||
parameter (one = (1.0D+0, 0.0D+0) ,
|
||||
|
||||
+60
-60
@@ -1,7 +1,7 @@
|
||||
program zndrv3
|
||||
program zndrv3
|
||||
c
|
||||
c Simple program to illustrate the idea of reverse communication
|
||||
c in inverse mode for a generalized complex nonsymmetric eigenvalue
|
||||
c in inverse mode for a generalized complex nonsymmetric eigenvalue
|
||||
c problem.
|
||||
c
|
||||
c We implement example three of ex-complex.doc in DOCUMENTS directory
|
||||
@@ -11,8 +11,8 @@ c ... Suppose we want to solve A*x = lambda*B*x in regular mode,
|
||||
c where A and B are derived from the finite element discretization
|
||||
c of the 1-dimensional convection-diffusion operator
|
||||
c (d^2u/dx^2) + rho*(du/dx)
|
||||
c on the interval [0,1] with zero boundary condition using
|
||||
c piecewise linear elements.
|
||||
c on the interval [0,1] with zero boundary condition using
|
||||
c piecewise linear elements.
|
||||
c
|
||||
c ... OP = inv[M]*A and B = M.
|
||||
c
|
||||
@@ -60,7 +60,7 @@ c | MAXNCV: Maximum NCV allowed |
|
||||
c %-----------------------------%
|
||||
c
|
||||
integer maxn, maxnev, maxncv, ldv
|
||||
parameter (maxn=256, maxnev=10, maxncv=25,
|
||||
parameter (maxn=256, maxnev=10, maxncv=25,
|
||||
& ldv=maxn )
|
||||
c
|
||||
c %--------------%
|
||||
@@ -69,13 +69,13 @@ c %--------------%
|
||||
c
|
||||
integer iparam(11), ipntr(14), ipiv(maxn)
|
||||
logical select(maxncv)
|
||||
Complex*16
|
||||
Complex*16
|
||||
& ax(maxn), mx(maxn), d(maxncv), resid(maxn),
|
||||
& v(ldv,maxncv), workd(3*maxn),
|
||||
& v(ldv,maxncv), workd(3*maxn),
|
||||
& workev(2*maxncv),
|
||||
& workl(3*maxncv*maxncv+5*maxncv),
|
||||
& dd(maxn), dl(maxn), du(maxn), du2(maxn)
|
||||
Double precision
|
||||
Double precision
|
||||
& rwork(maxn), rd(maxncv,3)
|
||||
c
|
||||
c %---------------%
|
||||
@@ -85,9 +85,9 @@ c
|
||||
character bmat*1, which*2
|
||||
integer ido, n, nev, ncv, lworkl, info, ierr, j,
|
||||
& nconv, maxitr, ishfts, mode
|
||||
Complex*16
|
||||
Complex*16
|
||||
& sigma, h
|
||||
Double precision
|
||||
Double precision
|
||||
& tol
|
||||
logical rvec
|
||||
c
|
||||
@@ -95,7 +95,7 @@ c %------------%
|
||||
c | Parameters |
|
||||
c %------------%
|
||||
c
|
||||
Complex*16
|
||||
Complex*16
|
||||
& zero, one
|
||||
parameter (zero = (0.0D+0, 0.0D+0) ,
|
||||
& one = (1.0D+0, 0.0D+0) )
|
||||
@@ -104,10 +104,10 @@ c %-----------------------------%
|
||||
c | BLAS & LAPACK routines used |
|
||||
c %-----------------------------%
|
||||
c
|
||||
Double precision
|
||||
& dznrm2 , dlapy2
|
||||
Double precision
|
||||
& dznrm2 , dlapy2
|
||||
external zaxpy , zcopy , dznrm2 , zgttrf , zgttrs ,
|
||||
& dlapy2
|
||||
& dlapy2
|
||||
c
|
||||
c %-----------------------%
|
||||
c | Executable Statements |
|
||||
@@ -126,9 +126,9 @@ c | NEV <= MAXNEV, |
|
||||
c | NEV + 2 <= NCV <= MAXNCV |
|
||||
c %----------------------------------------------------%
|
||||
c
|
||||
n = 100
|
||||
nev = 4
|
||||
ncv = 20
|
||||
n = 100
|
||||
nev = 4
|
||||
ncv = 20
|
||||
if ( n .gt. maxn ) then
|
||||
print *, ' ERROR with _NDRV3: N is greater than MAXN '
|
||||
go to 9000
|
||||
@@ -154,15 +154,15 @@ c
|
||||
do 20 j = 1, n-1
|
||||
dl(j) = one*h
|
||||
dd(j) = (4.0D+0, 0.0D+0) *h
|
||||
du(j) = one*h
|
||||
20 continue
|
||||
dd(n) = (4.0D+0, 0.0D+0) *h
|
||||
du(j) = one*h
|
||||
20 continue
|
||||
dd(n) = (4.0D+0, 0.0D+0) *h
|
||||
c
|
||||
call zgttrf (n, dl, dd, du, du2, ipiv, ierr)
|
||||
call zgttrf (n, dl, dd, du, du2, ipiv, ierr)
|
||||
if ( ierr .ne. 0 ) then
|
||||
print*, ' '
|
||||
print*, ' ERROR with _gttrf. '
|
||||
print*, ' '
|
||||
print*, ' ERROR with _gttrf. '
|
||||
print*, ' '
|
||||
go to 9000
|
||||
end if
|
||||
c
|
||||
@@ -177,8 +177,8 @@ c | Setting INFO=0 indicates that a random vector is |
|
||||
c | generated in ZNAUPD to start the Arnoldi iteration. |
|
||||
c %-----------------------------------------------------%
|
||||
c
|
||||
lworkl = 3*ncv**2+5*ncv
|
||||
tol = 0.0
|
||||
lworkl = 3*ncv**2+5*ncv
|
||||
tol = 0.0
|
||||
ido = 0
|
||||
info = 0
|
||||
c
|
||||
@@ -197,8 +197,8 @@ c
|
||||
mode = 2
|
||||
c
|
||||
iparam(1) = ishfts
|
||||
iparam(3) = maxitr
|
||||
iparam(7) = mode
|
||||
iparam(3) = maxitr
|
||||
iparam(7) = mode
|
||||
c
|
||||
c %-------------------------------------------%
|
||||
c | M A I N L O O P (Reverse communication) |
|
||||
@@ -207,14 +207,14 @@ c
|
||||
10 continue
|
||||
c
|
||||
c %---------------------------------------------%
|
||||
c | Repeatedly call the routine ZNAUPD and take |
|
||||
c | Repeatedly call the routine ZNAUPD and take |
|
||||
c | actions indicated by parameter IDO until |
|
||||
c | either convergence is indicated or maxitr |
|
||||
c | has been exceeded. |
|
||||
c %---------------------------------------------%
|
||||
c
|
||||
call znaupd ( ido, bmat, n, which, nev, tol, resid, ncv,
|
||||
& v, ldv, iparam, ipntr, workd, workl, lworkl,
|
||||
call znaupd ( ido, bmat, n, which, nev, tol, resid, ncv,
|
||||
& v, ldv, iparam, ipntr, workd, workl, lworkl,
|
||||
& rwork, info )
|
||||
c
|
||||
if (ido .eq. -1 .or. ido .eq. 1) then
|
||||
@@ -233,8 +233,8 @@ c
|
||||
call zgttrs ('N', n, 1, dl, dd, du, du2, ipiv,
|
||||
& workd(ipntr(2)), n, ierr)
|
||||
if ( ierr .ne. 0 ) then
|
||||
print*, ' '
|
||||
print*, ' ERROR with _gttrs. '
|
||||
print*, ' '
|
||||
print*, ' ERROR with _gttrs. '
|
||||
print*, ' '
|
||||
go to 9000
|
||||
end if
|
||||
@@ -268,7 +268,7 @@ c
|
||||
c %-----------------------------------------%
|
||||
c | Either we have convergence, or there is |
|
||||
c | an error. |
|
||||
c %-----------------------------------------%
|
||||
c %-----------------------------------------%
|
||||
c
|
||||
if ( info .lt. 0 ) then
|
||||
c
|
||||
@@ -280,24 +280,24 @@ c
|
||||
print *, ' '
|
||||
print *, ' Error with _naupd, info = ',info
|
||||
print *, ' Check the documentation of _naupd.'
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
c
|
||||
else
|
||||
else
|
||||
c
|
||||
c %-------------------------------------------%
|
||||
c | No fatal errors occurred. |
|
||||
c | Post-Process using ZNEUPD . |
|
||||
c | |
|
||||
c | Computed eigenvalues may be extracted. |
|
||||
c | Computed eigenvalues may be extracted. |
|
||||
c | |
|
||||
c | Eigenvectors may also be computed now if |
|
||||
c | desired. (indicated by rvec = .true.) |
|
||||
c | desired. (indicated by rvec = .true.) |
|
||||
c %-------------------------------------------%
|
||||
c
|
||||
rvec = .true.
|
||||
c
|
||||
call zneupd ( rvec, 'A', select, d, v, ldv, sigma,
|
||||
& workev, bmat, n, which, nev, tol, resid, ncv, v,
|
||||
call zneupd ( rvec, 'A', select, d, v, ldv, sigma,
|
||||
& workev, bmat, n, which, nev, tol, resid, ncv, v,
|
||||
& ldv, iparam, ipntr, workd, workl, lworkl, rwork,
|
||||
& ierr )
|
||||
c
|
||||
@@ -318,8 +318,8 @@ c %------------------------------------%
|
||||
c | Error condition: |
|
||||
c | Check the documentation of ZNEUPD . |
|
||||
c %------------------------------------%
|
||||
c
|
||||
print *, ' '
|
||||
c
|
||||
print *, ' '
|
||||
print *, ' Error with _neupd, info = ', ierr
|
||||
print *, ' Check the documentation of _neupd'
|
||||
print *, ' '
|
||||
@@ -327,7 +327,7 @@ c
|
||||
else
|
||||
c
|
||||
nconv = iparam(5)
|
||||
do 80 j=1, nconv
|
||||
do 80 j=1, nconv
|
||||
c
|
||||
c %---------------------------%
|
||||
c | Compute the residual norm |
|
||||
@@ -369,11 +369,11 @@ c
|
||||
print *, ' Maximum number of iterations reached.'
|
||||
print *, ' '
|
||||
else if ( info .eq. 3) then
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
print *, ' No shifts could be applied during implicit',
|
||||
& ' Arnoldi update, try increasing NCV.'
|
||||
print *, ' '
|
||||
end if
|
||||
end if
|
||||
c
|
||||
print *, ' '
|
||||
print *, '_NDRV3 '
|
||||
@@ -384,8 +384,8 @@ c
|
||||
print *, ' The number of Arnoldi vectors generated ',
|
||||
& ' (NCV) is ', ncv
|
||||
print *, ' What portion of the spectrum: ', which
|
||||
print *, ' The number of converged Ritz values is ',
|
||||
& nconv
|
||||
print *, ' The number of converged Ritz values is ',
|
||||
& nconv
|
||||
print *, ' The number of Implicit Arnoldi update',
|
||||
& ' iterations taken is ', iparam(3)
|
||||
print *, ' The number of OP*x is ', iparam(9)
|
||||
@@ -397,21 +397,21 @@ c
|
||||
9000 continue
|
||||
c
|
||||
end
|
||||
c
|
||||
c
|
||||
c==========================================================================
|
||||
c
|
||||
c matrix vector multiplication subroutine
|
||||
c
|
||||
subroutine av (n, v, w)
|
||||
integer n, j
|
||||
Complex*16
|
||||
& v(n), w(n), one, two, dd, dl, du, s, h, rho
|
||||
Complex*16
|
||||
& v(n), w(n), one, two, dd, dl, du, s, h, rho
|
||||
parameter (one = (1.0D+0, 0.0D+0) ,
|
||||
& two = (2.0D+0, 0.0D+0) ,
|
||||
& rho = (1.0D+1, 0.0D+0) )
|
||||
c
|
||||
c Compute the matrix vector multiplication y<---A*x
|
||||
c where A is the stiffness matrix formed by using piecewise linear
|
||||
c where A is the stiffness matrix formed by using piecewise linear
|
||||
c elements on [0,1].
|
||||
c
|
||||
h = one / dcmplx (n+1)
|
||||
@@ -422,28 +422,28 @@ c
|
||||
c
|
||||
w(1) = dd*v(1) + du*v(2)
|
||||
do 10 j = 2,n-1
|
||||
w(j) = dl*v(j-1) + dd*v(j) + du*v(j+1)
|
||||
10 continue
|
||||
w(n) = dl*v(n-1) + dd*v(n)
|
||||
w(j) = dl*v(j-1) + dd*v(j) + du*v(j+1)
|
||||
10 continue
|
||||
w(n) = dl*v(n-1) + dd*v(n)
|
||||
return
|
||||
end
|
||||
c------------------------------------------------------------------------
|
||||
subroutine mv (n, v, w)
|
||||
integer n, j
|
||||
Complex*16
|
||||
Complex*16
|
||||
& v(n), w(n), one, four, h
|
||||
parameter (one = (1.0D+0, 0.0D+0) ,
|
||||
parameter (one = (1.0D+0, 0.0D+0) ,
|
||||
& four = (4.0D+0, 0.0D+0) )
|
||||
c
|
||||
c Compute the matrix vector multiplication y<---M*x
|
||||
c where M is the mass matrix formed by using piecewise linear elements
|
||||
c where M is the mass matrix formed by using piecewise linear elements
|
||||
c on [0,1].
|
||||
c
|
||||
c
|
||||
w(1) = four*v(1) + one*v(2)
|
||||
do 10 j = 2,n-1
|
||||
w(j) = one*v(j-1) + four*v(j) + one*v(j+1)
|
||||
10 continue
|
||||
w(n) = one*v(n-1) + four*v(n)
|
||||
w(j) = one*v(j-1) + four*v(j) + one*v(j+1)
|
||||
10 continue
|
||||
w(n) = one*v(n-1) + four*v(n)
|
||||
c
|
||||
h = one / dcmplx (n+1)
|
||||
call zscal (n, h, w, 1)
|
||||
|
||||
+56
-56
@@ -1,7 +1,7 @@
|
||||
program zndrv4
|
||||
program zndrv4
|
||||
c
|
||||
c Simple program to illustrate the idea of reverse communication
|
||||
c in shift and invert mode for a generalized complex nonsymmetric
|
||||
c in shift and invert mode for a generalized complex nonsymmetric
|
||||
c eigenvalue problem.
|
||||
c
|
||||
c We implement example four of ex-complex.doc in DOCUMENTS directory
|
||||
@@ -11,7 +11,7 @@ c ... Suppose we want to solve A*x = lambda*B*x in shift-invert mode,
|
||||
c where A and B are derived from a finite element discretization
|
||||
c of a 1-dimensional convection-diffusion operator
|
||||
c (d^2u/dx^2) + rho*(du/dx)
|
||||
c on the interval [0,1] with zero boundary condition using
|
||||
c on the interval [0,1] with zero boundary condition using
|
||||
c piecewise linear elements.
|
||||
c
|
||||
c ... where the shift sigma is a complex number.
|
||||
@@ -36,15 +36,15 @@ c av Matrix vector multiplication routine that computes A*x.
|
||||
c mv Matrix vector multiplication routine that computes M*x.
|
||||
c
|
||||
c\Author
|
||||
c Danny Sorensen
|
||||
c Richard Lehoucq
|
||||
c Chao Yang
|
||||
c Dept. of Computational &
|
||||
c Applied Mathematics
|
||||
c Rice University
|
||||
c Houston, Texas
|
||||
c Danny Sorensen
|
||||
c Richard Lehoucq
|
||||
c Chao Yang
|
||||
c Dept. of Computational &
|
||||
c Applied Mathematics
|
||||
c Rice University
|
||||
c Houston, Texas
|
||||
c
|
||||
c\SCCS Information: @(#)
|
||||
c\SCCS Information: @(#)
|
||||
c FILE: ndrv4.F SID: 2.4 DATE OF SID: 10/18/00 RELEASE: 2
|
||||
c
|
||||
c\Remarks
|
||||
@@ -63,7 +63,7 @@ c | MAXNCV: Maximum NCV allowed |
|
||||
c %-----------------------------%
|
||||
c
|
||||
integer maxn, maxnev, maxncv, ldv
|
||||
parameter (maxn=256, maxnev=10, maxncv=25,
|
||||
parameter (maxn=256, maxnev=10, maxncv=25,
|
||||
& ldv=maxn )
|
||||
c
|
||||
c %--------------%
|
||||
@@ -72,14 +72,14 @@ c %--------------%
|
||||
c
|
||||
integer iparam(11), ipntr(14), ipiv(maxn)
|
||||
logical select(maxncv)
|
||||
Complex*16
|
||||
& ax(maxn), mx(maxn), d(maxncv),
|
||||
Complex*16
|
||||
& ax(maxn), mx(maxn), d(maxncv),
|
||||
& v(ldv,maxncv), workd(3*maxn), resid(maxn),
|
||||
& workev(2*maxncv),
|
||||
& workl(3*maxncv*maxncv+5*maxncv),
|
||||
& dd(maxn), dl(maxn), du(maxn),
|
||||
& du2(maxn)
|
||||
Double precision
|
||||
Double precision
|
||||
& rwork(maxn), rd(maxncv,3)
|
||||
c
|
||||
c %---------------%
|
||||
@@ -89,32 +89,32 @@ c
|
||||
character bmat*1, which*2
|
||||
integer ido, n, nev, ncv, lworkl, info, j, ierr,
|
||||
& nconv, maxitr, ishfts, mode
|
||||
Complex*16
|
||||
Complex*16
|
||||
& rho, h, s,
|
||||
& sigma, s1, s2, s3
|
||||
common /convct/ rho
|
||||
c
|
||||
Double precision
|
||||
Double precision
|
||||
& tol
|
||||
logical rvec
|
||||
c
|
||||
logical rvec
|
||||
c
|
||||
c %-----------------------------%
|
||||
c | BLAS & LAPACK routines used |
|
||||
c %-----------------------------%
|
||||
c
|
||||
Double precision
|
||||
& dznrm2 , dlapy2
|
||||
Double precision
|
||||
& dznrm2 , dlapy2
|
||||
external dznrm2 , zaxpy , zcopy , zgttrf , zgttrs ,
|
||||
& dlapy2
|
||||
& dlapy2
|
||||
c
|
||||
c %------------%
|
||||
c | Parameters |
|
||||
c %------------%
|
||||
c
|
||||
Complex*16
|
||||
Complex*16
|
||||
& one, zero, two, four, six
|
||||
parameter (one = (1.0D+0, 0.0D+0) ,
|
||||
& zero = (0.0D+0, 0.0D+0) ,
|
||||
& zero = (0.0D+0, 0.0D+0) ,
|
||||
& two = (2.0D+0, 0.0D+0) ,
|
||||
& four = (4.0D+0, 0.0D+0) ,
|
||||
& six = (6.0D+0, 0.0D+0) )
|
||||
@@ -138,7 +138,7 @@ c | NEV <= MAXNEV, |
|
||||
c | NEV + 2 <= NCV <= MAXNCV |
|
||||
c %----------------------------------------------------%
|
||||
c
|
||||
n = 100
|
||||
n = 100
|
||||
nev = 4
|
||||
ncv = 20
|
||||
if ( n .gt. maxn ) then
|
||||
@@ -153,7 +153,7 @@ c
|
||||
end if
|
||||
bmat = 'G'
|
||||
which = 'LM'
|
||||
sigma = one
|
||||
sigma = one
|
||||
c
|
||||
c %--------------------------------------------------%
|
||||
c | Construct C = A - SIGMA*M in COMPLEX arithmetic. |
|
||||
@@ -164,11 +164,11 @@ c | central difference discretization of the 1-d |
|
||||
c | convection-diffusion operator u``+ rho*u` on the |
|
||||
c | interval [0, 1] with zero Dirichlet boundary |
|
||||
c | condition. The matrix M is chosen to be the |
|
||||
c | symmetric tridiagonal matrix with 4.0 on the |
|
||||
c | diagonal and 1.0 on the off-diagonals. |
|
||||
c | symmetric tridiagonal matrix with 4.0 on the |
|
||||
c | diagonal and 1.0 on the off-diagonals. |
|
||||
c %--------------------------------------------------%
|
||||
c
|
||||
rho = (1.0D+1, 0.0D+0)
|
||||
rho = (1.0D+1, 0.0D+0)
|
||||
h = one / dcmplx (n+1)
|
||||
s = rho / two
|
||||
c
|
||||
@@ -177,12 +177,12 @@ c
|
||||
s3 = -one/h + s - sigma*h/six
|
||||
c
|
||||
do 10 j = 1, n-1
|
||||
dl(j) = s1
|
||||
dl(j) = s1
|
||||
dd(j) = s2
|
||||
du(j) = s3
|
||||
10 continue
|
||||
dd(n) = s2
|
||||
c
|
||||
10 continue
|
||||
dd(n) = s2
|
||||
c
|
||||
call zgttrf (n, dl, dd, du, du2, ipiv, ierr)
|
||||
if ( ierr .ne. 0 ) then
|
||||
print*, ' '
|
||||
@@ -202,7 +202,7 @@ c | Setting INFO=0 indicates that a random vector is |
|
||||
c | generated in ZNAUPD to start the Arnoldi iteration. |
|
||||
c %-----------------------------------------------------%
|
||||
c
|
||||
lworkl = 3*ncv**2+5*ncv
|
||||
lworkl = 3*ncv**2+5*ncv
|
||||
tol = 0.0
|
||||
ido = 0
|
||||
info = 0
|
||||
@@ -222,11 +222,11 @@ c
|
||||
mode = 3
|
||||
c
|
||||
iparam(1) = ishfts
|
||||
iparam(3) = maxitr
|
||||
iparam(7) = mode
|
||||
iparam(3) = maxitr
|
||||
iparam(7) = mode
|
||||
c
|
||||
c %------------------------------------------%
|
||||
c | M A I N L O O P(Reverse communication) |
|
||||
c | M A I N L O O P(Reverse communication) |
|
||||
c %------------------------------------------%
|
||||
c
|
||||
20 continue
|
||||
@@ -258,14 +258,14 @@ c | workd(ipntr(2)). |
|
||||
c %-------------------------------------------%
|
||||
c
|
||||
call mv (n, workd(ipntr(1)), workd(ipntr(2)))
|
||||
call zgttrs ('N', n, 1, dl, dd, du, du2, ipiv,
|
||||
call zgttrs ('N', n, 1, dl, dd, du, du2, ipiv,
|
||||
& workd(ipntr(2)), n, ierr)
|
||||
if ( ierr .ne. 0 ) then
|
||||
print*, ' '
|
||||
print*, ' ERROR with _gttrs in _NDRV4.'
|
||||
print*, ' '
|
||||
go to 9000
|
||||
end if
|
||||
end if
|
||||
c
|
||||
c %-----------------------------------------%
|
||||
c | L O O P B A C K to call ZNAUPD again. |
|
||||
@@ -285,7 +285,7 @@ c | workd(ipntr(2)). |
|
||||
c %-----------------------------------------%
|
||||
c
|
||||
call zcopy ( n, workd(ipntr(3)), 1, workd(ipntr(2)), 1)
|
||||
call zgttrs ('N', n, 1, dl, dd, du, du2, ipiv,
|
||||
call zgttrs ('N', n, 1, dl, dd, du, du2, ipiv,
|
||||
& workd(ipntr(2)), n, ierr)
|
||||
if ( ierr .ne. 0 ) then
|
||||
print*, ' '
|
||||
@@ -317,8 +317,8 @@ c %-----------------------------------------%
|
||||
c
|
||||
go to 20
|
||||
c
|
||||
end if
|
||||
c
|
||||
end if
|
||||
c
|
||||
c %-----------------------------------------%
|
||||
c | Either we have convergence, or there is |
|
||||
c | an error. |
|
||||
@@ -334,9 +334,9 @@ c
|
||||
print *, ' '
|
||||
print *, ' Error with _naupd, info = ', info
|
||||
print *, ' Check the documentation of _naupd.'
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
c
|
||||
else
|
||||
else
|
||||
c
|
||||
c %-------------------------------------------%
|
||||
c | No fatal errors occurred. |
|
||||
@@ -350,9 +350,9 @@ c %-------------------------------------------%
|
||||
c
|
||||
rvec = .true.
|
||||
c
|
||||
call zneupd (rvec, 'A', select, d, v, ldv, sigma,
|
||||
& workev, bmat, n, which, nev, tol, resid, ncv, v,
|
||||
& ldv, iparam, ipntr, workd, workl, lworkl, rwork,
|
||||
call zneupd (rvec, 'A', select, d, v, ldv, sigma,
|
||||
& workev, bmat, n, which, nev, tol, resid, ncv, v,
|
||||
& ldv, iparam, ipntr, workd, workl, lworkl, rwork,
|
||||
& ierr)
|
||||
c
|
||||
c %----------------------------------------------%
|
||||
@@ -367,7 +367,7 @@ c | returned in V. |
|
||||
c %----------------------------------------------%
|
||||
c
|
||||
if ( ierr .ne. 0) then
|
||||
c
|
||||
c
|
||||
c %------------------------------------%
|
||||
c | Error condition: |
|
||||
c | Check the documentation of ZNEUPD . |
|
||||
@@ -438,27 +438,27 @@ c
|
||||
9000 continue
|
||||
c
|
||||
end
|
||||
c
|
||||
c
|
||||
c==========================================================================
|
||||
c
|
||||
c matrix vector multiplication subroutine
|
||||
c
|
||||
subroutine mv (n, v, w)
|
||||
integer n, j
|
||||
Complex*16
|
||||
Complex*16
|
||||
& v(n), w(n), one, four, six, h
|
||||
parameter (one = (1.0D+0, 0.0D+0) ,
|
||||
& four = (4.0D+0, 0.0D+0) ,
|
||||
& six = (6.0D+0, 0.0D+0) )
|
||||
c
|
||||
c Compute the matrix vector multiplication y<---M*x
|
||||
c where M is a n by n symmetric tridiagonal matrix with 4 on the
|
||||
c where M is a n by n symmetric tridiagonal matrix with 4 on the
|
||||
c diagonal, 1 on the subdiagonal and superdiagonal.
|
||||
c
|
||||
c
|
||||
w(1) = ( four*v(1) + one*v(2) ) / six
|
||||
do 40 j = 2,n-1
|
||||
w(j) = ( one*v(j-1) + four*v(j) + one*v(j+1) ) / six
|
||||
40 continue
|
||||
40 continue
|
||||
w(n) = ( one*v(n-1) + four*v(n) ) / six
|
||||
c
|
||||
h = one / dcmplx (n+1)
|
||||
@@ -468,9 +468,9 @@ c
|
||||
c------------------------------------------------------------------
|
||||
subroutine av (n, v, w)
|
||||
integer n, j
|
||||
Complex*16
|
||||
& v(n), w(n), one, two, dd, dl, du, s, h, rho
|
||||
parameter (one = (1.0D+0, 0.0D+0) ,
|
||||
Complex*16
|
||||
& v(n), w(n), one, two, dd, dl, du, s, h, rho
|
||||
parameter (one = (1.0D+0, 0.0D+0) ,
|
||||
& two = (2.0D+0, 0.0D+0) )
|
||||
common /convct/ rho
|
||||
c
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
%% MatrixMarket matrix coordinate double symmetric
|
||||
% This example is 0-based without (optional) nnz
|
||||
%
|
||||
% This is a 1D diffusive laplacian matrix (fixed at first end <=> invertible)
|
||||
%
|
||||
% 1 1
|
||||
% . .--.
|
||||
% / \ | |
|
||||
% / \ 0 0 | |
|
||||
% phi_i --o o o--o-- => grad(phi_i) --o o o--o--
|
||||
% i j i| |j
|
||||
% | |
|
||||
% .--.
|
||||
% -1.
|
||||
%
|
||||
% 1 1
|
||||
% . .--.
|
||||
% / \ | |
|
||||
% / \ 0 i| |j
|
||||
% phi_j --o--o o o-- => grad(phi_j) --o--o o o--
|
||||
% i j | | 0
|
||||
% | |
|
||||
% .--.
|
||||
% -1.
|
||||
%
|
||||
% i j
|
||||
% | l_ii l_ij | i
|
||||
% laplacian = | |
|
||||
% | l_ji l_jj | j
|
||||
%
|
||||
% distance(i, j) = d = 1.
|
||||
%
|
||||
% l_ii = int_[i,j](grad(phi_i).grad(phi_i)) = d*(-1.)*(-1.) = 1.
|
||||
% l_ij = int_[i,j](grad(phi_i).grad(phi_j)) = d*(-1.)*( 1.) = -1.
|
||||
% l_ji = int_[i,j](grad(phi_j).grad(phi_i)) = d*( 1.)*(-1.) = -1.
|
||||
% l_jj = int_[i,j](grad(phi_j).grad(phi_j)) = d*( 1.)*( 1.) = 1.
|
||||
%
|
||||
% i j
|
||||
% | d_ii d_ij | i
|
||||
% diffusion = | |
|
||||
% | d_ji d_jj | j
|
||||
%
|
||||
% d_ii = int_[i,j](phi_i.grad(phi_i)) = int_[i,j]((1-x)*(-1.)) = -d*0.5 = -0.5
|
||||
% d_ij = int_[i,j](phi_i.grad(phi_j)) = int_[i,j]((1-x)*( 1.)) = d*0.5 = 0.5
|
||||
% d_ji = int_[i,j](phi_j.grad(phi_i)) = int_[i,j]( x *(-1.)) = -d*0.5 = -0.5
|
||||
% d_jj = int_[i,j](phi_j.grad(phi_j)) = int_[i,j]( x *( 1.)) = d*0.5 = 0.5
|
||||
%
|
||||
% A <=> assembly of {kappa*laplacian + rho*diffusion}
|
||||
% where kappa = 100 and rho = 2
|
||||
%
|
||||
% n m [nnz]
|
||||
% i j Aij
|
||||
|
||||
8 8
|
||||
|
||||
0 0 1.
|
||||
1 1 200.
|
||||
2 2 200.
|
||||
3 3 200.
|
||||
4 4 200.
|
||||
5 5 200.
|
||||
6 6 200.
|
||||
7 7 101.
|
||||
|
||||
1 0 0.
|
||||
2 1 -101.
|
||||
3 2 -101.
|
||||
4 3 -101.
|
||||
5 4 -101.
|
||||
6 5 -101.
|
||||
7 6 -101.
|
||||
|
||||
0 1 0.
|
||||
1 2 -99.
|
||||
2 3 -99.
|
||||
3 4 -99.
|
||||
4 5 -99.
|
||||
5 6 -99.
|
||||
6 7 -99.
|
||||
@@ -0,0 +1,69 @@
|
||||
%% MatrixMarket matrix coordinate double symmetric
|
||||
% This example is 0-based without (optional) nnz
|
||||
%
|
||||
% This is a 1D laplacian matrix (fixed at first end <=> invertible)
|
||||
%
|
||||
% 1 1
|
||||
% . .--.
|
||||
% / \ | |
|
||||
% / \ 0 0 | |
|
||||
% phi_i --o o o--o-- => grad(phi_i) --o o o--o--
|
||||
% i j i| |j
|
||||
% | |
|
||||
% .--.
|
||||
% -1.
|
||||
%
|
||||
% 1 1
|
||||
% . .--.
|
||||
% / \ | |
|
||||
% / \ 0 i| |j
|
||||
% phi_j --o--o o o-- => grad(phi_j) --o--o o o--
|
||||
% i j | | 0
|
||||
% | |
|
||||
% .--.
|
||||
% -1.
|
||||
%
|
||||
% i j
|
||||
% | l_ii l_ij | i
|
||||
% laplacian = | |
|
||||
% | l_ji l_jj | j
|
||||
%
|
||||
% distance(i, j) = d = 1.
|
||||
%
|
||||
% l_ii = int_[i,j](grad(phi_i).grad(phi_i)) = d*(-1.)*(-1.) = 1.
|
||||
% l_ij = int_[i,j](grad(phi_i).grad(phi_j)) = d*(-1.)*( 1.) = -1.
|
||||
% l_ji = int_[i,j](grad(phi_j).grad(phi_i)) = d*( 1.)*(-1.) = -1.
|
||||
% l_jj = int_[i,j](grad(phi_j).grad(phi_j)) = d*( 1.)*( 1.) = 1.
|
||||
%
|
||||
% A <=> assembly of {kappa*laplacian}
|
||||
% where kappa = 100
|
||||
%
|
||||
% n m [nnz]
|
||||
% i j Aij
|
||||
|
||||
8 8
|
||||
|
||||
0 0 1.
|
||||
1 1 200.
|
||||
2 2 200.
|
||||
3 3 200.
|
||||
4 4 200.
|
||||
5 5 200.
|
||||
6 6 200.
|
||||
7 7 100.
|
||||
|
||||
1 0 0.00
|
||||
2 1 -100.00
|
||||
3 2 -100.00
|
||||
4 3 -100.00
|
||||
5 4 -100.00
|
||||
6 5 -100.00
|
||||
7 6 -100.00
|
||||
|
||||
0 1 0.00
|
||||
1 2 -100.00
|
||||
2 3 -100.00
|
||||
3 4 -100.00
|
||||
4 5 -100.00
|
||||
5 6 -100.00
|
||||
6 7 -100.00
|
||||
@@ -0,0 +1,79 @@
|
||||
%% MatrixMarket matrix coordinate double symmetric
|
||||
% This example is 0-based without (optional) nnz
|
||||
%
|
||||
% This is a 1D diffusive laplacian matrix (fixed at first end <=> invertible)
|
||||
%
|
||||
% 1 1
|
||||
% . .--.
|
||||
% / \ | |
|
||||
% / \ 0 0 | |
|
||||
% phi_i --o o o--o-- => grad(phi_i) --o o o--o--
|
||||
% i j i| |j
|
||||
% | |
|
||||
% .--.
|
||||
% -1.
|
||||
%
|
||||
% 1 1
|
||||
% . .--.
|
||||
% / \ | |
|
||||
% / \ 0 i| |j
|
||||
% phi_j --o--o o o-- => grad(phi_j) --o--o o o--
|
||||
% i j | | 0
|
||||
% | |
|
||||
% .--.
|
||||
% -1.
|
||||
%
|
||||
% i j
|
||||
% | l_ii l_ij | i
|
||||
% laplacian = | |
|
||||
% | l_ji l_jj | j
|
||||
%
|
||||
% distance(i, j) = d = 1.
|
||||
%
|
||||
% l_ii = int_[i,j](grad(phi_i).grad(phi_i)) = d*(-1.)*(-1.) = 1.
|
||||
% l_ij = int_[i,j](grad(phi_i).grad(phi_j)) = d*(-1.)*( 1.) = -1.
|
||||
% l_ji = int_[i,j](grad(phi_j).grad(phi_i)) = d*( 1.)*(-1.) = -1.
|
||||
% l_jj = int_[i,j](grad(phi_j).grad(phi_j)) = d*( 1.)*( 1.) = 1.
|
||||
%
|
||||
% i j
|
||||
% | d_ii d_ij | i
|
||||
% diffusion = | |
|
||||
% | d_ji d_jj | j
|
||||
%
|
||||
% d_ii = int_[i,j](phi_i.grad(phi_i)) = int_[i,j]((1-x)*(-1.)) = -d*0.5 = -0.5
|
||||
% d_ij = int_[i,j](phi_i.grad(phi_j)) = int_[i,j]((1-x)*( 1.)) = d*0.5 = 0.5
|
||||
% d_ji = int_[i,j](phi_j.grad(phi_i)) = int_[i,j]( x *(-1.)) = -d*0.5 = -0.5
|
||||
% d_jj = int_[i,j](phi_j.grad(phi_j)) = int_[i,j]( x *( 1.)) = d*0.5 = 0.5
|
||||
%
|
||||
% A <=> assembly of {kappa*laplacian + rho*diffusion}
|
||||
% where kappa = 100 and rho = 2
|
||||
%
|
||||
% n m [nnz]
|
||||
% i j Aij
|
||||
|
||||
8 8
|
||||
|
||||
0 0 ( 1., 0.)
|
||||
1 1 (200., 0.)
|
||||
2 2 (200., 0.)
|
||||
3 3 (200., 0.)
|
||||
4 4 (200., 0.)
|
||||
5 5 (200., 0.)
|
||||
6 6 (200., 0.)
|
||||
7 7 (101., 0.)
|
||||
|
||||
1 0 ( 0., 0.)
|
||||
2 1 (-101., 0.)
|
||||
3 2 (-101., 0.)
|
||||
4 3 (-101., 0.)
|
||||
5 4 (-101., 0.)
|
||||
6 5 (-101., 0.)
|
||||
7 6 (-101., 0.)
|
||||
|
||||
0 1 ( 0., 0.)
|
||||
1 2 (-99., 0.)
|
||||
2 3 (-99., 0.)
|
||||
3 4 (-99., 0.)
|
||||
4 5 (-99., 0.)
|
||||
5 6 (-99., 0.)
|
||||
6 7 (-99., 0.)
|
||||
@@ -0,0 +1,62 @@
|
||||
%% MatrixMarket matrix coordinate double general
|
||||
% This example is 1-based with (optional) nnz
|
||||
%
|
||||
% This is a 1D mass matrix
|
||||
%
|
||||
% 1
|
||||
% .
|
||||
% / \
|
||||
% / \ 0
|
||||
% phi_i --o o o--o--
|
||||
% i j
|
||||
%
|
||||
% 1
|
||||
% .
|
||||
% / \
|
||||
% / \ 0
|
||||
% phi_j --o--o o o--
|
||||
% i j
|
||||
%
|
||||
% i j
|
||||
% | i_ii i_ij | i
|
||||
% inertia = | |
|
||||
% | i_ji i_jj | j
|
||||
%
|
||||
% distance(i, j) = d = 1.
|
||||
%
|
||||
% i_ii = int_[i,j](phi_i.phi_i) = int_[i,j]((1-x)(1-x)) = i_jj (area under the curve)
|
||||
% i_ij = int_[i,j](phi_i.phi_j) = int_[i,j]((1-x) x ) = i_ji
|
||||
% i_ji = int_[i,j](phi_j.phi_i) = int_[i,j]( x (1-x)) = d*1./6.
|
||||
% i_jj = int_[i,j](phi_j.phi_j) = int_[i,j]( x x ) = d*1./3.
|
||||
%
|
||||
% B <=> mass assembly
|
||||
%
|
||||
% n m [nnz]
|
||||
% i j Bij
|
||||
|
||||
8 8 22
|
||||
|
||||
1 1 0.333
|
||||
2 2 0.333
|
||||
3 3 0.333
|
||||
4 4 0.333
|
||||
5 5 0.333
|
||||
6 6 0.333
|
||||
7 7 0.333
|
||||
8 8 0.333
|
||||
|
||||
2 1 0.166
|
||||
3 2 0.166
|
||||
4 3 0.166
|
||||
5 4 0.166
|
||||
6 5 0.166
|
||||
7 6 0.166
|
||||
8 7 0.166
|
||||
|
||||
1 2 0.166
|
||||
2 3 0.166
|
||||
3 4 0.166
|
||||
4 5 0.166
|
||||
5 6 0.166
|
||||
6 7 0.166
|
||||
7 8 0.166
|
||||
@@ -0,0 +1,62 @@
|
||||
%% MatrixMarket matrix coordinate double general
|
||||
% This example is 1-based with (optional) nnz
|
||||
%
|
||||
% This is a 1D mass matrix
|
||||
%
|
||||
% 1
|
||||
% .
|
||||
% / \
|
||||
% / \ 0
|
||||
% phi_i --o o o--o--
|
||||
% i j
|
||||
%
|
||||
% 1
|
||||
% .
|
||||
% / \
|
||||
% / \ 0
|
||||
% phi_j --o--o o o--
|
||||
% i j
|
||||
%
|
||||
% i j
|
||||
% | i_ii i_ij | i
|
||||
% inertia = | |
|
||||
% | i_ji i_jj | j
|
||||
%
|
||||
% distance(i, j) = d = 1.
|
||||
%
|
||||
% i_ii = int_[i,j](phi_i.phi_i) = int_[i,j]((1-x)(1-x)) = i_jj (area under the curve)
|
||||
% i_ij = int_[i,j](phi_i.phi_j) = int_[i,j]((1-x) x ) = i_ji
|
||||
% i_ji = int_[i,j](phi_j.phi_i) = int_[i,j]( x (1-x)) = d*1./6.
|
||||
% i_jj = int_[i,j](phi_j.phi_j) = int_[i,j]( x x ) = d*1./3.
|
||||
%
|
||||
% B <=> mass assembly
|
||||
%
|
||||
% n m [nnz]
|
||||
% i j Bij
|
||||
|
||||
8 8 22
|
||||
|
||||
1 1 (0.333, 0.)
|
||||
2 2 (0.333, 0.)
|
||||
3 3 (0.333, 0.)
|
||||
4 4 (0.333, 0.)
|
||||
5 5 (0.333, 0.)
|
||||
6 6 (0.333, 0.)
|
||||
7 7 (0.333, 0.)
|
||||
8 8 (0.333, 0.)
|
||||
|
||||
2 1 (0.166, 0.)
|
||||
3 2 (0.166, 0.)
|
||||
4 3 (0.166, 0.)
|
||||
5 4 (0.166, 0.)
|
||||
6 5 (0.166, 0.)
|
||||
7 6 (0.166, 0.)
|
||||
8 7 (0.166, 0.)
|
||||
|
||||
1 2 (0.166, 0.)
|
||||
2 3 (0.166, 0.)
|
||||
3 4 (0.166, 0.)
|
||||
4 5 (0.166, 0.)
|
||||
5 6 (0.166, 0.)
|
||||
6 7 (0.166, 0.)
|
||||
7 8 (0.166, 0.)
|
||||
@@ -0,0 +1,22 @@
|
||||
LDADD = $(top_builddir)/SRC/libarpack$(LIBSUFFIX)$(ITF64SUFFIX).la
|
||||
AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir)/ICB $(EIGEN3_CFLAGS)
|
||||
|
||||
EXTRA_DIST = README
|
||||
|
||||
check_PROGRAMS = arpackmm
|
||||
dist_check_SCRIPTS = arpackmm.sh
|
||||
dist_check_DATA = An.mtx As.mtx Az.mtx B.mtx Bz.mtx
|
||||
TESTS = arpackmm.sh
|
||||
|
||||
arpackmm_SOURCES = arpackmm.cpp
|
||||
|
||||
if ICBEXMM
|
||||
pkginclude_HEADERS = arpackSolver.hpp
|
||||
endif
|
||||
|
||||
CLEANFILES = \
|
||||
arpackmm.run.log \
|
||||
arpackmm.resid.out \
|
||||
arpackmm.v.out \
|
||||
arpackSolver.resid.out \
|
||||
arpackSolver.v.out
|
||||
@@ -0,0 +1,39 @@
|
||||
arpackmm: utility to test arpack with matrix market files.
|
||||
|
||||
This is meant to run arpack with different options to find
|
||||
what are the ones that are the best for your particular
|
||||
problem.
|
||||
|
||||
Typically: computing small eigen values may breakdown and/or
|
||||
be slow (arpack is good at finding large eigen values only).
|
||||
To compute small eigen values, it may be a better choice
|
||||
to look for large eigen values with invert or shift+invert.
|
||||
|
||||
How to use this utility ?
|
||||
Start simple, then, increase complexity if/when needed:
|
||||
- defaults to: standard real symmetric eigen problem to be
|
||||
solved accurately (double precision).
|
||||
- list all possible options with --help.
|
||||
- add --verbose or --debug to get more informations.
|
||||
- if solve breaks down, you may:
|
||||
- play with --nbCV (increase workspace size).
|
||||
- play with --shiftReal/Imag and/or --invert.
|
||||
- if arpack mode > 1, change solver with --slv.
|
||||
- if arpack mode > 1, change solver parameters with --slv
|
||||
(typically: pivoting threshold, solver tolerance, ...).
|
||||
- try --restart (restart from previous eigen basis
|
||||
approximation computed by previous run).
|
||||
- etc...
|
||||
|
||||
Note: using openblas/mkl/atlas instead of netlib blas/lapack
|
||||
may impact results. In some cases, it may also fail checks.
|
||||
Use --noCheck to skip checks.
|
||||
|
||||
To build this utility, you need:
|
||||
- to use a fortran compiler which supports iso_c_binding.
|
||||
- to have installed eigen3 (to deal with the RCI).
|
||||
- to configure arpack-ng this way:
|
||||
- autotools:
|
||||
~arpack-ng> ./configure --enable-icb-exmm; make all check
|
||||
- cmake:
|
||||
~arpack-ng/build> cmake -D ICBEXMM=ON ..; make all test
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,983 @@
|
||||
#include <chrono>
|
||||
|
||||
#include "arpackSolver.hpp"
|
||||
#include "debug_c.hpp"
|
||||
#include "stat_c.hpp"
|
||||
|
||||
using namespace std;
|
||||
|
||||
class options {
|
||||
public:
|
||||
options() {
|
||||
fileA = "A.mtx";
|
||||
fileB = "N.A."; // Not available.
|
||||
dense = false;
|
||||
denseRR = true;
|
||||
nbEV = 1;
|
||||
nbCV = 2 * nbEV + 1;
|
||||
stdPb = true; // Standard or generalized (= not standard).
|
||||
symPb = true;
|
||||
cpxPb = false;
|
||||
simplePrec = false; // Double precision.
|
||||
mag = string("LM"); // Large magnitude.
|
||||
shiftReal = false;
|
||||
shiftImag = false;
|
||||
sigmaReal = 0.;
|
||||
sigmaImag = 0.; // Eigen value translation: look for lambda+sigma instead
|
||||
// of lambda.
|
||||
invert =
|
||||
false; // Eigen value invertion: look for 1./lambda instead of lambda.
|
||||
tol = 1.e-06;
|
||||
maxIt = 100;
|
||||
schur = false; // Compute Ritz vectors.
|
||||
slv = "BiCG";
|
||||
slvItrTol = 1.e-6;
|
||||
slvItrMaxIt = 100;
|
||||
slvItrPC = "Diag";
|
||||
slvDrtPivot = 1.e-6;
|
||||
slvDrtOffset = 0.;
|
||||
slvDrtScale = 1.;
|
||||
check = true;
|
||||
verbose = 0;
|
||||
debug = 0;
|
||||
restart = false;
|
||||
};
|
||||
|
||||
int readCmdLine(int argc, char** argv) {
|
||||
// Check for command line independent parameters.
|
||||
|
||||
for (int a = 1; argv && a < argc; a++) {
|
||||
string clo = argv[a]; // Command line option.
|
||||
if (clo == "--help") return usage(0);
|
||||
if (clo == "--A") {
|
||||
a++;
|
||||
if (a >= argc) {
|
||||
cerr << "Error: bad " << clo << " - need argument" << endl;
|
||||
return usage();
|
||||
}
|
||||
fileA = argv[a];
|
||||
}
|
||||
if (clo == "--dense") {
|
||||
dense = true;
|
||||
a++;
|
||||
if (a >= argc) {
|
||||
cerr << "Error: bad " << clo << " - need argument" << endl;
|
||||
return usage();
|
||||
}
|
||||
string rr(argv[a]);
|
||||
if (rr != "true" && rr != "false") {
|
||||
cerr << "Error: bad " << clo << " - bad argument" << endl;
|
||||
return usage();
|
||||
}
|
||||
denseRR = (rr == "true") ? true : false;
|
||||
}
|
||||
if (clo == "--nbEV") {
|
||||
a++;
|
||||
if (a >= argc) {
|
||||
cerr << "Error: bad " << clo << " - need argument" << endl;
|
||||
return usage();
|
||||
}
|
||||
stringstream nEV(argv[a]);
|
||||
nEV >> nbEV;
|
||||
if (!nEV) {
|
||||
cerr << "Error: bad " << clo << " - bad argument" << endl;
|
||||
return usage();
|
||||
}
|
||||
nbCV = 2 * nbEV + 1;
|
||||
}
|
||||
if (clo == "--genPb") {
|
||||
stdPb = false;
|
||||
fileB = "B.mtx";
|
||||
}
|
||||
if (clo == "--nonSymPb") symPb = false;
|
||||
if (clo == "--cpxPb") {
|
||||
symPb = false;
|
||||
cpxPb = true;
|
||||
}
|
||||
if (clo == "--simplePrec") simplePrec = true;
|
||||
if (clo == "--mag") {
|
||||
a++;
|
||||
if (a >= argc) {
|
||||
cerr << "Error: bad " << clo << " - need argument" << endl;
|
||||
return usage();
|
||||
}
|
||||
mag = argv[a]; // small mag (likely poor perf) <=> large mag + invert
|
||||
// (likely good perf).
|
||||
bool ok = (mag == "LM" || mag == "SM" || mag == "LR" || mag == "SR" ||
|
||||
mag == "LI" || mag == "SI")
|
||||
? true
|
||||
: false;
|
||||
if (!ok) {
|
||||
cerr << "Error: bad " << clo << " - bad argument" << endl;
|
||||
return usage();
|
||||
}
|
||||
}
|
||||
if (clo == "--shiftReal") {
|
||||
shiftReal = true;
|
||||
a++;
|
||||
if (a >= argc) {
|
||||
cerr << "Error: bad " << clo << " - need argument" << endl;
|
||||
return usage();
|
||||
}
|
||||
stringstream s(argv[a]);
|
||||
s >> sigmaReal;
|
||||
if (!s) {
|
||||
cerr << "Error: bad " << clo << " - bad argument" << endl;
|
||||
return usage();
|
||||
}
|
||||
}
|
||||
if (clo == "--shiftImag") {
|
||||
shiftImag = true;
|
||||
a++;
|
||||
if (a >= argc) {
|
||||
cerr << "Error: bad " << clo << " - need argument" << endl;
|
||||
return usage();
|
||||
}
|
||||
stringstream s(argv[a]);
|
||||
s >> sigmaImag;
|
||||
if (!s) {
|
||||
cerr << "Error: bad " << clo << " - bad argument" << endl;
|
||||
return usage();
|
||||
}
|
||||
}
|
||||
if (clo == "--invert") invert = true;
|
||||
if (clo == "--tol") {
|
||||
a++;
|
||||
if (a >= argc) {
|
||||
cerr << "Error: bad " << clo << " - need argument" << endl;
|
||||
return usage();
|
||||
}
|
||||
stringstream t(argv[a]);
|
||||
t >> tol;
|
||||
if (!t) {
|
||||
cerr << "Error: bad " << clo << " - bad argument" << endl;
|
||||
return usage();
|
||||
}
|
||||
}
|
||||
if (clo == "--maxIt") {
|
||||
a++;
|
||||
if (a >= argc) {
|
||||
cerr << "Error: bad " << clo << " - need argument" << endl;
|
||||
return usage();
|
||||
}
|
||||
stringstream mi(argv[a]);
|
||||
mi >> maxIt;
|
||||
if (!mi) {
|
||||
cerr << "Error: bad " << clo << " - bad argument" << endl;
|
||||
return usage();
|
||||
}
|
||||
}
|
||||
if (clo == "--slv") {
|
||||
a++;
|
||||
if (a >= argc) {
|
||||
cerr << "Error: bad " << clo << " - need argument" << endl;
|
||||
return usage();
|
||||
}
|
||||
slv = argv[a];
|
||||
}
|
||||
if (clo == "--slvItrTol") {
|
||||
a++;
|
||||
if (a >= argc) {
|
||||
cerr << "Error: bad " << clo << " - need argument" << endl;
|
||||
return usage();
|
||||
}
|
||||
stringstream t(argv[a]);
|
||||
double tol = 0.;
|
||||
t >> slvItrTol;
|
||||
if (!t) {
|
||||
cerr << "Error: bad " << clo << " - bad argument" << endl;
|
||||
return usage();
|
||||
}
|
||||
}
|
||||
if (clo == "--slvItrMaxIt") {
|
||||
a++;
|
||||
if (a >= argc) {
|
||||
cerr << "Error: bad " << clo << " - need argument" << endl;
|
||||
return usage();
|
||||
}
|
||||
stringstream mi(argv[a]);
|
||||
int maxIt = 0;
|
||||
mi >> slvItrMaxIt;
|
||||
if (!mi) {
|
||||
cerr << "Error: bad " << clo << " - bad argument" << endl;
|
||||
return usage();
|
||||
}
|
||||
}
|
||||
if (clo == "--slvItrPC") {
|
||||
a++;
|
||||
if (a >= argc) {
|
||||
cerr << "Error: bad " << clo << " - need argument" << endl;
|
||||
return usage();
|
||||
}
|
||||
stringstream pc(argv[a]);
|
||||
pc >> slvItrPC;
|
||||
if (!pc) {
|
||||
cerr << "Error: bad " << clo << " - bad argument" << endl;
|
||||
return usage();
|
||||
}
|
||||
}
|
||||
if (clo == "--slvDrtPivot") {
|
||||
a++;
|
||||
if (a >= argc) {
|
||||
cerr << "Error: bad " << clo << " - need argument" << endl;
|
||||
return usage();
|
||||
}
|
||||
stringstream pv(argv[a]);
|
||||
pv >> slvDrtPivot;
|
||||
if (!pv) {
|
||||
cerr << "Error: bad " << clo << " - bad argument" << endl;
|
||||
return usage();
|
||||
}
|
||||
}
|
||||
if (clo == "--slvDrtOffset") {
|
||||
a++;
|
||||
if (a >= argc) {
|
||||
cerr << "Error: bad " << clo << " - need argument" << endl;
|
||||
return usage();
|
||||
}
|
||||
stringstream of(argv[a]);
|
||||
of >> slvDrtOffset;
|
||||
if (!of) {
|
||||
cerr << "Error: bad " << clo << " - bad argument" << endl;
|
||||
return usage();
|
||||
}
|
||||
}
|
||||
if (clo == "--slvDrtScale") {
|
||||
a++;
|
||||
if (a >= argc) {
|
||||
cerr << "Error: bad " << clo << " - need argument" << endl;
|
||||
return usage();
|
||||
}
|
||||
stringstream sc(argv[a]);
|
||||
sc >> slvDrtScale;
|
||||
if (!sc) {
|
||||
cerr << "Error: bad " << clo << " - bad argument" << endl;
|
||||
return usage();
|
||||
}
|
||||
}
|
||||
if (clo == "--noCheck") check = false;
|
||||
if (clo == "--verbose") {
|
||||
a++;
|
||||
if (a >= argc) {
|
||||
cerr << "Error: bad " << clo << " - need argument" << endl;
|
||||
return usage();
|
||||
}
|
||||
stringstream vb(argv[a]);
|
||||
vb >> verbose;
|
||||
if (!vb) {
|
||||
cerr << "Error: bad " << clo << " - bad argument" << endl;
|
||||
return usage();
|
||||
}
|
||||
}
|
||||
if (clo == "--debug") {
|
||||
a++;
|
||||
if (a >= argc) {
|
||||
cerr << "Error: bad " << clo << " - need argument" << endl;
|
||||
return usage();
|
||||
}
|
||||
stringstream dbg(argv[a]);
|
||||
dbg >> debug;
|
||||
if (!dbg) {
|
||||
cerr << "Error: bad " << clo << " - bad argument" << endl;
|
||||
return usage();
|
||||
}
|
||||
if (debug > 3) debug = 3;
|
||||
debug_c(6, -6, debug, debug, debug, debug, debug, debug, debug, debug,
|
||||
debug, debug, debug, debug, debug, debug, debug, debug, debug,
|
||||
debug, debug, debug, debug, debug);
|
||||
}
|
||||
if (clo == "--restart") restart = true;
|
||||
}
|
||||
|
||||
// Check for command line dependent parameters.
|
||||
|
||||
for (int a = 1; argv && a < argc; a++) {
|
||||
string clo = argv[a]; // Command line option.
|
||||
if (clo == "--nbCV") {
|
||||
a++;
|
||||
if (a >= argc) {
|
||||
cerr << "Error: bad " << clo << " - need argument" << endl;
|
||||
return usage();
|
||||
}
|
||||
stringstream nCV(argv[a]);
|
||||
nCV >> nbCV;
|
||||
if (!nCV) {
|
||||
cerr << "Error: bad " << clo << " - bad argument" << endl;
|
||||
return usage();
|
||||
}
|
||||
}
|
||||
if (clo == "--B") {
|
||||
a++;
|
||||
if (a >= argc) {
|
||||
cerr << "Error: bad " << clo << " - need argument" << endl;
|
||||
return usage();
|
||||
}
|
||||
fileB = argv[a];
|
||||
}
|
||||
}
|
||||
|
||||
// Sanity checks.
|
||||
|
||||
if (!stdPb && fileB.empty()) {
|
||||
cerr << "Error: generalized problem without B matrix" << endl;
|
||||
return usage();
|
||||
}
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
||||
int usage(int rc = 1) {
|
||||
cout << "Usage: running arpack with matrix market files to check for eigen "
|
||||
"values/vectors."
|
||||
<< endl;
|
||||
cout << endl;
|
||||
cout << " --A F: file name of matrix A such that A X = lambda "
|
||||
"X. (standard)"
|
||||
<< endl;
|
||||
cout << " the file F must be compliant with the matrix "
|
||||
"market format."
|
||||
<< endl;
|
||||
cout << " default: A.mtx" << endl;
|
||||
cout << " --B F: file name of matrix B such that A X = lambda "
|
||||
"B X. (generalized)"
|
||||
<< endl;
|
||||
cout << " the file F must be compliant with the matrix "
|
||||
"market format."
|
||||
<< endl;
|
||||
cout << " default: N.A. for standard problem, or, B.mtx "
|
||||
"for generalized problem"
|
||||
<< endl;
|
||||
cout << " --dense RR: consider A and B as dense matrices." << endl;
|
||||
cout << " if RR = true, use more-stable-but-slow "
|
||||
"versions of LU / QR (rank revealing)."
|
||||
<< endl;
|
||||
cout << " if RR = false, use less-stable-but-fast "
|
||||
"versions of LU / QR (depends on condition number)."
|
||||
<< endl;
|
||||
cout << " Notes:" << endl;
|
||||
cout << " - only direct solvers are available when "
|
||||
"using dense matrices."
|
||||
<< endl;
|
||||
cout
|
||||
<< " - RR does not impact the use of LLT and LDLT."
|
||||
<< endl;
|
||||
cout << " - thresholds only make sense for "
|
||||
"rank-revealing decompositions."
|
||||
<< endl;
|
||||
cout << " default: consider A and B as sparse matrices"
|
||||
<< endl;
|
||||
cout << " --nbEV: number of eigen values/vectors to compute."
|
||||
<< endl;
|
||||
cout << " default: 1" << endl;
|
||||
cout << " --nbCV: number of columns of the matrix V." << endl;
|
||||
cout << " default: 2*nbEV+1" << endl;
|
||||
cout << " --genPb: generalized problem." << endl;
|
||||
cout << " default: standard problem" << endl;
|
||||
cout << " --nonSymPb: non symmetric problem (<=> use dn[ae]upd)."
|
||||
<< endl;
|
||||
cout << " default: symmetric problem (<=> use ds[ae]upd)"
|
||||
<< endl;
|
||||
cout << " --cpxPb: complex (non symmetric) problem (<=> use "
|
||||
"zn[ae]upd)."
|
||||
<< endl;
|
||||
cout << " default: false (<=> use d*[ae]upd)" << endl;
|
||||
cout << " --simplePrec: use simple precision (less accurate, but, "
|
||||
"half memory footprint)."
|
||||
<< endl;
|
||||
cout << " default: false (<=> use double precision: use "
|
||||
"[dz]*upd)"
|
||||
<< endl;
|
||||
cout << " --mag M: set magnitude of eigen values to look for "
|
||||
"(LM, SM, LR, SR, LI, SI)."
|
||||
<< endl;
|
||||
cout << " default: large magnitude (LM)" << endl;
|
||||
cout << " --shiftReal S: real shift where sigma = S (look for lambda+S "
|
||||
"instead of lambda)."
|
||||
<< endl;
|
||||
cout << " default: no shift, S = 0." << endl;
|
||||
cout << " --shiftImag S: imaginary shift where sigma = S (look for "
|
||||
"lambda+S instead of lambda)."
|
||||
<< endl;
|
||||
cout << " default: no shift, S = 0." << endl;
|
||||
cout << " --invert: invert mode (look for 1./lambda instead of "
|
||||
"lambda)."
|
||||
<< endl;
|
||||
cout << " default: no invert" << endl;
|
||||
cout << " --tol T: tolerance T." << endl;
|
||||
cout << " default: 1.e-06" << endl;
|
||||
cout << " --maxIt M: maximum iterations M." << endl;
|
||||
cout << " default: 100" << endl;
|
||||
cout << " --schur: compute Schur vectors." << endl;
|
||||
cout << " the Schur decomposition is such that A = "
|
||||
"Q^H x T x Q where:"
|
||||
<< endl;
|
||||
cout << " - the H superscript refers to the "
|
||||
"Hermitian transpose: Q^H = (Q^t)^*."
|
||||
<< endl;
|
||||
cout
|
||||
<< " - Q is unitary: Q is such that Q^H x Q = I."
|
||||
<< endl;
|
||||
cout << " - T is an upper-triangular matrix whose "
|
||||
"diagonal elements are the eigenvalues of A."
|
||||
<< endl;
|
||||
cout << " every square matrix has a Schur "
|
||||
"decomposition: columns of Q are the Schur vectors."
|
||||
<< endl;
|
||||
cout << " for a general matrix A, there is no "
|
||||
"relation between Schur vectors of A and eigenvectors of A."
|
||||
<< endl;
|
||||
cout << " if q_j is the j-th Schur vector, then A x "
|
||||
"q_j is a linear combination of q_1, ..., q_j."
|
||||
<< endl;
|
||||
cout << " Schur vectors q_1, q_2, ..., q_j span an "
|
||||
"invariant subspace of A."
|
||||
<< endl;
|
||||
cout << " the Schur vectors and eigenvectors of A are "
|
||||
"the same if A is a normal matrix."
|
||||
<< endl;
|
||||
cout << " default: compute Ritz vectors (approximations "
|
||||
"of eigen vectors)"
|
||||
<< endl;
|
||||
cout << " --slv S: solver (needed if arpack mode > 1)." << endl;
|
||||
cout << " BiCG: iterative method, any matrices"
|
||||
<< endl;
|
||||
cout << " CG: iterative method, sym matrices only"
|
||||
<< endl;
|
||||
cout << " LU: direct method, any matrices (pivoting "
|
||||
"needed)"
|
||||
<< endl;
|
||||
cout << " QR: direct method, any matrices (pivoting "
|
||||
"needed)"
|
||||
<< endl;
|
||||
cout << " LLT: direct method, SPD matrices only "
|
||||
"(pivoting not needed)"
|
||||
<< endl;
|
||||
cout << " LDLT: direct method, symmetric positive "
|
||||
"semi-definite matrices only (pivoting not needed)"
|
||||
<< endl;
|
||||
cout << " default: BiCG" << endl;
|
||||
cout << " --slvItrTol T: solver tolerance T (for iterative solvers)."
|
||||
<< endl;
|
||||
cout << " default: 1.e-6" << endl;
|
||||
cout << " --slvItrMaxIt M: solver maximum iterations M (for iterative "
|
||||
"solvers)."
|
||||
<< endl;
|
||||
cout << " default: 100" << endl;
|
||||
cout << " --slvItrPC PC: solver preconditioner (for iterative solvers)."
|
||||
<< endl;
|
||||
cout << " PC preconditioner:" << endl;
|
||||
cout << " Diag: eigen diagonal preconditioner "
|
||||
"(Jacobi)."
|
||||
<< endl;
|
||||
cout << " ILU#D#F: eigen ILU preconditioner."
|
||||
<< endl;
|
||||
cout << " D: drop tolerance." << endl;
|
||||
cout << " F: fill factor." << endl;
|
||||
cout << " default: diagonal preconditioner (Jacobi)"
|
||||
<< endl;
|
||||
cout << " --slvDrtPivot: P solver pivot P (for direct solvers)." << endl;
|
||||
cout << " default: 1.e-06" << endl;
|
||||
cout << " --slvDrtOffset: O solver offset O (for direct solvers)." << endl;
|
||||
cout << " default: 0." << endl;
|
||||
cout << " --slvDrtScale: S solver scale S (for direct solvers)." << endl;
|
||||
cout << " default: 1." << endl;
|
||||
cout << " --noCheck: check arpack eigen values/vectors." << endl;
|
||||
cout << " check will fail if Schur vectors are computed "
|
||||
"and A is NOT a normal matrix."
|
||||
<< endl;
|
||||
cout << " default: check" << endl;
|
||||
cout << " --verbose V: verbosity level (up to 3)." << endl;
|
||||
cout << " default: 0" << endl;
|
||||
cout << " --debug D: debug level (up to 3)." << endl;
|
||||
cout << " default: 0" << endl;
|
||||
cout << " --restart: restart from previous run (which had produced "
|
||||
"arpackSolver.*.out)."
|
||||
<< endl;
|
||||
cout << " restart from eigen basis approximation "
|
||||
"computed during a previous run."
|
||||
<< endl;
|
||||
cout << " default: false" << endl;
|
||||
if (rc == 0) exit(0);
|
||||
return rc;
|
||||
};
|
||||
|
||||
friend ostream& operator<<(ostream& ostr, options const& opt);
|
||||
|
||||
string fileA;
|
||||
string fileB;
|
||||
bool dense;
|
||||
bool denseRR;
|
||||
a_int nbEV;
|
||||
a_int nbCV;
|
||||
bool stdPb; // Standard or generalized (= not standard).
|
||||
bool symPb;
|
||||
bool cpxPb;
|
||||
bool simplePrec;
|
||||
string mag; // Magnitude <=> "which" arpack parameter.
|
||||
bool shiftReal, shiftImag;
|
||||
double sigmaReal, sigmaImag; // Eigen value translation: look for
|
||||
// lambda+sigma instead of lambda.
|
||||
bool invert; // Eigen value invertion: look for 1./lambda instead of lambda.
|
||||
double tol;
|
||||
int maxIt;
|
||||
bool schur;
|
||||
string slv;
|
||||
double slvItrTol;
|
||||
int slvItrMaxIt;
|
||||
string slvItrPC;
|
||||
double slvDrtPivot;
|
||||
double slvDrtOffset;
|
||||
double slvDrtScale;
|
||||
bool check;
|
||||
int verbose;
|
||||
a_int debug;
|
||||
bool restart;
|
||||
};
|
||||
|
||||
ostream& operator<<(ostream& ostr, options const& opt) {
|
||||
ostr << "OPT: A " << opt.fileA << ", B " << opt.fileB;
|
||||
if (opt.dense && opt.denseRR)
|
||||
ostr << ", dense yes (RR true)";
|
||||
else if (opt.dense && !opt.denseRR)
|
||||
ostr << ", dense yes (RR false)";
|
||||
else
|
||||
ostr << ", dense no";
|
||||
ostr << ", nbEV " << opt.nbEV << ", nbCV " << opt.nbCV << ", stdPb "
|
||||
<< (opt.stdPb ? "yes" : "no");
|
||||
ostr << ", symPb " << (opt.symPb ? "yes" : "no") << ", cpxPb "
|
||||
<< (opt.cpxPb ? "yes" : "no");
|
||||
ostr << ", simplePrec " << (opt.simplePrec ? "yes" : "no") << ", mag "
|
||||
<< opt.mag << endl;
|
||||
ostr << "OPT: shiftReal " << (opt.shiftReal ? "yes" : "no") << ", sigmaReal "
|
||||
<< opt.sigmaReal;
|
||||
ostr << ", shiftImag " << (opt.shiftImag ? "yes" : "no") << ", sigmaImag "
|
||||
<< opt.sigmaImag;
|
||||
ostr << ", invert " << (opt.invert ? "yes" : "no") << ", tol " << opt.tol
|
||||
<< ", maxIt " << opt.maxIt;
|
||||
ostr << ", " << (opt.schur ? "Schur" : "Ritz") << " vectors" << endl;
|
||||
ostr << "OPT: slv " << opt.slv << ", slvItrPC " << opt.slvItrPC
|
||||
<< ", slvItrTol " << opt.slvItrTol;
|
||||
ostr << ", slvItrMaxIt " << opt.slvItrMaxIt << ", slvDrtPivot "
|
||||
<< opt.slvDrtPivot;
|
||||
ostr << ", slvDrtOffset " << opt.slvDrtOffset << ", slvDrtScale "
|
||||
<< opt.slvDrtScale << endl;
|
||||
ostr << "OPT: check " << (opt.check ? "yes" : "no") << ", verbose "
|
||||
<< opt.verbose << ", debug " << opt.debug;
|
||||
ostr << ", restart " << (opt.restart ? "yes" : "no") << endl;
|
||||
return ostr;
|
||||
}
|
||||
|
||||
class output {
|
||||
public:
|
||||
output() {
|
||||
nbVal = 0;
|
||||
mode = 0;
|
||||
nbIt = 0;
|
||||
imsTime = 0.;
|
||||
rciTime = 0.;
|
||||
};
|
||||
|
||||
int nbVal; // Eigen values.
|
||||
int mode; // Arpack mode.
|
||||
int nbIt; // Arpack number of iterations.
|
||||
double imsTime; // Init mode solver time.
|
||||
double rciTime; // Reverse communication interface time.
|
||||
};
|
||||
|
||||
template <typename RC, typename FD, typename EM, typename SLV>
|
||||
int itrSolve(options& opt, output& out, double const& slvItrILUDropTol,
|
||||
double const& slvItrILUFillFactor) {
|
||||
// Init solver.
|
||||
|
||||
arpackItrSolver<RC, FD, EM, SLV> as;
|
||||
as.symPb = opt.symPb;
|
||||
as.nbEV = opt.nbEV;
|
||||
as.nbCV = opt.nbCV;
|
||||
as.tol = opt.tol;
|
||||
as.sigmaReal = opt.sigmaReal;
|
||||
as.sigmaImag = opt.sigmaImag;
|
||||
as.dumpToFile = true;
|
||||
as.restartFromFile = opt.restart;
|
||||
as.mag = opt.mag;
|
||||
as.maxIt = opt.maxIt;
|
||||
as.schur = opt.schur;
|
||||
as.verbose = opt.verbose;
|
||||
as.slvTol = opt.slvItrTol;
|
||||
as.slvMaxIt = opt.slvItrMaxIt;
|
||||
as.slvILUDropTol = slvItrILUDropTol;
|
||||
as.slvILUFillFactor = slvItrILUFillFactor;
|
||||
|
||||
// Read A and B matrices.
|
||||
|
||||
EM A;
|
||||
auto start = chrono::high_resolution_clock::now();
|
||||
int rc = as.createMatrix(opt.fileA, A);
|
||||
if (rc != 0) {
|
||||
cerr << "Error: read A KO" << endl;
|
||||
return rc;
|
||||
}
|
||||
auto stop = chrono::high_resolution_clock::now();
|
||||
double readATime =
|
||||
chrono::duration_cast<chrono::milliseconds>(stop - start).count() / 1000.;
|
||||
cout << endl;
|
||||
cout << "INP: create A " << readATime << " s" << endl;
|
||||
|
||||
if (opt.nbCV > A.cols()) opt.nbCV = A.cols(); /* Cut-off */
|
||||
|
||||
EM B;
|
||||
if (!opt.stdPb) {
|
||||
start = chrono::high_resolution_clock::now();
|
||||
rc = as.createMatrix(opt.fileB, B);
|
||||
if (rc != 0) {
|
||||
cerr << "Error: read B KO" << endl;
|
||||
return rc;
|
||||
}
|
||||
stop = chrono::high_resolution_clock::now();
|
||||
double readBTime =
|
||||
chrono::duration_cast<chrono::milliseconds>(stop - start).count() /
|
||||
1000.;
|
||||
cout << endl;
|
||||
cout << "INP: create B " << readBTime << " s" << endl;
|
||||
|
||||
if (A.rows() != B.rows()) {
|
||||
cerr << "Error: A.rows() != B.rows()" << endl;
|
||||
return rc;
|
||||
}
|
||||
if (A.cols() != B.cols()) {
|
||||
cerr << "Error: A.cols() != B.cols()" << endl;
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
|
||||
// Solve.
|
||||
|
||||
rc = as.solve(A, opt.stdPb ? nullptr : &B);
|
||||
if (rc != 0) {
|
||||
cerr << "Error: solve KO" << endl;
|
||||
return rc;
|
||||
}
|
||||
if (opt.check) {
|
||||
rc = as.checkEigVec(A, opt.stdPb ? nullptr : &B);
|
||||
if (rc != 0) {
|
||||
cerr << "Error: check KO" << endl;
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
|
||||
// Retrieve outputs.
|
||||
|
||||
out.nbVal = as.val.size();
|
||||
out.mode = as.mode;
|
||||
out.nbIt = as.nbIt;
|
||||
out.imsTime = as.imsTime;
|
||||
out.rciTime = as.rciTime;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
template <typename RC, typename FD, typename EM, typename SLV>
|
||||
int drtSolve(options& opt, output& out) {
|
||||
// Init solver.
|
||||
|
||||
arpackDrtSolver<RC, FD, EM, SLV> as;
|
||||
as.symPb = opt.symPb;
|
||||
as.nbEV = opt.nbEV;
|
||||
as.nbCV = opt.nbCV;
|
||||
as.tol = opt.tol;
|
||||
as.sigmaReal = opt.sigmaReal;
|
||||
as.sigmaImag = opt.sigmaImag;
|
||||
as.dumpToFile = true;
|
||||
as.restartFromFile = opt.restart;
|
||||
as.mag = opt.mag;
|
||||
as.maxIt = opt.maxIt;
|
||||
as.schur = opt.schur;
|
||||
as.verbose = opt.verbose;
|
||||
as.slvPvtThd = opt.slvDrtPivot;
|
||||
as.slvOffset = opt.slvDrtOffset;
|
||||
as.slvScale = opt.slvDrtScale;
|
||||
|
||||
// Read A and B matrices.
|
||||
|
||||
EM A;
|
||||
auto start = chrono::high_resolution_clock::now();
|
||||
int rc = as.createMatrix(opt.fileA, A);
|
||||
if (rc != 0) {
|
||||
cerr << "Error: read A KO" << endl;
|
||||
return rc;
|
||||
}
|
||||
auto stop = chrono::high_resolution_clock::now();
|
||||
double readATime =
|
||||
chrono::duration_cast<chrono::milliseconds>(stop - start).count() / 1000.;
|
||||
cout << endl;
|
||||
cout << "INP: create A " << readATime << " s" << endl;
|
||||
|
||||
if (opt.nbCV > A.cols()) opt.nbCV = A.cols(); /* Cut-off */
|
||||
|
||||
EM B;
|
||||
if (!opt.stdPb) {
|
||||
start = chrono::high_resolution_clock::now();
|
||||
rc = as.createMatrix(opt.fileB, B);
|
||||
if (rc != 0) {
|
||||
cerr << "Error: read B KO" << endl;
|
||||
return rc;
|
||||
}
|
||||
stop = chrono::high_resolution_clock::now();
|
||||
double readBTime =
|
||||
chrono::duration_cast<chrono::milliseconds>(stop - start).count() /
|
||||
1000.;
|
||||
cout << endl;
|
||||
cout << "INP: create B " << readBTime << " s" << endl;
|
||||
|
||||
if (A.rows() != B.rows()) {
|
||||
cerr << "Error: A.rows() != B.rows()" << endl;
|
||||
return rc;
|
||||
}
|
||||
if (A.cols() != B.cols()) {
|
||||
cerr << "Error: A.cols() != B.cols()" << endl;
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
|
||||
// Solve.
|
||||
|
||||
rc = as.solve(A, opt.stdPb ? nullptr : &B);
|
||||
if (rc != 0) {
|
||||
cerr << "Error: solve KO" << endl;
|
||||
return rc;
|
||||
}
|
||||
if (opt.check) {
|
||||
rc = as.checkEigVec(A, opt.stdPb ? nullptr : &B);
|
||||
if (rc != 0) {
|
||||
cerr << "Error: check KO" << endl;
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
|
||||
// Retrieve outputs.
|
||||
|
||||
out.nbVal = as.val.size();
|
||||
out.mode = as.mode;
|
||||
out.nbIt = as.nbIt;
|
||||
out.imsTime = as.imsTime;
|
||||
out.rciTime = as.rciTime;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
template <typename RC, typename FD, typename EM, typename SLV1, typename SLV2,
|
||||
typename SLV3, typename SLV4>
|
||||
int drtSolve(options& opt, output& out) {
|
||||
int rc = 1;
|
||||
|
||||
if (opt.slv == "LU") rc = drtSolve<RC, FD, EM, SLV1>(opt, out);
|
||||
if (opt.slv == "QR") rc = drtSolve<RC, FD, EM, SLV2>(opt, out);
|
||||
if (opt.slv == "LLT") rc = drtSolve<RC, FD, EM, SLV3>(opt, out);
|
||||
if (opt.slv == "LDLT") rc = drtSolve<RC, FD, EM, SLV4>(opt, out);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
template <typename RC, typename FD, typename EM, typename SLV1, typename SLV2,
|
||||
typename SLV3, typename SLV4>
|
||||
int itrSolve(options& opt, output& out) {
|
||||
int rc = 1;
|
||||
|
||||
stringstream clo(opt.slvItrPC);
|
||||
string slvItrPC;
|
||||
getline(clo, slvItrPC, '#');
|
||||
|
||||
double slvItrILUDropTol = 1.;
|
||||
if (slvItrPC == "ILU") {
|
||||
string dropTol;
|
||||
getline(clo, dropTol, '#');
|
||||
stringstream dt(dropTol);
|
||||
dt >> slvItrILUDropTol;
|
||||
}
|
||||
|
||||
int slvItrILUFillFactor = 2;
|
||||
if (slvItrPC == "ILU") {
|
||||
string fillFactor;
|
||||
getline(clo, fillFactor);
|
||||
stringstream ff(fillFactor);
|
||||
ff >> slvItrILUFillFactor;
|
||||
}
|
||||
|
||||
if (opt.slv == "BiCG") {
|
||||
if (slvItrPC == "Diag")
|
||||
rc = itrSolve<RC, FD, EM, SLV1>(opt, out, slvItrILUDropTol,
|
||||
slvItrILUFillFactor);
|
||||
if (slvItrPC == "ILU")
|
||||
rc = itrSolve<RC, FD, EM, SLV2>(opt, out, slvItrILUDropTol,
|
||||
slvItrILUFillFactor);
|
||||
}
|
||||
if (opt.slv == "CG") {
|
||||
if (slvItrPC == "Diag")
|
||||
rc = itrSolve<RC, FD, EM, SLV3>(opt, out, slvItrILUDropTol,
|
||||
slvItrILUFillFactor);
|
||||
if (slvItrPC == "ILU")
|
||||
rc = itrSolve<RC, FD, EM, SLV4>(opt, out, slvItrILUDropTol,
|
||||
slvItrILUFillFactor);
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
// Check for options.
|
||||
|
||||
options opt;
|
||||
int rc = opt.readCmdLine(argc, argv);
|
||||
if (rc != 0) {
|
||||
cerr << "Error: read cmd line KO" << endl;
|
||||
return rc;
|
||||
}
|
||||
cout << opt; // Print options.
|
||||
|
||||
// Solve with arpack.
|
||||
|
||||
sstats_c(); // Reset timers.
|
||||
sstatn_c(); // Reset timers.
|
||||
cstatn_c(); // Reset timers.
|
||||
|
||||
bool itrSlv = true; // Use iterative solvers.
|
||||
if (opt.slv.find("LU") != string::npos ||
|
||||
opt.slv.find("QR") != string::npos ||
|
||||
opt.slv.find("LLT") != string::npos ||
|
||||
opt.slv.find("LDLT") != string::npos)
|
||||
itrSlv = false;
|
||||
|
||||
output out;
|
||||
auto start = chrono::high_resolution_clock::now();
|
||||
if (opt.dense) {
|
||||
if (itrSlv) {
|
||||
cerr << "Error: dense matrices does not support iterative solvers"
|
||||
<< endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (opt.simplePrec) {
|
||||
if (opt.cpxPb) {
|
||||
if (opt.denseRR) {
|
||||
rc = drtSolve<complex<float>, float, EigDMxC, EigDFLUC, EigDFQRC,
|
||||
EigDLLTC, EigDLDLTC>(opt, out);
|
||||
} else {
|
||||
rc = drtSolve<complex<float>, float, EigDMxC, EigDPLUC, EigDPQRC,
|
||||
EigDLLTC, EigDLDLTC>(opt, out);
|
||||
}
|
||||
} else {
|
||||
if (opt.denseRR) {
|
||||
rc = drtSolve<float, float, EigDMxS, EigDFLUS, EigDFQRS, EigDLLTS,
|
||||
EigDLDLTS>(opt, out);
|
||||
} else {
|
||||
rc = drtSolve<float, float, EigDMxS, EigDPLUS, EigDPQRS, EigDLLTS,
|
||||
EigDLDLTS>(opt, out);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (opt.cpxPb) {
|
||||
if (opt.denseRR) {
|
||||
rc = drtSolve<complex<double>, double, EigDMxZ, EigDFLUZ, EigDFQRZ,
|
||||
EigDLLTZ, EigDLDLTZ>(opt, out);
|
||||
} else {
|
||||
rc = drtSolve<complex<double>, double, EigDMxZ, EigDPLUZ, EigDPQRZ,
|
||||
EigDLLTZ, EigDLDLTZ>(opt, out);
|
||||
}
|
||||
} else {
|
||||
if (opt.denseRR) {
|
||||
rc = drtSolve<double, double, EigDMxD, EigDFLUD, EigDFQRD, EigDLLTD,
|
||||
EigDLDLTD>(opt, out);
|
||||
} else {
|
||||
rc = drtSolve<double, double, EigDMxD, EigDPLUD, EigDPQRD, EigDLLTD,
|
||||
EigDLDLTD>(opt, out);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (opt.simplePrec) {
|
||||
if (opt.cpxPb) {
|
||||
if (itrSlv) {
|
||||
rc = itrSolve<complex<float>, float, EigSMxC, EigSBiCGC, EigSBiCGILUC,
|
||||
EigSCGC, EigSCGILUC>(opt, out);
|
||||
} else {
|
||||
rc = drtSolve<complex<float>, float, EigSMxC, EigSLUC, EigSQRC,
|
||||
EigSLLTC, EigSLDLTC>(opt, out);
|
||||
}
|
||||
} else {
|
||||
if (itrSlv) {
|
||||
rc = itrSolve<float, float, EigSMxS, EigSBiCGS, EigSBiCGILUS, EigSCGS,
|
||||
EigSCGILUS>(opt, out);
|
||||
} else {
|
||||
rc = drtSolve<float, float, EigSMxS, EigSLUS, EigSQRS, EigSLLTS,
|
||||
EigSLDLTS>(opt, out);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (opt.cpxPb) {
|
||||
if (itrSlv) {
|
||||
rc = itrSolve<complex<double>, double, EigSMxZ, EigSBiCGZ,
|
||||
EigSBiCGILUZ, EigSCGZ, EigSCGILUZ>(opt, out);
|
||||
} else {
|
||||
rc = drtSolve<complex<double>, double, EigSMxZ, EigSLUZ, EigSQRZ,
|
||||
EigSLLTZ, EigSLDLTZ>(opt, out);
|
||||
}
|
||||
} else {
|
||||
if (itrSlv) {
|
||||
rc = itrSolve<double, double, EigSMxD, EigSBiCGD, EigSBiCGILUD,
|
||||
EigSCGD, EigSCGILUD>(opt, out);
|
||||
} else {
|
||||
rc = drtSolve<double, double, EigSMxD, EigSLUD, EigSQRD, EigSLLTD,
|
||||
EigSLDLTD>(opt, out);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (rc != 0) {
|
||||
cerr << "Error: arpack solve KO" << endl;
|
||||
return rc;
|
||||
}
|
||||
|
||||
// Output results and stats.
|
||||
|
||||
auto stop = chrono::high_resolution_clock::now();
|
||||
double fullTime =
|
||||
chrono::duration_cast<chrono::milliseconds>(stop - start).count() / 1000.;
|
||||
cout << endl;
|
||||
cout << "OUT: mode " << out.mode << ", nb EV found " << out.nbVal
|
||||
<< ", nb iterations " << out.nbIt << endl;
|
||||
cout << "OUT: init mode solver " << out.imsTime << " s, RCI time "
|
||||
<< out.rciTime << " s" << endl;
|
||||
cout << "OUT: full time " << fullTime << " s" << endl;
|
||||
|
||||
a_int nopx = 0, nbx = 0, nrorth = 0, nitref = 0, nrstrt = 0;
|
||||
float tsaupd = 0., tsaup2 = 0., tsaitr = 0., tseigt = 0., tsgets = 0.,
|
||||
tsapps = 0., tsconv = 0.;
|
||||
float tnaupd = 0., tnaup2 = 0., tnaitr = 0., tneigt = 0., tngets = 0.,
|
||||
tnapps = 0., tnconv = 0.;
|
||||
float tcaupd = 0., tcaup2 = 0., tcaitr = 0., tceigt = 0., tcgets = 0.,
|
||||
tcapps = 0., tcconv = 0.;
|
||||
float tmvopx = 0., tmvbx = 0., tgetv0 = 0., titref = 0., trvec = 0.;
|
||||
stat_c(nopx, nbx, nrorth, nitref, nrstrt, tsaupd, tsaup2, tsaitr, tseigt,
|
||||
tsgets, tsapps, tsconv, tnaupd, tnaup2, tnaitr, tneigt, tngets, tnapps,
|
||||
tnconv, tcaupd, tcaup2, tcaitr, tceigt, tcgets, tcapps, tcconv, tmvopx,
|
||||
tmvbx, tgetv0, titref, trvec);
|
||||
cout << endl;
|
||||
cout << "STAT: total number of user OP*x operation "
|
||||
<< nopx << endl;
|
||||
cout << "STAT: total number of user B*x operation "
|
||||
<< nbx << endl;
|
||||
cout << "STAT: total number of reorthogonalization steps taken "
|
||||
<< nrorth << endl;
|
||||
cout << "STAT: total number of it. refinement steps in reorthogonalization "
|
||||
<< nitref << endl;
|
||||
cout << "STAT: total number of restart steps "
|
||||
<< nrstrt << endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Local Variables:
|
||||
// mode: c++
|
||||
// c-file-style:"stroustrup"
|
||||
// show-trailing-whitespace: t
|
||||
// End:
|
||||
/* vim: set sw=2 ts=2 et smartindent :*/
|
||||
Executable
+98
@@ -0,0 +1,98 @@
|
||||
#!/bin/bash -eu
|
||||
|
||||
export CMD="./arpackmm --help" # For coverage
|
||||
echo "$CMD"
|
||||
eval "$CMD &> arpackmm.run.log"
|
||||
echo ""
|
||||
echo "========================================================================================"
|
||||
echo ""
|
||||
|
||||
for eigPb in "--A As.mtx" "--nonSymPb --A An.mtx" "--nonSymPb --cpxPb --A Az.mtx --B Bz.mtx"
|
||||
do
|
||||
for genPb in "" "--genPb"
|
||||
do
|
||||
for smallMag in "" "--mag SM --noCheck" # SM is known to be difficult to converge.
|
||||
do
|
||||
export shiftOpt=""
|
||||
if [[ "$eigPb" == *nonSymPb* ]]; then
|
||||
if [[ "$genPb" == *genPb* ]]; then
|
||||
continue # Skip to ensure stable test: tricky to convergence.
|
||||
else
|
||||
export shiftOpt="--shiftReal 100.0 --shiftImag 100.0"
|
||||
fi
|
||||
else
|
||||
if [[ "$genPb" == *genPb* ]]; then
|
||||
continue # Skip to ensure stable test: tricky to convergence.
|
||||
else
|
||||
export shiftOpt="--shiftReal 100.0"
|
||||
fi
|
||||
fi
|
||||
|
||||
for shiftRI in "" "$shiftOpt"
|
||||
do
|
||||
for invert in "" "--invert"
|
||||
do
|
||||
for tol in "" "--tol 1.e-5"
|
||||
do
|
||||
for slv in "--slv BiCG --slvItrTol 1.e-06 --slvItrMaxIt 150" "--slv CG --slvItrTol 1.e-06 --slvItrMaxIt 150" \
|
||||
"--slv BiCG --slvItrPC ILU" "--slv CG --slvItrPC ILU#1.e-06#2" \
|
||||
"--slv LU" "--slv QR --slvDrtPivot 1.e-06" \
|
||||
"--slv LLT" "--slv LLT --slvDrtOffset 0." \
|
||||
"--slv LDLT" "--slv LDLT --slvDrtScale 1."
|
||||
do
|
||||
for rs in "" "--schur"
|
||||
do
|
||||
for dsPrec in "" "--simplePrec"
|
||||
do
|
||||
for dsMat in "" "--dense false" "--dense true"
|
||||
do
|
||||
export extraGenPb=""
|
||||
if [[ "$genPb" == *genPb* ]]; then
|
||||
export extraGenPb="$shiftOpt" # Force shift if genPb.
|
||||
fi
|
||||
|
||||
if [[ "$slv" == *CG* ]]; then
|
||||
if [[ "$eigPb" == *nonSymPb* ]]; then
|
||||
continue # Skip CG that could fail (CG is meant to deal with sym matrices).
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ "$slv" == *LLT* ]] || [[ "$slv" == *LDLT* ]]; then
|
||||
if [[ "$eigPb" == *nonSymPb* ]] || [[ "$genPb" == *genPb* ]]; then
|
||||
continue # Skip LLT/LDLT that could fail (LLT/LDLT are meant to deal with SPD matrices).
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ "$dsMat" == *dense* ]]; then
|
||||
if [[ "$slv" == *CG* ]]; then
|
||||
continue # Iterative solvers are not allowed when using dense matrices.
|
||||
fi
|
||||
fi
|
||||
|
||||
# Run arpackmm: use --nbCV 6 and --maxIt 200 to ease convergence, and, --verbose 3 for debug.
|
||||
export CMD="./arpackmm $eigPb $genPb $smallMag $shiftRI $invert $tol $slv $rs $dsPrec $dsMat $extraGenPb --nbCV 6 --maxIt 200 --verbose 3 --debug 3"
|
||||
echo "$CMD"
|
||||
eval "$CMD &> arpackmm.run.log"
|
||||
echo ""
|
||||
echo "========================================================================================"
|
||||
echo ""
|
||||
|
||||
# Run arpackmm: re-run with restart.
|
||||
export CMD="$CMD --restart"
|
||||
echo "$CMD"
|
||||
eval "$CMD &> arpackmm.run.log"
|
||||
echo ""
|
||||
echo "========================================================================================"
|
||||
echo ""
|
||||
done
|
||||
done
|
||||
done
|
||||
done
|
||||
done
|
||||
done
|
||||
done
|
||||
done
|
||||
done
|
||||
done
|
||||
|
||||
echo "OK"
|
||||
@@ -0,0 +1,6 @@
|
||||
SUBDIRS = BAND COMPLEX NONSYM SIMPLE SVD SYM
|
||||
if ICBEXMM
|
||||
SUBDIRS += MATRIX_MARKET
|
||||
endif
|
||||
|
||||
EXTRA_DIST = README README.CALLING-ARPACK-FROM-C-OR-CPP
|
||||
@@ -0,0 +1,26 @@
|
||||
LDADD = $(top_builddir)/SRC/libarpack$(LIBSUFFIX)$(ITF64SUFFIX).la $(LAPACK_LIBS) $(BLAS_LIBS)
|
||||
|
||||
SNDRV = sndrv1 sndrv2 sndrv3 sndrv4 sndrv5 sndrv6
|
||||
DNDRV = dndrv1 dndrv2 dndrv3 dndrv4 dndrv5 dndrv6
|
||||
NONSYM = $(SNDRV) $(DNDRV)
|
||||
|
||||
check_PROGRAMS = $(NONSYM)
|
||||
TESTS = $(check_PROGRAMS)
|
||||
|
||||
EXTRA_DIST = README
|
||||
|
||||
# Simple nonsymmetric problem using single precision
|
||||
sndrv1_SOURCES = sndrv1.f
|
||||
sndrv2_SOURCES = sndrv2.f
|
||||
sndrv3_SOURCES = sndrv3.f
|
||||
sndrv4_SOURCES = sndrv4.f
|
||||
sndrv5_SOURCES = sndrv5.f
|
||||
sndrv6_SOURCES = sndrv6.f
|
||||
|
||||
# Simple nonsymmetric problem using double precision
|
||||
dndrv1_SOURCES = dndrv1.f
|
||||
dndrv2_SOURCES = dndrv2.f
|
||||
dndrv3_SOURCES = dndrv3.f
|
||||
dndrv4_SOURCES = dndrv4.f
|
||||
dndrv5_SOURCES = dndrv5.f
|
||||
dndrv6_SOURCES = dndrv6.f
|
||||
+56
-56
@@ -1,4 +1,4 @@
|
||||
program dndrv1
|
||||
program dndrv1
|
||||
c
|
||||
c
|
||||
c Example program to illustrate the idea of reverse communication
|
||||
@@ -9,9 +9,9 @@ c
|
||||
c\Example-1
|
||||
c ... Suppose we want to solve A*x = lambda*x in regular mode,
|
||||
c where A is obtained from the standard central difference
|
||||
c discretization of the convection-diffusion operator
|
||||
c discretization of the convection-diffusion operator
|
||||
c (Laplacian u) + rho*(du / dx)
|
||||
c on the unit square [0,1]x[0,1] with zero Dirichlet boundary
|
||||
c on the unit square [0,1]x[0,1] with zero Dirichlet boundary
|
||||
c condition.
|
||||
c
|
||||
c ... OP = A and B = I.
|
||||
@@ -30,7 +30,7 @@ c dlapy2 LAPACK routine to compute sqrt(x**2+y**2) carefully.
|
||||
c daxpy Level 1 BLAS that computes y <- alpha*x+y.
|
||||
c dnrm2 Level 1 BLAS that computes the norm of a vector.
|
||||
c av Matrix vector multiplication routine that computes A*x.
|
||||
c tv Matrix vector multiplication routine that computes T*x,
|
||||
c tv Matrix vector multiplication routine that computes T*x,
|
||||
c where T is a tridiagonal matrix. It is used in routine
|
||||
c av.
|
||||
c
|
||||
@@ -71,9 +71,9 @@ c
|
||||
integer iparam(11), ipntr(14)
|
||||
logical select(maxncv)
|
||||
Double precision
|
||||
& ax(maxn), d(maxncv,3), resid(maxn),
|
||||
& v(ldv,maxncv), workd(3*maxn),
|
||||
& workev(3*maxncv),
|
||||
& ax(maxn), d(maxncv,3), resid(maxn),
|
||||
& v(ldv,maxncv), workd(3*maxn),
|
||||
& workev(3*maxncv),
|
||||
& workl(3*maxncv*maxncv+6*maxncv)
|
||||
c
|
||||
c %---------------%
|
||||
@@ -112,12 +112,12 @@ c
|
||||
c %-----------------------%
|
||||
c | Executable Statements |
|
||||
c %-----------------------%
|
||||
c
|
||||
c
|
||||
c %--------------------------------------------------%
|
||||
c | The number NX is the number of interior points |
|
||||
c | in the discretization of the 2-dimensional |
|
||||
c | convection-diffusion operator on the unit |
|
||||
c | square with zero Dirichlet boundary condition. |
|
||||
c | square with zero Dirichlet boundary condition. |
|
||||
c | The number N(=NX*NX) is the dimension of the |
|
||||
c | matrix. A standard eigenvalue problem is |
|
||||
c | solved (BMAT = 'I'). NEV is the number of |
|
||||
@@ -128,13 +128,13 @@ c | the spectrum. However, The following |
|
||||
c | conditions must be satisfied: |
|
||||
c | N <= MAXN |
|
||||
c | NEV <= MAXNEV |
|
||||
c | NEV + 2 <= NCV <= MAXNCV |
|
||||
c %--------------------------------------------------%
|
||||
c | NEV + 2 <= NCV <= MAXNCV |
|
||||
c %--------------------------------------------------%
|
||||
c
|
||||
nx = 10
|
||||
n = nx*nx
|
||||
nx = 10
|
||||
n = nx*nx
|
||||
nev = 4
|
||||
ncv = 20
|
||||
ncv = 20
|
||||
if ( n .gt. maxn ) then
|
||||
print *, ' ERROR with _NDRV1: N is greater than MAXN '
|
||||
go to 9000
|
||||
@@ -149,18 +149,18 @@ c
|
||||
which = 'SM'
|
||||
c
|
||||
c %-----------------------------------------------------%
|
||||
c | The work array WORKL is used in DNAUPD as |
|
||||
c | The work array WORKL is used in DNAUPD as |
|
||||
c | workspace. Its dimension LWORKL is set as |
|
||||
c | illustrated below. The parameter TOL determines |
|
||||
c | the stopping criterion. If TOL<=0, machine |
|
||||
c | precision is used. The variable IDO is used for |
|
||||
c | reverse communication, and is initially set to 0. |
|
||||
c | Setting INFO=0 indicates that a random vector is |
|
||||
c | generated in DNAUPD to start the Arnoldi iteration. |
|
||||
c | generated in DNAUPD to start the Arnoldi iteration. |
|
||||
c %-----------------------------------------------------%
|
||||
c
|
||||
lworkl = 3*ncv**2+6*ncv
|
||||
tol = zero
|
||||
lworkl = 3*ncv**2+6*ncv
|
||||
tol = zero
|
||||
ido = 0
|
||||
info = 0
|
||||
c
|
||||
@@ -179,11 +179,11 @@ c
|
||||
mode = 1
|
||||
c
|
||||
iparam(1) = ishfts
|
||||
iparam(3) = maxitr
|
||||
iparam(3) = maxitr
|
||||
iparam(7) = mode
|
||||
c
|
||||
c %-------------------------------------------%
|
||||
c | M A I N L O O P (Reverse communication) |
|
||||
c | M A I N L O O P (Reverse communication) |
|
||||
c %-------------------------------------------%
|
||||
c
|
||||
10 continue
|
||||
@@ -195,8 +195,8 @@ c | either convergence is indicated or maxitr |
|
||||
c | has been exceeded. |
|
||||
c %---------------------------------------------%
|
||||
c
|
||||
call dnaupd ( ido, bmat, n, which, nev, tol, resid,
|
||||
& ncv, v, ldv, iparam, ipntr, workd, workl, lworkl,
|
||||
call dnaupd ( ido, bmat, n, which, nev, tol, resid,
|
||||
& ncv, v, ldv, iparam, ipntr, workd, workl, lworkl,
|
||||
& info )
|
||||
c
|
||||
if (ido .eq. -1 .or. ido .eq. 1) then
|
||||
@@ -208,7 +208,7 @@ c | The user should supply his/her own |
|
||||
c | matrix vector multiplication routine here |
|
||||
c | that takes workd(ipntr(1)) as the input |
|
||||
c | vector, and return the matrix vector |
|
||||
c | product to workd(ipntr(2)). |
|
||||
c | product to workd(ipntr(2)). |
|
||||
c %-------------------------------------------%
|
||||
c
|
||||
call av (nx, workd(ipntr(1)), workd(ipntr(2)))
|
||||
@@ -219,8 +219,8 @@ c %-----------------------------------------%
|
||||
c
|
||||
go to 10
|
||||
c
|
||||
end if
|
||||
c
|
||||
end if
|
||||
c
|
||||
c %----------------------------------------%
|
||||
c | Either we have convergence or there is |
|
||||
c | an error. |
|
||||
@@ -238,7 +238,7 @@ c
|
||||
print *, ' Check the documentation of _naupd'
|
||||
print *, ' '
|
||||
c
|
||||
else
|
||||
else
|
||||
c
|
||||
c %-------------------------------------------%
|
||||
c | No fatal errors occurred. |
|
||||
@@ -252,8 +252,8 @@ c %-------------------------------------------%
|
||||
c
|
||||
rvec = .true.
|
||||
c
|
||||
call dneupd ( rvec, 'A', select, d, d(1,2), v, ldv,
|
||||
& sigmar, sigmai, workev, bmat, n, which, nev, tol,
|
||||
call dneupd ( rvec, 'A', select, d, d(1,2), v, ldv,
|
||||
& sigmar, sigmai, workev, bmat, n, which, nev, tol,
|
||||
& resid, ncv, v, ldv, iparam, ipntr, workd, workl,
|
||||
& lworkl, ierr )
|
||||
c
|
||||
@@ -281,7 +281,7 @@ c
|
||||
print *, ' Check the documentation of _neupd. '
|
||||
print *, ' '
|
||||
c
|
||||
else
|
||||
else
|
||||
c
|
||||
first = .true.
|
||||
nconv = iparam(5)
|
||||
@@ -317,9 +317,9 @@ c %------------------------%
|
||||
c | Ritz value is complex. |
|
||||
c | Residual of one Ritz |
|
||||
c | value of the conjugate |
|
||||
c | pair is computed. |
|
||||
c | pair is computed. |
|
||||
c %------------------------%
|
||||
c
|
||||
c
|
||||
call av(nx, v(1,j), ax)
|
||||
call daxpy(n, -d(j,1), v(1,j), 1, ax, 1)
|
||||
call daxpy(n, d(j,2), v(1,j+1), 1, ax, 1)
|
||||
@@ -354,23 +354,23 @@ c
|
||||
print *, ' Maximum number of iterations reached.'
|
||||
print *, ' '
|
||||
else if ( info .eq. 3) then
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
print *, ' No shifts could be applied during implicit',
|
||||
& ' Arnoldi update, try increasing NCV.'
|
||||
print *, ' '
|
||||
end if
|
||||
end if
|
||||
c
|
||||
print *, ' '
|
||||
print *, ' _NDRV1 '
|
||||
print *, ' ====== '
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
print *, ' Size of the matrix is ', n
|
||||
print *, ' The number of Ritz values requested is ', nev
|
||||
print *, ' The number of Arnoldi vectors generated',
|
||||
& ' (NCV) is ', ncv
|
||||
print *, ' What portion of the spectrum: ', which
|
||||
print *, ' The number of converged Ritz values is ',
|
||||
& nconv
|
||||
print *, ' The number of converged Ritz values is ',
|
||||
& nconv
|
||||
print *, ' The number of Implicit Arnoldi update',
|
||||
& ' iterations taken is ', iparam(3)
|
||||
print *, ' The number of OP*x is ', iparam(9)
|
||||
@@ -386,37 +386,37 @@ c
|
||||
9000 continue
|
||||
c
|
||||
end
|
||||
c
|
||||
c
|
||||
c==========================================================================
|
||||
c
|
||||
c matrix vector subroutine
|
||||
c
|
||||
c The matrix used is the 2 dimensional convection-diffusion
|
||||
c The matrix used is the 2 dimensional convection-diffusion
|
||||
c operator discretized using central difference.
|
||||
c
|
||||
subroutine av (nx, v, w)
|
||||
integer nx, j, lo
|
||||
Double precision
|
||||
Double precision
|
||||
& v(nx*nx), w(nx*nx), one, h2
|
||||
parameter (one = 1.0D+0)
|
||||
external daxpy
|
||||
c
|
||||
c Computes w <--- OP*v, where OP is the nx*nx by nx*nx block
|
||||
c Computes w <--- OP*v, where OP is the nx*nx by nx*nx block
|
||||
c tridiagonal matrix
|
||||
c
|
||||
c | T -I |
|
||||
c | T -I |
|
||||
c |-I T -I |
|
||||
c OP = | -I T |
|
||||
c | ... -I|
|
||||
c | -I T|
|
||||
c
|
||||
c derived from the standard central difference discretization
|
||||
c of the 2 dimensional convection-diffusion operator
|
||||
c (Laplacian u) + rho*(du/dx) on a unit square with zero boundary
|
||||
c derived from the standard central difference discretization
|
||||
c of the 2 dimensional convection-diffusion operator
|
||||
c (Laplacian u) + rho*(du/dx) on a unit square with zero boundary
|
||||
c condition.
|
||||
c
|
||||
c When rho*h/2 <= 1, the discrete convection-diffusion operator
|
||||
c has real eigenvalues. When rho*h/2 > 1, it has COMPLEX
|
||||
c When rho*h/2 <= 1, the discrete convection-diffusion operator
|
||||
c has real eigenvalues. When rho*h/2 > 1, it has COMPLEX
|
||||
c eigenvalues.
|
||||
c
|
||||
c The subroutine TV is called to compute y<---T*x.
|
||||
@@ -432,7 +432,7 @@ c
|
||||
call tv(nx, v(lo+1), w(lo+1))
|
||||
call daxpy(nx, -one/h2, v(lo-nx+1), 1, w(lo+1), 1)
|
||||
call daxpy(nx, -one/h2, v(lo+nx+1), 1, w(lo+1), 1)
|
||||
10 continue
|
||||
10 continue
|
||||
c
|
||||
lo = (nx-1)*nx
|
||||
call tv(nx, v(lo+1), w(lo+1))
|
||||
@@ -443,21 +443,21 @@ c
|
||||
c=========================================================================
|
||||
subroutine tv (nx, x, y)
|
||||
c
|
||||
integer nx, j
|
||||
integer nx, j
|
||||
Double precision
|
||||
& x(nx), y(nx), h, h2, dd, dl, du
|
||||
c
|
||||
Double precision
|
||||
& one, zero, rho
|
||||
parameter (one = 1.0D+0, zero = 0.0D+0,
|
||||
parameter (one = 1.0D+0, zero = 0.0D+0,
|
||||
& rho = 0.0D+0)
|
||||
c
|
||||
c Compute the matrix vector multiplication y<---T*x
|
||||
c where T is a nx by nx tridiagonal matrix with DD on the
|
||||
c where T is a nx by nx tridiagonal matrix with DD on the
|
||||
c diagonal, DL on the subdiagonal, and DU on the superdiagonal.
|
||||
c
|
||||
c When rho*h/2 <= 1, the discrete convection-diffusion operator
|
||||
c has real eigenvalues. When rho*h/2 > 1, it has COMPLEX
|
||||
c When rho*h/2 <= 1, the discrete convection-diffusion operator
|
||||
c has real eigenvalues. When rho*h/2 > 1, it has COMPLEX
|
||||
c eigenvalues.
|
||||
c
|
||||
h = one / dble(nx+1)
|
||||
@@ -465,11 +465,11 @@ c
|
||||
dd = 4.0D+0 / h2
|
||||
dl = -one / h2 - 5.0D-1*rho / h
|
||||
du = -one / h2 + 5.0D-1*rho / h
|
||||
c
|
||||
c
|
||||
y(1) = dd*x(1) + du*x(2)
|
||||
do 10 j = 2,nx-1
|
||||
y(j) = dl*x(j-1) + dd*x(j) + du*x(j+1)
|
||||
10 continue
|
||||
y(nx) = dl*x(nx-1) + dd*x(nx)
|
||||
y(j) = dl*x(j-1) + dd*x(j) + du*x(j+1)
|
||||
10 continue
|
||||
y(nx) = dl*x(nx-1) + dd*x(nx)
|
||||
return
|
||||
end
|
||||
|
||||
+49
-49
@@ -9,7 +9,7 @@ c\Example-2
|
||||
c ... Suppose we want to solve A*x = lambda*x in shift-invert mode,
|
||||
c where A is derived from the centered difference discretization
|
||||
c of the 1-dimensional convection-diffusion operator
|
||||
c (d^2u / dx^2) + rho*(du/dx)
|
||||
c (d^2u / dx^2) + rho*(du/dx)
|
||||
c on the interval [0,1] with zero Dirichlet boundary condition.
|
||||
c
|
||||
c ... The shift sigma is a real number.
|
||||
@@ -61,7 +61,7 @@ c | MAXNCV: Maximum NCV allowed |
|
||||
c %-----------------------------%
|
||||
c
|
||||
integer maxn, maxnev, maxncv, ldv
|
||||
parameter (maxn=256, maxnev=10, maxncv=25,
|
||||
parameter (maxn=256, maxnev=10, maxncv=25,
|
||||
& ldv=maxn )
|
||||
c
|
||||
c %--------------%
|
||||
@@ -97,7 +97,7 @@ c
|
||||
Double precision
|
||||
& one, zero, two, rho
|
||||
common /convct/ rho
|
||||
parameter (one = 1.0D+0, zero = 0.0D+0,
|
||||
parameter (one = 1.0D+0, zero = 0.0D+0,
|
||||
& two = 2.0D+0)
|
||||
c
|
||||
c %-----------------------------%
|
||||
@@ -128,14 +128,14 @@ c | 'LM'. The user can modify NEV, NCV, SIGMAR to |
|
||||
c | solve problems of different sizes, and to get |
|
||||
c | different parts of the spectrum. However, The |
|
||||
c | following conditions must be satisfied: |
|
||||
c | N <= MAXN, |
|
||||
c | N <= MAXN, |
|
||||
c | NEV <= MAXNEV, |
|
||||
c | NEV + 2 <= NCV <= MAXNCV |
|
||||
c | NEV + 2 <= NCV <= MAXNCV |
|
||||
c %--------------------------------------------------%
|
||||
c
|
||||
n = 100
|
||||
nev = 4
|
||||
ncv = 20
|
||||
nev = 4
|
||||
ncv = 20
|
||||
if ( n .gt. maxn ) then
|
||||
print *, ' ERROR with _NDRV2: N is greater than MAXN '
|
||||
go to 9000
|
||||
@@ -148,8 +148,8 @@ c
|
||||
end if
|
||||
bmat = 'I'
|
||||
which = 'LM'
|
||||
sigmar = 1.0D+0
|
||||
sigmai = 0.0D+0
|
||||
sigmar = 1.0D+0
|
||||
sigmai = 0.0D+0
|
||||
c
|
||||
c %----------------------------------------------------%
|
||||
c | Construct C = A - SIGMA*I in real arithmetic, and |
|
||||
@@ -157,7 +157,7 @@ c | factor C in real arithmetic using LAPACK |
|
||||
c | subroutine dgttrf. The matrix A is chosen to be |
|
||||
c | the tridiagonal matrix derived from standard |
|
||||
c | central difference of the 1-d convection diffusion |
|
||||
c | operator u" + rho*u' on the interval [0, 1] with |
|
||||
c | operator u" + rho*u' on the interval [0, 1] with |
|
||||
c | zero Dirichlet boundary condition. |
|
||||
c %----------------------------------------------------%
|
||||
c
|
||||
@@ -165,25 +165,25 @@ c
|
||||
h = one / dble(n+1)
|
||||
s = rho*h / two
|
||||
c
|
||||
s1 = -one-s
|
||||
s1 = -one-s
|
||||
s2 = two - sigmar
|
||||
s3 = -one+s
|
||||
s3 = -one+s
|
||||
c
|
||||
do 10 j = 1, n-1
|
||||
dl(j) = s1
|
||||
dl(j) = s1
|
||||
dd(j) = s2
|
||||
du(j) = s3
|
||||
10 continue
|
||||
dd(n) = s2
|
||||
c
|
||||
10 continue
|
||||
dd(n) = s2
|
||||
c
|
||||
call dgttrf(n, dl, dd, du, du2, ipiv, ierr)
|
||||
if ( ierr .ne. 0 ) then
|
||||
print*, ' '
|
||||
print*, ' '
|
||||
print*, ' ERROR with _gttrf in _NDRV2.'
|
||||
print*, ' '
|
||||
go to 9000
|
||||
end if
|
||||
c
|
||||
c
|
||||
c %-----------------------------------------------------%
|
||||
c | The work array WORKL is used in DNAUPD as |
|
||||
c | workspace. Its dimension LWORKL is set as |
|
||||
@@ -195,8 +195,8 @@ c | Setting INFO=0 indicates that a random vector is |
|
||||
c | generated in DNAUPD to start the Arnoldi iteration. |
|
||||
c %-----------------------------------------------------%
|
||||
c
|
||||
lworkl = 3*ncv**2+6*ncv
|
||||
tol = zero
|
||||
lworkl = 3*ncv**2+6*ncv
|
||||
tol = zero
|
||||
ido = 0
|
||||
info = 0
|
||||
c
|
||||
@@ -213,26 +213,26 @@ c
|
||||
ishfts = 1
|
||||
maxitr = 300
|
||||
mode = 3
|
||||
|
||||
iparam(1) = ishfts
|
||||
iparam(3) = maxitr
|
||||
iparam(7) = mode
|
||||
|
||||
iparam(1) = ishfts
|
||||
iparam(3) = maxitr
|
||||
iparam(7) = mode
|
||||
c
|
||||
c %-------------------------------------------%
|
||||
c | M A I N L O O P (Reverse communication) |
|
||||
c | M A I N L O O P (Reverse communication) |
|
||||
c %-------------------------------------------%
|
||||
c
|
||||
20 continue
|
||||
c
|
||||
c %---------------------------------------------%
|
||||
c | Repeatedly call the routine DNAUPD and take |
|
||||
c | Repeatedly call the routine DNAUPD and take |
|
||||
c | actions indicated by parameter IDO until |
|
||||
c | either convergence is indicated or maxitr |
|
||||
c | has been exceeded. |
|
||||
c %---------------------------------------------%
|
||||
c
|
||||
call dnaupd ( ido, bmat, n, which, nev, tol, resid,
|
||||
& ncv, v, ldv, iparam, ipntr, workd, workl, lworkl,
|
||||
call dnaupd ( ido, bmat, n, which, nev, tol, resid,
|
||||
& ncv, v, ldv, iparam, ipntr, workd, workl, lworkl,
|
||||
& info )
|
||||
c
|
||||
if ( ido .eq. -1 .or. ido .eq. 1) then
|
||||
@@ -247,10 +247,10 @@ c %-------------------------------------------%
|
||||
c
|
||||
call dcopy( n, workd(ipntr(1)), 1, workd(ipntr(2)), 1)
|
||||
c
|
||||
call dgttrs('N', n, 1, dl, dd, du, du2, ipiv,
|
||||
& workd(ipntr(2)), n, ierr)
|
||||
call dgttrs('N', n, 1, dl, dd, du, du2, ipiv,
|
||||
& workd(ipntr(2)), n, ierr)
|
||||
if ( ierr .ne. 0 ) then
|
||||
print*, ' '
|
||||
print*, ' '
|
||||
print*, ' ERROR with _gttrs in _NDRV2.'
|
||||
print*, ' '
|
||||
go to 9000
|
||||
@@ -279,26 +279,26 @@ c
|
||||
print *, ' '
|
||||
print *, ' Error with _naupd, info = ', info
|
||||
print *, ' Check the documentation in _naupd.'
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
c
|
||||
else
|
||||
else
|
||||
c
|
||||
c %-------------------------------------------%
|
||||
c | No fatal errors occurred. |
|
||||
c | Post-Process using DNEUPD. |
|
||||
c | |
|
||||
c | Computed eigenvalues may be extracted. |
|
||||
c | Computed eigenvalues may be extracted. |
|
||||
c | |
|
||||
c | Eigenvectors may also be computed now if |
|
||||
c | desired. (indicated by rvec = .true.) |
|
||||
c | desired. (indicated by rvec = .true.) |
|
||||
c %-------------------------------------------%
|
||||
c
|
||||
c
|
||||
rvec = .true.
|
||||
c
|
||||
call dneupd ( rvec, 'A', select, d, d(1,2), v, ldv,
|
||||
& sigmar, sigmai, workev, bmat, n, which, nev, tol,
|
||||
& resid, ncv, v, ldv, iparam, ipntr, workd,
|
||||
& workl, lworkl, ierr )
|
||||
call dneupd ( rvec, 'A', select, d, d(1,2), v, ldv,
|
||||
& sigmar, sigmai, workev, bmat, n, which, nev, tol,
|
||||
& resid, ncv, v, ldv, iparam, ipntr, workd,
|
||||
& workl, lworkl, ierr )
|
||||
c
|
||||
c %-----------------------------------------------%
|
||||
c | The real part of the eigenvalue is returned |
|
||||
@@ -319,11 +319,11 @@ c | Error condition: |
|
||||
c | Check the documentation of DNEUPD. |
|
||||
c %------------------------------------%
|
||||
c
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
print *, ' Error with _neupd, info = ', ierr
|
||||
print *, ' Check the documentation of _neupd. '
|
||||
print *, ' '
|
||||
c
|
||||
print *, ' '
|
||||
c
|
||||
else
|
||||
c
|
||||
first = .true.
|
||||
@@ -360,9 +360,9 @@ c %------------------------%
|
||||
c | Ritz value is complex |
|
||||
c | Residual of one Ritz |
|
||||
c | value of the conjugate |
|
||||
c | pair is computed. |
|
||||
c | pair is computed. |
|
||||
c %------------------------%
|
||||
c
|
||||
c
|
||||
call av(n, v(1,j), ax)
|
||||
call daxpy(n, -d(j,1), v(1,j), 1, ax, 1)
|
||||
call daxpy(n, d(j,2), v(1,j+1), 1, ax, 1)
|
||||
@@ -397,11 +397,11 @@ c
|
||||
print *, ' Maximum number of iterations reached.'
|
||||
print *, ' '
|
||||
else if ( info .eq. 3) then
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
print *, ' No shifts could be applied during implicit',
|
||||
& ' Arnoldi update, try increasing NCV.'
|
||||
print *, ' '
|
||||
end if
|
||||
end if
|
||||
c
|
||||
print *, ' '
|
||||
print *, ' _NDRV2 '
|
||||
@@ -412,8 +412,8 @@ c
|
||||
print *, ' The number of Arnoldi vectors generated',
|
||||
& ' (NCV) is ', ncv
|
||||
print *, ' What portion of the spectrum: ', which
|
||||
print *, ' The number of converged Ritz values is ',
|
||||
& nconv
|
||||
print *, ' The number of converged Ritz values is ',
|
||||
& nconv
|
||||
print *, ' The number of Implicit Arnoldi update',
|
||||
& ' iterations taken is ', iparam(3)
|
||||
print *, ' The number of OP*x is ', iparam(9)
|
||||
|
||||
+51
-51
@@ -15,7 +15,7 @@ c using linear elements.
|
||||
c
|
||||
c ... So OP = inv[M]*A and B = M.
|
||||
c
|
||||
c ... Use mode 2 of DNAUPD.
|
||||
c ... Use mode 2 of DNAUPD.
|
||||
c
|
||||
c\BeginLib
|
||||
c
|
||||
@@ -60,7 +60,7 @@ c | MAXNCV: Maximum NCV allowed |
|
||||
c %-----------------------------%
|
||||
c
|
||||
integer maxn, maxnev, maxncv, ldv
|
||||
parameter (maxn=256, maxnev=10, maxncv=25,
|
||||
parameter (maxn=256, maxnev=10, maxncv=25,
|
||||
& ldv=maxn )
|
||||
c
|
||||
c %--------------%
|
||||
@@ -71,7 +71,7 @@ c
|
||||
logical select(maxncv)
|
||||
Double precision
|
||||
& ax(maxn), mx(maxn), d(maxncv, 3), resid(maxn),
|
||||
& v(ldv,maxncv), workd(3*maxn),
|
||||
& v(ldv,maxncv), workd(3*maxn),
|
||||
& workev(3*maxncv),
|
||||
& workl(3*maxncv*maxncv+6*maxncv),
|
||||
& md(maxn), me(maxn-1)
|
||||
@@ -83,7 +83,7 @@ c
|
||||
character bmat*1, which*2
|
||||
integer ido, n, nev, ncv, lworkl, info, ierr, j,
|
||||
& nconv, maxitr, ishfts, mode
|
||||
Double precision
|
||||
Double precision
|
||||
& tol, sigmar, sigmai, h
|
||||
logical first, rvec
|
||||
c
|
||||
@@ -91,14 +91,14 @@ c %------------%
|
||||
c | Parameters |
|
||||
c %------------%
|
||||
c
|
||||
Double precision
|
||||
Double precision
|
||||
& zero, one
|
||||
parameter (zero = 0.0D+0, one = 1.0D+0)
|
||||
c
|
||||
c %-----------------------------%
|
||||
c | BLAS & LAPACK routines used |
|
||||
c %-----------------------------%
|
||||
Double precision
|
||||
Double precision
|
||||
& dnrm2, dlapy2
|
||||
external daxpy, dnrm2, dpttrf, dpttrs, dlapy2
|
||||
c
|
||||
@@ -125,9 +125,9 @@ c | NEV <= MAXNEV, |
|
||||
c | NEV + 2 <= NCV <= MAXNCV |
|
||||
c %----------------------------------------------------%
|
||||
c
|
||||
n = 100
|
||||
nev = 4
|
||||
ncv = 20
|
||||
n = 100
|
||||
nev = 4
|
||||
ncv = 20
|
||||
if ( n .gt. maxn ) then
|
||||
print *, ' ERROR with _NDRV3: N is greater than MAXN '
|
||||
go to 9000
|
||||
@@ -148,16 +148,16 @@ c %------------------------------------------------%
|
||||
c
|
||||
h = one / dble(n+1)
|
||||
do 20 j = 1, n-1
|
||||
md(j) = 4.0D+0*h
|
||||
me(j) = one*h
|
||||
20 continue
|
||||
md(j) = 4.0D+0*h
|
||||
me(j) = one*h
|
||||
20 continue
|
||||
md(n) = 4.0D+0*h
|
||||
c
|
||||
c
|
||||
call dpttrf(n, md, me, ierr)
|
||||
if ( ierr .ne. 0 ) then
|
||||
print*, ' '
|
||||
print*, ' ERROR with _pttrf. '
|
||||
print*, ' '
|
||||
print*, ' ERROR with _pttrf. '
|
||||
print*, ' '
|
||||
go to 9000
|
||||
end if
|
||||
c
|
||||
@@ -172,8 +172,8 @@ c | Setting INFO=0 indicates that a random vector is |
|
||||
c | generated in DNAUPD to start the Arnoldi iteration. |
|
||||
c %-----------------------------------------------------%
|
||||
c
|
||||
lworkl = 3*ncv**2+6*ncv
|
||||
tol = 0.0
|
||||
lworkl = 3*ncv**2+6*ncv
|
||||
tol = 0.0
|
||||
ido = 0
|
||||
info = 0
|
||||
c
|
||||
@@ -191,9 +191,9 @@ c
|
||||
maxitr = 300
|
||||
mode = 2
|
||||
c
|
||||
iparam(1) = ishfts
|
||||
iparam(3) = maxitr
|
||||
iparam(7) = mode
|
||||
iparam(1) = ishfts
|
||||
iparam(3) = maxitr
|
||||
iparam(7) = mode
|
||||
c
|
||||
c %-------------------------------------------%
|
||||
c | M A I N L O O P (Reverse communication) |
|
||||
@@ -202,14 +202,14 @@ c
|
||||
10 continue
|
||||
c
|
||||
c %---------------------------------------------%
|
||||
c | Repeatedly call the routine DNAUPD and take |
|
||||
c | Repeatedly call the routine DNAUPD and take |
|
||||
c | actions indicated by parameter IDO until |
|
||||
c | either convergence is indicated or maxitr |
|
||||
c | has been exceeded. |
|
||||
c %---------------------------------------------%
|
||||
c
|
||||
call dnaupd ( ido, bmat, n, which, nev, tol, resid,
|
||||
& ncv, v, ldv, iparam, ipntr, workd,
|
||||
call dnaupd ( ido, bmat, n, which, nev, tol, resid,
|
||||
& ncv, v, ldv, iparam, ipntr, workd,
|
||||
& workl, lworkl, info )
|
||||
c
|
||||
if (ido .eq. -1 .or. ido .eq. 1) then
|
||||
@@ -228,8 +228,8 @@ c
|
||||
call dpttrs(n, 1, md, me, workd(ipntr(2)), n,
|
||||
& ierr)
|
||||
if ( ierr .ne. 0 ) then
|
||||
print*, ' '
|
||||
print*, ' ERROR with _pttrs. '
|
||||
print*, ' '
|
||||
print*, ' ERROR with _pttrs. '
|
||||
print*, ' '
|
||||
go to 9000
|
||||
end if
|
||||
@@ -264,7 +264,7 @@ c
|
||||
c %-----------------------------------------%
|
||||
c | Either we have convergence, or there is |
|
||||
c | an error. |
|
||||
c %-----------------------------------------%
|
||||
c %-----------------------------------------%
|
||||
c
|
||||
if ( info .lt. 0 ) then
|
||||
c
|
||||
@@ -276,22 +276,22 @@ c
|
||||
print *, ' '
|
||||
print *, ' Error with _naupd, info = ', info
|
||||
print *, ' Check the documentation of _naupd.'
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
c
|
||||
else
|
||||
else
|
||||
c
|
||||
c %-------------------------------------------%
|
||||
c | No fatal errors occurred. |
|
||||
c | Post-Process using DNEUPD. |
|
||||
c | |
|
||||
c | Computed eigenvalues may be extracted. |
|
||||
c | Computed eigenvalues may be extracted. |
|
||||
c | |
|
||||
c | Eigenvectors may also be computed now if |
|
||||
c | desired. (indicated by rvec = .true.) |
|
||||
c | desired. (indicated by rvec = .true.) |
|
||||
c %-------------------------------------------%
|
||||
c
|
||||
rvec = .true.
|
||||
call dneupd ( rvec, 'A', select, d, d(1,2), v, ldv,
|
||||
call dneupd ( rvec, 'A', select, d, d(1,2), v, ldv,
|
||||
& sigmar, sigmai, workev, bmat, n, which, nev, tol,
|
||||
& resid, ncv, v, ldv, iparam, ipntr, workd,
|
||||
& workl, lworkl, ierr )
|
||||
@@ -314,13 +314,13 @@ c %------------------------------------%
|
||||
c | Error condition: |
|
||||
c | Check the documentation of DNEUPD. |
|
||||
c %------------------------------------%
|
||||
c
|
||||
print *, ' '
|
||||
c
|
||||
print *, ' '
|
||||
print *, ' Error with _neupd, info = ', ierr
|
||||
print *, ' Check the documentation of _neupd'
|
||||
print *, ' '
|
||||
c
|
||||
else
|
||||
else
|
||||
c
|
||||
first = .true.
|
||||
nconv = iparam(5)
|
||||
@@ -399,11 +399,11 @@ c
|
||||
print *, ' Maximum number of iterations reached.'
|
||||
print *, ' '
|
||||
else if ( info .eq. 3) then
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
print *, ' No shifts could be applied during implicit',
|
||||
& ' Arnoldi update, try increasing NCV.'
|
||||
print *, ' '
|
||||
end if
|
||||
end if
|
||||
c
|
||||
print *, ' '
|
||||
print *, ' _NDRV3 '
|
||||
@@ -414,8 +414,8 @@ c
|
||||
print *, ' The number of Arnoldi vectors generated',
|
||||
& ' (NCV) is ', ncv
|
||||
print *, ' What portion of the spectrum: ', which
|
||||
print *, ' The number of converged Ritz values is ',
|
||||
& nconv
|
||||
print *, ' The number of converged Ritz values is ',
|
||||
& nconv
|
||||
print *, ' The number of Implicit Arnoldi update',
|
||||
& ' iterations taken is ', iparam(3)
|
||||
print *, ' The number of OP*x is ', iparam(9)
|
||||
@@ -431,16 +431,16 @@ c
|
||||
9000 continue
|
||||
c
|
||||
end
|
||||
c
|
||||
c
|
||||
c==========================================================================
|
||||
c
|
||||
c matrix vector multiplication subroutine
|
||||
c
|
||||
subroutine av (n, v, w)
|
||||
integer n, j
|
||||
Double precision
|
||||
& v(n), w(n), one, two, dd, dl, du, s, h, rho
|
||||
parameter ( rho = 1.0D+1, one = 1.0D+0,
|
||||
Double precision
|
||||
& v(n), w(n), one, two, dd, dl, du, s, h, rho
|
||||
parameter ( rho = 1.0D+1, one = 1.0D+0,
|
||||
& two = 2.0D+0)
|
||||
c
|
||||
c Compute the matrix vector multiplication y<---A*x
|
||||
@@ -458,27 +458,27 @@ c
|
||||
c
|
||||
w(1) = dd*v(1) + du*v(2)
|
||||
do 10 j = 2,n-1
|
||||
w(j) = dl*v(j-1) + dd*v(j) + du*v(j+1)
|
||||
10 continue
|
||||
w(n) = dl*v(n-1) + dd*v(n)
|
||||
w(j) = dl*v(j-1) + dd*v(j) + du*v(j+1)
|
||||
10 continue
|
||||
w(n) = dl*v(n-1) + dd*v(n)
|
||||
return
|
||||
end
|
||||
c------------------------------------------------------------------------
|
||||
subroutine mv (n, v, w)
|
||||
integer n, j
|
||||
Double precision
|
||||
Double precision
|
||||
& v(n), w(n), one, four, h
|
||||
parameter ( one = 1.0D+0, four = 4.0D+0)
|
||||
c
|
||||
c Compute the matrix vector multiplication y<---M*x
|
||||
c where M is the mass matrix formed by using piecewise linear
|
||||
c where M is the mass matrix formed by using piecewise linear
|
||||
c elements on [0,1].
|
||||
c
|
||||
c
|
||||
w(1) = four*v(1) + one*v(2)
|
||||
do 10 j = 2,n-1
|
||||
w(j) = one*v(j-1) + four*v(j) + one*v(j+1)
|
||||
10 continue
|
||||
w(n) = one*v(n-1) + four*v(n)
|
||||
w(j) = one*v(j-1) + four*v(j) + one*v(j+1)
|
||||
10 continue
|
||||
w(n) = one*v(n-1) + four*v(n)
|
||||
c
|
||||
h = one / dble(n+1)
|
||||
call dscal(n, h, w, 1)
|
||||
|
||||
+58
-58
@@ -1,7 +1,7 @@
|
||||
program dndrv4
|
||||
c
|
||||
c Simple program to illustrate the idea of reverse communication
|
||||
c in shift-invert mode for a generalized nonsymmetric eigenvalue
|
||||
c in shift-invert mode for a generalized nonsymmetric eigenvalue
|
||||
c problem.
|
||||
c
|
||||
c We implement example four of ex-nonsym.doc in DOCUMENTS directory
|
||||
@@ -25,7 +25,7 @@ c
|
||||
c\Routines called:
|
||||
c dnaupd ARPACK reverse communication interface routine.
|
||||
c dneupd ARPACK routine that returns Ritz values and (optionally)
|
||||
c Ritz vectors.
|
||||
c Ritz vectors.
|
||||
c dgttrf LAPACK tridiagonal factorization routine.
|
||||
c dgttrs LAPACK tridiagonal linear system solve routine.
|
||||
c dlapy2 LAPACK routine to compute sqrt(x**2+y**2) carefully.
|
||||
@@ -37,15 +37,15 @@ c av Matrix vector multiplication routine that computes A*x.
|
||||
c mv Matrix vector multiplication routine that computes M*x.
|
||||
c
|
||||
c\Author
|
||||
c Richard Lehoucq
|
||||
c Danny Sorensen
|
||||
c Chao Yang
|
||||
c Dept. of Computational &
|
||||
c Applied Mathematics
|
||||
c Rice University
|
||||
c Houston, Texas
|
||||
c Richard Lehoucq
|
||||
c Danny Sorensen
|
||||
c Chao Yang
|
||||
c Dept. of Computational &
|
||||
c Applied Mathematics
|
||||
c Rice University
|
||||
c Houston, Texas
|
||||
c
|
||||
c\SCCS Information: @(#)
|
||||
c\SCCS Information: @(#)
|
||||
c FILE: ndrv4.F SID: 2.5 DATE OF SID: 10/17/00 RELEASE: 2
|
||||
c
|
||||
c\Remarks
|
||||
@@ -64,7 +64,7 @@ c | MAXNCV: Maximum NCV allowed |
|
||||
c %-----------------------------%
|
||||
c
|
||||
integer maxn, maxnev, maxncv, ldv
|
||||
parameter (maxn=256, maxnev=10, maxncv=25,
|
||||
parameter (maxn=256, maxnev=10, maxncv=25,
|
||||
& ldv=maxn )
|
||||
c
|
||||
c %--------------%
|
||||
@@ -90,13 +90,13 @@ c
|
||||
Double precision
|
||||
& tol, h, s,
|
||||
& sigmar, sigmai, s1, s2, s3
|
||||
logical first, rvec
|
||||
c
|
||||
logical first, rvec
|
||||
c
|
||||
c %-----------------------------%
|
||||
c | BLAS & LAPACK routines used |
|
||||
c %-----------------------------%
|
||||
c
|
||||
Double precision
|
||||
Double precision
|
||||
& ddot, dnrm2, dlapy2
|
||||
external ddot, dnrm2, dlapy2, dgttrf, dgttrs
|
||||
c
|
||||
@@ -113,7 +113,7 @@ c
|
||||
Double precision
|
||||
& one, zero, two, six, rho
|
||||
common /convct/ rho
|
||||
parameter (one = 1.0D+0, zero = 0.0D+0,
|
||||
parameter (one = 1.0D+0, zero = 0.0D+0,
|
||||
& two = 2.0D+0, six = 6.0D+0)
|
||||
c
|
||||
c %-----------------------%
|
||||
@@ -130,14 +130,14 @@ c | The user can modify NEV, NCV, SIGMAR to solve |
|
||||
c | problems of different sizes, and to get different |
|
||||
c | parts of the spectrum. However, The following |
|
||||
c | conditions must be satisfied: |
|
||||
c | N <= MAXN, |
|
||||
c | N <= MAXN, |
|
||||
c | NEV <= MAXNEV, |
|
||||
c | NEV + 2 <= NCV <= MAXNCV |
|
||||
c | NEV + 2 <= NCV <= MAXNCV |
|
||||
c %----------------------------------------------------%
|
||||
c
|
||||
n = 100
|
||||
nev = 4
|
||||
ncv = 10
|
||||
n = 100
|
||||
nev = 4
|
||||
ncv = 10
|
||||
if ( n .gt. maxn ) then
|
||||
print *, ' ERROR with _NDRV4: N is greater than MAXN '
|
||||
go to 9000
|
||||
@@ -150,7 +150,7 @@ c
|
||||
end if
|
||||
bmat = 'G'
|
||||
which = 'LM'
|
||||
sigmar = one
|
||||
sigmar = one
|
||||
sigmai = zero
|
||||
c
|
||||
c %--------------------------------------------------%
|
||||
@@ -175,12 +175,12 @@ c
|
||||
s3 = -one/h + s - sigmar*h/six
|
||||
c
|
||||
do 10 j = 1, n-1
|
||||
dl(j) = s1
|
||||
dl(j) = s1
|
||||
dd(j) = s2
|
||||
du(j) = s3
|
||||
10 continue
|
||||
dd(n) = s2
|
||||
c
|
||||
10 continue
|
||||
dd(n) = s2
|
||||
c
|
||||
call dgttrf(n, dl, dd, du, du2, ipiv, ierr)
|
||||
if ( ierr .ne. 0 ) then
|
||||
print*, ' '
|
||||
@@ -200,7 +200,7 @@ c | Setting INFO=0 indicates that a random vector is |
|
||||
c | generated in DNAUPD to start the Arnoldi iteration. |
|
||||
c %-----------------------------------------------------%
|
||||
c
|
||||
lworkl = 3*ncv**2+6*ncv
|
||||
lworkl = 3*ncv**2+6*ncv
|
||||
tol = zero
|
||||
ido = 0
|
||||
info = 0
|
||||
@@ -224,20 +224,20 @@ c
|
||||
iparam(7) = mode
|
||||
c
|
||||
c %------------------------------------------%
|
||||
c | M A I N L O O P(Reverse communication) |
|
||||
c | M A I N L O O P(Reverse communication) |
|
||||
c %------------------------------------------%
|
||||
c
|
||||
20 continue
|
||||
c
|
||||
c %---------------------------------------------%
|
||||
c | Repeatedly call the routine DNAUPD and take |
|
||||
c | Repeatedly call the routine DNAUPD and take |
|
||||
c | actions indicated by parameter IDO until |
|
||||
c | either convergence is indicated or maxitr |
|
||||
c | has been exceeded. |
|
||||
c %---------------------------------------------%
|
||||
c
|
||||
call dnaupd ( ido, bmat, n, which, nev, tol, resid,
|
||||
& ncv, v, ldv, iparam, ipntr, workd,
|
||||
call dnaupd ( ido, bmat, n, which, nev, tol, resid,
|
||||
& ncv, v, ldv, iparam, ipntr, workd,
|
||||
& workl, lworkl, info )
|
||||
c
|
||||
if (ido .eq. -1) then
|
||||
@@ -255,8 +255,8 @@ c | workd(ipntr(2)). |
|
||||
c %-------------------------------------------%
|
||||
c
|
||||
call mv (n, workd(ipntr(1)), workd(ipntr(2)))
|
||||
call dgttrs('N', n, 1, dl, dd, du, du2, ipiv,
|
||||
& workd(ipntr(2)), n, ierr)
|
||||
call dgttrs('N', n, 1, dl, dd, du, du2, ipiv,
|
||||
& workd(ipntr(2)), n, ierr)
|
||||
if ( ierr .ne. 0 ) then
|
||||
print*, ' '
|
||||
print*, ' ERROR with _gttrs in _NDRV4.'
|
||||
@@ -282,7 +282,7 @@ c | workd(ipntr(2)). |
|
||||
c %-----------------------------------------%
|
||||
c
|
||||
call dcopy( n, workd(ipntr(3)), 1, workd(ipntr(2)), 1)
|
||||
call dgttrs ('N', n, 1, dl, dd, du, du2, ipiv,
|
||||
call dgttrs ('N', n, 1, dl, dd, du, du2, ipiv,
|
||||
& workd(ipntr(2)), n, ierr)
|
||||
if ( ierr .ne. 0 ) then
|
||||
print*, ' '
|
||||
@@ -314,8 +314,8 @@ c %-----------------------------------------%
|
||||
c
|
||||
go to 20
|
||||
c
|
||||
end if
|
||||
c
|
||||
end if
|
||||
c
|
||||
c
|
||||
c %-----------------------------------------%
|
||||
c | Either we have convergence, or there is |
|
||||
@@ -334,23 +334,23 @@ c
|
||||
print *, ' Check the documentation in _naupd.'
|
||||
print *, ' '
|
||||
c
|
||||
else
|
||||
else
|
||||
c
|
||||
c %-------------------------------------------%
|
||||
c | No fatal errors occurred. |
|
||||
c | Post-Process using DNEUPD. |
|
||||
c | |
|
||||
c | Computed eigenvalues may be extracted. |
|
||||
c | Computed eigenvalues may be extracted. |
|
||||
c | |
|
||||
c | Eigenvectors may also be computed now if |
|
||||
c | desired. (indicated by rvec = .true.) |
|
||||
c | desired. (indicated by rvec = .true.) |
|
||||
c %-------------------------------------------%
|
||||
c
|
||||
rvec = .true.
|
||||
call dneupd ( rvec, 'A', select, d, d(1,2), v, ldv,
|
||||
& sigmar, sigmai, workev, bmat, n, which, nev, tol,
|
||||
& resid, ncv, v, ldv, iparam, ipntr, workd,
|
||||
& workl, lworkl, ierr )
|
||||
call dneupd ( rvec, 'A', select, d, d(1,2), v, ldv,
|
||||
& sigmar, sigmai, workev, bmat, n, which, nev, tol,
|
||||
& resid, ncv, v, ldv, iparam, ipntr, workd,
|
||||
& workl, lworkl, ierr )
|
||||
c
|
||||
c %-----------------------------------------------%
|
||||
c | The real part of the eigenvalue is returned |
|
||||
@@ -365,16 +365,16 @@ c | the eigenvalues in D is returned in V. |
|
||||
c %-----------------------------------------------%
|
||||
c
|
||||
if ( ierr .ne. 0) then
|
||||
c
|
||||
c
|
||||
c %------------------------------------%
|
||||
c | Error condition: |
|
||||
c | Check the documentation of DNEUPD. |
|
||||
c %------------------------------------%
|
||||
c
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
print *, ' Error with _neupd, info = ', ierr
|
||||
print *, ' Check the documentation of _neupd. '
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
c
|
||||
else
|
||||
c
|
||||
@@ -413,9 +413,9 @@ c %------------------------%
|
||||
c | Ritz value is complex. |
|
||||
c | Residual of one Ritz |
|
||||
c | value of the conjugate |
|
||||
c | pair is computed. |
|
||||
c | pair is computed. |
|
||||
c %------------------------%
|
||||
c
|
||||
c
|
||||
call av(n, v(1,j), ax)
|
||||
call mv(n, v(1,j), mx)
|
||||
call daxpy(n, -d(j,1), mx, 1, ax, 1)
|
||||
@@ -455,11 +455,11 @@ c
|
||||
print *, ' Maximum number of iterations reached.'
|
||||
print *, ' '
|
||||
else if ( info .eq. 3) then
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
print *, ' No shifts could be applied during implicit',
|
||||
& ' Arnoldi update, try increasing NCV.'
|
||||
print *, ' '
|
||||
end if
|
||||
end if
|
||||
c
|
||||
print *, ' '
|
||||
print *, ' _NDRV4 '
|
||||
@@ -470,8 +470,8 @@ c
|
||||
print *, ' The number of Arnoldi vectors generated',
|
||||
& ' (NCV) is ', ncv
|
||||
print *, ' What portion of the spectrum: ', which
|
||||
print *, ' The number of converged Ritz values is ',
|
||||
& nconv
|
||||
print *, ' The number of converged Ritz values is ',
|
||||
& nconv
|
||||
print *, ' The number of Implicit Arnoldi update',
|
||||
& ' iterations taken is ', iparam(3)
|
||||
print *, ' The number of OP*x is ', iparam(9)
|
||||
@@ -487,7 +487,7 @@ c
|
||||
9000 continue
|
||||
c
|
||||
end
|
||||
c
|
||||
c
|
||||
c==========================================================================
|
||||
c
|
||||
c matrix vector multiplication subroutine
|
||||
@@ -495,17 +495,17 @@ c
|
||||
subroutine mv (n, v, w)
|
||||
integer n, j
|
||||
Double precision
|
||||
& v(n), w(n), one, four, six, h
|
||||
& v(n), w(n), one, four, six, h
|
||||
parameter (one = 1.0D+0, four = 4.0D+0, six = 6.0D+0)
|
||||
c
|
||||
c Compute the matrix vector multiplication y<---M*x
|
||||
c where M is mass matrix formed by using piecewise linear elements
|
||||
c where M is mass matrix formed by using piecewise linear elements
|
||||
c on [0,1].
|
||||
c
|
||||
c
|
||||
w(1) = ( four*v(1) + one*v(2) ) / six
|
||||
do 10 j = 2,n-1
|
||||
w(j) = ( one*v(j-1) + four*v(j) + one*v(j+1) ) / six
|
||||
10 continue
|
||||
10 continue
|
||||
w(n) = ( one*v(n-1) + four*v(n) ) / six
|
||||
c
|
||||
h = one / dble(n+1)
|
||||
@@ -516,7 +516,7 @@ c------------------------------------------------------------------
|
||||
subroutine av (n, v, w)
|
||||
integer n, j
|
||||
Double precision
|
||||
& v(n), w(n), one, two, dd, dl, du, s, h, rho
|
||||
& v(n), w(n), one, two, dd, dl, du, s, h, rho
|
||||
common /convct/ rho
|
||||
parameter (one = 1.0D+0, two = 2.0D+0)
|
||||
c
|
||||
@@ -530,7 +530,7 @@ c This routine is only used in residual calculation.
|
||||
c
|
||||
h = one / dble(n+1)
|
||||
s = rho / two
|
||||
dd = two / h
|
||||
dd = two / h
|
||||
dl = -one/h - s
|
||||
du = -one/h + s
|
||||
c
|
||||
|
||||
+74
-74
@@ -8,9 +8,9 @@ c
|
||||
c\Example-5
|
||||
c
|
||||
c ... Suppose we want to solve A*x = lambda*B*x in shift-invert mode
|
||||
c The matrix A is the tridiagonal matrix with 2 on the diagonal,
|
||||
c -2 on the subdiagonal and 3 on the superdiagonal. The matrix M
|
||||
c is the tridiagonal matrix with 4 on the diagonal and 1 on the
|
||||
c The matrix A is the tridiagonal matrix with 2 on the diagonal,
|
||||
c -2 on the subdiagonal and 3 on the superdiagonal. The matrix M
|
||||
c is the tridiagonal matrix with 4 on the diagonal and 1 on the
|
||||
c off-diagonals.
|
||||
c ... The shift sigma is a complex number (sigmar, sigmai).
|
||||
c ... OP = Real_Part{inv[A-(SIGMAR,SIGMAI)*M]*M and B = M.
|
||||
@@ -32,15 +32,15 @@ c av Matrix vector subroutine that computes A*x.
|
||||
c mv Matrix vector subroutine that computes M*x.
|
||||
c
|
||||
c\Author
|
||||
c Richard Lehoucq
|
||||
c Danny Sorensen
|
||||
c Chao Yang
|
||||
c Dept. of Computational &
|
||||
c Applied Mathematics
|
||||
c Rice University
|
||||
c Houston, Texas
|
||||
c Richard Lehoucq
|
||||
c Danny Sorensen
|
||||
c Chao Yang
|
||||
c Dept. of Computational &
|
||||
c Applied Mathematics
|
||||
c Rice University
|
||||
c Houston, Texas
|
||||
c
|
||||
c\SCCS Information: @(#)
|
||||
c\SCCS Information: @(#)
|
||||
c FILE: ndrv5.F SID: 2.5 DATE OF SID: 10/17/00 RELEASE: 2
|
||||
c
|
||||
c\Remarks
|
||||
@@ -59,7 +59,7 @@ c | MAXNCV: Maximum NCV allowed |
|
||||
c %-----------------------------%
|
||||
c
|
||||
integer maxn, maxnev, maxncv, ldv
|
||||
parameter (maxn=256, maxnev=10, maxncv=25,
|
||||
parameter (maxn=256, maxnev=10, maxncv=25,
|
||||
& ldv=maxn )
|
||||
c
|
||||
c %--------------%
|
||||
@@ -73,7 +73,7 @@ c
|
||||
& v(ldv,maxncv), workd(3*maxn),
|
||||
& workev(3*maxncv),
|
||||
& workl(3*maxncv*maxncv+6*maxncv)
|
||||
Complex*16
|
||||
Complex*16
|
||||
& cdd(maxn), cdl(maxn), cdu(maxn),
|
||||
& cdu2(maxn), ctemp(maxn)
|
||||
c
|
||||
@@ -86,16 +86,16 @@ c
|
||||
& nconv, maxitr, ishfts, mode
|
||||
Double precision
|
||||
& tol, numr, numi, denr, deni, sigmar, sigmai
|
||||
Complex*16
|
||||
Complex*16
|
||||
& c1, c2, c3
|
||||
logical first, rvec
|
||||
c
|
||||
logical first, rvec
|
||||
c
|
||||
c %-----------------------------%
|
||||
c | BLAS & LAPACK routines used |
|
||||
c %-----------------------------%
|
||||
c
|
||||
external zgttrf, zgttrs
|
||||
Double precision
|
||||
Double precision
|
||||
& ddot, dnrm2, dlapy2
|
||||
external ddot, dnrm2, dlapy2
|
||||
c
|
||||
@@ -128,14 +128,14 @@ c | to 'LM'. The user can modify NEV, NCV, SIGMAR, |
|
||||
c | SIGMAI to solve problems of different sizes, and |
|
||||
c | to get different parts of the spectrum. However, |
|
||||
c | The following conditions must be satisfied: |
|
||||
c | N <= MAXN, |
|
||||
c | N <= MAXN, |
|
||||
c | NEV <= MAXNEV, |
|
||||
c | NEV + 2 <= NCV <= MAXNCV |
|
||||
c | NEV + 2 <= NCV <= MAXNCV |
|
||||
c %----------------------------------------------------%
|
||||
c
|
||||
n = 100
|
||||
nev = 4
|
||||
ncv = 20
|
||||
n = 100
|
||||
nev = 4
|
||||
ncv = 20
|
||||
if ( n .gt. maxn ) then
|
||||
print *, ' ERROR with _NDRV5: N is greater than MAXN '
|
||||
go to 9000
|
||||
@@ -167,12 +167,12 @@ c
|
||||
c3 = dcmplx( 3.0D+0-sigmar, -sigmai)
|
||||
c
|
||||
do 10 j = 1, n-1
|
||||
cdl(j) = c1
|
||||
cdl(j) = c1
|
||||
cdd(j) = c2
|
||||
cdu(j) = c3
|
||||
10 continue
|
||||
cdd(n) = c2
|
||||
c
|
||||
10 continue
|
||||
cdd(n) = c2
|
||||
c
|
||||
call zgttrf(n, cdl, cdd, cdu, cdu2, ipiv, ierr)
|
||||
if ( ierr .ne. 0 ) then
|
||||
print*, ' '
|
||||
@@ -192,8 +192,8 @@ c | Setting INFO=0 indicates that a random vector is |
|
||||
c | generated in DNAUPD to start the Arnoldi iteration. |
|
||||
c %-----------------------------------------------------%
|
||||
c
|
||||
lworkl = 3*ncv**2+6*ncv
|
||||
tol = zero
|
||||
lworkl = 3*ncv**2+6*ncv
|
||||
tol = zero
|
||||
ido = 0
|
||||
info = 0
|
||||
c
|
||||
@@ -212,30 +212,30 @@ c
|
||||
mode = 3
|
||||
c
|
||||
iparam(1) = ishfts
|
||||
iparam(3) = maxitr
|
||||
iparam(7) = mode
|
||||
iparam(3) = maxitr
|
||||
iparam(7) = mode
|
||||
c
|
||||
c %------------------------------------------%
|
||||
c | M A I N L O O P(Reverse communication) |
|
||||
c | M A I N L O O P(Reverse communication) |
|
||||
c %------------------------------------------%
|
||||
c
|
||||
20 continue
|
||||
c
|
||||
c %---------------------------------------------%
|
||||
c | Repeatedly call the routine DNAUPD and take |
|
||||
c | Repeatedly call the routine DNAUPD and take |
|
||||
c | actions indicated by parameter IDO until |
|
||||
c | either convergence is indicated or maxitr |
|
||||
c | has been exceeded. |
|
||||
c %---------------------------------------------%
|
||||
c
|
||||
call dnaupd ( ido, bmat, n, which, nev, tol, resid,
|
||||
& ncv, v, ldv, iparam, ipntr, workd,
|
||||
call dnaupd ( ido, bmat, n, which, nev, tol, resid,
|
||||
& ncv, v, ldv, iparam, ipntr, workd,
|
||||
& workl, lworkl, info )
|
||||
c
|
||||
if (ido .eq. -1) then
|
||||
c
|
||||
c %-------------------------------------------------------%
|
||||
c | Perform |
|
||||
c | Perform |
|
||||
c | y <--- OP*x = Real_Part{inv[A-(SIGMAR,SIGMAI)*M]*M*x} |
|
||||
c | to force starting vector into the range of OP. The |
|
||||
c | user should supply his/her own matrix vector |
|
||||
@@ -251,14 +251,14 @@ c
|
||||
ctemp(j) = dcmplx(workd(ipntr(2)+j-1))
|
||||
30 continue
|
||||
c
|
||||
call zgttrs('N', n, 1, cdl, cdd, cdu, cdu2, ipiv,
|
||||
call zgttrs('N', n, 1, cdl, cdd, cdu, cdu2, ipiv,
|
||||
& ctemp, n, ierr)
|
||||
if ( ierr .ne. 0 ) then
|
||||
print*, ' '
|
||||
print*, ' ERROR with _gttrs in _NDRV5.'
|
||||
print*, ' '
|
||||
go to 9000
|
||||
end if
|
||||
end if
|
||||
do 40 j = 1, n
|
||||
workd(ipntr(2)+j-1) = dble(ctemp(j))
|
||||
40 continue
|
||||
@@ -283,14 +283,14 @@ c
|
||||
do 50 j = 1,n
|
||||
ctemp(j) = dcmplx(workd(ipntr(3)+j-1))
|
||||
50 continue
|
||||
call zgttrs ('N', n, 1, cdl, cdd, cdu, cdu2, ipiv,
|
||||
call zgttrs ('N', n, 1, cdl, cdd, cdu, cdu2, ipiv,
|
||||
& ctemp, n, ierr)
|
||||
if ( ierr .ne. 0 ) then
|
||||
print*, ' '
|
||||
print*, ' ERROR with _gttrs in _NDRV5.'
|
||||
print*, ' '
|
||||
go to 9000
|
||||
end if
|
||||
end if
|
||||
do 60 j = 1, n
|
||||
workd(ipntr(2)+j-1) = dble(ctemp(j))
|
||||
60 continue
|
||||
@@ -320,7 +320,7 @@ c
|
||||
c
|
||||
end if
|
||||
c
|
||||
c
|
||||
c
|
||||
c %------------------------------------------%
|
||||
c | Either we have convergence, or there is |
|
||||
c | an error. |
|
||||
@@ -336,25 +336,25 @@ c
|
||||
print *, ' '
|
||||
print *, ' Error with _naupd info = ',info
|
||||
print *, ' Check the documentation of _naupd.'
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
c
|
||||
else
|
||||
else
|
||||
c
|
||||
c %-------------------------------------------%
|
||||
c | No fatal errors occurred. |
|
||||
c | Post-Process using DNEUPD. |
|
||||
c | |
|
||||
c | Computed eigenvalues may be extracted. |
|
||||
c | Computed eigenvalues may be extracted. |
|
||||
c | |
|
||||
c | Eigenvectors may also be computed now if |
|
||||
c | desired. (indicated by rvec = .true.) |
|
||||
c | desired. (indicated by rvec = .true.) |
|
||||
c %-------------------------------------------%
|
||||
c
|
||||
rvec = .true.
|
||||
call dneupd ( rvec, 'A', select, d, d(1,2), v, ldv,
|
||||
& sigmar, sigmai, workev, bmat, n, which, nev, tol,
|
||||
& resid, ncv, v, ldv, iparam, ipntr, workd,
|
||||
& workl, lworkl, ierr )
|
||||
call dneupd ( rvec, 'A', select, d, d(1,2), v, ldv,
|
||||
& sigmar, sigmai, workev, bmat, n, which, nev, tol,
|
||||
& resid, ncv, v, ldv, iparam, ipntr, workd,
|
||||
& workl, lworkl, ierr )
|
||||
c
|
||||
c %-----------------------------------------------%
|
||||
c | The real part of the eigenvalue is returned |
|
||||
@@ -375,14 +375,14 @@ c | Error condition: |
|
||||
c | Check the documentation of DNEUPD. |
|
||||
c %------------------------------------%
|
||||
c
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
print *, ' Error with _neupd = ', ierr
|
||||
print *, ' Check the documentation of _neupd. '
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
c
|
||||
else
|
||||
else
|
||||
c
|
||||
first = .true.
|
||||
first = .true.
|
||||
nconv = iparam(5)
|
||||
do 70 j=1,nconv
|
||||
c
|
||||
@@ -394,7 +394,7 @@ c
|
||||
if ( d(j,2) .eq. zero ) then
|
||||
c
|
||||
c %---------------------------%
|
||||
c | Eigenvalue is real. |
|
||||
c | Eigenvalue is real. |
|
||||
c | Compute d = x'(Ax)/x'(Mx).|
|
||||
c %---------------------------%
|
||||
c
|
||||
@@ -402,7 +402,7 @@ c
|
||||
numr = ddot(n, v(1,j), 1, ax, 1)
|
||||
call mv(n, v(1,j), ax )
|
||||
denr = ddot(n, v(1,j), 1, ax, 1)
|
||||
d(j,1) = numr / denr
|
||||
d(j,1) = numr / denr
|
||||
c
|
||||
else if (first) then
|
||||
c
|
||||
@@ -420,7 +420,7 @@ c %----------------%
|
||||
numr = ddot(n, v(1,j), 1, ax, 1)
|
||||
numi = ddot(n, v(1,j+1), 1, ax, 1)
|
||||
call av(n, v(1,j+1), ax)
|
||||
numr = numr + ddot(n,v(1,j+1),1,ax,1)
|
||||
numr = numr + ddot(n,v(1,j+1),1,ax,1)
|
||||
numi = -numi + ddot(n,v(1,j),1,ax,1)
|
||||
c
|
||||
c %----------------%
|
||||
@@ -431,7 +431,7 @@ c
|
||||
denr = ddot(n, v(1,j), 1, ax, 1)
|
||||
deni = ddot(n, v(1,j+1), 1, ax, 1)
|
||||
call mv(n, v(1,j+1), ax)
|
||||
denr = denr + ddot(n,v(1,j+1),1,ax,1)
|
||||
denr = denr + ddot(n,v(1,j+1),1,ax,1)
|
||||
deni = -deni + ddot(n,v(1,j),1, ax,1)
|
||||
c
|
||||
c %----------------%
|
||||
@@ -452,7 +452,7 @@ c | the conjugate pair by taking |
|
||||
c | the conjugate of the last |
|
||||
c | eigenvalue computed. |
|
||||
c %------------------------------%
|
||||
c
|
||||
c
|
||||
d(j,1) = d(j-1,1)
|
||||
d(j,2) = -d(j-1,2)
|
||||
first = .true.
|
||||
@@ -475,7 +475,7 @@ c | tolerance) |
|
||||
c %---------------------------%
|
||||
c
|
||||
first = .true.
|
||||
do 80 j=1, nconv
|
||||
do 80 j=1, nconv
|
||||
c
|
||||
if (d(j,2) .eq. zero) then
|
||||
c
|
||||
@@ -495,9 +495,9 @@ c %------------------------%
|
||||
c | Ritz value is complex |
|
||||
c | Residual of one Ritz |
|
||||
c | value of the conjugate |
|
||||
c | pair is computed. |
|
||||
c | pair is computed. |
|
||||
c %------------------------%
|
||||
c
|
||||
c
|
||||
call av(n, v(1,j), ax)
|
||||
call mv(n, v(1,j), mx)
|
||||
call daxpy(n, -d(j,1), mx, 1, ax, 1)
|
||||
@@ -527,7 +527,7 @@ c
|
||||
call dmout(6, nconv, 3, d, maxncv, -6,
|
||||
& 'Ritz values (Real,Imag) and relative residuals')
|
||||
c
|
||||
end if
|
||||
end if
|
||||
c
|
||||
c %-------------------------------------------%
|
||||
c | Print additional convergence information. |
|
||||
@@ -538,11 +538,11 @@ c
|
||||
print *, ' Maximum number of iterations reached.'
|
||||
print *, ' '
|
||||
else if ( info .eq. 3) then
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
print *, ' No shifts could be applied during implicit',
|
||||
& ' Arnoldi update, try increasing NCV.'
|
||||
print *, ' '
|
||||
end if
|
||||
end if
|
||||
c
|
||||
print *, ' '
|
||||
print *, ' _NDRV5 '
|
||||
@@ -553,8 +553,8 @@ c
|
||||
print *, ' The number of Arnoldi vectors generated',
|
||||
& ' (NCV) is ', ncv
|
||||
print *, ' What portion of the spectrum: ', which
|
||||
print *, ' The number of converged Ritz values is ',
|
||||
& nconv
|
||||
print *, ' The number of converged Ritz values is ',
|
||||
& nconv
|
||||
print *, ' The number of Implicit Arnoldi update',
|
||||
& ' iterations taken is ', iparam(3)
|
||||
print *, ' The number of OP*x is ', iparam(9)
|
||||
@@ -570,7 +570,7 @@ c
|
||||
9000 continue
|
||||
c
|
||||
end
|
||||
c
|
||||
c
|
||||
c==========================================================================
|
||||
c
|
||||
c matrix vector multiplication subroutine
|
||||
@@ -578,25 +578,25 @@ c
|
||||
subroutine mv (n, v, w)
|
||||
integer n, j
|
||||
Double precision
|
||||
& v(n), w(n), one, four
|
||||
& v(n), w(n), one, four
|
||||
parameter (one = 1.0D+0, four = 4.0D+0)
|
||||
c
|
||||
c Compute the matrix vector multiplication y<---M*x
|
||||
c where M is a n by n symmetric tridiagonal matrix with 4 on the
|
||||
c where M is a n by n symmetric tridiagonal matrix with 4 on the
|
||||
c diagonal, 1 on the subdiagonal and superdiagonal.
|
||||
c
|
||||
c
|
||||
w(1) = four*v(1) + one*v(2)
|
||||
do 10 j = 2,n-1
|
||||
w(j) = one*v(j-1) + four*v(j) + one*v(j+1)
|
||||
10 continue
|
||||
w(n) = one*v(n-1) + four*v(n)
|
||||
w(j) = one*v(j-1) + four*v(j) + one*v(j+1)
|
||||
10 continue
|
||||
w(n) = one*v(n-1) + four*v(n)
|
||||
return
|
||||
end
|
||||
c------------------------------------------------------------------
|
||||
subroutine av (n, v, w)
|
||||
integer n, j
|
||||
Double precision
|
||||
& v(n), w(n), three, two
|
||||
Double precision
|
||||
& v(n), w(n), three, two
|
||||
parameter (three = 3.0D+0, two = 2.0D+0)
|
||||
c
|
||||
c Compute the matrix vector multiplication y<---A*x
|
||||
|
||||
+71
-71
@@ -8,9 +8,9 @@ c
|
||||
c\Example-6
|
||||
c
|
||||
c ... Suppose we want to solve A*x = lambda*B*x in shift-invert mode
|
||||
c The matrix A is the tridiagonal matrix with 2 on the diagonal,
|
||||
c -2 on the subdiagonal and 3 on the superdiagonal. The matrix M
|
||||
c is the tridiagonal matrix with 4 on the diagonal and 1 on the
|
||||
c The matrix A is the tridiagonal matrix with 2 on the diagonal,
|
||||
c -2 on the subdiagonal and 3 on the superdiagonal. The matrix M
|
||||
c is the tridiagonal matrix with 4 on the diagonal and 1 on the
|
||||
c off-diagonals.
|
||||
c ... The shift sigma is a complex number (sigmar, sigmai).
|
||||
c ... OP = Imaginary_Part{inv[A-(SIGMAR,SIGMAI)*M]*M and B = M.
|
||||
@@ -32,15 +32,15 @@ c av Matrix vector subroutine that computes A*x.
|
||||
c mv Matrix vector subroutine that computes M*x.
|
||||
c
|
||||
c\Author
|
||||
c Richard Lehoucq
|
||||
c Danny Sorensen
|
||||
c Chao Yang
|
||||
c Dept. of Computational &
|
||||
c Applied Mathematics
|
||||
c Rice University
|
||||
c Houston, Texas
|
||||
c Richard Lehoucq
|
||||
c Danny Sorensen
|
||||
c Chao Yang
|
||||
c Dept. of Computational &
|
||||
c Applied Mathematics
|
||||
c Rice University
|
||||
c Houston, Texas
|
||||
c
|
||||
c\SCCS Information: @(#)
|
||||
c\SCCS Information: @(#)
|
||||
c FILE: ndrv6.F SID: 2.5 DATE OF SID: 10/17/00 RELEASE: 2
|
||||
c
|
||||
c\Remarks
|
||||
@@ -59,7 +59,7 @@ c | MAXNCV: Maximum NCV allowed |
|
||||
c %-----------------------------%
|
||||
c
|
||||
integer maxn, maxnev, maxncv, ldv
|
||||
parameter (maxn=256, maxnev=10, maxncv=25,
|
||||
parameter (maxn=256, maxnev=10, maxncv=25,
|
||||
& ldv=maxn )
|
||||
c
|
||||
c %--------------%
|
||||
@@ -73,7 +73,7 @@ c
|
||||
& v(ldv,maxncv), workd(3*maxn),
|
||||
& workev(3*maxncv),
|
||||
& workl(3*maxncv*maxncv+6*maxncv)
|
||||
Complex*16
|
||||
Complex*16
|
||||
& cdd(maxn), cdl(maxn), cdu(maxn),
|
||||
& cdu2(maxn), ctemp(maxn)
|
||||
c
|
||||
@@ -86,16 +86,16 @@ c
|
||||
& nconv, maxitr, ishfts, mode
|
||||
Double precision
|
||||
& tol, numr, numi, denr, deni, sigmar, sigmai
|
||||
Complex*16
|
||||
Complex*16
|
||||
& c1, c2, c3
|
||||
logical first, rvec
|
||||
c
|
||||
logical first, rvec
|
||||
c
|
||||
c %-----------------------------%
|
||||
c | BLAS & LAPACK routines used |
|
||||
c %-----------------------------%
|
||||
c
|
||||
external zgttrf, zgttrs
|
||||
Double precision
|
||||
Double precision
|
||||
& ddot, dnrm2, dlapy2
|
||||
external ddot, dnrm2, dlapy2
|
||||
c
|
||||
@@ -127,14 +127,14 @@ c | to 'LM'. The user can modify NEV, NCV, SIGMA to |
|
||||
c | solve problems of different sizes, and to get |
|
||||
c | different parts of the spectrum. However, The |
|
||||
c | following conditions must be satisfied: |
|
||||
c | N <= MAXN, |
|
||||
c | N <= MAXN, |
|
||||
c | NEV <= MAXNEV, |
|
||||
c | NEV + 2 <= NCV <= MAXNCV |
|
||||
c | NEV + 2 <= NCV <= MAXNCV |
|
||||
c %----------------------------------------------------%
|
||||
c
|
||||
n = 100
|
||||
nev = 4
|
||||
ncv = 20
|
||||
n = 100
|
||||
nev = 4
|
||||
ncv = 20
|
||||
if ( n .gt. maxn ) then
|
||||
print *, ' ERROR with _NDRV6: N is greater than MAXN '
|
||||
go to 9000
|
||||
@@ -148,7 +148,7 @@ c
|
||||
bmat = 'G'
|
||||
which = 'LM'
|
||||
sigmar = 4.0D-1
|
||||
sigmai = 6.0D-1
|
||||
sigmai = 6.0D-1
|
||||
c
|
||||
c %----------------------------------------------------%
|
||||
c | Construct C = A - (SIGMAR,SIGMAI)*M in complex |
|
||||
@@ -166,12 +166,12 @@ c
|
||||
c3 = dcmplx( 3.0D+0-sigmar, -sigmai)
|
||||
c
|
||||
do 10 j = 1, n-1
|
||||
cdl(j) = c1
|
||||
cdl(j) = c1
|
||||
cdd(j) = c2
|
||||
cdu(j) = c3
|
||||
10 continue
|
||||
cdd(n) = c2
|
||||
c
|
||||
10 continue
|
||||
cdd(n) = c2
|
||||
c
|
||||
call zgttrf(n, cdl, cdd, cdu, cdu2, ipiv, ierr)
|
||||
if ( ierr .ne. 0 ) then
|
||||
print*, ' '
|
||||
@@ -191,8 +191,8 @@ c | Setting INFO=0 indicates that a random vector is |
|
||||
c | generated in DNAUPD to start the Arnoldi iteration. |
|
||||
c %-----------------------------------------------------%
|
||||
c
|
||||
lworkl = 3*ncv**2+6*ncv
|
||||
tol = zero
|
||||
lworkl = 3*ncv**2+6*ncv
|
||||
tol = zero
|
||||
ido = 0
|
||||
info = 0
|
||||
c
|
||||
@@ -211,31 +211,31 @@ c
|
||||
mode = 3
|
||||
c
|
||||
iparam(1) = ishfts
|
||||
iparam(3) = maxitr
|
||||
iparam(3) = maxitr
|
||||
iparam(7) = mode
|
||||
c
|
||||
c %------------------------------------------%
|
||||
c | M A I N L O O P(Reverse communication) |
|
||||
c | M A I N L O O P(Reverse communication) |
|
||||
c %------------------------------------------%
|
||||
c
|
||||
20 continue
|
||||
c
|
||||
c %---------------------------------------------%
|
||||
c | Repeatedly call the routine DNAUPD and take |
|
||||
c | Repeatedly call the routine DNAUPD and take |
|
||||
c | actions indicated by parameter IDO until |
|
||||
c | either convergence is indicated or maxitr |
|
||||
c | has been exceeded. |
|
||||
c %---------------------------------------------%
|
||||
c
|
||||
call dnaupd ( ido, bmat, n, which, nev, tol, resid,
|
||||
& ncv, v, ldv, iparam, ipntr, workd,
|
||||
call dnaupd ( ido, bmat, n, which, nev, tol, resid,
|
||||
& ncv, v, ldv, iparam, ipntr, workd,
|
||||
& workl, lworkl, info )
|
||||
c
|
||||
|
||||
if (ido .eq. -1) then
|
||||
c
|
||||
c %------------------------------------------------------------%
|
||||
c | Perform |
|
||||
c | Perform |
|
||||
c | y <--- OP*x = Imaginary_Part{inv[A-(SIGMAR,SIGMAI)*M]*M*x} |
|
||||
c | to force starting vector into the range of OP. The user |
|
||||
c | should supply his/her own matrix vector multiplication |
|
||||
@@ -250,14 +250,14 @@ c
|
||||
ctemp(j) = dcmplx(workd(ipntr(2)+j-1))
|
||||
30 continue
|
||||
c
|
||||
call zgttrs('N', n, 1, cdl, cdd, cdu, cdu2, ipiv,
|
||||
call zgttrs('N', n, 1, cdl, cdd, cdu, cdu2, ipiv,
|
||||
& ctemp, maxn, ierr)
|
||||
if ( ierr .ne. 0 ) then
|
||||
print*, ' '
|
||||
print*, ' ERROR with _gttrs in _NDRV6.'
|
||||
print*, ' '
|
||||
go to 9000
|
||||
end if
|
||||
end if
|
||||
do 40 j = 1, n
|
||||
workd(ipntr(2)+j-1) = dimag(ctemp(j))
|
||||
40 continue
|
||||
@@ -282,14 +282,14 @@ c
|
||||
do 50 j = 1,n
|
||||
ctemp(j) = dcmplx(workd(ipntr(3)+j-1))
|
||||
50 continue
|
||||
call zgttrs ('N', n, 1, cdl, cdd, cdu, cdu2, ipiv,
|
||||
call zgttrs ('N', n, 1, cdl, cdd, cdu, cdu2, ipiv,
|
||||
& ctemp, maxn, ierr)
|
||||
if ( ierr .ne. 0 ) then
|
||||
print*, ' '
|
||||
print*, ' ERROR with _gttrs in _NDRV6.'
|
||||
print*, ' '
|
||||
go to 9000
|
||||
end if
|
||||
end if
|
||||
do 60 j = 1, n
|
||||
workd(ipntr(2)+j-1) = dimag(ctemp(j))
|
||||
60 continue
|
||||
@@ -335,24 +335,24 @@ c
|
||||
print *, ' '
|
||||
print *, ' Error with _naupd, info = ',info
|
||||
print *, ' Check the documentation of _naupd.'
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
c
|
||||
else
|
||||
else
|
||||
c
|
||||
c %-------------------------------------------%
|
||||
c | No fatal errors occurred. |
|
||||
c | Post-Process using DNEUPD. |
|
||||
c | |
|
||||
c | Computed eigenvalues may be extracted. |
|
||||
c | Computed eigenvalues may be extracted. |
|
||||
c | |
|
||||
c | Eigenvectors may also be computed now if |
|
||||
c | desired. (indicated by rvec = .true.) |
|
||||
c | desired. (indicated by rvec = .true.) |
|
||||
c %-------------------------------------------%
|
||||
c
|
||||
rvec = .true.
|
||||
call dneupd ( rvec, 'A', select, d, d(1,2), v, ldv,
|
||||
& sigmar, sigmai, workev, bmat, n, which, nev, tol,
|
||||
& resid, ncv, v, ldv, iparam, ipntr, workd,
|
||||
call dneupd ( rvec, 'A', select, d, d(1,2), v, ldv,
|
||||
& sigmar, sigmai, workev, bmat, n, which, nev, tol,
|
||||
& resid, ncv, v, ldv, iparam, ipntr, workd,
|
||||
& workl, lworkl, ierr )
|
||||
c
|
||||
c %-----------------------------------------------%
|
||||
@@ -368,16 +368,16 @@ c | the eigenvalues in D is returned in V. |
|
||||
c %-----------------------------------------------%
|
||||
c
|
||||
if ( ierr .ne. 0) then
|
||||
c
|
||||
c
|
||||
c %------------------------------------%
|
||||
c | Error condition: |
|
||||
c | Check the documentation of DNEUPD. |
|
||||
c %------------------------------------%
|
||||
c
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
print *, ' Error with _neupd, info = ', ierr
|
||||
print *, ' Check the documentation of _neupd. '
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
c
|
||||
else
|
||||
c
|
||||
@@ -393,7 +393,7 @@ c
|
||||
if ( d(j,2) .eq. zero) then
|
||||
c
|
||||
c %----------------------------%
|
||||
c | Eigenvalue is real. |
|
||||
c | Eigenvalue is real. |
|
||||
c | Compute d = x'(Ax)/x'(Mx). |
|
||||
c %----------------------------%
|
||||
c
|
||||
@@ -401,7 +401,7 @@ c
|
||||
numr = ddot(n, v(1,j), 1, ax, 1)
|
||||
call mv(n, v(1,j), ax )
|
||||
denr = ddot(n, v(1,j), 1, ax, 1)
|
||||
d(j,1) = numr / denr
|
||||
d(j,1) = numr / denr
|
||||
c
|
||||
else if (first) then
|
||||
c
|
||||
@@ -419,7 +419,7 @@ c
|
||||
numr = ddot(n, v(1,j), 1, ax, 1)
|
||||
numi = ddot(n, v(1,j+1), 1, ax, 1)
|
||||
call av(n, v(1,j+1), ax)
|
||||
numr = numr + ddot(n,v(1,j+1),1,ax,1)
|
||||
numr = numr + ddot(n,v(1,j+1),1,ax,1)
|
||||
numi = -numi + ddot(n,v(1,j),1,ax,1)
|
||||
c
|
||||
c %----------------%
|
||||
@@ -430,7 +430,7 @@ c
|
||||
denr = ddot(n, v(1,j), 1, ax, 1)
|
||||
deni = ddot(n, v(1,j+1), 1, ax, 1)
|
||||
call mv(n, v(1,j+1), ax)
|
||||
denr = denr + ddot(n,v(1,j+1),1,ax,1)
|
||||
denr = denr + ddot(n,v(1,j+1),1,ax,1)
|
||||
deni = -deni + ddot(n,v(1,j),1, ax,1)
|
||||
c
|
||||
c %----------------%
|
||||
@@ -451,7 +451,7 @@ c | the conjugate pair by taking |
|
||||
c | the conjugate of the last |
|
||||
c | eigenvalue computed. |
|
||||
c %------------------------------%
|
||||
c
|
||||
c
|
||||
d(j,1) = d(j-1,1)
|
||||
d(j,2) = -d(j-1,2)
|
||||
first = .true.
|
||||
@@ -475,7 +475,7 @@ c %---------------------------%
|
||||
c
|
||||
first = .true.
|
||||
nconv = iparam(5)
|
||||
do 80 j=1, nconv
|
||||
do 80 j=1, nconv
|
||||
c
|
||||
if (d(j,2) .eq. zero) then
|
||||
c
|
||||
@@ -495,9 +495,9 @@ c %------------------------%
|
||||
c | Ritz value is complex |
|
||||
c | Residual of one Ritz |
|
||||
c | value of the conjugate |
|
||||
c | pair is computed. |
|
||||
c | pair is computed. |
|
||||
c %------------------------%
|
||||
c
|
||||
c
|
||||
call av(n, v(1,j), ax)
|
||||
call mv(n, v(1,j), mx)
|
||||
call daxpy(n, -d(j,1), mx, 1, ax, 1)
|
||||
@@ -510,7 +510,7 @@ c
|
||||
call mv(n, v(1,j), mx)
|
||||
call daxpy(n, -d(j,2), mx, 1, ax, 1)
|
||||
d(j,3) = dlapy2( d(j,3), dnrm2(n, ax, 1) )
|
||||
d(j,3) = d(j,3) / dlapy2(d(j,1),d(j,2))
|
||||
d(j,3) = d(j,3) / dlapy2(d(j,1),d(j,2))
|
||||
d(j+1,3) = d(j,3)
|
||||
first = .false.
|
||||
else
|
||||
@@ -537,11 +537,11 @@ c
|
||||
print *, ' Maximum number of iterations reached.'
|
||||
print *, ' '
|
||||
else if ( info .eq. 3) then
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
print *, ' No shifts could be applied during implicit',
|
||||
& ' Arnoldi update, try increasing NCV.'
|
||||
print *, ' '
|
||||
end if
|
||||
end if
|
||||
c
|
||||
print *, ' '
|
||||
print *, ' _NDRV6 '
|
||||
@@ -552,8 +552,8 @@ c
|
||||
print *, ' The number of Arnoldi vectors generated',
|
||||
& ' (NCV) is ', ncv
|
||||
print *, ' What portion of the spectrum: ', which
|
||||
print *, ' The number of converged Ritz values is ',
|
||||
& nconv
|
||||
print *, ' The number of converged Ritz values is ',
|
||||
& nconv
|
||||
print *, ' The number of Implicit Arnoldi update',
|
||||
& ' iterations taken is ', iparam(3)
|
||||
print *, ' The number of OP*x is ', iparam(9)
|
||||
@@ -569,7 +569,7 @@ c
|
||||
9000 continue
|
||||
c
|
||||
end
|
||||
c
|
||||
c
|
||||
c==========================================================================
|
||||
c
|
||||
c matrix vector multiplication subroutine
|
||||
@@ -577,25 +577,25 @@ c
|
||||
subroutine mv (n, v, w)
|
||||
integer n, j
|
||||
Double precision
|
||||
& v(n), w(n), one, four
|
||||
& v(n), w(n), one, four
|
||||
parameter (one = 1.0D+0, four = 4.0D+0)
|
||||
c
|
||||
c Compute the matrix vector multiplication y<---M*x
|
||||
c where M is a n by n symmetric tridiagonal matrix with 4 on the
|
||||
c where M is a n by n symmetric tridiagonal matrix with 4 on the
|
||||
c diagonal, 1 on the subdiagonal and superdiagonal.
|
||||
c
|
||||
c
|
||||
w(1) = four*v(1) + one*v(2)
|
||||
do 10 j = 2,n-1
|
||||
w(j) = one*v(j-1) + four*v(j) + one*v(j+1)
|
||||
10 continue
|
||||
w(n) = one*v(n-1) + four*v(n)
|
||||
w(j) = one*v(j-1) + four*v(j) + one*v(j+1)
|
||||
10 continue
|
||||
w(n) = one*v(n-1) + four*v(n)
|
||||
return
|
||||
end
|
||||
c------------------------------------------------------------------
|
||||
subroutine av (n, v, w)
|
||||
integer n, j
|
||||
Double precision
|
||||
& v(n), w(n), three, two
|
||||
Double precision
|
||||
& v(n), w(n), three, two
|
||||
parameter (three = 3.0D+0, two = 2.0D+0)
|
||||
c
|
||||
c Compute the matrix vector multiplication y<---A*x
|
||||
|
||||
@@ -1,71 +0,0 @@
|
||||
#
|
||||
# makefile to run simple examples of the reverse communication
|
||||
# protocol.
|
||||
#
|
||||
# Modify if ARPACK library was built somewhere else.
|
||||
#
|
||||
# If ALIBS (defined in ../../ARmake.inc) contains the BLAS and LAPACK
|
||||
# libraries installed on your system, you DO NOT need to change this
|
||||
# makefile. OTHERWISE, you may need to modify the Makefile in the top level
|
||||
# ARPACK directory tree to include sdrv and/or ddrv in the
|
||||
# definition of the PRECISION variable, and issue 'make lib' from there.
|
||||
# For example:
|
||||
#
|
||||
# PRECISION = single double sdrv ddrv
|
||||
#
|
||||
#\SCCS Information: @(#)
|
||||
# FILE: makefile SID: 2.2 DATE OF SID: 9/24/96 RELEASE: 2
|
||||
#
|
||||
include ../../ARmake.inc
|
||||
#
|
||||
# Issue "make nonsym" to make all 12 nonsymmetric drivers.
|
||||
# Issue "make sndrv" to make 6 single precision nonsymmetric drivers.
|
||||
# Issue "make dndrv" to make 6 double precision nonsymmetric drivers.
|
||||
#
|
||||
nonsym: sndrv dndrv
|
||||
#
|
||||
#-----------------------------------------------------------------------
|
||||
# Simple nonsymmetric problem using single precision
|
||||
#
|
||||
sndrv: sndrv1 sndrv2 sndrv3 sndrv4 sndrv5 sndrv6
|
||||
|
||||
sndrv1: sndrv1.o
|
||||
$(FC) $(FFLAGS) sndrv1.o $(ALIBS) -o sndrv1
|
||||
#
|
||||
sndrv2: sndrv2.o
|
||||
$(FC) $(FFLAGS) sndrv2.o $(ALIBS) -o sndrv2
|
||||
#
|
||||
sndrv3: sndrv3.o
|
||||
$(FC) $(FFLAGS) sndrv3.o $(ALIBS) -o sndrv3
|
||||
#
|
||||
sndrv4: sndrv4.o
|
||||
$(FC) $(FFLAGS) sndrv4.o $(ALIBS) -o sndrv4
|
||||
#
|
||||
sndrv5: sndrv5.o
|
||||
$(FC) $(FFLAGS) sndrv5.o $(ALIBS) -o sndrv5
|
||||
#
|
||||
sndrv6: sndrv6.o
|
||||
$(FC) $(FFLAGS) sndrv6.o $(ALIBS) -o sndrv6
|
||||
#
|
||||
#------------------------------------------------------
|
||||
# Simple nonsymmetric problem using double precision
|
||||
#
|
||||
dndrv: dndrv1 dndrv2 dndrv3 dndrv4 dndrv5 dndrv6
|
||||
|
||||
dndrv1: dndrv1.o
|
||||
$(FC) $(FFLAGS) dndrv1.o $(ALIBS) -o dndrv1
|
||||
#
|
||||
dndrv2: dndrv2.o
|
||||
$(FC) $(FFLAGS) dndrv2.o $(ALIBS) -o dndrv2
|
||||
#
|
||||
dndrv3: dndrv3.o
|
||||
$(FC) $(FFLAGS) dndrv3.o $(ALIBS) -o dndrv3
|
||||
#
|
||||
dndrv4: dndrv4.o
|
||||
$(FC) $(FFLAGS) dndrv4.o $(ALIBS) -o dndrv4
|
||||
#
|
||||
dndrv5: dndrv5.o
|
||||
$(FC) $(FFLAGS) dndrv5.o $(ALIBS) -o dndrv5
|
||||
#
|
||||
dndrv6: dndrv6.o
|
||||
$(FC) $(FFLAGS) dndrv6.o $(ALIBS) -o dndrv6
|
||||
+56
-56
@@ -1,4 +1,4 @@
|
||||
program sndrv1
|
||||
program sndrv1
|
||||
c
|
||||
c
|
||||
c Example program to illustrate the idea of reverse communication
|
||||
@@ -9,9 +9,9 @@ c
|
||||
c\Example-1
|
||||
c ... Suppose we want to solve A*x = lambda*x in regular mode,
|
||||
c where A is obtained from the standard central difference
|
||||
c discretization of the convection-diffusion operator
|
||||
c discretization of the convection-diffusion operator
|
||||
c (Laplacian u) + rho*(du / dx)
|
||||
c on the unit square [0,1]x[0,1] with zero Dirichlet boundary
|
||||
c on the unit square [0,1]x[0,1] with zero Dirichlet boundary
|
||||
c condition.
|
||||
c
|
||||
c ... OP = A and B = I.
|
||||
@@ -30,7 +30,7 @@ c slapy2 LAPACK routine to compute sqrt(x**2+y**2) carefully.
|
||||
c saxpy Level 1 BLAS that computes y <- alpha*x+y.
|
||||
c snrm2 Level 1 BLAS that computes the norm of a vector.
|
||||
c av Matrix vector multiplication routine that computes A*x.
|
||||
c tv Matrix vector multiplication routine that computes T*x,
|
||||
c tv Matrix vector multiplication routine that computes T*x,
|
||||
c where T is a tridiagonal matrix. It is used in routine
|
||||
c av.
|
||||
c
|
||||
@@ -71,9 +71,9 @@ c
|
||||
integer iparam(11), ipntr(14)
|
||||
logical select(maxncv)
|
||||
Real
|
||||
& ax(maxn), d(maxncv,3), resid(maxn),
|
||||
& v(ldv,maxncv), workd(3*maxn),
|
||||
& workev(3*maxncv),
|
||||
& ax(maxn), d(maxncv,3), resid(maxn),
|
||||
& v(ldv,maxncv), workd(3*maxn),
|
||||
& workev(3*maxncv),
|
||||
& workl(3*maxncv*maxncv+6*maxncv)
|
||||
c
|
||||
c %---------------%
|
||||
@@ -112,12 +112,12 @@ c
|
||||
c %-----------------------%
|
||||
c | Executable Statements |
|
||||
c %-----------------------%
|
||||
c
|
||||
c
|
||||
c %--------------------------------------------------%
|
||||
c | The number NX is the number of interior points |
|
||||
c | in the discretization of the 2-dimensional |
|
||||
c | convection-diffusion operator on the unit |
|
||||
c | square with zero Dirichlet boundary condition. |
|
||||
c | square with zero Dirichlet boundary condition. |
|
||||
c | The number N(=NX*NX) is the dimension of the |
|
||||
c | matrix. A standard eigenvalue problem is |
|
||||
c | solved (BMAT = 'I'). NEV is the number of |
|
||||
@@ -128,13 +128,13 @@ c | the spectrum. However, The following |
|
||||
c | conditions must be satisfied: |
|
||||
c | N <= MAXN |
|
||||
c | NEV <= MAXNEV |
|
||||
c | NEV + 2 <= NCV <= MAXNCV |
|
||||
c %--------------------------------------------------%
|
||||
c | NEV + 2 <= NCV <= MAXNCV |
|
||||
c %--------------------------------------------------%
|
||||
c
|
||||
nx = 10
|
||||
n = nx*nx
|
||||
nx = 10
|
||||
n = nx*nx
|
||||
nev = 4
|
||||
ncv = 20
|
||||
ncv = 20
|
||||
if ( n .gt. maxn ) then
|
||||
print *, ' ERROR with _NDRV1: N is greater than MAXN '
|
||||
go to 9000
|
||||
@@ -149,18 +149,18 @@ c
|
||||
which = 'SM'
|
||||
c
|
||||
c %-----------------------------------------------------%
|
||||
c | The work array WORKL is used in SNAUPD as |
|
||||
c | The work array WORKL is used in SNAUPD as |
|
||||
c | workspace. Its dimension LWORKL is set as |
|
||||
c | illustrated below. The parameter TOL determines |
|
||||
c | the stopping criterion. If TOL<=0, machine |
|
||||
c | precision is used. The variable IDO is used for |
|
||||
c | reverse communication, and is initially set to 0. |
|
||||
c | Setting INFO=0 indicates that a random vector is |
|
||||
c | generated in SNAUPD to start the Arnoldi iteration. |
|
||||
c | generated in SNAUPD to start the Arnoldi iteration. |
|
||||
c %-----------------------------------------------------%
|
||||
c
|
||||
lworkl = 3*ncv**2+6*ncv
|
||||
tol = zero
|
||||
lworkl = 3*ncv**2+6*ncv
|
||||
tol = zero
|
||||
ido = 0
|
||||
info = 0
|
||||
c
|
||||
@@ -179,11 +179,11 @@ c
|
||||
mode = 1
|
||||
c
|
||||
iparam(1) = ishfts
|
||||
iparam(3) = maxitr
|
||||
iparam(3) = maxitr
|
||||
iparam(7) = mode
|
||||
c
|
||||
c %-------------------------------------------%
|
||||
c | M A I N L O O P (Reverse communication) |
|
||||
c | M A I N L O O P (Reverse communication) |
|
||||
c %-------------------------------------------%
|
||||
c
|
||||
10 continue
|
||||
@@ -195,8 +195,8 @@ c | either convergence is indicated or maxitr |
|
||||
c | has been exceeded. |
|
||||
c %---------------------------------------------%
|
||||
c
|
||||
call snaupd ( ido, bmat, n, which, nev, tol, resid,
|
||||
& ncv, v, ldv, iparam, ipntr, workd, workl, lworkl,
|
||||
call snaupd ( ido, bmat, n, which, nev, tol, resid,
|
||||
& ncv, v, ldv, iparam, ipntr, workd, workl, lworkl,
|
||||
& info )
|
||||
c
|
||||
if (ido .eq. -1 .or. ido .eq. 1) then
|
||||
@@ -208,7 +208,7 @@ c | The user should supply his/her own |
|
||||
c | matrix vector multiplication routine here |
|
||||
c | that takes workd(ipntr(1)) as the input |
|
||||
c | vector, and return the matrix vector |
|
||||
c | product to workd(ipntr(2)). |
|
||||
c | product to workd(ipntr(2)). |
|
||||
c %-------------------------------------------%
|
||||
c
|
||||
call av (nx, workd(ipntr(1)), workd(ipntr(2)))
|
||||
@@ -219,8 +219,8 @@ c %-----------------------------------------%
|
||||
c
|
||||
go to 10
|
||||
c
|
||||
end if
|
||||
c
|
||||
end if
|
||||
c
|
||||
c %----------------------------------------%
|
||||
c | Either we have convergence or there is |
|
||||
c | an error. |
|
||||
@@ -238,7 +238,7 @@ c
|
||||
print *, ' Check the documentation of _naupd'
|
||||
print *, ' '
|
||||
c
|
||||
else
|
||||
else
|
||||
c
|
||||
c %-------------------------------------------%
|
||||
c | No fatal errors occurred. |
|
||||
@@ -252,8 +252,8 @@ c %-------------------------------------------%
|
||||
c
|
||||
rvec = .true.
|
||||
c
|
||||
call sneupd ( rvec, 'A', select, d, d(1,2), v, ldv,
|
||||
& sigmar, sigmai, workev, bmat, n, which, nev, tol,
|
||||
call sneupd ( rvec, 'A', select, d, d(1,2), v, ldv,
|
||||
& sigmar, sigmai, workev, bmat, n, which, nev, tol,
|
||||
& resid, ncv, v, ldv, iparam, ipntr, workd, workl,
|
||||
& lworkl, ierr )
|
||||
c
|
||||
@@ -281,7 +281,7 @@ c
|
||||
print *, ' Check the documentation of _neupd. '
|
||||
print *, ' '
|
||||
c
|
||||
else
|
||||
else
|
||||
c
|
||||
first = .true.
|
||||
nconv = iparam(5)
|
||||
@@ -317,9 +317,9 @@ c %------------------------%
|
||||
c | Ritz value is complex. |
|
||||
c | Residual of one Ritz |
|
||||
c | value of the conjugate |
|
||||
c | pair is computed. |
|
||||
c | pair is computed. |
|
||||
c %------------------------%
|
||||
c
|
||||
c
|
||||
call av(nx, v(1,j), ax)
|
||||
call saxpy(n, -d(j,1), v(1,j), 1, ax, 1)
|
||||
call saxpy(n, d(j,2), v(1,j+1), 1, ax, 1)
|
||||
@@ -354,23 +354,23 @@ c
|
||||
print *, ' Maximum number of iterations reached.'
|
||||
print *, ' '
|
||||
else if ( info .eq. 3) then
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
print *, ' No shifts could be applied during implicit',
|
||||
& ' Arnoldi update, try increasing NCV.'
|
||||
print *, ' '
|
||||
end if
|
||||
end if
|
||||
c
|
||||
print *, ' '
|
||||
print *, ' _NDRV1 '
|
||||
print *, ' ====== '
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
print *, ' Size of the matrix is ', n
|
||||
print *, ' The number of Ritz values requested is ', nev
|
||||
print *, ' The number of Arnoldi vectors generated',
|
||||
& ' (NCV) is ', ncv
|
||||
print *, ' What portion of the spectrum: ', which
|
||||
print *, ' The number of converged Ritz values is ',
|
||||
& nconv
|
||||
print *, ' The number of converged Ritz values is ',
|
||||
& nconv
|
||||
print *, ' The number of Implicit Arnoldi update',
|
||||
& ' iterations taken is ', iparam(3)
|
||||
print *, ' The number of OP*x is ', iparam(9)
|
||||
@@ -386,37 +386,37 @@ c
|
||||
9000 continue
|
||||
c
|
||||
end
|
||||
c
|
||||
c
|
||||
c==========================================================================
|
||||
c
|
||||
c matrix vector subroutine
|
||||
c
|
||||
c The matrix used is the 2 dimensional convection-diffusion
|
||||
c The matrix used is the 2 dimensional convection-diffusion
|
||||
c operator discretized using central difference.
|
||||
c
|
||||
subroutine av (nx, v, w)
|
||||
integer nx, j, lo
|
||||
Real
|
||||
Real
|
||||
& v(nx*nx), w(nx*nx), one, h2
|
||||
parameter (one = 1.0E+0)
|
||||
external saxpy
|
||||
c
|
||||
c Computes w <--- OP*v, where OP is the nx*nx by nx*nx block
|
||||
c Computes w <--- OP*v, where OP is the nx*nx by nx*nx block
|
||||
c tridiagonal matrix
|
||||
c
|
||||
c | T -I |
|
||||
c | T -I |
|
||||
c |-I T -I |
|
||||
c OP = | -I T |
|
||||
c | ... -I|
|
||||
c | -I T|
|
||||
c
|
||||
c derived from the standard central difference discretization
|
||||
c of the 2 dimensional convection-diffusion operator
|
||||
c (Laplacian u) + rho*(du/dx) on a unit square with zero boundary
|
||||
c derived from the standard central difference discretization
|
||||
c of the 2 dimensional convection-diffusion operator
|
||||
c (Laplacian u) + rho*(du/dx) on a unit square with zero boundary
|
||||
c condition.
|
||||
c
|
||||
c When rho*h/2 <= 1, the discrete convection-diffusion operator
|
||||
c has real eigenvalues. When rho*h/2 > 1, it has COMPLEX
|
||||
c When rho*h/2 <= 1, the discrete convection-diffusion operator
|
||||
c has real eigenvalues. When rho*h/2 > 1, it has COMPLEX
|
||||
c eigenvalues.
|
||||
c
|
||||
c The subroutine TV is called to compute y<---T*x.
|
||||
@@ -432,7 +432,7 @@ c
|
||||
call tv(nx, v(lo+1), w(lo+1))
|
||||
call saxpy(nx, -one/h2, v(lo-nx+1), 1, w(lo+1), 1)
|
||||
call saxpy(nx, -one/h2, v(lo+nx+1), 1, w(lo+1), 1)
|
||||
10 continue
|
||||
10 continue
|
||||
c
|
||||
lo = (nx-1)*nx
|
||||
call tv(nx, v(lo+1), w(lo+1))
|
||||
@@ -443,21 +443,21 @@ c
|
||||
c=========================================================================
|
||||
subroutine tv (nx, x, y)
|
||||
c
|
||||
integer nx, j
|
||||
integer nx, j
|
||||
Real
|
||||
& x(nx), y(nx), h, h2, dd, dl, du
|
||||
c
|
||||
Real
|
||||
& one, zero, rho
|
||||
parameter (one = 1.0E+0, zero = 0.0E+0,
|
||||
parameter (one = 1.0E+0, zero = 0.0E+0,
|
||||
& rho = 0.0E+0)
|
||||
c
|
||||
c Compute the matrix vector multiplication y<---T*x
|
||||
c where T is a nx by nx tridiagonal matrix with DD on the
|
||||
c where T is a nx by nx tridiagonal matrix with DD on the
|
||||
c diagonal, DL on the subdiagonal, and DU on the superdiagonal.
|
||||
c
|
||||
c When rho*h/2 <= 1, the discrete convection-diffusion operator
|
||||
c has real eigenvalues. When rho*h/2 > 1, it has COMPLEX
|
||||
c When rho*h/2 <= 1, the discrete convection-diffusion operator
|
||||
c has real eigenvalues. When rho*h/2 > 1, it has COMPLEX
|
||||
c eigenvalues.
|
||||
c
|
||||
h = one / real(nx+1)
|
||||
@@ -465,11 +465,11 @@ c
|
||||
dd = 4.0E+0 / h2
|
||||
dl = -one / h2 - 5.0E-1*rho / h
|
||||
du = -one / h2 + 5.0E-1*rho / h
|
||||
c
|
||||
c
|
||||
y(1) = dd*x(1) + du*x(2)
|
||||
do 10 j = 2,nx-1
|
||||
y(j) = dl*x(j-1) + dd*x(j) + du*x(j+1)
|
||||
10 continue
|
||||
y(nx) = dl*x(nx-1) + dd*x(nx)
|
||||
y(j) = dl*x(j-1) + dd*x(j) + du*x(j+1)
|
||||
10 continue
|
||||
y(nx) = dl*x(nx-1) + dd*x(nx)
|
||||
return
|
||||
end
|
||||
|
||||
+49
-49
@@ -9,7 +9,7 @@ c\Example-2
|
||||
c ... Suppose we want to solve A*x = lambda*x in shift-invert mode,
|
||||
c where A is derived from the centered difference discretization
|
||||
c of the 1-dimensional convection-diffusion operator
|
||||
c (d^2u / dx^2) + rho*(du/dx)
|
||||
c (d^2u / dx^2) + rho*(du/dx)
|
||||
c on the interval [0,1] with zero Dirichlet boundary condition.
|
||||
c
|
||||
c ... The shift sigma is a real number.
|
||||
@@ -61,7 +61,7 @@ c | MAXNCV: Maximum NCV allowed |
|
||||
c %-----------------------------%
|
||||
c
|
||||
integer maxn, maxnev, maxncv, ldv
|
||||
parameter (maxn=256, maxnev=10, maxncv=25,
|
||||
parameter (maxn=256, maxnev=10, maxncv=25,
|
||||
& ldv=maxn )
|
||||
c
|
||||
c %--------------%
|
||||
@@ -97,7 +97,7 @@ c
|
||||
Real
|
||||
& one, zero, two, rho
|
||||
common /convct/ rho
|
||||
parameter (one = 1.0E+0, zero = 0.0E+0,
|
||||
parameter (one = 1.0E+0, zero = 0.0E+0,
|
||||
& two = 2.0E+0)
|
||||
c
|
||||
c %-----------------------------%
|
||||
@@ -128,14 +128,14 @@ c | 'LM'. The user can modify NEV, NCV, SIGMAR to |
|
||||
c | solve problems of different sizes, and to get |
|
||||
c | different parts of the spectrum. However, The |
|
||||
c | following conditions must be satisfied: |
|
||||
c | N <= MAXN, |
|
||||
c | N <= MAXN, |
|
||||
c | NEV <= MAXNEV, |
|
||||
c | NEV + 2 <= NCV <= MAXNCV |
|
||||
c | NEV + 2 <= NCV <= MAXNCV |
|
||||
c %--------------------------------------------------%
|
||||
c
|
||||
n = 100
|
||||
nev = 4
|
||||
ncv = 20
|
||||
nev = 4
|
||||
ncv = 20
|
||||
if ( n .gt. maxn ) then
|
||||
print *, ' ERROR with _NDRV2: N is greater than MAXN '
|
||||
go to 9000
|
||||
@@ -148,8 +148,8 @@ c
|
||||
end if
|
||||
bmat = 'I'
|
||||
which = 'LM'
|
||||
sigmar = 1.0E+0
|
||||
sigmai = 0.0E+0
|
||||
sigmar = 1.0E+0
|
||||
sigmai = 0.0E+0
|
||||
c
|
||||
c %----------------------------------------------------%
|
||||
c | Construct C = A - SIGMA*I in real arithmetic, and |
|
||||
@@ -157,7 +157,7 @@ c | factor C in real arithmetic using LAPACK |
|
||||
c | subroutine sgttrf. The matrix A is chosen to be |
|
||||
c | the tridiagonal matrix derived from standard |
|
||||
c | central difference of the 1-d convection diffusion |
|
||||
c | operator u" + rho*u' on the interval [0, 1] with |
|
||||
c | operator u" + rho*u' on the interval [0, 1] with |
|
||||
c | zero Dirichlet boundary condition. |
|
||||
c %----------------------------------------------------%
|
||||
c
|
||||
@@ -165,25 +165,25 @@ c
|
||||
h = one / real(n+1)
|
||||
s = rho*h / two
|
||||
c
|
||||
s1 = -one-s
|
||||
s1 = -one-s
|
||||
s2 = two - sigmar
|
||||
s3 = -one+s
|
||||
s3 = -one+s
|
||||
c
|
||||
do 10 j = 1, n-1
|
||||
dl(j) = s1
|
||||
dl(j) = s1
|
||||
dd(j) = s2
|
||||
du(j) = s3
|
||||
10 continue
|
||||
dd(n) = s2
|
||||
c
|
||||
10 continue
|
||||
dd(n) = s2
|
||||
c
|
||||
call sgttrf(n, dl, dd, du, du2, ipiv, ierr)
|
||||
if ( ierr .ne. 0 ) then
|
||||
print*, ' '
|
||||
print*, ' '
|
||||
print*, ' ERROR with _gttrf in _NDRV2.'
|
||||
print*, ' '
|
||||
go to 9000
|
||||
end if
|
||||
c
|
||||
c
|
||||
c %-----------------------------------------------------%
|
||||
c | The work array WORKL is used in SNAUPD as |
|
||||
c | workspace. Its dimension LWORKL is set as |
|
||||
@@ -195,8 +195,8 @@ c | Setting INFO=0 indicates that a random vector is |
|
||||
c | generated in SNAUPD to start the Arnoldi iteration. |
|
||||
c %-----------------------------------------------------%
|
||||
c
|
||||
lworkl = 3*ncv**2+6*ncv
|
||||
tol = zero
|
||||
lworkl = 3*ncv**2+6*ncv
|
||||
tol = zero
|
||||
ido = 0
|
||||
info = 0
|
||||
c
|
||||
@@ -213,26 +213,26 @@ c
|
||||
ishfts = 1
|
||||
maxitr = 300
|
||||
mode = 3
|
||||
|
||||
iparam(1) = ishfts
|
||||
iparam(3) = maxitr
|
||||
iparam(7) = mode
|
||||
|
||||
iparam(1) = ishfts
|
||||
iparam(3) = maxitr
|
||||
iparam(7) = mode
|
||||
c
|
||||
c %-------------------------------------------%
|
||||
c | M A I N L O O P (Reverse communication) |
|
||||
c | M A I N L O O P (Reverse communication) |
|
||||
c %-------------------------------------------%
|
||||
c
|
||||
20 continue
|
||||
c
|
||||
c %---------------------------------------------%
|
||||
c | Repeatedly call the routine SNAUPD and take |
|
||||
c | Repeatedly call the routine SNAUPD and take |
|
||||
c | actions indicated by parameter IDO until |
|
||||
c | either convergence is indicated or maxitr |
|
||||
c | has been exceeded. |
|
||||
c %---------------------------------------------%
|
||||
c
|
||||
call snaupd ( ido, bmat, n, which, nev, tol, resid,
|
||||
& ncv, v, ldv, iparam, ipntr, workd, workl, lworkl,
|
||||
call snaupd ( ido, bmat, n, which, nev, tol, resid,
|
||||
& ncv, v, ldv, iparam, ipntr, workd, workl, lworkl,
|
||||
& info )
|
||||
c
|
||||
if ( ido .eq. -1 .or. ido .eq. 1) then
|
||||
@@ -247,10 +247,10 @@ c %-------------------------------------------%
|
||||
c
|
||||
call scopy( n, workd(ipntr(1)), 1, workd(ipntr(2)), 1)
|
||||
c
|
||||
call sgttrs('N', n, 1, dl, dd, du, du2, ipiv,
|
||||
& workd(ipntr(2)), n, ierr)
|
||||
call sgttrs('N', n, 1, dl, dd, du, du2, ipiv,
|
||||
& workd(ipntr(2)), n, ierr)
|
||||
if ( ierr .ne. 0 ) then
|
||||
print*, ' '
|
||||
print*, ' '
|
||||
print*, ' ERROR with _gttrs in _NDRV2.'
|
||||
print*, ' '
|
||||
go to 9000
|
||||
@@ -279,26 +279,26 @@ c
|
||||
print *, ' '
|
||||
print *, ' Error with _naupd, info = ', info
|
||||
print *, ' Check the documentation in _naupd.'
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
c
|
||||
else
|
||||
else
|
||||
c
|
||||
c %-------------------------------------------%
|
||||
c | No fatal errors occurred. |
|
||||
c | Post-Process using SNEUPD. |
|
||||
c | |
|
||||
c | Computed eigenvalues may be extracted. |
|
||||
c | Computed eigenvalues may be extracted. |
|
||||
c | |
|
||||
c | Eigenvectors may also be computed now if |
|
||||
c | desired. (indicated by rvec = .true.) |
|
||||
c | desired. (indicated by rvec = .true.) |
|
||||
c %-------------------------------------------%
|
||||
c
|
||||
c
|
||||
rvec = .true.
|
||||
c
|
||||
call sneupd ( rvec, 'A', select, d, d(1,2), v, ldv,
|
||||
& sigmar, sigmai, workev, bmat, n, which, nev, tol,
|
||||
& resid, ncv, v, ldv, iparam, ipntr, workd,
|
||||
& workl, lworkl, ierr )
|
||||
call sneupd ( rvec, 'A', select, d, d(1,2), v, ldv,
|
||||
& sigmar, sigmai, workev, bmat, n, which, nev, tol,
|
||||
& resid, ncv, v, ldv, iparam, ipntr, workd,
|
||||
& workl, lworkl, ierr )
|
||||
c
|
||||
c %-----------------------------------------------%
|
||||
c | The real part of the eigenvalue is returned |
|
||||
@@ -319,11 +319,11 @@ c | Error condition: |
|
||||
c | Check the documentation of SNEUPD. |
|
||||
c %------------------------------------%
|
||||
c
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
print *, ' Error with _neupd, info = ', ierr
|
||||
print *, ' Check the documentation of _neupd. '
|
||||
print *, ' '
|
||||
c
|
||||
print *, ' '
|
||||
c
|
||||
else
|
||||
c
|
||||
first = .true.
|
||||
@@ -360,9 +360,9 @@ c %------------------------%
|
||||
c | Ritz value is complex |
|
||||
c | Residual of one Ritz |
|
||||
c | value of the conjugate |
|
||||
c | pair is computed. |
|
||||
c | pair is computed. |
|
||||
c %------------------------%
|
||||
c
|
||||
c
|
||||
call av(n, v(1,j), ax)
|
||||
call saxpy(n, -d(j,1), v(1,j), 1, ax, 1)
|
||||
call saxpy(n, d(j,2), v(1,j+1), 1, ax, 1)
|
||||
@@ -397,11 +397,11 @@ c
|
||||
print *, ' Maximum number of iterations reached.'
|
||||
print *, ' '
|
||||
else if ( info .eq. 3) then
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
print *, ' No shifts could be applied during implicit',
|
||||
& ' Arnoldi update, try increasing NCV.'
|
||||
print *, ' '
|
||||
end if
|
||||
end if
|
||||
c
|
||||
print *, ' '
|
||||
print *, ' _NDRV2 '
|
||||
@@ -412,8 +412,8 @@ c
|
||||
print *, ' The number of Arnoldi vectors generated',
|
||||
& ' (NCV) is ', ncv
|
||||
print *, ' What portion of the spectrum: ', which
|
||||
print *, ' The number of converged Ritz values is ',
|
||||
& nconv
|
||||
print *, ' The number of converged Ritz values is ',
|
||||
& nconv
|
||||
print *, ' The number of Implicit Arnoldi update',
|
||||
& ' iterations taken is ', iparam(3)
|
||||
print *, ' The number of OP*x is ', iparam(9)
|
||||
|
||||
+51
-51
@@ -15,7 +15,7 @@ c using linear elements.
|
||||
c
|
||||
c ... So OP = inv[M]*A and B = M.
|
||||
c
|
||||
c ... Use mode 2 of SNAUPD.
|
||||
c ... Use mode 2 of SNAUPD.
|
||||
c
|
||||
c\BeginLib
|
||||
c
|
||||
@@ -60,7 +60,7 @@ c | MAXNCV: Maximum NCV allowed |
|
||||
c %-----------------------------%
|
||||
c
|
||||
integer maxn, maxnev, maxncv, ldv
|
||||
parameter (maxn=256, maxnev=10, maxncv=25,
|
||||
parameter (maxn=256, maxnev=10, maxncv=25,
|
||||
& ldv=maxn )
|
||||
c
|
||||
c %--------------%
|
||||
@@ -71,7 +71,7 @@ c
|
||||
logical select(maxncv)
|
||||
Real
|
||||
& ax(maxn), mx(maxn), d(maxncv, 3), resid(maxn),
|
||||
& v(ldv,maxncv), workd(3*maxn),
|
||||
& v(ldv,maxncv), workd(3*maxn),
|
||||
& workev(3*maxncv),
|
||||
& workl(3*maxncv*maxncv+6*maxncv),
|
||||
& md(maxn), me(maxn-1)
|
||||
@@ -83,7 +83,7 @@ c
|
||||
character bmat*1, which*2
|
||||
integer ido, n, nev, ncv, lworkl, info, ierr, j,
|
||||
& nconv, maxitr, ishfts, mode
|
||||
Real
|
||||
Real
|
||||
& tol, sigmar, sigmai, h
|
||||
logical first, rvec
|
||||
c
|
||||
@@ -91,14 +91,14 @@ c %------------%
|
||||
c | Parameters |
|
||||
c %------------%
|
||||
c
|
||||
Real
|
||||
Real
|
||||
& zero, one
|
||||
parameter (zero = 0.0E+0, one = 1.0E+0)
|
||||
c
|
||||
c %-----------------------------%
|
||||
c | BLAS & LAPACK routines used |
|
||||
c %-----------------------------%
|
||||
Real
|
||||
Real
|
||||
& snrm2, slapy2
|
||||
external saxpy, snrm2, spttrf, spttrs, slapy2
|
||||
c
|
||||
@@ -125,9 +125,9 @@ c | NEV <= MAXNEV, |
|
||||
c | NEV + 2 <= NCV <= MAXNCV |
|
||||
c %----------------------------------------------------%
|
||||
c
|
||||
n = 100
|
||||
nev = 4
|
||||
ncv = 20
|
||||
n = 100
|
||||
nev = 4
|
||||
ncv = 20
|
||||
if ( n .gt. maxn ) then
|
||||
print *, ' ERROR with _NDRV3: N is greater than MAXN '
|
||||
go to 9000
|
||||
@@ -148,16 +148,16 @@ c %------------------------------------------------%
|
||||
c
|
||||
h = one / real(n+1)
|
||||
do 20 j = 1, n-1
|
||||
md(j) = 4.0E+0*h
|
||||
me(j) = one*h
|
||||
20 continue
|
||||
md(j) = 4.0E+0*h
|
||||
me(j) = one*h
|
||||
20 continue
|
||||
md(n) = 4.0E+0*h
|
||||
c
|
||||
c
|
||||
call spttrf(n, md, me, ierr)
|
||||
if ( ierr .ne. 0 ) then
|
||||
print*, ' '
|
||||
print*, ' ERROR with _pttrf. '
|
||||
print*, ' '
|
||||
print*, ' ERROR with _pttrf. '
|
||||
print*, ' '
|
||||
go to 9000
|
||||
end if
|
||||
c
|
||||
@@ -172,8 +172,8 @@ c | Setting INFO=0 indicates that a random vector is |
|
||||
c | generated in SNAUPD to start the Arnoldi iteration. |
|
||||
c %-----------------------------------------------------%
|
||||
c
|
||||
lworkl = 3*ncv**2+6*ncv
|
||||
tol = 0.0
|
||||
lworkl = 3*ncv**2+6*ncv
|
||||
tol = 0.0
|
||||
ido = 0
|
||||
info = 0
|
||||
c
|
||||
@@ -191,9 +191,9 @@ c
|
||||
maxitr = 300
|
||||
mode = 2
|
||||
c
|
||||
iparam(1) = ishfts
|
||||
iparam(3) = maxitr
|
||||
iparam(7) = mode
|
||||
iparam(1) = ishfts
|
||||
iparam(3) = maxitr
|
||||
iparam(7) = mode
|
||||
c
|
||||
c %-------------------------------------------%
|
||||
c | M A I N L O O P (Reverse communication) |
|
||||
@@ -202,14 +202,14 @@ c
|
||||
10 continue
|
||||
c
|
||||
c %---------------------------------------------%
|
||||
c | Repeatedly call the routine SNAUPD and take |
|
||||
c | Repeatedly call the routine SNAUPD and take |
|
||||
c | actions indicated by parameter IDO until |
|
||||
c | either convergence is indicated or maxitr |
|
||||
c | has been exceeded. |
|
||||
c %---------------------------------------------%
|
||||
c
|
||||
call snaupd ( ido, bmat, n, which, nev, tol, resid,
|
||||
& ncv, v, ldv, iparam, ipntr, workd,
|
||||
call snaupd ( ido, bmat, n, which, nev, tol, resid,
|
||||
& ncv, v, ldv, iparam, ipntr, workd,
|
||||
& workl, lworkl, info )
|
||||
c
|
||||
if (ido .eq. -1 .or. ido .eq. 1) then
|
||||
@@ -228,8 +228,8 @@ c
|
||||
call spttrs(n, 1, md, me, workd(ipntr(2)), n,
|
||||
& ierr)
|
||||
if ( ierr .ne. 0 ) then
|
||||
print*, ' '
|
||||
print*, ' ERROR with _pttrs. '
|
||||
print*, ' '
|
||||
print*, ' ERROR with _pttrs. '
|
||||
print*, ' '
|
||||
go to 9000
|
||||
end if
|
||||
@@ -264,7 +264,7 @@ c
|
||||
c %-----------------------------------------%
|
||||
c | Either we have convergence, or there is |
|
||||
c | an error. |
|
||||
c %-----------------------------------------%
|
||||
c %-----------------------------------------%
|
||||
c
|
||||
if ( info .lt. 0 ) then
|
||||
c
|
||||
@@ -276,22 +276,22 @@ c
|
||||
print *, ' '
|
||||
print *, ' Error with _naupd, info = ', info
|
||||
print *, ' Check the documentation of _naupd.'
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
c
|
||||
else
|
||||
else
|
||||
c
|
||||
c %-------------------------------------------%
|
||||
c | No fatal errors occurred. |
|
||||
c | Post-Process using SNEUPD. |
|
||||
c | |
|
||||
c | Computed eigenvalues may be extracted. |
|
||||
c | Computed eigenvalues may be extracted. |
|
||||
c | |
|
||||
c | Eigenvectors may also be computed now if |
|
||||
c | desired. (indicated by rvec = .true.) |
|
||||
c | desired. (indicated by rvec = .true.) |
|
||||
c %-------------------------------------------%
|
||||
c
|
||||
rvec = .true.
|
||||
call sneupd ( rvec, 'A', select, d, d(1,2), v, ldv,
|
||||
call sneupd ( rvec, 'A', select, d, d(1,2), v, ldv,
|
||||
& sigmar, sigmai, workev, bmat, n, which, nev, tol,
|
||||
& resid, ncv, v, ldv, iparam, ipntr, workd,
|
||||
& workl, lworkl, ierr )
|
||||
@@ -314,13 +314,13 @@ c %------------------------------------%
|
||||
c | Error condition: |
|
||||
c | Check the documentation of SNEUPD. |
|
||||
c %------------------------------------%
|
||||
c
|
||||
print *, ' '
|
||||
c
|
||||
print *, ' '
|
||||
print *, ' Error with _neupd, info = ', ierr
|
||||
print *, ' Check the documentation of _neupd'
|
||||
print *, ' '
|
||||
c
|
||||
else
|
||||
else
|
||||
c
|
||||
first = .true.
|
||||
nconv = iparam(5)
|
||||
@@ -399,11 +399,11 @@ c
|
||||
print *, ' Maximum number of iterations reached.'
|
||||
print *, ' '
|
||||
else if ( info .eq. 3) then
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
print *, ' No shifts could be applied during implicit',
|
||||
& ' Arnoldi update, try increasing NCV.'
|
||||
print *, ' '
|
||||
end if
|
||||
end if
|
||||
c
|
||||
print *, ' '
|
||||
print *, ' _NDRV3 '
|
||||
@@ -414,8 +414,8 @@ c
|
||||
print *, ' The number of Arnoldi vectors generated',
|
||||
& ' (NCV) is ', ncv
|
||||
print *, ' What portion of the spectrum: ', which
|
||||
print *, ' The number of converged Ritz values is ',
|
||||
& nconv
|
||||
print *, ' The number of converged Ritz values is ',
|
||||
& nconv
|
||||
print *, ' The number of Implicit Arnoldi update',
|
||||
& ' iterations taken is ', iparam(3)
|
||||
print *, ' The number of OP*x is ', iparam(9)
|
||||
@@ -431,16 +431,16 @@ c
|
||||
9000 continue
|
||||
c
|
||||
end
|
||||
c
|
||||
c
|
||||
c==========================================================================
|
||||
c
|
||||
c matrix vector multiplication subroutine
|
||||
c
|
||||
subroutine av (n, v, w)
|
||||
integer n, j
|
||||
Real
|
||||
& v(n), w(n), one, two, dd, dl, du, s, h, rho
|
||||
parameter ( rho = 1.0E+1, one = 1.0E+0,
|
||||
Real
|
||||
& v(n), w(n), one, two, dd, dl, du, s, h, rho
|
||||
parameter ( rho = 1.0E+1, one = 1.0E+0,
|
||||
& two = 2.0E+0)
|
||||
c
|
||||
c Compute the matrix vector multiplication y<---A*x
|
||||
@@ -458,27 +458,27 @@ c
|
||||
c
|
||||
w(1) = dd*v(1) + du*v(2)
|
||||
do 10 j = 2,n-1
|
||||
w(j) = dl*v(j-1) + dd*v(j) + du*v(j+1)
|
||||
10 continue
|
||||
w(n) = dl*v(n-1) + dd*v(n)
|
||||
w(j) = dl*v(j-1) + dd*v(j) + du*v(j+1)
|
||||
10 continue
|
||||
w(n) = dl*v(n-1) + dd*v(n)
|
||||
return
|
||||
end
|
||||
c------------------------------------------------------------------------
|
||||
subroutine mv (n, v, w)
|
||||
integer n, j
|
||||
Real
|
||||
Real
|
||||
& v(n), w(n), one, four, h
|
||||
parameter ( one = 1.0E+0, four = 4.0E+0)
|
||||
c
|
||||
c Compute the matrix vector multiplication y<---M*x
|
||||
c where M is the mass matrix formed by using piecewise linear
|
||||
c where M is the mass matrix formed by using piecewise linear
|
||||
c elements on [0,1].
|
||||
c
|
||||
c
|
||||
w(1) = four*v(1) + one*v(2)
|
||||
do 10 j = 2,n-1
|
||||
w(j) = one*v(j-1) + four*v(j) + one*v(j+1)
|
||||
10 continue
|
||||
w(n) = one*v(n-1) + four*v(n)
|
||||
w(j) = one*v(j-1) + four*v(j) + one*v(j+1)
|
||||
10 continue
|
||||
w(n) = one*v(n-1) + four*v(n)
|
||||
c
|
||||
h = one / real(n+1)
|
||||
call sscal(n, h, w, 1)
|
||||
|
||||
+58
-58
@@ -1,7 +1,7 @@
|
||||
program sndrv4
|
||||
c
|
||||
c Simple program to illustrate the idea of reverse communication
|
||||
c in shift-invert mode for a generalized nonsymmetric eigenvalue
|
||||
c in shift-invert mode for a generalized nonsymmetric eigenvalue
|
||||
c problem.
|
||||
c
|
||||
c We implement example four of ex-nonsym.doc in DOCUMENTS directory
|
||||
@@ -25,7 +25,7 @@ c
|
||||
c\Routines called:
|
||||
c snaupd ARPACK reverse communication interface routine.
|
||||
c sneupd ARPACK routine that returns Ritz values and (optionally)
|
||||
c Ritz vectors.
|
||||
c Ritz vectors.
|
||||
c sgttrf LAPACK tridiagonal factorization routine.
|
||||
c sgttrs LAPACK tridiagonal linear system solve routine.
|
||||
c slapy2 LAPACK routine to compute sqrt(x**2+y**2) carefully.
|
||||
@@ -37,15 +37,15 @@ c av Matrix vector multiplication routine that computes A*x.
|
||||
c mv Matrix vector multiplication routine that computes M*x.
|
||||
c
|
||||
c\Author
|
||||
c Richard Lehoucq
|
||||
c Danny Sorensen
|
||||
c Chao Yang
|
||||
c Dept. of Computational &
|
||||
c Applied Mathematics
|
||||
c Rice University
|
||||
c Houston, Texas
|
||||
c Richard Lehoucq
|
||||
c Danny Sorensen
|
||||
c Chao Yang
|
||||
c Dept. of Computational &
|
||||
c Applied Mathematics
|
||||
c Rice University
|
||||
c Houston, Texas
|
||||
c
|
||||
c\SCCS Information: @(#)
|
||||
c\SCCS Information: @(#)
|
||||
c FILE: ndrv4.F SID: 2.5 DATE OF SID: 10/17/00 RELEASE: 2
|
||||
c
|
||||
c\Remarks
|
||||
@@ -64,7 +64,7 @@ c | MAXNCV: Maximum NCV allowed |
|
||||
c %-----------------------------%
|
||||
c
|
||||
integer maxn, maxnev, maxncv, ldv
|
||||
parameter (maxn=256, maxnev=10, maxncv=25,
|
||||
parameter (maxn=256, maxnev=10, maxncv=25,
|
||||
& ldv=maxn )
|
||||
c
|
||||
c %--------------%
|
||||
@@ -90,13 +90,13 @@ c
|
||||
Real
|
||||
& tol, h, s,
|
||||
& sigmar, sigmai, s1, s2, s3
|
||||
logical first, rvec
|
||||
c
|
||||
logical first, rvec
|
||||
c
|
||||
c %-----------------------------%
|
||||
c | BLAS & LAPACK routines used |
|
||||
c %-----------------------------%
|
||||
c
|
||||
Real
|
||||
Real
|
||||
& sdot, snrm2, slapy2
|
||||
external sdot, snrm2, slapy2, sgttrf, sgttrs
|
||||
c
|
||||
@@ -113,7 +113,7 @@ c
|
||||
Real
|
||||
& one, zero, two, six, rho
|
||||
common /convct/ rho
|
||||
parameter (one = 1.0E+0, zero = 0.0E+0,
|
||||
parameter (one = 1.0E+0, zero = 0.0E+0,
|
||||
& two = 2.0E+0, six = 6.0E+0)
|
||||
c
|
||||
c %-----------------------%
|
||||
@@ -130,14 +130,14 @@ c | The user can modify NEV, NCV, SIGMAR to solve |
|
||||
c | problems of different sizes, and to get different |
|
||||
c | parts of the spectrum. However, The following |
|
||||
c | conditions must be satisfied: |
|
||||
c | N <= MAXN, |
|
||||
c | N <= MAXN, |
|
||||
c | NEV <= MAXNEV, |
|
||||
c | NEV + 2 <= NCV <= MAXNCV |
|
||||
c | NEV + 2 <= NCV <= MAXNCV |
|
||||
c %----------------------------------------------------%
|
||||
c
|
||||
n = 100
|
||||
nev = 4
|
||||
ncv = 10
|
||||
n = 100
|
||||
nev = 4
|
||||
ncv = 10
|
||||
if ( n .gt. maxn ) then
|
||||
print *, ' ERROR with _NDRV4: N is greater than MAXN '
|
||||
go to 9000
|
||||
@@ -150,7 +150,7 @@ c
|
||||
end if
|
||||
bmat = 'G'
|
||||
which = 'LM'
|
||||
sigmar = one
|
||||
sigmar = one
|
||||
sigmai = zero
|
||||
c
|
||||
c %--------------------------------------------------%
|
||||
@@ -175,12 +175,12 @@ c
|
||||
s3 = -one/h + s - sigmar*h/six
|
||||
c
|
||||
do 10 j = 1, n-1
|
||||
dl(j) = s1
|
||||
dl(j) = s1
|
||||
dd(j) = s2
|
||||
du(j) = s3
|
||||
10 continue
|
||||
dd(n) = s2
|
||||
c
|
||||
10 continue
|
||||
dd(n) = s2
|
||||
c
|
||||
call sgttrf(n, dl, dd, du, du2, ipiv, ierr)
|
||||
if ( ierr .ne. 0 ) then
|
||||
print*, ' '
|
||||
@@ -200,7 +200,7 @@ c | Setting INFO=0 indicates that a random vector is |
|
||||
c | generated in SNAUPD to start the Arnoldi iteration. |
|
||||
c %-----------------------------------------------------%
|
||||
c
|
||||
lworkl = 3*ncv**2+6*ncv
|
||||
lworkl = 3*ncv**2+6*ncv
|
||||
tol = zero
|
||||
ido = 0
|
||||
info = 0
|
||||
@@ -224,20 +224,20 @@ c
|
||||
iparam(7) = mode
|
||||
c
|
||||
c %------------------------------------------%
|
||||
c | M A I N L O O P(Reverse communication) |
|
||||
c | M A I N L O O P(Reverse communication) |
|
||||
c %------------------------------------------%
|
||||
c
|
||||
20 continue
|
||||
c
|
||||
c %---------------------------------------------%
|
||||
c | Repeatedly call the routine SNAUPD and take |
|
||||
c | Repeatedly call the routine SNAUPD and take |
|
||||
c | actions indicated by parameter IDO until |
|
||||
c | either convergence is indicated or maxitr |
|
||||
c | has been exceeded. |
|
||||
c %---------------------------------------------%
|
||||
c
|
||||
call snaupd ( ido, bmat, n, which, nev, tol, resid,
|
||||
& ncv, v, ldv, iparam, ipntr, workd,
|
||||
call snaupd ( ido, bmat, n, which, nev, tol, resid,
|
||||
& ncv, v, ldv, iparam, ipntr, workd,
|
||||
& workl, lworkl, info )
|
||||
c
|
||||
if (ido .eq. -1) then
|
||||
@@ -255,8 +255,8 @@ c | workd(ipntr(2)). |
|
||||
c %-------------------------------------------%
|
||||
c
|
||||
call mv (n, workd(ipntr(1)), workd(ipntr(2)))
|
||||
call sgttrs('N', n, 1, dl, dd, du, du2, ipiv,
|
||||
& workd(ipntr(2)), n, ierr)
|
||||
call sgttrs('N', n, 1, dl, dd, du, du2, ipiv,
|
||||
& workd(ipntr(2)), n, ierr)
|
||||
if ( ierr .ne. 0 ) then
|
||||
print*, ' '
|
||||
print*, ' ERROR with _gttrs in _NDRV4.'
|
||||
@@ -282,7 +282,7 @@ c | workd(ipntr(2)). |
|
||||
c %-----------------------------------------%
|
||||
c
|
||||
call scopy( n, workd(ipntr(3)), 1, workd(ipntr(2)), 1)
|
||||
call sgttrs ('N', n, 1, dl, dd, du, du2, ipiv,
|
||||
call sgttrs ('N', n, 1, dl, dd, du, du2, ipiv,
|
||||
& workd(ipntr(2)), n, ierr)
|
||||
if ( ierr .ne. 0 ) then
|
||||
print*, ' '
|
||||
@@ -314,8 +314,8 @@ c %-----------------------------------------%
|
||||
c
|
||||
go to 20
|
||||
c
|
||||
end if
|
||||
c
|
||||
end if
|
||||
c
|
||||
c
|
||||
c %-----------------------------------------%
|
||||
c | Either we have convergence, or there is |
|
||||
@@ -334,23 +334,23 @@ c
|
||||
print *, ' Check the documentation in _naupd.'
|
||||
print *, ' '
|
||||
c
|
||||
else
|
||||
else
|
||||
c
|
||||
c %-------------------------------------------%
|
||||
c | No fatal errors occurred. |
|
||||
c | Post-Process using SNEUPD. |
|
||||
c | |
|
||||
c | Computed eigenvalues may be extracted. |
|
||||
c | Computed eigenvalues may be extracted. |
|
||||
c | |
|
||||
c | Eigenvectors may also be computed now if |
|
||||
c | desired. (indicated by rvec = .true.) |
|
||||
c | desired. (indicated by rvec = .true.) |
|
||||
c %-------------------------------------------%
|
||||
c
|
||||
rvec = .true.
|
||||
call sneupd ( rvec, 'A', select, d, d(1,2), v, ldv,
|
||||
& sigmar, sigmai, workev, bmat, n, which, nev, tol,
|
||||
& resid, ncv, v, ldv, iparam, ipntr, workd,
|
||||
& workl, lworkl, ierr )
|
||||
call sneupd ( rvec, 'A', select, d, d(1,2), v, ldv,
|
||||
& sigmar, sigmai, workev, bmat, n, which, nev, tol,
|
||||
& resid, ncv, v, ldv, iparam, ipntr, workd,
|
||||
& workl, lworkl, ierr )
|
||||
c
|
||||
c %-----------------------------------------------%
|
||||
c | The real part of the eigenvalue is returned |
|
||||
@@ -365,16 +365,16 @@ c | the eigenvalues in D is returned in V. |
|
||||
c %-----------------------------------------------%
|
||||
c
|
||||
if ( ierr .ne. 0) then
|
||||
c
|
||||
c
|
||||
c %------------------------------------%
|
||||
c | Error condition: |
|
||||
c | Check the documentation of SNEUPD. |
|
||||
c %------------------------------------%
|
||||
c
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
print *, ' Error with _neupd, info = ', ierr
|
||||
print *, ' Check the documentation of _neupd. '
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
c
|
||||
else
|
||||
c
|
||||
@@ -413,9 +413,9 @@ c %------------------------%
|
||||
c | Ritz value is complex. |
|
||||
c | Residual of one Ritz |
|
||||
c | value of the conjugate |
|
||||
c | pair is computed. |
|
||||
c | pair is computed. |
|
||||
c %------------------------%
|
||||
c
|
||||
c
|
||||
call av(n, v(1,j), ax)
|
||||
call mv(n, v(1,j), mx)
|
||||
call saxpy(n, -d(j,1), mx, 1, ax, 1)
|
||||
@@ -455,11 +455,11 @@ c
|
||||
print *, ' Maximum number of iterations reached.'
|
||||
print *, ' '
|
||||
else if ( info .eq. 3) then
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
print *, ' No shifts could be applied during implicit',
|
||||
& ' Arnoldi update, try increasing NCV.'
|
||||
print *, ' '
|
||||
end if
|
||||
end if
|
||||
c
|
||||
print *, ' '
|
||||
print *, ' _NDRV4 '
|
||||
@@ -470,8 +470,8 @@ c
|
||||
print *, ' The number of Arnoldi vectors generated',
|
||||
& ' (NCV) is ', ncv
|
||||
print *, ' What portion of the spectrum: ', which
|
||||
print *, ' The number of converged Ritz values is ',
|
||||
& nconv
|
||||
print *, ' The number of converged Ritz values is ',
|
||||
& nconv
|
||||
print *, ' The number of Implicit Arnoldi update',
|
||||
& ' iterations taken is ', iparam(3)
|
||||
print *, ' The number of OP*x is ', iparam(9)
|
||||
@@ -487,7 +487,7 @@ c
|
||||
9000 continue
|
||||
c
|
||||
end
|
||||
c
|
||||
c
|
||||
c==========================================================================
|
||||
c
|
||||
c matrix vector multiplication subroutine
|
||||
@@ -495,17 +495,17 @@ c
|
||||
subroutine mv (n, v, w)
|
||||
integer n, j
|
||||
Real
|
||||
& v(n), w(n), one, four, six, h
|
||||
& v(n), w(n), one, four, six, h
|
||||
parameter (one = 1.0E+0, four = 4.0E+0, six = 6.0E+0)
|
||||
c
|
||||
c Compute the matrix vector multiplication y<---M*x
|
||||
c where M is mass matrix formed by using piecewise linear elements
|
||||
c where M is mass matrix formed by using piecewise linear elements
|
||||
c on [0,1].
|
||||
c
|
||||
c
|
||||
w(1) = ( four*v(1) + one*v(2) ) / six
|
||||
do 10 j = 2,n-1
|
||||
w(j) = ( one*v(j-1) + four*v(j) + one*v(j+1) ) / six
|
||||
10 continue
|
||||
10 continue
|
||||
w(n) = ( one*v(n-1) + four*v(n) ) / six
|
||||
c
|
||||
h = one / real(n+1)
|
||||
@@ -516,7 +516,7 @@ c------------------------------------------------------------------
|
||||
subroutine av (n, v, w)
|
||||
integer n, j
|
||||
Real
|
||||
& v(n), w(n), one, two, dd, dl, du, s, h, rho
|
||||
& v(n), w(n), one, two, dd, dl, du, s, h, rho
|
||||
common /convct/ rho
|
||||
parameter (one = 1.0E+0, two = 2.0E+0)
|
||||
c
|
||||
@@ -530,7 +530,7 @@ c This routine is only used in residual calculation.
|
||||
c
|
||||
h = one / real(n+1)
|
||||
s = rho / two
|
||||
dd = two / h
|
||||
dd = two / h
|
||||
dl = -one/h - s
|
||||
du = -one/h + s
|
||||
c
|
||||
|
||||
+74
-74
@@ -8,9 +8,9 @@ c
|
||||
c\Example-5
|
||||
c
|
||||
c ... Suppose we want to solve A*x = lambda*B*x in shift-invert mode
|
||||
c The matrix A is the tridiagonal matrix with 2 on the diagonal,
|
||||
c -2 on the subdiagonal and 3 on the superdiagonal. The matrix M
|
||||
c is the tridiagonal matrix with 4 on the diagonal and 1 on the
|
||||
c The matrix A is the tridiagonal matrix with 2 on the diagonal,
|
||||
c -2 on the subdiagonal and 3 on the superdiagonal. The matrix M
|
||||
c is the tridiagonal matrix with 4 on the diagonal and 1 on the
|
||||
c off-diagonals.
|
||||
c ... The shift sigma is a complex number (sigmar, sigmai).
|
||||
c ... OP = Real_Part{inv[A-(SIGMAR,SIGMAI)*M]*M and B = M.
|
||||
@@ -32,15 +32,15 @@ c av Matrix vector subroutine that computes A*x.
|
||||
c mv Matrix vector subroutine that computes M*x.
|
||||
c
|
||||
c\Author
|
||||
c Richard Lehoucq
|
||||
c Danny Sorensen
|
||||
c Chao Yang
|
||||
c Dept. of Computational &
|
||||
c Applied Mathematics
|
||||
c Rice University
|
||||
c Houston, Texas
|
||||
c Richard Lehoucq
|
||||
c Danny Sorensen
|
||||
c Chao Yang
|
||||
c Dept. of Computational &
|
||||
c Applied Mathematics
|
||||
c Rice University
|
||||
c Houston, Texas
|
||||
c
|
||||
c\SCCS Information: @(#)
|
||||
c\SCCS Information: @(#)
|
||||
c FILE: ndrv5.F SID: 2.5 DATE OF SID: 10/17/00 RELEASE: 2
|
||||
c
|
||||
c\Remarks
|
||||
@@ -59,7 +59,7 @@ c | MAXNCV: Maximum NCV allowed |
|
||||
c %-----------------------------%
|
||||
c
|
||||
integer maxn, maxnev, maxncv, ldv
|
||||
parameter (maxn=256, maxnev=10, maxncv=25,
|
||||
parameter (maxn=256, maxnev=10, maxncv=25,
|
||||
& ldv=maxn )
|
||||
c
|
||||
c %--------------%
|
||||
@@ -73,7 +73,7 @@ c
|
||||
& v(ldv,maxncv), workd(3*maxn),
|
||||
& workev(3*maxncv),
|
||||
& workl(3*maxncv*maxncv+6*maxncv)
|
||||
Complex
|
||||
Complex
|
||||
& cdd(maxn), cdl(maxn), cdu(maxn),
|
||||
& cdu2(maxn), ctemp(maxn)
|
||||
c
|
||||
@@ -86,16 +86,16 @@ c
|
||||
& nconv, maxitr, ishfts, mode
|
||||
Real
|
||||
& tol, numr, numi, denr, deni, sigmar, sigmai
|
||||
Complex
|
||||
Complex
|
||||
& c1, c2, c3
|
||||
logical first, rvec
|
||||
c
|
||||
logical first, rvec
|
||||
c
|
||||
c %-----------------------------%
|
||||
c | BLAS & LAPACK routines used |
|
||||
c %-----------------------------%
|
||||
c
|
||||
external cgttrf, cgttrs
|
||||
Real
|
||||
Real
|
||||
& sdot, snrm2, slapy2
|
||||
external sdot, snrm2, slapy2
|
||||
c
|
||||
@@ -128,14 +128,14 @@ c | to 'LM'. The user can modify NEV, NCV, SIGMAR, |
|
||||
c | SIGMAI to solve problems of different sizes, and |
|
||||
c | to get different parts of the spectrum. However, |
|
||||
c | The following conditions must be satisfied: |
|
||||
c | N <= MAXN, |
|
||||
c | N <= MAXN, |
|
||||
c | NEV <= MAXNEV, |
|
||||
c | NEV + 2 <= NCV <= MAXNCV |
|
||||
c | NEV + 2 <= NCV <= MAXNCV |
|
||||
c %----------------------------------------------------%
|
||||
c
|
||||
n = 100
|
||||
nev = 4
|
||||
ncv = 20
|
||||
n = 100
|
||||
nev = 4
|
||||
ncv = 20
|
||||
if ( n .gt. maxn ) then
|
||||
print *, ' ERROR with _NDRV5: N is greater than MAXN '
|
||||
go to 9000
|
||||
@@ -167,12 +167,12 @@ c
|
||||
c3 = cmplx( 3.0E+0-sigmar, -sigmai)
|
||||
c
|
||||
do 10 j = 1, n-1
|
||||
cdl(j) = c1
|
||||
cdl(j) = c1
|
||||
cdd(j) = c2
|
||||
cdu(j) = c3
|
||||
10 continue
|
||||
cdd(n) = c2
|
||||
c
|
||||
10 continue
|
||||
cdd(n) = c2
|
||||
c
|
||||
call cgttrf(n, cdl, cdd, cdu, cdu2, ipiv, ierr)
|
||||
if ( ierr .ne. 0 ) then
|
||||
print*, ' '
|
||||
@@ -192,8 +192,8 @@ c | Setting INFO=0 indicates that a random vector is |
|
||||
c | generated in SNAUPD to start the Arnoldi iteration. |
|
||||
c %-----------------------------------------------------%
|
||||
c
|
||||
lworkl = 3*ncv**2+6*ncv
|
||||
tol = zero
|
||||
lworkl = 3*ncv**2+6*ncv
|
||||
tol = zero
|
||||
ido = 0
|
||||
info = 0
|
||||
c
|
||||
@@ -212,30 +212,30 @@ c
|
||||
mode = 3
|
||||
c
|
||||
iparam(1) = ishfts
|
||||
iparam(3) = maxitr
|
||||
iparam(7) = mode
|
||||
iparam(3) = maxitr
|
||||
iparam(7) = mode
|
||||
c
|
||||
c %------------------------------------------%
|
||||
c | M A I N L O O P(Reverse communication) |
|
||||
c | M A I N L O O P(Reverse communication) |
|
||||
c %------------------------------------------%
|
||||
c
|
||||
20 continue
|
||||
c
|
||||
c %---------------------------------------------%
|
||||
c | Repeatedly call the routine SNAUPD and take |
|
||||
c | Repeatedly call the routine SNAUPD and take |
|
||||
c | actions indicated by parameter IDO until |
|
||||
c | either convergence is indicated or maxitr |
|
||||
c | has been exceeded. |
|
||||
c %---------------------------------------------%
|
||||
c
|
||||
call snaupd ( ido, bmat, n, which, nev, tol, resid,
|
||||
& ncv, v, ldv, iparam, ipntr, workd,
|
||||
call snaupd ( ido, bmat, n, which, nev, tol, resid,
|
||||
& ncv, v, ldv, iparam, ipntr, workd,
|
||||
& workl, lworkl, info )
|
||||
c
|
||||
if (ido .eq. -1) then
|
||||
c
|
||||
c %-------------------------------------------------------%
|
||||
c | Perform |
|
||||
c | Perform |
|
||||
c | y <--- OP*x = Real_Part{inv[A-(SIGMAR,SIGMAI)*M]*M*x} |
|
||||
c | to force starting vector into the range of OP. The |
|
||||
c | user should supply his/her own matrix vector |
|
||||
@@ -251,14 +251,14 @@ c
|
||||
ctemp(j) = cmplx(workd(ipntr(2)+j-1))
|
||||
30 continue
|
||||
c
|
||||
call cgttrs('N', n, 1, cdl, cdd, cdu, cdu2, ipiv,
|
||||
call cgttrs('N', n, 1, cdl, cdd, cdu, cdu2, ipiv,
|
||||
& ctemp, n, ierr)
|
||||
if ( ierr .ne. 0 ) then
|
||||
print*, ' '
|
||||
print*, ' ERROR with _gttrs in _NDRV5.'
|
||||
print*, ' '
|
||||
go to 9000
|
||||
end if
|
||||
end if
|
||||
do 40 j = 1, n
|
||||
workd(ipntr(2)+j-1) = real(ctemp(j))
|
||||
40 continue
|
||||
@@ -283,14 +283,14 @@ c
|
||||
do 50 j = 1,n
|
||||
ctemp(j) = cmplx(workd(ipntr(3)+j-1))
|
||||
50 continue
|
||||
call cgttrs ('N', n, 1, cdl, cdd, cdu, cdu2, ipiv,
|
||||
call cgttrs ('N', n, 1, cdl, cdd, cdu, cdu2, ipiv,
|
||||
& ctemp, n, ierr)
|
||||
if ( ierr .ne. 0 ) then
|
||||
print*, ' '
|
||||
print*, ' ERROR with _gttrs in _NDRV5.'
|
||||
print*, ' '
|
||||
go to 9000
|
||||
end if
|
||||
end if
|
||||
do 60 j = 1, n
|
||||
workd(ipntr(2)+j-1) = real(ctemp(j))
|
||||
60 continue
|
||||
@@ -320,7 +320,7 @@ c
|
||||
c
|
||||
end if
|
||||
c
|
||||
c
|
||||
c
|
||||
c %------------------------------------------%
|
||||
c | Either we have convergence, or there is |
|
||||
c | an error. |
|
||||
@@ -336,25 +336,25 @@ c
|
||||
print *, ' '
|
||||
print *, ' Error with _naupd info = ',info
|
||||
print *, ' Check the documentation of _naupd.'
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
c
|
||||
else
|
||||
else
|
||||
c
|
||||
c %-------------------------------------------%
|
||||
c | No fatal errors occurred. |
|
||||
c | Post-Process using SNEUPD. |
|
||||
c | |
|
||||
c | Computed eigenvalues may be extracted. |
|
||||
c | Computed eigenvalues may be extracted. |
|
||||
c | |
|
||||
c | Eigenvectors may also be computed now if |
|
||||
c | desired. (indicated by rvec = .true.) |
|
||||
c | desired. (indicated by rvec = .true.) |
|
||||
c %-------------------------------------------%
|
||||
c
|
||||
rvec = .true.
|
||||
call sneupd ( rvec, 'A', select, d, d(1,2), v, ldv,
|
||||
& sigmar, sigmai, workev, bmat, n, which, nev, tol,
|
||||
& resid, ncv, v, ldv, iparam, ipntr, workd,
|
||||
& workl, lworkl, ierr )
|
||||
call sneupd ( rvec, 'A', select, d, d(1,2), v, ldv,
|
||||
& sigmar, sigmai, workev, bmat, n, which, nev, tol,
|
||||
& resid, ncv, v, ldv, iparam, ipntr, workd,
|
||||
& workl, lworkl, ierr )
|
||||
c
|
||||
c %-----------------------------------------------%
|
||||
c | The real part of the eigenvalue is returned |
|
||||
@@ -375,14 +375,14 @@ c | Error condition: |
|
||||
c | Check the documentation of SNEUPD. |
|
||||
c %------------------------------------%
|
||||
c
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
print *, ' Error with _neupd = ', ierr
|
||||
print *, ' Check the documentation of _neupd. '
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
c
|
||||
else
|
||||
else
|
||||
c
|
||||
first = .true.
|
||||
first = .true.
|
||||
nconv = iparam(5)
|
||||
do 70 j=1,nconv
|
||||
c
|
||||
@@ -394,7 +394,7 @@ c
|
||||
if ( d(j,2) .eq. zero ) then
|
||||
c
|
||||
c %---------------------------%
|
||||
c | Eigenvalue is real. |
|
||||
c | Eigenvalue is real. |
|
||||
c | Compute d = x'(Ax)/x'(Mx).|
|
||||
c %---------------------------%
|
||||
c
|
||||
@@ -402,7 +402,7 @@ c
|
||||
numr = sdot(n, v(1,j), 1, ax, 1)
|
||||
call mv(n, v(1,j), ax )
|
||||
denr = sdot(n, v(1,j), 1, ax, 1)
|
||||
d(j,1) = numr / denr
|
||||
d(j,1) = numr / denr
|
||||
c
|
||||
else if (first) then
|
||||
c
|
||||
@@ -420,7 +420,7 @@ c %----------------%
|
||||
numr = sdot(n, v(1,j), 1, ax, 1)
|
||||
numi = sdot(n, v(1,j+1), 1, ax, 1)
|
||||
call av(n, v(1,j+1), ax)
|
||||
numr = numr + sdot(n,v(1,j+1),1,ax,1)
|
||||
numr = numr + sdot(n,v(1,j+1),1,ax,1)
|
||||
numi = -numi + sdot(n,v(1,j),1,ax,1)
|
||||
c
|
||||
c %----------------%
|
||||
@@ -431,7 +431,7 @@ c
|
||||
denr = sdot(n, v(1,j), 1, ax, 1)
|
||||
deni = sdot(n, v(1,j+1), 1, ax, 1)
|
||||
call mv(n, v(1,j+1), ax)
|
||||
denr = denr + sdot(n,v(1,j+1),1,ax,1)
|
||||
denr = denr + sdot(n,v(1,j+1),1,ax,1)
|
||||
deni = -deni + sdot(n,v(1,j),1, ax,1)
|
||||
c
|
||||
c %----------------%
|
||||
@@ -452,7 +452,7 @@ c | the conjugate pair by taking |
|
||||
c | the conjugate of the last |
|
||||
c | eigenvalue computed. |
|
||||
c %------------------------------%
|
||||
c
|
||||
c
|
||||
d(j,1) = d(j-1,1)
|
||||
d(j,2) = -d(j-1,2)
|
||||
first = .true.
|
||||
@@ -475,7 +475,7 @@ c | tolerance) |
|
||||
c %---------------------------%
|
||||
c
|
||||
first = .true.
|
||||
do 80 j=1, nconv
|
||||
do 80 j=1, nconv
|
||||
c
|
||||
if (d(j,2) .eq. zero) then
|
||||
c
|
||||
@@ -495,9 +495,9 @@ c %------------------------%
|
||||
c | Ritz value is complex |
|
||||
c | Residual of one Ritz |
|
||||
c | value of the conjugate |
|
||||
c | pair is computed. |
|
||||
c | pair is computed. |
|
||||
c %------------------------%
|
||||
c
|
||||
c
|
||||
call av(n, v(1,j), ax)
|
||||
call mv(n, v(1,j), mx)
|
||||
call saxpy(n, -d(j,1), mx, 1, ax, 1)
|
||||
@@ -527,7 +527,7 @@ c
|
||||
call smout(6, nconv, 3, d, maxncv, -6,
|
||||
& 'Ritz values (Real,Imag) and relative residuals')
|
||||
c
|
||||
end if
|
||||
end if
|
||||
c
|
||||
c %-------------------------------------------%
|
||||
c | Print additional convergence information. |
|
||||
@@ -538,11 +538,11 @@ c
|
||||
print *, ' Maximum number of iterations reached.'
|
||||
print *, ' '
|
||||
else if ( info .eq. 3) then
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
print *, ' No shifts could be applied during implicit',
|
||||
& ' Arnoldi update, try increasing NCV.'
|
||||
print *, ' '
|
||||
end if
|
||||
end if
|
||||
c
|
||||
print *, ' '
|
||||
print *, ' _NDRV5 '
|
||||
@@ -553,8 +553,8 @@ c
|
||||
print *, ' The number of Arnoldi vectors generated',
|
||||
& ' (NCV) is ', ncv
|
||||
print *, ' What portion of the spectrum: ', which
|
||||
print *, ' The number of converged Ritz values is ',
|
||||
& nconv
|
||||
print *, ' The number of converged Ritz values is ',
|
||||
& nconv
|
||||
print *, ' The number of Implicit Arnoldi update',
|
||||
& ' iterations taken is ', iparam(3)
|
||||
print *, ' The number of OP*x is ', iparam(9)
|
||||
@@ -570,7 +570,7 @@ c
|
||||
9000 continue
|
||||
c
|
||||
end
|
||||
c
|
||||
c
|
||||
c==========================================================================
|
||||
c
|
||||
c matrix vector multiplication subroutine
|
||||
@@ -578,25 +578,25 @@ c
|
||||
subroutine mv (n, v, w)
|
||||
integer n, j
|
||||
Real
|
||||
& v(n), w(n), one, four
|
||||
& v(n), w(n), one, four
|
||||
parameter (one = 1.0E+0, four = 4.0E+0)
|
||||
c
|
||||
c Compute the matrix vector multiplication y<---M*x
|
||||
c where M is a n by n symmetric tridiagonal matrix with 4 on the
|
||||
c where M is a n by n symmetric tridiagonal matrix with 4 on the
|
||||
c diagonal, 1 on the subdiagonal and superdiagonal.
|
||||
c
|
||||
c
|
||||
w(1) = four*v(1) + one*v(2)
|
||||
do 10 j = 2,n-1
|
||||
w(j) = one*v(j-1) + four*v(j) + one*v(j+1)
|
||||
10 continue
|
||||
w(n) = one*v(n-1) + four*v(n)
|
||||
w(j) = one*v(j-1) + four*v(j) + one*v(j+1)
|
||||
10 continue
|
||||
w(n) = one*v(n-1) + four*v(n)
|
||||
return
|
||||
end
|
||||
c------------------------------------------------------------------
|
||||
subroutine av (n, v, w)
|
||||
integer n, j
|
||||
Real
|
||||
& v(n), w(n), three, two
|
||||
Real
|
||||
& v(n), w(n), three, two
|
||||
parameter (three = 3.0E+0, two = 2.0E+0)
|
||||
c
|
||||
c Compute the matrix vector multiplication y<---A*x
|
||||
|
||||
+71
-71
@@ -8,9 +8,9 @@ c
|
||||
c\Example-6
|
||||
c
|
||||
c ... Suppose we want to solve A*x = lambda*B*x in shift-invert mode
|
||||
c The matrix A is the tridiagonal matrix with 2 on the diagonal,
|
||||
c -2 on the subdiagonal and 3 on the superdiagonal. The matrix M
|
||||
c is the tridiagonal matrix with 4 on the diagonal and 1 on the
|
||||
c The matrix A is the tridiagonal matrix with 2 on the diagonal,
|
||||
c -2 on the subdiagonal and 3 on the superdiagonal. The matrix M
|
||||
c is the tridiagonal matrix with 4 on the diagonal and 1 on the
|
||||
c off-diagonals.
|
||||
c ... The shift sigma is a complex number (sigmar, sigmai).
|
||||
c ... OP = Imaginary_Part{inv[A-(SIGMAR,SIGMAI)*M]*M and B = M.
|
||||
@@ -32,15 +32,15 @@ c av Matrix vector subroutine that computes A*x.
|
||||
c mv Matrix vector subroutine that computes M*x.
|
||||
c
|
||||
c\Author
|
||||
c Richard Lehoucq
|
||||
c Danny Sorensen
|
||||
c Chao Yang
|
||||
c Dept. of Computational &
|
||||
c Applied Mathematics
|
||||
c Rice University
|
||||
c Houston, Texas
|
||||
c Richard Lehoucq
|
||||
c Danny Sorensen
|
||||
c Chao Yang
|
||||
c Dept. of Computational &
|
||||
c Applied Mathematics
|
||||
c Rice University
|
||||
c Houston, Texas
|
||||
c
|
||||
c\SCCS Information: @(#)
|
||||
c\SCCS Information: @(#)
|
||||
c FILE: ndrv6.F SID: 2.5 DATE OF SID: 10/17/00 RELEASE: 2
|
||||
c
|
||||
c\Remarks
|
||||
@@ -59,7 +59,7 @@ c | MAXNCV: Maximum NCV allowed |
|
||||
c %-----------------------------%
|
||||
c
|
||||
integer maxn, maxnev, maxncv, ldv
|
||||
parameter (maxn=256, maxnev=10, maxncv=25,
|
||||
parameter (maxn=256, maxnev=10, maxncv=25,
|
||||
& ldv=maxn )
|
||||
c
|
||||
c %--------------%
|
||||
@@ -73,7 +73,7 @@ c
|
||||
& v(ldv,maxncv), workd(3*maxn),
|
||||
& workev(3*maxncv),
|
||||
& workl(3*maxncv*maxncv+6*maxncv)
|
||||
Complex
|
||||
Complex
|
||||
& cdd(maxn), cdl(maxn), cdu(maxn),
|
||||
& cdu2(maxn), ctemp(maxn)
|
||||
c
|
||||
@@ -86,16 +86,16 @@ c
|
||||
& nconv, maxitr, ishfts, mode
|
||||
Real
|
||||
& tol, numr, numi, denr, deni, sigmar, sigmai
|
||||
Complex
|
||||
Complex
|
||||
& c1, c2, c3
|
||||
logical first, rvec
|
||||
c
|
||||
logical first, rvec
|
||||
c
|
||||
c %-----------------------------%
|
||||
c | BLAS & LAPACK routines used |
|
||||
c %-----------------------------%
|
||||
c
|
||||
external cgttrf, cgttrs
|
||||
Real
|
||||
Real
|
||||
& sdot, snrm2, slapy2
|
||||
external sdot, snrm2, slapy2
|
||||
c
|
||||
@@ -127,14 +127,14 @@ c | to 'LM'. The user can modify NEV, NCV, SIGMA to |
|
||||
c | solve problems of different sizes, and to get |
|
||||
c | different parts of the spectrum. However, The |
|
||||
c | following conditions must be satisfied: |
|
||||
c | N <= MAXN, |
|
||||
c | N <= MAXN, |
|
||||
c | NEV <= MAXNEV, |
|
||||
c | NEV + 2 <= NCV <= MAXNCV |
|
||||
c | NEV + 2 <= NCV <= MAXNCV |
|
||||
c %----------------------------------------------------%
|
||||
c
|
||||
n = 100
|
||||
nev = 4
|
||||
ncv = 20
|
||||
n = 100
|
||||
nev = 4
|
||||
ncv = 20
|
||||
if ( n .gt. maxn ) then
|
||||
print *, ' ERROR with _NDRV6: N is greater than MAXN '
|
||||
go to 9000
|
||||
@@ -148,7 +148,7 @@ c
|
||||
bmat = 'G'
|
||||
which = 'LM'
|
||||
sigmar = 4.0E-1
|
||||
sigmai = 6.0E-1
|
||||
sigmai = 6.0E-1
|
||||
c
|
||||
c %----------------------------------------------------%
|
||||
c | Construct C = A - (SIGMAR,SIGMAI)*M in complex |
|
||||
@@ -166,12 +166,12 @@ c
|
||||
c3 = cmplx( 3.0E+0-sigmar, -sigmai)
|
||||
c
|
||||
do 10 j = 1, n-1
|
||||
cdl(j) = c1
|
||||
cdl(j) = c1
|
||||
cdd(j) = c2
|
||||
cdu(j) = c3
|
||||
10 continue
|
||||
cdd(n) = c2
|
||||
c
|
||||
10 continue
|
||||
cdd(n) = c2
|
||||
c
|
||||
call cgttrf(n, cdl, cdd, cdu, cdu2, ipiv, ierr)
|
||||
if ( ierr .ne. 0 ) then
|
||||
print*, ' '
|
||||
@@ -191,8 +191,8 @@ c | Setting INFO=0 indicates that a random vector is |
|
||||
c | generated in SNAUPD to start the Arnoldi iteration. |
|
||||
c %-----------------------------------------------------%
|
||||
c
|
||||
lworkl = 3*ncv**2+6*ncv
|
||||
tol = zero
|
||||
lworkl = 3*ncv**2+6*ncv
|
||||
tol = zero
|
||||
ido = 0
|
||||
info = 0
|
||||
c
|
||||
@@ -211,31 +211,31 @@ c
|
||||
mode = 3
|
||||
c
|
||||
iparam(1) = ishfts
|
||||
iparam(3) = maxitr
|
||||
iparam(3) = maxitr
|
||||
iparam(7) = mode
|
||||
c
|
||||
c %------------------------------------------%
|
||||
c | M A I N L O O P(Reverse communication) |
|
||||
c | M A I N L O O P(Reverse communication) |
|
||||
c %------------------------------------------%
|
||||
c
|
||||
20 continue
|
||||
c
|
||||
c %---------------------------------------------%
|
||||
c | Repeatedly call the routine SNAUPD and take |
|
||||
c | Repeatedly call the routine SNAUPD and take |
|
||||
c | actions indicated by parameter IDO until |
|
||||
c | either convergence is indicated or maxitr |
|
||||
c | has been exceeded. |
|
||||
c %---------------------------------------------%
|
||||
c
|
||||
call snaupd ( ido, bmat, n, which, nev, tol, resid,
|
||||
& ncv, v, ldv, iparam, ipntr, workd,
|
||||
call snaupd ( ido, bmat, n, which, nev, tol, resid,
|
||||
& ncv, v, ldv, iparam, ipntr, workd,
|
||||
& workl, lworkl, info )
|
||||
c
|
||||
|
||||
if (ido .eq. -1) then
|
||||
c
|
||||
c %------------------------------------------------------------%
|
||||
c | Perform |
|
||||
c | Perform |
|
||||
c | y <--- OP*x = Imaginary_Part{inv[A-(SIGMAR,SIGMAI)*M]*M*x} |
|
||||
c | to force starting vector into the range of OP. The user |
|
||||
c | should supply his/her own matrix vector multiplication |
|
||||
@@ -250,14 +250,14 @@ c
|
||||
ctemp(j) = cmplx(workd(ipntr(2)+j-1))
|
||||
30 continue
|
||||
c
|
||||
call cgttrs('N', n, 1, cdl, cdd, cdu, cdu2, ipiv,
|
||||
call cgttrs('N', n, 1, cdl, cdd, cdu, cdu2, ipiv,
|
||||
& ctemp, maxn, ierr)
|
||||
if ( ierr .ne. 0 ) then
|
||||
print*, ' '
|
||||
print*, ' ERROR with _gttrs in _NDRV6.'
|
||||
print*, ' '
|
||||
go to 9000
|
||||
end if
|
||||
end if
|
||||
do 40 j = 1, n
|
||||
workd(ipntr(2)+j-1) = aimag(ctemp(j))
|
||||
40 continue
|
||||
@@ -282,14 +282,14 @@ c
|
||||
do 50 j = 1,n
|
||||
ctemp(j) = cmplx(workd(ipntr(3)+j-1))
|
||||
50 continue
|
||||
call cgttrs ('N', n, 1, cdl, cdd, cdu, cdu2, ipiv,
|
||||
call cgttrs ('N', n, 1, cdl, cdd, cdu, cdu2, ipiv,
|
||||
& ctemp, maxn, ierr)
|
||||
if ( ierr .ne. 0 ) then
|
||||
print*, ' '
|
||||
print*, ' ERROR with _gttrs in _NDRV6.'
|
||||
print*, ' '
|
||||
go to 9000
|
||||
end if
|
||||
end if
|
||||
do 60 j = 1, n
|
||||
workd(ipntr(2)+j-1) = aimag(ctemp(j))
|
||||
60 continue
|
||||
@@ -335,24 +335,24 @@ c
|
||||
print *, ' '
|
||||
print *, ' Error with _naupd, info = ',info
|
||||
print *, ' Check the documentation of _naupd.'
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
c
|
||||
else
|
||||
else
|
||||
c
|
||||
c %-------------------------------------------%
|
||||
c | No fatal errors occurred. |
|
||||
c | Post-Process using SNEUPD. |
|
||||
c | |
|
||||
c | Computed eigenvalues may be extracted. |
|
||||
c | Computed eigenvalues may be extracted. |
|
||||
c | |
|
||||
c | Eigenvectors may also be computed now if |
|
||||
c | desired. (indicated by rvec = .true.) |
|
||||
c | desired. (indicated by rvec = .true.) |
|
||||
c %-------------------------------------------%
|
||||
c
|
||||
rvec = .true.
|
||||
call sneupd ( rvec, 'A', select, d, d(1,2), v, ldv,
|
||||
& sigmar, sigmai, workev, bmat, n, which, nev, tol,
|
||||
& resid, ncv, v, ldv, iparam, ipntr, workd,
|
||||
call sneupd ( rvec, 'A', select, d, d(1,2), v, ldv,
|
||||
& sigmar, sigmai, workev, bmat, n, which, nev, tol,
|
||||
& resid, ncv, v, ldv, iparam, ipntr, workd,
|
||||
& workl, lworkl, ierr )
|
||||
c
|
||||
c %-----------------------------------------------%
|
||||
@@ -368,16 +368,16 @@ c | the eigenvalues in D is returned in V. |
|
||||
c %-----------------------------------------------%
|
||||
c
|
||||
if ( ierr .ne. 0) then
|
||||
c
|
||||
c
|
||||
c %------------------------------------%
|
||||
c | Error condition: |
|
||||
c | Check the documentation of SNEUPD. |
|
||||
c %------------------------------------%
|
||||
c
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
print *, ' Error with _neupd, info = ', ierr
|
||||
print *, ' Check the documentation of _neupd. '
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
c
|
||||
else
|
||||
c
|
||||
@@ -393,7 +393,7 @@ c
|
||||
if ( d(j,2) .eq. zero) then
|
||||
c
|
||||
c %----------------------------%
|
||||
c | Eigenvalue is real. |
|
||||
c | Eigenvalue is real. |
|
||||
c | Compute d = x'(Ax)/x'(Mx). |
|
||||
c %----------------------------%
|
||||
c
|
||||
@@ -401,7 +401,7 @@ c
|
||||
numr = sdot(n, v(1,j), 1, ax, 1)
|
||||
call mv(n, v(1,j), ax )
|
||||
denr = sdot(n, v(1,j), 1, ax, 1)
|
||||
d(j,1) = numr / denr
|
||||
d(j,1) = numr / denr
|
||||
c
|
||||
else if (first) then
|
||||
c
|
||||
@@ -419,7 +419,7 @@ c
|
||||
numr = sdot(n, v(1,j), 1, ax, 1)
|
||||
numi = sdot(n, v(1,j+1), 1, ax, 1)
|
||||
call av(n, v(1,j+1), ax)
|
||||
numr = numr + sdot(n,v(1,j+1),1,ax,1)
|
||||
numr = numr + sdot(n,v(1,j+1),1,ax,1)
|
||||
numi = -numi + sdot(n,v(1,j),1,ax,1)
|
||||
c
|
||||
c %----------------%
|
||||
@@ -430,7 +430,7 @@ c
|
||||
denr = sdot(n, v(1,j), 1, ax, 1)
|
||||
deni = sdot(n, v(1,j+1), 1, ax, 1)
|
||||
call mv(n, v(1,j+1), ax)
|
||||
denr = denr + sdot(n,v(1,j+1),1,ax,1)
|
||||
denr = denr + sdot(n,v(1,j+1),1,ax,1)
|
||||
deni = -deni + sdot(n,v(1,j),1, ax,1)
|
||||
c
|
||||
c %----------------%
|
||||
@@ -451,7 +451,7 @@ c | the conjugate pair by taking |
|
||||
c | the conjugate of the last |
|
||||
c | eigenvalue computed. |
|
||||
c %------------------------------%
|
||||
c
|
||||
c
|
||||
d(j,1) = d(j-1,1)
|
||||
d(j,2) = -d(j-1,2)
|
||||
first = .true.
|
||||
@@ -475,7 +475,7 @@ c %---------------------------%
|
||||
c
|
||||
first = .true.
|
||||
nconv = iparam(5)
|
||||
do 80 j=1, nconv
|
||||
do 80 j=1, nconv
|
||||
c
|
||||
if (d(j,2) .eq. zero) then
|
||||
c
|
||||
@@ -495,9 +495,9 @@ c %------------------------%
|
||||
c | Ritz value is complex |
|
||||
c | Residual of one Ritz |
|
||||
c | value of the conjugate |
|
||||
c | pair is computed. |
|
||||
c | pair is computed. |
|
||||
c %------------------------%
|
||||
c
|
||||
c
|
||||
call av(n, v(1,j), ax)
|
||||
call mv(n, v(1,j), mx)
|
||||
call saxpy(n, -d(j,1), mx, 1, ax, 1)
|
||||
@@ -510,7 +510,7 @@ c
|
||||
call mv(n, v(1,j), mx)
|
||||
call saxpy(n, -d(j,2), mx, 1, ax, 1)
|
||||
d(j,3) = slapy2( d(j,3), snrm2(n, ax, 1) )
|
||||
d(j,3) = d(j,3) / slapy2(d(j,1),d(j,2))
|
||||
d(j,3) = d(j,3) / slapy2(d(j,1),d(j,2))
|
||||
d(j+1,3) = d(j,3)
|
||||
first = .false.
|
||||
else
|
||||
@@ -537,11 +537,11 @@ c
|
||||
print *, ' Maximum number of iterations reached.'
|
||||
print *, ' '
|
||||
else if ( info .eq. 3) then
|
||||
print *, ' '
|
||||
print *, ' '
|
||||
print *, ' No shifts could be applied during implicit',
|
||||
& ' Arnoldi update, try increasing NCV.'
|
||||
print *, ' '
|
||||
end if
|
||||
end if
|
||||
c
|
||||
print *, ' '
|
||||
print *, ' _NDRV6 '
|
||||
@@ -552,8 +552,8 @@ c
|
||||
print *, ' The number of Arnoldi vectors generated',
|
||||
& ' (NCV) is ', ncv
|
||||
print *, ' What portion of the spectrum: ', which
|
||||
print *, ' The number of converged Ritz values is ',
|
||||
& nconv
|
||||
print *, ' The number of converged Ritz values is ',
|
||||
& nconv
|
||||
print *, ' The number of Implicit Arnoldi update',
|
||||
& ' iterations taken is ', iparam(3)
|
||||
print *, ' The number of OP*x is ', iparam(9)
|
||||
@@ -569,7 +569,7 @@ c
|
||||
9000 continue
|
||||
c
|
||||
end
|
||||
c
|
||||
c
|
||||
c==========================================================================
|
||||
c
|
||||
c matrix vector multiplication subroutine
|
||||
@@ -577,25 +577,25 @@ c
|
||||
subroutine mv (n, v, w)
|
||||
integer n, j
|
||||
Real
|
||||
& v(n), w(n), one, four
|
||||
& v(n), w(n), one, four
|
||||
parameter (one = 1.0E+0, four = 4.0E+0)
|
||||
c
|
||||
c Compute the matrix vector multiplication y<---M*x
|
||||
c where M is a n by n symmetric tridiagonal matrix with 4 on the
|
||||
c where M is a n by n symmetric tridiagonal matrix with 4 on the
|
||||
c diagonal, 1 on the subdiagonal and superdiagonal.
|
||||
c
|
||||
c
|
||||
w(1) = four*v(1) + one*v(2)
|
||||
do 10 j = 2,n-1
|
||||
w(j) = one*v(j-1) + four*v(j) + one*v(j+1)
|
||||
10 continue
|
||||
w(n) = one*v(n-1) + four*v(n)
|
||||
w(j) = one*v(j-1) + four*v(j) + one*v(j+1)
|
||||
10 continue
|
||||
w(n) = one*v(n-1) + four*v(n)
|
||||
return
|
||||
end
|
||||
c------------------------------------------------------------------
|
||||
subroutine av (n, v, w)
|
||||
integer n, j
|
||||
Real
|
||||
& v(n), w(n), three, two
|
||||
Real
|
||||
& v(n), w(n), three, two
|
||||
parameter (three = 3.0E+0, two = 2.0E+0)
|
||||
c
|
||||
c Compute the matrix vector multiplication y<---A*x
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
pyarpack: python binding based on Boost.Python.Numpy used to expose arpack C++ API
|
||||
|
||||
Installation:
|
||||
-------------
|
||||
|
||||
Python3: ~/arpack-ng/build> cmake -DCMAKE_INSTALL_PREFIX=/tmp/local -DPYTHON3=ON -DBOOST_PYTHON_LIBSUFFIX="3" ..
|
||||
~/arpack-ng/build> make all test
|
||||
~/arpack-ng/build> make install
|
||||
Note: Boost must have been compiled for Python3.
|
||||
Note: installation will install libpyarpack.so in the install directory.
|
||||
Note: python3 minimal packages must be installed (apt-get install python3-minimal python3-pip).
|
||||
numpy must be installed (apt-get install python3-numpy) as the A/B matrices used by arpack
|
||||
solver must be numpy arrays.
|
||||
|
||||
Usage:
|
||||
------
|
||||
|
||||
PYTHONPATH must include the directory where libpyarpack.so has been installed.
|
||||
|
||||
>> export PYTHONPATH="/tmp/local/lib/pyarpack:${PYTHONPATH}"
|
||||
>> python
|
||||
>> import pyarpack
|
||||
>> help(pyarpack)
|
||||
|
||||
You can use sparse or dense matrices, and, play with iterative or direct mode solvers (CG, LU, ...):
|
||||
|
||||
1. choose arpack solver with a given mode solver
|
||||
1.1. if you need to handle sparse matrices
|
||||
>> from pyarpack import sparseBiCG as pyarpackSlv
|
||||
1.2. if you need to handle dense matrices
|
||||
>> from pyarpack import denseBiCG as pyarpackSlv
|
||||
2. choose arpack data type (float, double, ...)
|
||||
>> arpackSlv = pyarpackSlv.double()
|
||||
3. solve the eigen problem
|
||||
>> arpackSlv.solve(A, B)
|
||||
4. get eigen values and vectors
|
||||
>> print(arpackSlv.vec)
|
||||
>> print(arpackSlv.val)
|
||||
|
||||
You can also:
|
||||
|
||||
1. restart a solve from the workspace of a previous solve: check out pyarpackRestart.py.in.
|
||||
2. compute eigen and / or schur vectors.
|
||||
|
||||
Note:
|
||||
|
||||
1. arpack data type (float, double, ...) must be consistent with A/B numpy dtypes (float32, float64, ...).
|
||||
at python side, the data MUST be casted in the EXACT expected type (int32, int64, float, double, ...).
|
||||
otherwise, C++ may not get the data the way it expects them: C++ will not know how to read python data.
|
||||
if you are not sure how data have been passed from python to C++, set arpackSlv.debug = 1 and check out debug traces.
|
||||
in other words, pyarpack users MUST :
|
||||
1.1. create numpy arrays specifying explicitly the type:
|
||||
>> Aij = np.array([], dtype='complex128')
|
||||
1.2. filling numpy arrays casting value on append:
|
||||
>> Aij = np.append(Aij, np.complex128(complex( 200., 200.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
1.3. calling the solver flavor which is consistent with the numpy array data type:
|
||||
>> arpackSlv = pyarpackSlv.complexDouble() # Caution: complexDouble <=> np.array(..., dtype='complex128')
|
||||
note: NO data type check can be done at C++ side, the pyarpack user MUST insure data consistency.
|
||||
2. sparse matrices must be provided in coo format (n, i, j, Mij), that is, as a tuple where:
|
||||
2.1. n is an integer.
|
||||
2.2. i, j, Mij are 1 x nnz numpy arrays.
|
||||
3. dense matrices must be provided in raw format (Mij, rowOrdered), that is, as a tuple where:
|
||||
3.1. Mij is an n x n numpy array.
|
||||
3.2. rowOrdered is a boolean (column ordered if False).
|
||||
4. arpack mode solver are provided by eigen:
|
||||
4.1. when solver is iterative, A and B can be sparse only.
|
||||
4.2. when solver is direct, A and B can be sparse or dense.
|
||||
|
||||
Examples:
|
||||
---------
|
||||
|
||||
~/arpack-ng> find . -name *.py.in (template files from which python scripts will result)
|
||||
|
||||
@@ -0,0 +1,431 @@
|
||||
#include <Python.h> // PyErr_SetString.
|
||||
|
||||
#include <boost/python.hpp>
|
||||
#include <boost/python/numpy.hpp>
|
||||
#include <boost/python/suite/indexing/vector_indexing_suite.hpp>
|
||||
#include <complex>
|
||||
#include <pyarpackDrtSolver.hpp>
|
||||
#include <pyarpackItrSolver.hpp>
|
||||
#include <sstream> // ostringstream.
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace bp = boost::python;
|
||||
namespace bn = boost::python::numpy;
|
||||
|
||||
template <typename RC, typename FD, typename EM, typename SLV>
|
||||
void exportArpackSparseItr(bp::scope& pySlv, std::string const& dtype) {
|
||||
// Created nested namespace in module.
|
||||
|
||||
pySlv.attr(dtype.c_str()) =
|
||||
bp::class_<pyarpackSparseItrSolver<RC, FD, EM, SLV>>(
|
||||
dtype.c_str(),
|
||||
"arpack data type (must be consistent with numpy dtype)")
|
||||
.def("solve", &pyarpackSparseItrSolver<RC, FD, EM, SLV>::solve,
|
||||
(bp::arg("A"), bp::arg("B") = bp::tuple()),
|
||||
"solve standard or generalised eigen problem where A and B must "
|
||||
"be sparse and provided in coo format: (dimension, row-indice "
|
||||
"array, column-indice array, matrice-value array) tuple")
|
||||
.def("checkEigVec",
|
||||
&pyarpackSparseItrSolver<RC, FD, EM, SLV>::checkEigVec,
|
||||
(bp::arg("A"), bp::arg("B") = bp::tuple(),
|
||||
bp::arg("diffTol") = 1.e-3),
|
||||
"check eigen vectors accuracy where A and B must be sparse and "
|
||||
"provided in coo format: (dimension, row-indice array, "
|
||||
"column-indice array, matrice-value array) tuple")
|
||||
ARPACKSOLVERMEMBER(pyarpackSparseItrSolver)
|
||||
.def_readwrite(
|
||||
"slvTol", &pyarpackSparseItrSolver<RC, FD, EM, SLV>::slvTol,
|
||||
"tolerance of the iterative mode solver - default: 1.e-6")
|
||||
.def_readwrite("slvMaxIt",
|
||||
&pyarpackSparseItrSolver<RC, FD, EM, SLV>::slvMaxIt,
|
||||
"maximum number of iterations of the iterative mode "
|
||||
"solver - default: 100")
|
||||
.def_readwrite(
|
||||
"slvILUDropTol",
|
||||
&pyarpackSparseItrSolver<RC, FD, EM, SLV>::slvILUDropTol,
|
||||
"drop tolerance of the ILU preconditioner (if any) of the "
|
||||
"iterative mode solver - default: 1")
|
||||
.def_readwrite(
|
||||
"slvILUFillFactor",
|
||||
&pyarpackSparseItrSolver<RC, FD, EM, SLV>::slvILUFillFactor,
|
||||
"fill factor of the ILU preconditioner (if any) of the iterative "
|
||||
"mode solver - default: 2");
|
||||
};
|
||||
|
||||
template <typename RC, typename FD, typename EM, typename SLV>
|
||||
void exportArpackSparseDrt(bp::scope& pySlv, std::string const& dtype) {
|
||||
// Created nested namespace in module.
|
||||
|
||||
pySlv.attr(dtype.c_str()) =
|
||||
bp::class_<pyarpackSparseDrtSolver<RC, FD, EM, SLV>>(
|
||||
dtype.c_str(),
|
||||
"arpack data type (must be consistent with numpy dtype)")
|
||||
.def("solve", &pyarpackSparseDrtSolver<RC, FD, EM, SLV>::solve,
|
||||
(bp::arg("A"), bp::arg("B") = bp::tuple()),
|
||||
"solve standard or generalised eigen problem where A and B must "
|
||||
"be sparse and provided in coo format: (dimension, row-indice "
|
||||
"array, column-indice array, matrice-value array) tuple")
|
||||
.def("checkEigVec",
|
||||
&pyarpackSparseDrtSolver<RC, FD, EM, SLV>::checkEigVec,
|
||||
(bp::arg("A"), bp::arg("B") = bp::tuple(),
|
||||
bp::arg("diffTol") = 1.e-3),
|
||||
"check eigen vectors accuracy where A and B must be sparse and "
|
||||
"provided in coo format: (dimension, row-indice array, "
|
||||
"column-indice array, matrice-value array) tuple")
|
||||
ARPACKSOLVERMEMBER(pyarpackSparseDrtSolver)
|
||||
.def_readwrite(
|
||||
"slvPvtThd", &pyarpackSparseDrtSolver<RC, FD, EM, SLV>::slvPvtThd,
|
||||
"pivoting tolerance of the direct mode solver - default: 1.e-6")
|
||||
.def_readwrite("slvOffset",
|
||||
&pyarpackSparseDrtSolver<RC, FD, EM, SLV>::slvOffset,
|
||||
"cholesky offset (LLT, LDLT) of the direct mode "
|
||||
"solver - default: 0.")
|
||||
.def_readwrite("slvScale",
|
||||
&pyarpackSparseDrtSolver<RC, FD, EM, SLV>::slvScale,
|
||||
"cholesky scale (LLT, LDLT) of the direct mode solver "
|
||||
"- default: 1.");
|
||||
};
|
||||
|
||||
template <typename RC, typename FD, typename EM, typename SLV>
|
||||
void exportArpackDenseDrt(bp::scope& pySlv, std::string const& dtype) {
|
||||
// Created nested namespace in module.
|
||||
|
||||
pySlv.attr(dtype.c_str()) =
|
||||
bp::class_<pyarpackDenseDrtSolver<RC, FD, EM, SLV>>(
|
||||
dtype.c_str(),
|
||||
"arpack data type (must be consistent with numpy dtype)")
|
||||
.def("solve", &pyarpackDenseDrtSolver<RC, FD, EM, SLV>::solve,
|
||||
(bp::arg("A"), bp::arg("B") = bp::tuple()),
|
||||
"solve standard or generalised eigen problem where A and B must "
|
||||
"be dense and provided in raw format: (n-squared matrice-value "
|
||||
"array, row or column ordered boolean)")
|
||||
.def("checkEigVec",
|
||||
&pyarpackDenseDrtSolver<RC, FD, EM, SLV>::checkEigVec,
|
||||
(bp::arg("A"), bp::arg("B") = bp::tuple(),
|
||||
bp::arg("diffTol") = 1.e-3),
|
||||
"check eigen vectors accuracy where A and B must be dense and "
|
||||
"provided in raw format: (n-squared matrice-value array, row or "
|
||||
"column ordered boolean)")
|
||||
ARPACKSOLVERMEMBER(pyarpackDenseDrtSolver)
|
||||
.def_readwrite(
|
||||
"slvPvtThd", &pyarpackDenseDrtSolver<RC, FD, EM, SLV>::slvPvtThd,
|
||||
"pivoting tolerance of the direct mode solver - default: 1.e-6")
|
||||
.def_readwrite("slvOffset",
|
||||
&pyarpackDenseDrtSolver<RC, FD, EM, SLV>::slvOffset,
|
||||
"cholesky offset (LLT, LDLT) of the direct mode "
|
||||
"solver - default: 0.")
|
||||
.def_readwrite("slvScale",
|
||||
&pyarpackDenseDrtSolver<RC, FD, EM, SLV>::slvScale,
|
||||
"cholesky scale (LLT, LDLT) of the direct mode solver "
|
||||
"- default: 1.");
|
||||
};
|
||||
|
||||
class sparseBiCGDiag {};
|
||||
class sparseBiCGILU {};
|
||||
class sparseCGDiag {};
|
||||
class sparseCGILU {};
|
||||
class sparseLLT {};
|
||||
class sparseLDLT {};
|
||||
class sparseLU {};
|
||||
class sparseQR {};
|
||||
|
||||
class denseLLT {};
|
||||
class denseLDLT {};
|
||||
class denseLURR {};
|
||||
class denseQRRR {};
|
||||
class denseLUPP {};
|
||||
class denseQRPP {};
|
||||
|
||||
std::complex<double> EigVecZGetItem(
|
||||
Eigen::Matrix<std::complex<double>, Eigen::Dynamic, 1>& M, int idx) {
|
||||
if (idx < 0 || idx >= M.size()) {
|
||||
pyarpackThrowError("index out of range");
|
||||
return std::complex<double>();
|
||||
}
|
||||
return M[idx];
|
||||
};
|
||||
|
||||
std::string EigVecZToString(EigVecZ const& vec) {
|
||||
std::ostringstream s;
|
||||
s << vec;
|
||||
return s.str();
|
||||
};
|
||||
|
||||
BOOST_PYTHON_MODULE(pyarpack) {
|
||||
// Initialize.
|
||||
|
||||
bn::initialize();
|
||||
|
||||
bp::class_<std::vector<std::complex<double>>>("StdVecZ").def(
|
||||
bp::vector_indexing_suite<std::vector<std::complex<double>>>());
|
||||
|
||||
bp::class_<Eigen::Matrix<std::complex<double>, Eigen::Dynamic, 1>>("EigVecZ")
|
||||
.def("__getitem__", &EigVecZGetItem)
|
||||
.def("__str__", &EigVecZToString);
|
||||
|
||||
bp::class_<std::vector<EigVecZ>>("StdVecEVZ")
|
||||
.def("__iter__", bp::iterator<std::vector<EigVecZ>>())
|
||||
.def(bp::vector_indexing_suite<std::vector<EigVecZ>>());
|
||||
|
||||
// Documentation of the python module.
|
||||
|
||||
std::ostringstream doc;
|
||||
doc << "You can use sparse or dense matrices, and, play with iterative or direct mode solvers (CG, LU, ...):" << std::endl;
|
||||
doc << "1. choose arpack solver with a given mode solver" << std::endl;
|
||||
doc << " 1.1. if you need to handle sparse matrices" << std::endl;
|
||||
doc << " >> from pyarpack import sparseBiCG as pyarpackSlv" << std::endl;
|
||||
doc << " 1.2. if you need to handle dense matrices" << std::endl;
|
||||
doc << " >> from pyarpack import denseBiCG as pyarpackSlv" << std::endl;
|
||||
doc << "2. choose arpack data type (float, double, ...)" << std::endl;
|
||||
doc << " >> arpackSlv = pyarpackSlv.double()" << std::endl;
|
||||
doc << "3. solve the eigen problem" << std::endl;
|
||||
doc << " >> arpackSlv.solve(A, B)" << std::endl;
|
||||
doc << "4. get eigen values and vectors" << std::endl;
|
||||
doc << " >> print(arpackSlv.vec)" << std::endl;
|
||||
doc << " >> print(arpackSlv.val)" << std::endl;
|
||||
doc << std::endl;
|
||||
doc << "Notes:" << std::endl;
|
||||
doc << "1. arpack data type (float, double, ...) must be consistent with A/B numpy dtypes (float32, float64, ...)." << std::endl;
|
||||
doc << " at python side, the data MUST be casted in the EXACT expected type (int32, int64, float, double, ...)." << std::endl;
|
||||
doc << " otherwise, C++ may not get the data the way it expects them: C++ will not know how to read python data." << std::endl;
|
||||
doc << " if you are not sure how data have been passed from python to C++, set arpackSlv.debug = 1 and check out debug traces." << std::endl;
|
||||
doc << " in other words, pyarpack users MUST :" << std::endl;
|
||||
doc << " 1.1. create numpy arrays specifying explicitly the type:" << std::endl;
|
||||
doc << " >> Aij = np.array([], dtype='complex128')" << std::endl;
|
||||
doc << " 1.2. filling numpy arrays casting value on append:" << std::endl;
|
||||
doc << " >> Aij = np.append(Aij, np.complex128(complex( 200., 200.))) # Casting value on append is MANDATORY or C++ won't get the expected type." << std::endl;
|
||||
doc << " 1.3. calling the solver flavor which is consistent with the numpy array data type:" << std::endl;
|
||||
doc << " >> arpackSlv = pyarpackSlv.complexDouble() # Caution: complexDouble <=> np.array(..., dtype='complex128')" << std::endl;
|
||||
doc << " note: NO data type check can be done at C++ side, the pyarpack user MUST insure data consistency." << std::endl;
|
||||
doc << "2. sparse matrices must be provided in coo format (n, i, j, Mij), that is, as a tuple where:" << std::endl;
|
||||
doc << " 2.1. n is an integer." << std::endl;
|
||||
doc << " 2.2. i, j, Mij are 1 x nnz numpy arrays." << std::endl;
|
||||
doc << "3. dense matrices must be provided in raw format (Mij, rowOrdered), that is, as a tuple where:" << std::endl;
|
||||
doc << " 3.1. Mij is an n x n numpy array." << std::endl;
|
||||
doc << " 3.2. rowOrdered is a boolean (column ordered if False)." << std::endl;
|
||||
doc << "4. arpack mode solver are provided by eigen:" << std::endl;
|
||||
doc << " 4.1. when solver is iterative, A and B can be sparse only." << std::endl;
|
||||
doc << " 4.2. when solver is direct, A and B can be sparse or dense." << std::endl;
|
||||
bp::scope().attr("__doc__") = doc.str().c_str();
|
||||
|
||||
// Specify that this module is actually a package.
|
||||
|
||||
bp::object package = bp::scope();
|
||||
package.attr("__path__") = "pyarpack";
|
||||
|
||||
// Create python module.
|
||||
|
||||
std::string module = "pyarpack";
|
||||
bp::object pyModule(
|
||||
bp::handle<>(bp::borrowed(PyImport_AddModule(module.c_str()))));
|
||||
|
||||
// Create modules.
|
||||
|
||||
{
|
||||
std::string slv = "sparseBiCGDiag";
|
||||
std::string slvHelp =
|
||||
"arpack internal mode solver (mode > 1): BiCG with diagonal (Jacobi) "
|
||||
"preconditioner";
|
||||
bp::scope pySlvBiCGDiag =
|
||||
bp::class_<sparseBiCGDiag>(slv.c_str(), slvHelp.c_str());
|
||||
exportArpackSparseItr<float, float, EigSMxS, EigSBiCGS>(pySlvBiCGDiag,
|
||||
"float");
|
||||
exportArpackSparseItr<double, double, EigSMxD, EigSBiCGD>(pySlvBiCGDiag,
|
||||
"double");
|
||||
exportArpackSparseItr<std::complex<float>, float, EigSMxC, EigSBiCGC>(
|
||||
pySlvBiCGDiag, "complexFloat");
|
||||
exportArpackSparseItr<std::complex<double>, double, EigSMxZ, EigSBiCGZ>(
|
||||
pySlvBiCGDiag, "complexDouble");
|
||||
}
|
||||
|
||||
{
|
||||
std::string slv = "sparseBiCGILU";
|
||||
std::string slvHelp =
|
||||
"arpack internal mode solver (mode > 1): BiCG with ILU preconditioner";
|
||||
bp::scope pySlvBiCGILU =
|
||||
bp::class_<sparseBiCGILU>(slv.c_str(), slvHelp.c_str());
|
||||
exportArpackSparseItr<float, float, EigSMxS, EigSBiCGILUS>(pySlvBiCGILU,
|
||||
"float");
|
||||
exportArpackSparseItr<double, double, EigSMxD, EigSBiCGILUD>(pySlvBiCGILU,
|
||||
"double");
|
||||
exportArpackSparseItr<std::complex<float>, float, EigSMxC, EigSBiCGILUC>(
|
||||
pySlvBiCGILU, "complexFloat");
|
||||
exportArpackSparseItr<std::complex<double>, double, EigSMxZ, EigSBiCGILUZ>(
|
||||
pySlvBiCGILU, "complexDouble");
|
||||
}
|
||||
|
||||
{
|
||||
std::string slv = "sparseCGDiag";
|
||||
std::string slvHelp =
|
||||
"arpack internal mode solver (mode > 1): CG with diagonal (Jacobi) "
|
||||
"preconditioner";
|
||||
bp::scope pySlvCGDiag =
|
||||
bp::class_<sparseCGDiag>(slv.c_str(), slvHelp.c_str());
|
||||
exportArpackSparseItr<float, float, EigSMxS, EigSCGS>(pySlvCGDiag, "float");
|
||||
exportArpackSparseItr<double, double, EigSMxD, EigSCGD>(pySlvCGDiag,
|
||||
"double");
|
||||
exportArpackSparseItr<std::complex<float>, float, EigSMxC, EigSCGC>(
|
||||
pySlvCGDiag, "complexFloat");
|
||||
exportArpackSparseItr<std::complex<double>, double, EigSMxZ, EigSCGZ>(
|
||||
pySlvCGDiag, "complexDouble");
|
||||
}
|
||||
|
||||
{
|
||||
std::string slv = "sparseCGILU";
|
||||
std::string slvHelp =
|
||||
"arpack internal mode solver (mode > 1): CG with ILU preconditioner";
|
||||
bp::scope pySlvCGILU =
|
||||
bp::class_<sparseCGILU>(slv.c_str(), slvHelp.c_str());
|
||||
exportArpackSparseItr<float, float, EigSMxS, EigSCGILUS>(pySlvCGILU,
|
||||
"float");
|
||||
exportArpackSparseItr<double, double, EigSMxD, EigSCGILUD>(pySlvCGILU,
|
||||
"double");
|
||||
exportArpackSparseItr<std::complex<float>, float, EigSMxC, EigSCGILUC>(
|
||||
pySlvCGILU, "complexFloat");
|
||||
exportArpackSparseItr<std::complex<double>, double, EigSMxZ, EigSCGILUZ>(
|
||||
pySlvCGILU, "complexDouble");
|
||||
}
|
||||
|
||||
{
|
||||
std::string slv = "sparseLLT";
|
||||
std::string slvHelp = "arpack internal mode solver (mode > 1): LLT";
|
||||
bp::scope pySlvLLT = bp::class_<sparseLLT>(slv.c_str(), slvHelp.c_str());
|
||||
exportArpackSparseDrt<float, float, EigSMxS, EigSLLTS>(pySlvLLT, "float");
|
||||
exportArpackSparseDrt<double, double, EigSMxD, EigSLLTD>(pySlvLLT,
|
||||
"double");
|
||||
exportArpackSparseDrt<std::complex<float>, float, EigSMxC, EigSLLTC>(
|
||||
pySlvLLT, "complexFloat");
|
||||
exportArpackSparseDrt<std::complex<double>, double, EigSMxZ, EigSLLTZ>(
|
||||
pySlvLLT, "complexDouble");
|
||||
}
|
||||
|
||||
{
|
||||
std::string slv = "sparseLDLT";
|
||||
std::string slvHelp = "arpack internal mode solver (mode > 1): LDLT";
|
||||
bp::scope pySlvLDLT = bp::class_<sparseLDLT>(slv.c_str(), slvHelp.c_str());
|
||||
exportArpackSparseDrt<float, float, EigSMxS, EigSLDLTS>(pySlvLDLT, "float");
|
||||
exportArpackSparseDrt<double, double, EigSMxD, EigSLDLTD>(pySlvLDLT,
|
||||
"double");
|
||||
exportArpackSparseDrt<std::complex<float>, float, EigSMxC, EigSLDLTC>(
|
||||
pySlvLDLT, "complexFloat");
|
||||
exportArpackSparseDrt<std::complex<double>, double, EigSMxZ, EigSLDLTZ>(
|
||||
pySlvLDLT, "complexDouble");
|
||||
}
|
||||
|
||||
{
|
||||
std::string slv = "sparseLU";
|
||||
std::string slvHelp = "arpack internal mode solver (mode > 1): LU";
|
||||
bp::scope pySlvLU = bp::class_<sparseLU>(slv.c_str(), slvHelp.c_str());
|
||||
exportArpackSparseDrt<float, float, EigSMxS, EigSLUS>(pySlvLU, "float");
|
||||
exportArpackSparseDrt<double, double, EigSMxD, EigSLUD>(pySlvLU, "double");
|
||||
exportArpackSparseDrt<std::complex<float>, float, EigSMxC, EigSLUC>(
|
||||
pySlvLU, "complexFloat");
|
||||
exportArpackSparseDrt<std::complex<double>, double, EigSMxZ, EigSLUZ>(
|
||||
pySlvLU, "complexDouble");
|
||||
}
|
||||
|
||||
{
|
||||
std::string slv = "sparseQR";
|
||||
std::string slvHelp = "arpack internal mode solver (mode > 1): QR";
|
||||
bp::scope pySlvQR = bp::class_<sparseQR>(slv.c_str(), slvHelp.c_str());
|
||||
exportArpackSparseDrt<float, float, EigSMxS, EigSQRS>(pySlvQR, "float");
|
||||
exportArpackSparseDrt<double, double, EigSMxD, EigSQRD>(pySlvQR, "double");
|
||||
exportArpackSparseDrt<std::complex<float>, float, EigSMxC, EigSQRC>(
|
||||
pySlvQR, "complexFloat");
|
||||
exportArpackSparseDrt<std::complex<double>, double, EigSMxZ, EigSQRZ>(
|
||||
pySlvQR, "complexDouble");
|
||||
}
|
||||
|
||||
{
|
||||
std::string slv = "denseLLT";
|
||||
std::string slvHelp = "arpack internal mode solver (mode > 1): LLT";
|
||||
bp::scope pySlvLLT = bp::class_<denseLLT>(slv.c_str(), slvHelp.c_str());
|
||||
exportArpackDenseDrt<float, float, EigDMxS, EigDLLTS>(pySlvLLT, "float");
|
||||
exportArpackDenseDrt<double, double, EigDMxD, EigDLLTD>(pySlvLLT, "double");
|
||||
exportArpackDenseDrt<std::complex<float>, float, EigDMxC, EigDLLTC>(
|
||||
pySlvLLT, "complexFloat");
|
||||
exportArpackDenseDrt<std::complex<double>, double, EigDMxZ, EigDLLTZ>(
|
||||
pySlvLLT, "complexDouble");
|
||||
}
|
||||
|
||||
{
|
||||
std::string slv = "denseLDLT";
|
||||
std::string slvHelp = "arpack internal mode solver (mode > 1): LDLT";
|
||||
bp::scope pySlvLDLT = bp::class_<denseLDLT>(slv.c_str(), slvHelp.c_str());
|
||||
exportArpackDenseDrt<float, float, EigDMxS, EigDLDLTS>(pySlvLDLT, "float");
|
||||
exportArpackDenseDrt<double, double, EigDMxD, EigDLDLTD>(pySlvLDLT,
|
||||
"double");
|
||||
exportArpackDenseDrt<std::complex<float>, float, EigDMxC, EigDLDLTC>(
|
||||
pySlvLDLT, "complexFloat");
|
||||
exportArpackDenseDrt<std::complex<double>, double, EigDMxZ, EigDLDLTZ>(
|
||||
pySlvLDLT, "complexDouble");
|
||||
}
|
||||
|
||||
{
|
||||
std::string slv = "denseLURR";
|
||||
std::string slvHelp =
|
||||
"arpack internal mode solver (mode > 1): LU Rank Revealing (slower, "
|
||||
"more stable)";
|
||||
bp::scope pySlvLURR = bp::class_<denseLURR>(slv.c_str(), slvHelp.c_str());
|
||||
exportArpackDenseDrt<float, float, EigDMxS, EigDFLUS>(pySlvLURR, "float");
|
||||
exportArpackDenseDrt<double, double, EigDMxD, EigDFLUD>(pySlvLURR,
|
||||
"double");
|
||||
exportArpackDenseDrt<std::complex<float>, float, EigDMxC, EigDFLUC>(
|
||||
pySlvLURR, "complexFloat");
|
||||
exportArpackDenseDrt<std::complex<double>, double, EigDMxZ, EigDFLUZ>(
|
||||
pySlvLURR, "complexDouble");
|
||||
}
|
||||
|
||||
{
|
||||
std::string slv = "denseQRRR";
|
||||
std::string slvHelp =
|
||||
"arpack internal mode solver (mode > 1): QR Rank Revealing (slower, "
|
||||
"more stable)";
|
||||
bp::scope pySlvQRRR = bp::class_<denseQRRR>(slv.c_str(), slvHelp.c_str());
|
||||
exportArpackDenseDrt<float, float, EigDMxS, EigDFQRS>(pySlvQRRR, "float");
|
||||
exportArpackDenseDrt<double, double, EigDMxD, EigDFQRD>(pySlvQRRR,
|
||||
"double");
|
||||
exportArpackDenseDrt<std::complex<float>, float, EigDMxC, EigDFQRC>(
|
||||
pySlvQRRR, "complexFloat");
|
||||
exportArpackDenseDrt<std::complex<double>, double, EigDMxZ, EigDFQRZ>(
|
||||
pySlvQRRR, "complexDouble");
|
||||
}
|
||||
|
||||
{
|
||||
std::string slv = "denseLUPP";
|
||||
std::string slvHelp =
|
||||
"arpack internal mode solver (mode > 1): LU Partial Pivoting (faster, "
|
||||
"less stable)";
|
||||
bp::scope pySlvLUPP = bp::class_<denseLUPP>(slv.c_str(), slvHelp.c_str());
|
||||
exportArpackDenseDrt<float, float, EigDMxS, EigDPLUS>(pySlvLUPP, "float");
|
||||
exportArpackDenseDrt<double, double, EigDMxD, EigDPLUD>(pySlvLUPP,
|
||||
"double");
|
||||
exportArpackDenseDrt<std::complex<float>, float, EigDMxC, EigDPLUC>(
|
||||
pySlvLUPP, "complexFloat");
|
||||
exportArpackDenseDrt<std::complex<double>, double, EigDMxZ, EigDPLUZ>(
|
||||
pySlvLUPP, "complexDouble");
|
||||
}
|
||||
|
||||
{
|
||||
std::string slv = "denseQRPP";
|
||||
std::string slvHelp =
|
||||
"arpack internal mode solver (mode > 1): QR Partial Pivoting (faster, "
|
||||
"less stable)";
|
||||
bp::scope pySlvQPPR = bp::class_<denseQRPP>(slv.c_str(), slvHelp.c_str());
|
||||
exportArpackDenseDrt<float, float, EigDMxS, EigDPQRS>(pySlvQPPR, "float");
|
||||
exportArpackDenseDrt<double, double, EigDMxD, EigDPQRD>(pySlvQPPR,
|
||||
"double");
|
||||
exportArpackDenseDrt<std::complex<float>, float, EigDMxC, EigDPQRC>(
|
||||
pySlvQPPR, "complexFloat");
|
||||
exportArpackDenseDrt<std::complex<double>, double, EigDMxZ, EigDPQRZ>(
|
||||
pySlvQPPR, "complexDouble");
|
||||
}
|
||||
}
|
||||
|
||||
// Local Variables:
|
||||
// mode: c++
|
||||
// c-file-style:"stroustrup"
|
||||
// show-trailing-whitespace: t
|
||||
// End:
|
||||
/* vim: set sw=2 ts=2 et smartindent :*/
|
||||
@@ -0,0 +1,118 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import numpy as np
|
||||
from pyarpack import denseLDLT as pyarpackSlv
|
||||
|
||||
# Build laplacian.
|
||||
|
||||
n = 4
|
||||
Aij = np.array([], dtype='complex128')
|
||||
for k in range(n):
|
||||
for l in range(n):
|
||||
if l == k:
|
||||
Aij = np.append(Aij, np.complex128(complex( 200., 200.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
elif l == k-1:
|
||||
Aij = np.append(Aij, np.complex128(complex(-101., -101.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
elif l == k+1:
|
||||
Aij = np.append(Aij, np.complex128(complex( -99., -99.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
else:
|
||||
Aij = np.append(Aij, np.complex128(complex( 0., 0.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
for idx, val in enumerate(Aij):
|
||||
print("A[", idx, "] =", val)
|
||||
A = (Aij, False) # raw format: Aij values, row ordered (or not).
|
||||
|
||||
# Get and tune arpack solver.
|
||||
|
||||
arpackSlv = pyarpackSlv.complexDouble() # Caution: complexDouble <=> np.array(..., dtype='complex128')
|
||||
arpackSlv.verbose = 3 # Set to 0 to get a quiet solve.
|
||||
arpackSlv.debug = 1 # Set to 0 to get a quiet solve.
|
||||
arpackSlv.nbEV = 1
|
||||
arpackSlv.nbCV = 2*arpackSlv.nbEV + 1
|
||||
arpackSlv.mag = 'LM'
|
||||
arpackSlv.maxIt = 200
|
||||
arpackSlv.slvOffset = 0.
|
||||
arpackSlv.slvScale = 1.
|
||||
arpackSlv.symPb = False
|
||||
|
||||
# Solve eigen problem.
|
||||
|
||||
rc = arpackSlv.solve(A)
|
||||
assert rc == 0, "bad solve"
|
||||
rc = arpackSlv.checkEigVec(A)
|
||||
assert rc == 0, "bad checkEigVec"
|
||||
|
||||
# Print out results (mode selected, eigen vectors, eigen values, ...).
|
||||
|
||||
assert arpackSlv.nbEV == len(arpackSlv.val), "bad result"
|
||||
print("\nresults:\n")
|
||||
print("mode selected:", arpackSlv.mode)
|
||||
print("nb iterations:", arpackSlv.nbIt)
|
||||
print("Reverse Communication Interface time:", arpackSlv.rciTime, "s")
|
||||
for val, vec in zip(arpackSlv.val, arpackSlv.vec):
|
||||
print("eigen value:", val)
|
||||
print("eigen vector:")
|
||||
print(vec)
|
||||
|
||||
#######################################################################################
|
||||
print("\n##########################################################################\n")
|
||||
#######################################################################################
|
||||
|
||||
# Build laplacian.
|
||||
|
||||
n = 8
|
||||
Aij = np.array([], dtype='complex64')
|
||||
Bij = np.array([], dtype='complex64')
|
||||
for k in range(n):
|
||||
for l in range(n):
|
||||
if l == k:
|
||||
Aij = np.append(Aij, np.complex64(complex( 200., 200.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
Bij = np.append(Bij, np.complex64(complex( 33.3, 33.3))) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
elif l == k-1:
|
||||
Aij = np.append(Aij, np.complex64(complex(-101., -101.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
Bij = np.append(Bij, np.complex64(complex( 16.6, 16.6))) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
elif l == k+1:
|
||||
Aij = np.append(Aij, np.complex64(complex( -99., -99.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
Bij = np.append(Bij, np.complex64(complex( 16.6, 16.6))) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
else:
|
||||
Aij = np.append(Aij, np.complex64(complex( 0., 0.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
Bij = np.append(Bij, np.complex64(complex( 0., 0.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
for idx, val in enumerate(Aij):
|
||||
print("A[", idx, "] =", val)
|
||||
for idx, val in enumerate(Bij):
|
||||
print("B[", idx, "] =", val)
|
||||
A = (Aij, False) # raw format: Aij values, row ordered (or not).
|
||||
B = (Bij, True) # raw format: Bij values, row ordered (or not).
|
||||
|
||||
# Get and tune arpack solver.
|
||||
|
||||
arpackSlv = pyarpackSlv.complexFloat() # Caution: complexFloat <=> np.array(..., dtype='complex64')
|
||||
arpackSlv.verbose = 3 # Set to 0 to get a quiet solve.
|
||||
arpackSlv.debug = 1 # Set to 0 to get a quiet solve.
|
||||
arpackSlv.nbEV = 2
|
||||
arpackSlv.nbCV = 2*arpackSlv.nbEV + 1
|
||||
arpackSlv.mag = 'LM'
|
||||
arpackSlv.maxIt = 200
|
||||
arpackSlv.slvOffset = 0.
|
||||
arpackSlv.slvScale = 1.
|
||||
arpackSlv.sigmaReal = 1
|
||||
arpackSlv.symPb = False
|
||||
|
||||
# Solve eigen problem.
|
||||
|
||||
rc = arpackSlv.solve(A, B)
|
||||
assert rc == 0, "bad solve"
|
||||
rc = arpackSlv.checkEigVec(A, B, 1.e-2)
|
||||
assert rc == 0, "bad checkEigVec"
|
||||
|
||||
# Print out results (mode selected, eigen vectors, eigen values, ...).
|
||||
|
||||
assert arpackSlv.nbEV == len(arpackSlv.val), "bad result"
|
||||
print("\nresults:\n")
|
||||
print("mode selected:", arpackSlv.mode)
|
||||
print("nb iterations:", arpackSlv.nbIt)
|
||||
print("Reverse Communication Interface time:", arpackSlv.rciTime, "s")
|
||||
for val, vec in zip(arpackSlv.val, arpackSlv.vec):
|
||||
print("eigen value:", val)
|
||||
print("eigen vector:")
|
||||
for v in range(n):
|
||||
print(vec[v])
|
||||
@@ -0,0 +1,110 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import numpy as np
|
||||
from pyarpack import denseLLT as pyarpackSlv
|
||||
|
||||
# Build laplacian.
|
||||
|
||||
n = 4
|
||||
Aij = np.array([], dtype='float64')
|
||||
for k in range(n):
|
||||
for l in range(n):
|
||||
if l == k:
|
||||
Aij = np.append(Aij, np.float64( 200.)) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
elif l == k-1 or l == k+1:
|
||||
Aij = np.append(Aij, np.float64(-100.)) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
else:
|
||||
Aij = np.append(Aij, np.float64( 0.)) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
for idx, val in enumerate(Aij):
|
||||
print("A[", idx, "] =", val)
|
||||
A = (Aij, False) # raw format: Aij values, row ordered (or not).
|
||||
|
||||
# Get and tune arpack solver.
|
||||
|
||||
arpackSlv = pyarpackSlv.double() # Caution: double <=> np.array(..., dtype='float64')
|
||||
arpackSlv.verbose = 3 # Set to 0 to get a quiet solve.
|
||||
arpackSlv.debug = 1 # Set to 0 to get a quiet solve.
|
||||
arpackSlv.nbEV = 1
|
||||
arpackSlv.nbCV = 2*arpackSlv.nbEV + 1
|
||||
arpackSlv.mag = 'LM'
|
||||
arpackSlv.maxIt = 200
|
||||
arpackSlv.slvOffset = 0.
|
||||
arpackSlv.slvScale = 1.
|
||||
|
||||
# Solve eigen problem.
|
||||
|
||||
rc = arpackSlv.solve(A)
|
||||
assert rc == 0, "bad solve"
|
||||
rc = arpackSlv.checkEigVec(A)
|
||||
assert rc == 0, "bad checkEigVec"
|
||||
|
||||
# Print out results (mode selected, eigen vectors, eigen values, ...).
|
||||
|
||||
assert arpackSlv.nbEV == len(arpackSlv.val), "bad result"
|
||||
print("\nresults:\n")
|
||||
print("mode selected:", arpackSlv.mode)
|
||||
print("nb iterations:", arpackSlv.nbIt)
|
||||
print("Reverse Communication Interface time:", arpackSlv.rciTime, "s")
|
||||
for val, vec in zip(arpackSlv.val, arpackSlv.vec):
|
||||
print("eigen value:", val)
|
||||
print("eigen vector:")
|
||||
print(vec)
|
||||
|
||||
#######################################################################################
|
||||
print("\n##########################################################################\n")
|
||||
#######################################################################################
|
||||
|
||||
# Build laplacian.
|
||||
|
||||
n = 8
|
||||
Aij = np.array([], dtype='float32')
|
||||
Bij = np.array([], dtype='float32')
|
||||
for k in range(n):
|
||||
for l in range(n):
|
||||
if l == k:
|
||||
Aij = np.append(Aij, np.float32( 200.)) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
Bij = np.append(Bij, np.float32( 33.3)) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
elif l == k-1 or l == k+1:
|
||||
Aij = np.append(Aij, np.float32(-100.)) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
Bij = np.append(Bij, np.float32( 16.6)) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
else:
|
||||
Aij = np.append(Aij, np.float32( 0.)) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
Bij = np.append(Bij, np.float32( 0.)) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
for idx, val in enumerate(Aij):
|
||||
print("A[", idx, "] =", val)
|
||||
for idx, val in enumerate(Bij):
|
||||
print("B[", idx, "] =", val)
|
||||
A = (Aij, False) # raw format: Aij values, row ordered (or not).
|
||||
B = (Bij, True) # raw format: Bij values, row ordered (or not).
|
||||
|
||||
# Get and tune arpack solver.
|
||||
|
||||
arpackSlv = pyarpackSlv.float() # Caution: float <=> np.array(..., dtype='float32')
|
||||
arpackSlv.verbose = 3 # Set to 0 to get a quiet solve.
|
||||
arpackSlv.debug = 1 # Set to 0 to get a quiet solve.
|
||||
arpackSlv.nbEV = 2
|
||||
arpackSlv.nbCV = 2*arpackSlv.nbEV + 1
|
||||
arpackSlv.mag = 'LM'
|
||||
arpackSlv.maxIt = 200
|
||||
arpackSlv.slvOffset = 0.
|
||||
arpackSlv.slvScale = 1.
|
||||
|
||||
# Solve eigen problem.
|
||||
|
||||
rc = arpackSlv.solve(A, B)
|
||||
assert rc == 0, "bad solve"
|
||||
rc = arpackSlv.checkEigVec(A, B, 1.e-2)
|
||||
assert rc == 0, "bad checkEigVec"
|
||||
|
||||
# Print out results (mode selected, eigen vectors, eigen values, ...).
|
||||
|
||||
assert arpackSlv.nbEV == len(arpackSlv.val), "bad result"
|
||||
print("\nresults:\n")
|
||||
print("mode selected:", arpackSlv.mode)
|
||||
print("nb iterations:", arpackSlv.nbIt)
|
||||
print("Reverse Communication Interface time:", arpackSlv.rciTime, "s")
|
||||
for val, vec in zip(arpackSlv.val, arpackSlv.vec):
|
||||
print("eigen value:", val)
|
||||
print("eigen vector:")
|
||||
for v in range(n):
|
||||
print(vec[v])
|
||||
@@ -0,0 +1,109 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import numpy as np
|
||||
from pyarpack import denseLUPP as pyarpackSlv
|
||||
|
||||
# Build laplacian.
|
||||
|
||||
n = 4
|
||||
Aij = np.array([], dtype='float64')
|
||||
for k in range(n):
|
||||
for l in range(n):
|
||||
if l == k:
|
||||
Aij = np.append(Aij, np.float64( 200.)) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
elif l == k-1 or l == k+1:
|
||||
Aij = np.append(Aij, np.float64(-100.)) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
else:
|
||||
Aij = np.append(Aij, np.float64( 0.)) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
for idx, val in enumerate(Aij):
|
||||
print("A[", idx, "] =", val)
|
||||
A = (Aij, False) # raw format: Aij values, row ordered (or not).
|
||||
|
||||
# Get and tune arpack solver.
|
||||
|
||||
arpackSlv = pyarpackSlv.double() # Caution: double <=> np.array(..., dtype='float64')
|
||||
arpackSlv.verbose = 3 # Set to 0 to get a quiet solve.
|
||||
arpackSlv.debug = 1 # Set to 0 to get a quiet solve.
|
||||
arpackSlv.nbEV = 1
|
||||
arpackSlv.nbCV = 2*arpackSlv.nbEV + 1
|
||||
arpackSlv.mag = 'LM'
|
||||
arpackSlv.maxIt = 200
|
||||
arpackSlv.slvPvtThd = 1.e-6
|
||||
|
||||
# Solve eigen problem.
|
||||
|
||||
rc = arpackSlv.solve(A)
|
||||
assert rc == 0, "bad solve"
|
||||
rc = arpackSlv.checkEigVec(A)
|
||||
assert rc == 0, "bad checkEigVec"
|
||||
|
||||
# Print out results (mode selected, eigen vectors, eigen values, ...).
|
||||
|
||||
assert arpackSlv.nbEV == len(arpackSlv.val), "bad result"
|
||||
print("\nresults:\n")
|
||||
print("mode selected:", arpackSlv.mode)
|
||||
print("nb iterations:", arpackSlv.nbIt)
|
||||
print("Reverse Communication Interface time:", arpackSlv.rciTime, "s")
|
||||
for val, vec in zip(arpackSlv.val, arpackSlv.vec):
|
||||
print("eigen value:", val)
|
||||
print("eigen vector:")
|
||||
print(vec)
|
||||
|
||||
#######################################################################################
|
||||
print("\n##########################################################################\n")
|
||||
#######################################################################################
|
||||
|
||||
# Build laplacian.
|
||||
|
||||
n = 8
|
||||
Aij = np.array([], dtype='float32')
|
||||
Bij = np.array([], dtype='float32')
|
||||
for k in range(n):
|
||||
for l in range(n):
|
||||
if l == k:
|
||||
Aij = np.append(Aij, np.float32( 200.)) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
Bij = np.append(Bij, np.float32( 33.3)) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
elif l == k-1 or l == k+1:
|
||||
Aij = np.append(Aij, np.float32(-100.)) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
Bij = np.append(Bij, np.float32( 16.6)) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
else:
|
||||
Aij = np.append(Aij, np.float32( 0.)) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
Bij = np.append(Bij, np.float32( 0.)) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
for idx, val in enumerate(Aij):
|
||||
print("A[", idx, "] =", val)
|
||||
for idx, val in enumerate(Bij):
|
||||
print("B[", idx, "] =", val)
|
||||
A = (Aij, False) # raw format: Aij values, row ordered (or not).
|
||||
B = (Bij, True) # raw format: Bij values, row ordered (or not).
|
||||
|
||||
# Get and tune arpack solver.
|
||||
|
||||
arpackSlv = pyarpackSlv.float() # Caution: float <=> np.array(..., dtype='float32')
|
||||
arpackSlv.verbose = 3 # Set to 0 to get a quiet solve.
|
||||
arpackSlv.debug = 1 # Set to 0 to get a quiet solve.
|
||||
arpackSlv.nbEV = 2
|
||||
arpackSlv.nbCV = 2*arpackSlv.nbEV + 1
|
||||
arpackSlv.mag = 'LM'
|
||||
arpackSlv.maxIt = 200
|
||||
arpackSlv.slvPvtThd = 1.e-6
|
||||
arpackSlv.sigmaReal = 1
|
||||
|
||||
# Solve eigen problem.
|
||||
|
||||
rc = arpackSlv.solve(A, B)
|
||||
assert rc == 0, "bad solve"
|
||||
rc = arpackSlv.checkEigVec(A, B, 1.e-2)
|
||||
assert rc == 0, "bad checkEigVec"
|
||||
|
||||
# Print out results (mode selected, eigen vectors, eigen values, ...).
|
||||
|
||||
assert arpackSlv.nbEV == len(arpackSlv.val), "bad result"
|
||||
print("\nresults:\n")
|
||||
print("mode selected:", arpackSlv.mode)
|
||||
print("nb iterations:", arpackSlv.nbIt)
|
||||
print("Reverse Communication Interface time:", arpackSlv.rciTime, "s")
|
||||
for val, vec in zip(arpackSlv.val, arpackSlv.vec):
|
||||
print("eigen value:", val)
|
||||
print("eigen vector:")
|
||||
for v in range(n):
|
||||
print(vec[v])
|
||||
@@ -0,0 +1,109 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import numpy as np
|
||||
from pyarpack import denseLURR as pyarpackSlv
|
||||
|
||||
# Build laplacian.
|
||||
|
||||
n = 4
|
||||
Aij = np.array([], dtype='float64')
|
||||
for k in range(n):
|
||||
for l in range(n):
|
||||
if l == k:
|
||||
Aij = np.append(Aij, np.float64( 200.)) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
elif l == k-1 or l == k+1:
|
||||
Aij = np.append(Aij, np.float64(-100.)) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
else:
|
||||
Aij = np.append(Aij, np.float64( 0.)) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
for idx, val in enumerate(Aij):
|
||||
print("A[", idx, "] =", val)
|
||||
A = (Aij, False) # raw format: Aij values, row ordered (or not).
|
||||
|
||||
# Get and tune arpack solver.
|
||||
|
||||
arpackSlv = pyarpackSlv.double() # Caution: double <=> np.array(..., dtype='float64')
|
||||
arpackSlv.verbose = 3 # Set to 0 to get a quiet solve.
|
||||
arpackSlv.debug = 1 # Set to 0 to get a quiet solve.
|
||||
arpackSlv.nbEV = 1
|
||||
arpackSlv.nbCV = 2*arpackSlv.nbEV + 1
|
||||
arpackSlv.mag = 'LM'
|
||||
arpackSlv.maxIt = 200
|
||||
arpackSlv.slvPvtThd = 1.e-6
|
||||
|
||||
# Solve eigen problem.
|
||||
|
||||
rc = arpackSlv.solve(A)
|
||||
assert rc == 0, "bad solve"
|
||||
rc = arpackSlv.checkEigVec(A)
|
||||
assert rc == 0, "bad checkEigVec"
|
||||
|
||||
# Print out results (mode selected, eigen vectors, eigen values, ...).
|
||||
|
||||
assert arpackSlv.nbEV == len(arpackSlv.val), "bad result"
|
||||
print("\nresults:\n")
|
||||
print("mode selected:", arpackSlv.mode)
|
||||
print("nb iterations:", arpackSlv.nbIt)
|
||||
print("Reverse Communication Interface time:", arpackSlv.rciTime, "s")
|
||||
for val, vec in zip(arpackSlv.val, arpackSlv.vec):
|
||||
print("eigen value:", val)
|
||||
print("eigen vector:")
|
||||
print(vec)
|
||||
|
||||
#######################################################################################
|
||||
print("\n##########################################################################\n")
|
||||
#######################################################################################
|
||||
|
||||
# Build laplacian.
|
||||
|
||||
n = 8
|
||||
Aij = np.array([], dtype='float32')
|
||||
Bij = np.array([], dtype='float32')
|
||||
for k in range(n):
|
||||
for l in range(n):
|
||||
if l == k:
|
||||
Aij = np.append(Aij, np.float32( 200.)) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
Bij = np.append(Bij, np.float32( 33.3)) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
elif l == k-1 or l == k+1:
|
||||
Aij = np.append(Aij, np.float32(-100.)) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
Bij = np.append(Bij, np.float32( 16.6)) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
else:
|
||||
Aij = np.append(Aij, np.float32( 0.)) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
Bij = np.append(Bij, np.float32( 0.)) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
for idx, val in enumerate(Aij):
|
||||
print("A[", idx, "] =", val)
|
||||
for idx, val in enumerate(Bij):
|
||||
print("B[", idx, "] =", val)
|
||||
A = (Aij, False) # raw format: Aij values, row ordered (or not).
|
||||
B = (Bij, True) # raw format: Bij values, row ordered (or not).
|
||||
|
||||
# Get and tune arpack solver.
|
||||
|
||||
arpackSlv = pyarpackSlv.float() # Caution: float <=> np.array(..., dtype='float32')
|
||||
arpackSlv.verbose = 3 # Set to 0 to get a quiet solve.
|
||||
arpackSlv.debug = 1 # Set to 0 to get a quiet solve.
|
||||
arpackSlv.nbEV = 2
|
||||
arpackSlv.nbCV = 2*arpackSlv.nbEV + 1
|
||||
arpackSlv.mag = 'LM'
|
||||
arpackSlv.maxIt = 200
|
||||
arpackSlv.slvPvtThd = 1.e-6
|
||||
arpackSlv.sigmaReal = 1
|
||||
|
||||
# Solve eigen problem.
|
||||
|
||||
rc = arpackSlv.solve(A, B)
|
||||
assert rc == 0, "bad solve"
|
||||
rc = arpackSlv.checkEigVec(A, B, 1.e-2)
|
||||
assert rc == 0, "bad checkEigVec"
|
||||
|
||||
# Print out results (mode selected, eigen vectors, eigen values, ...).
|
||||
|
||||
assert arpackSlv.nbEV == len(arpackSlv.val), "bad result"
|
||||
print("\nresults:\n")
|
||||
print("mode selected:", arpackSlv.mode)
|
||||
print("nb iterations:", arpackSlv.nbIt)
|
||||
print("Reverse Communication Interface time:", arpackSlv.rciTime, "s")
|
||||
for val, vec in zip(arpackSlv.val, arpackSlv.vec):
|
||||
print("eigen value:", val)
|
||||
print("eigen vector:")
|
||||
for v in range(n):
|
||||
print(vec[v])
|
||||
@@ -0,0 +1,116 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import numpy as np
|
||||
from pyarpack import denseQRPP as pyarpackSlv
|
||||
|
||||
# Build laplacian.
|
||||
|
||||
n = 4
|
||||
Aij = np.array([], dtype='complex128')
|
||||
for k in range(n):
|
||||
for l in range(n):
|
||||
if l == k:
|
||||
Aij = np.append(Aij, np.complex128(complex( 200., 200.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
elif l == k-1:
|
||||
Aij = np.append(Aij, np.complex128(complex(-101., -101.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
elif l == k+1:
|
||||
Aij = np.append(Aij, np.complex128(complex( -99., -99.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
else:
|
||||
Aij = np.append(Aij, np.complex128(complex( 0., 0.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
for idx, val in enumerate(Aij):
|
||||
print("A[", idx, "] =", val)
|
||||
A = (Aij, False) # raw format: Aij values, row ordered (or not).
|
||||
|
||||
# Get and tune arpack solver.
|
||||
|
||||
arpackSlv = pyarpackSlv.complexDouble() # Caution: complexDouble <=> np.array(..., dtype='complex128')
|
||||
arpackSlv.verbose = 3 # Set to 0 to get a quiet solve.
|
||||
arpackSlv.debug = 1 # Set to 0 to get a quiet solve.
|
||||
arpackSlv.nbEV = 1
|
||||
arpackSlv.nbCV = 2*arpackSlv.nbEV + 1
|
||||
arpackSlv.mag = 'LM'
|
||||
arpackSlv.maxIt = 200
|
||||
arpackSlv.slvPvtThd = 1.e-6
|
||||
arpackSlv.symPb = False
|
||||
|
||||
# Solve eigen problem.
|
||||
|
||||
rc = arpackSlv.solve(A)
|
||||
assert rc == 0, "bad solve"
|
||||
rc = arpackSlv.checkEigVec(A)
|
||||
assert rc == 0, "bad checkEigVec"
|
||||
|
||||
# Print out results (mode selected, eigen vectors, eigen values, ...).
|
||||
|
||||
assert arpackSlv.nbEV == len(arpackSlv.val), "bad result"
|
||||
print("\nresults:\n")
|
||||
print("mode selected:", arpackSlv.mode)
|
||||
print("nb iterations:", arpackSlv.nbIt)
|
||||
print("Reverse Communication Interface time:", arpackSlv.rciTime, "s")
|
||||
for val, vec in zip(arpackSlv.val, arpackSlv.vec):
|
||||
print("eigen value:", val)
|
||||
print("eigen vector:")
|
||||
print(vec)
|
||||
|
||||
#######################################################################################
|
||||
print("\n##########################################################################\n")
|
||||
#######################################################################################
|
||||
|
||||
# Build laplacian.
|
||||
|
||||
n = 8
|
||||
Aij = np.array([], dtype='complex64')
|
||||
Bij = np.array([], dtype='complex64')
|
||||
for k in range(n):
|
||||
for l in range(n):
|
||||
if l == k:
|
||||
Aij = np.append(Aij, np.complex64(complex( 200., 200.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
Bij = np.append(Bij, np.complex64(complex( 33.3, 33.3))) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
elif l == k-1:
|
||||
Aij = np.append(Aij, np.complex64(complex(-101., -101.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
Bij = np.append(Bij, np.complex64(complex( 16.6, 16.6))) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
elif l == k+1:
|
||||
Aij = np.append(Aij, np.complex64(complex( -99., -99.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
Bij = np.append(Bij, np.complex64(complex( 16.6, 16.6))) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
else:
|
||||
Aij = np.append(Aij, np.complex64(complex( 0., 0.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
Bij = np.append(Bij, np.complex64(complex( 0., 0.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
for idx, val in enumerate(Aij):
|
||||
print("A[", idx, "] =", val)
|
||||
for idx, val in enumerate(Bij):
|
||||
print("B[", idx, "] =", val)
|
||||
A = (Aij, False) # raw format: Aij values, row ordered (or not).
|
||||
B = (Bij, True) # raw format: Bij values, row ordered (or not).
|
||||
|
||||
# Get and tune arpack solver.
|
||||
|
||||
arpackSlv = pyarpackSlv.complexFloat() # Caution: complexFloat <=> np.array(..., dtype='complex64')
|
||||
arpackSlv.verbose = 3 # Set to 0 to get a quiet solve.
|
||||
arpackSlv.debug = 1 # Set to 0 to get a quiet solve.
|
||||
arpackSlv.nbEV = 2
|
||||
arpackSlv.nbCV = 2*arpackSlv.nbEV + 1
|
||||
arpackSlv.mag = 'LM'
|
||||
arpackSlv.maxIt = 200
|
||||
arpackSlv.slvPvtThd = 1.e-6
|
||||
arpackSlv.sigmaReal = 1
|
||||
arpackSlv.symPb = False
|
||||
|
||||
# Solve eigen problem.
|
||||
|
||||
rc = arpackSlv.solve(A, B)
|
||||
assert rc == 0, "bad solve"
|
||||
rc = arpackSlv.checkEigVec(A, B, 1.e-2)
|
||||
assert rc == 0, "bad checkEigVec"
|
||||
|
||||
# Print out results (mode selected, eigen vectors, eigen values, ...).
|
||||
|
||||
assert arpackSlv.nbEV == len(arpackSlv.val), "bad result"
|
||||
print("\nresults:\n")
|
||||
print("mode selected:", arpackSlv.mode)
|
||||
print("nb iterations:", arpackSlv.nbIt)
|
||||
print("Reverse Communication Interface time:", arpackSlv.rciTime, "s")
|
||||
for val, vec in zip(arpackSlv.val, arpackSlv.vec):
|
||||
print("eigen value:", val)
|
||||
print("eigen vector:")
|
||||
for v in range(n):
|
||||
print(vec[v])
|
||||
@@ -0,0 +1,116 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import numpy as np
|
||||
from pyarpack import denseQRRR as pyarpackSlv
|
||||
|
||||
# Build laplacian.
|
||||
|
||||
n = 4
|
||||
Aij = np.array([], dtype='complex128')
|
||||
for k in range(n):
|
||||
for l in range(n):
|
||||
if l == k:
|
||||
Aij = np.append(Aij, np.complex128(complex( 200., 200.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
elif l == k-1:
|
||||
Aij = np.append(Aij, np.complex128(complex(-101., -101.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
elif l == k+1:
|
||||
Aij = np.append(Aij, np.complex128(complex( -99., -99.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
else:
|
||||
Aij = np.append(Aij, np.complex128(complex( 0., 0.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
for idx, val in enumerate(Aij):
|
||||
print("A[", idx, "] =", val)
|
||||
A = (Aij, False) # raw format: Aij values, row ordered (or not).
|
||||
|
||||
# Get and tune arpack solver.
|
||||
|
||||
arpackSlv = pyarpackSlv.complexDouble() # Caution: complexDouble <=> np.array(..., dtype='complex128')
|
||||
arpackSlv.verbose = 3 # Set to 0 to get a quiet solve.
|
||||
arpackSlv.debug = 1 # Set to 0 to get a quiet solve.
|
||||
arpackSlv.nbEV = 1
|
||||
arpackSlv.nbCV = 2*arpackSlv.nbEV + 1
|
||||
arpackSlv.mag = 'LM'
|
||||
arpackSlv.maxIt = 200
|
||||
arpackSlv.slvPvtThd = 1.e-6
|
||||
arpackSlv.symPb = False
|
||||
|
||||
# Solve eigen problem.
|
||||
|
||||
rc = arpackSlv.solve(A)
|
||||
assert rc == 0, "bad solve"
|
||||
rc = arpackSlv.checkEigVec(A)
|
||||
assert rc == 0, "bad checkEigVec"
|
||||
|
||||
# Print out results (mode selected, eigen vectors, eigen values, ...).
|
||||
|
||||
assert arpackSlv.nbEV == len(arpackSlv.val), "bad result"
|
||||
print("\nresults:\n")
|
||||
print("mode selected:", arpackSlv.mode)
|
||||
print("nb iterations:", arpackSlv.nbIt)
|
||||
print("Reverse Communication Interface time:", arpackSlv.rciTime, "s")
|
||||
for val, vec in zip(arpackSlv.val, arpackSlv.vec):
|
||||
print("eigen value:", val)
|
||||
print("eigen vector:")
|
||||
print(vec)
|
||||
|
||||
#######################################################################################
|
||||
print("\n##########################################################################\n")
|
||||
#######################################################################################
|
||||
|
||||
# Build laplacian.
|
||||
|
||||
n = 8
|
||||
Aij = np.array([], dtype='complex64')
|
||||
Bij = np.array([], dtype='complex64')
|
||||
for k in range(n):
|
||||
for l in range(n):
|
||||
if l == k:
|
||||
Aij = np.append(Aij, np.complex64(complex( 200., 200.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
Bij = np.append(Bij, np.complex64(complex( 33.3, 33.3))) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
elif l == k-1:
|
||||
Aij = np.append(Aij, np.complex64(complex(-101., -101.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
Bij = np.append(Bij, np.complex64(complex( 16.6, 16.6))) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
elif l == k+1:
|
||||
Aij = np.append(Aij, np.complex64(complex( -99., -99.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
Bij = np.append(Bij, np.complex64(complex( 16.6, 16.6))) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
else:
|
||||
Aij = np.append(Aij, np.complex64(complex( 0., 0.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
Bij = np.append(Bij, np.complex64(complex( 0., 0.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
for idx, val in enumerate(Aij):
|
||||
print("A[", idx, "] =", val)
|
||||
for idx, val in enumerate(Bij):
|
||||
print("B[", idx, "] =", val)
|
||||
A = (Aij, False) # raw format: Aij values, row ordered (or not).
|
||||
B = (Bij, True) # raw format: Bij values, row ordered (or not).
|
||||
|
||||
# Get and tune arpack solver.
|
||||
|
||||
arpackSlv = pyarpackSlv.complexFloat() # Caution: complexFloat <=> np.array(..., dtype='complex64')
|
||||
arpackSlv.verbose = 3 # Set to 0 to get a quiet solve.
|
||||
arpackSlv.debug = 1 # Set to 0 to get a quiet solve.
|
||||
arpackSlv.nbEV = 2
|
||||
arpackSlv.nbCV = 2*arpackSlv.nbEV + 1
|
||||
arpackSlv.mag = 'LM'
|
||||
arpackSlv.maxIt = 200
|
||||
arpackSlv.slvPvtThd = 1.e-6
|
||||
arpackSlv.sigmaReal = 1
|
||||
arpackSlv.symPb = False
|
||||
|
||||
# Solve eigen problem.
|
||||
|
||||
rc = arpackSlv.solve(A, B)
|
||||
assert rc == 0, "bad solve"
|
||||
rc = arpackSlv.checkEigVec(A, B, 1.e-2)
|
||||
assert rc == 0, "bad checkEigVec"
|
||||
|
||||
# Print out results (mode selected, eigen vectors, eigen values, ...).
|
||||
|
||||
assert arpackSlv.nbEV == len(arpackSlv.val), "bad result"
|
||||
print("\nresults:\n")
|
||||
print("mode selected:", arpackSlv.mode)
|
||||
print("nb iterations:", arpackSlv.nbIt)
|
||||
print("Reverse Communication Interface time:", arpackSlv.rciTime, "s")
|
||||
for val, vec in zip(arpackSlv.val, arpackSlv.vec):
|
||||
print("eigen value:", val)
|
||||
print("eigen vector:")
|
||||
for v in range(n):
|
||||
print(vec[v])
|
||||
@@ -0,0 +1,138 @@
|
||||
#ifndef __PYARPACKDRTSOLVER_HPP__
|
||||
#define __PYARPACKDRTSOLVER_HPP__
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <arpackSolver.hpp>
|
||||
#include <pyarpackServices.hpp>
|
||||
#include "debug_c.hpp"
|
||||
#include "stat_c.hpp"
|
||||
|
||||
#include <boost/python.hpp>
|
||||
#include <boost/python/numpy.hpp>
|
||||
|
||||
namespace bp = boost::python;
|
||||
namespace bn = boost::python::numpy;
|
||||
|
||||
template<typename RC, typename FD, typename EM, typename SLV>
|
||||
class pyarpackSparseDrtSolver: public arpackDrtSolver<RC, FD, EM, SLV> {
|
||||
// Public methods.
|
||||
|
||||
public:
|
||||
|
||||
pyarpackSparseDrtSolver(): arpackDrtSolver<RC, FD, EM, SLV>() {
|
||||
debug = 0;
|
||||
|
||||
nopx = 0, nbx = 0, nrorth = 0, nitref = 0, nrstrt = 0;
|
||||
tsaupd = 0., tsaup2 = 0., tsaitr = 0., tseigt = 0., tsgets = 0., tsapps = 0., tsconv = 0.;
|
||||
tnaupd = 0., tnaup2 = 0., tnaitr = 0., tneigt = 0., tngets = 0., tnapps = 0., tnconv = 0.;
|
||||
tcaupd = 0., tcaup2 = 0., tcaitr = 0., tceigt = 0., tcgets = 0., tcapps = 0., tcconv = 0.;
|
||||
tmvopx = 0., tmvbx = 0., tgetv0 = 0., titref = 0., trvec = 0.;
|
||||
};
|
||||
|
||||
int solve(bp::tuple & A, bp::tuple B = bp::tuple()) {
|
||||
ARPACKSOLVERDEBUGSTAT();
|
||||
EM M;
|
||||
int rc = pyarpackServices<RC, EM>::buildSparseMatrice(A, M, debug, "A");
|
||||
if (rc != 0) {pyarpackThrowError("build matrice from A KO"); return rc;}
|
||||
bool stdPb = (bp::len(B) > 0) ? false : true;
|
||||
EM N;
|
||||
if (!stdPb) {
|
||||
rc = pyarpackServices<RC, EM>::buildSparseMatrice(B, N, debug, "B");
|
||||
if (rc != 0) {pyarpackThrowError("build matrice from B KO"); return rc;}
|
||||
}
|
||||
return arpackDrtSolver<RC, FD, EM, SLV>::solve(M, (stdPb ? NULL : &N));
|
||||
};
|
||||
|
||||
int checkEigVec(bp::tuple const & A, bp::tuple const B = bp::tuple(), double const diffTol = 1.e-3) {
|
||||
ARPACKSOLVERDEBUGSTAT();
|
||||
EM M;
|
||||
int rc = pyarpackServices<RC, EM>::buildSparseMatrice(A, M, debug, "A");
|
||||
if (rc != 0) {pyarpackThrowError("build matrice from A KO"); return rc;}
|
||||
bool stdPb = (bp::len(B) > 0) ? false : true;
|
||||
EM N;
|
||||
if (!stdPb) {
|
||||
rc = pyarpackServices<RC, EM>::buildSparseMatrice(B, N, debug, "B");
|
||||
if (rc != 0) {pyarpackThrowError("build matrice from B KO"); return rc;}
|
||||
}
|
||||
return arpackDrtSolver<RC, FD, EM, SLV>::checkEigVec(M, (stdPb ? NULL : &N), &diffTol);
|
||||
};
|
||||
|
||||
// Public members.
|
||||
|
||||
public:
|
||||
|
||||
a_int debug;
|
||||
|
||||
a_int nopx, nbx, nrorth, nitref, nrstrt;
|
||||
float tsaupd, tsaup2, tsaitr, tseigt, tsgets, tsapps, tsconv;
|
||||
float tnaupd, tnaup2, tnaitr, tneigt, tngets, tnapps, tnconv;
|
||||
float tcaupd, tcaup2, tcaitr, tceigt, tcgets, tcapps, tcconv;
|
||||
float tmvopx, tmvbx, tgetv0, titref, trvec;
|
||||
};
|
||||
|
||||
template<typename RC, typename FD, typename EM, typename SLV>
|
||||
class pyarpackDenseDrtSolver: public arpackDrtSolver<RC, FD, EM, SLV> {
|
||||
// Public methods.
|
||||
|
||||
public:
|
||||
|
||||
pyarpackDenseDrtSolver(): arpackDrtSolver<RC, FD, EM, SLV>() {
|
||||
debug = 0;
|
||||
|
||||
nopx = 0, nbx = 0, nrorth = 0, nitref = 0, nrstrt = 0;
|
||||
tsaupd = 0., tsaup2 = 0., tsaitr = 0., tseigt = 0., tsgets = 0., tsapps = 0., tsconv = 0.;
|
||||
tnaupd = 0., tnaup2 = 0., tnaitr = 0., tneigt = 0., tngets = 0., tnapps = 0., tnconv = 0.;
|
||||
tcaupd = 0., tcaup2 = 0., tcaitr = 0., tceigt = 0., tcgets = 0., tcapps = 0., tcconv = 0.;
|
||||
tmvopx = 0., tmvbx = 0., tgetv0 = 0., titref = 0., trvec = 0.;
|
||||
};
|
||||
|
||||
int solve(bp::tuple & A, bp::tuple B = bp::tuple()) {
|
||||
ARPACKSOLVERDEBUGSTAT();
|
||||
EM M;
|
||||
int rc = pyarpackServices<RC, EM>::buildDenseMatrice(A, M, debug, "A");
|
||||
if (rc != 0) {pyarpackThrowError("build matrice from A KO"); return rc;}
|
||||
bool stdPb = (bp::len(B) > 0) ? false : true;
|
||||
EM N;
|
||||
if (!stdPb) {
|
||||
rc = pyarpackServices<RC, EM>::buildDenseMatrice(B, N, debug, "B");
|
||||
if (rc != 0) {pyarpackThrowError("build matrice from B KO"); return rc;}
|
||||
}
|
||||
return arpackDrtSolver<RC, FD, EM, SLV>::solve(M, (stdPb ? NULL : &N));
|
||||
};
|
||||
|
||||
int checkEigVec(bp::tuple const & A, bp::tuple const B = bp::tuple(), double const diffTol = 1.e-3) {
|
||||
ARPACKSOLVERDEBUGSTAT();
|
||||
EM M;
|
||||
int rc = pyarpackServices<RC, EM>::buildDenseMatrice(A, M, debug, "A");
|
||||
if (rc != 0) {pyarpackThrowError("build matrice from A KO"); return rc;}
|
||||
bool stdPb = (bp::len(B) > 0) ? false : true;
|
||||
EM N;
|
||||
if (!stdPb) {
|
||||
rc = pyarpackServices<RC, EM>::buildDenseMatrice(B, N, debug, "B");
|
||||
if (rc != 0) {pyarpackThrowError("build matrice from B KO"); return rc;}
|
||||
}
|
||||
return arpackDrtSolver<RC, FD, EM, SLV>::checkEigVec(M, (stdPb ? NULL : &N), &diffTol);
|
||||
};
|
||||
|
||||
// Public members.
|
||||
|
||||
public:
|
||||
|
||||
a_int debug;
|
||||
|
||||
a_int nopx, nbx, nrorth, nitref, nrstrt;
|
||||
float tsaupd, tsaup2, tsaitr, tseigt, tsgets, tsapps, tsconv;
|
||||
float tnaupd, tnaup2, tnaitr, tneigt, tngets, tnapps, tnconv;
|
||||
float tcaupd, tcaup2, tcaitr, tceigt, tcgets, tcapps, tcconv;
|
||||
float tmvopx, tmvbx, tgetv0, titref, trvec;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
// Local Variables:
|
||||
// mode: c++
|
||||
// c-file-style:"stroustrup"
|
||||
// show-trailing-whitespace: t
|
||||
// End:
|
||||
/* vim: set sw=2 ts=2 et smartindent :*/
|
||||
@@ -0,0 +1,80 @@
|
||||
#ifndef __PYARPACKITRSOLVER_HPP__
|
||||
#define __PYARPACKITRSOLVER_HPP__
|
||||
|
||||
#include <string>
|
||||
|
||||
#include <arpackSolver.hpp>
|
||||
#include <pyarpackServices.hpp>
|
||||
#include "debug_c.hpp"
|
||||
#include "stat_c.hpp"
|
||||
|
||||
#include <boost/python.hpp>
|
||||
#include <boost/python/numpy.hpp>
|
||||
|
||||
namespace bp = boost::python;
|
||||
|
||||
template<typename RC, typename FD, typename EM, typename SLV>
|
||||
class pyarpackSparseItrSolver: public arpackItrSolver<RC, FD, EM, SLV> {
|
||||
// Public methods.
|
||||
|
||||
public:
|
||||
|
||||
pyarpackSparseItrSolver(): arpackItrSolver<RC, FD, EM, SLV>() {
|
||||
debug = 0;
|
||||
|
||||
nopx = 0, nbx = 0, nrorth = 0, nitref = 0, nrstrt = 0;
|
||||
tsaupd = 0., tsaup2 = 0., tsaitr = 0., tseigt = 0., tsgets = 0., tsapps = 0., tsconv = 0.;
|
||||
tnaupd = 0., tnaup2 = 0., tnaitr = 0., tneigt = 0., tngets = 0., tnapps = 0., tnconv = 0.;
|
||||
tcaupd = 0., tcaup2 = 0., tcaitr = 0., tceigt = 0., tcgets = 0., tcapps = 0., tcconv = 0.;
|
||||
tmvopx = 0., tmvbx = 0., tgetv0 = 0., titref = 0., trvec = 0.;
|
||||
};
|
||||
|
||||
int solve(bp::tuple & A, bp::tuple B = bp::tuple()) {
|
||||
ARPACKSOLVERDEBUGSTAT();
|
||||
EM M;
|
||||
int rc = pyarpackServices<RC, EM>::buildSparseMatrice(A, M, debug, "A");
|
||||
if (rc != 0) {pyarpackThrowError("build matrice from A KO"); return rc;}
|
||||
bool stdPb = (bp::len(B) > 0) ? false : true;
|
||||
EM N;
|
||||
if (!stdPb) {
|
||||
rc = pyarpackServices<RC, EM>::buildSparseMatrice(B, N, debug, "B");
|
||||
if (rc != 0) {pyarpackThrowError("build matrice from B KO"); return rc;}
|
||||
}
|
||||
return arpackItrSolver<RC, FD, EM, SLV>::solve(M, (stdPb ? NULL : &N));
|
||||
};
|
||||
|
||||
int checkEigVec(bp::tuple const & A, bp::tuple const B = bp::tuple(), double const diffTol = 1.e-3) {
|
||||
ARPACKSOLVERDEBUGSTAT();
|
||||
EM M;
|
||||
int rc = pyarpackServices<RC, EM>::buildSparseMatrice(A, M, debug, "A");
|
||||
if (rc != 0) {pyarpackThrowError("build matrice from A KO"); return rc;}
|
||||
bool stdPb = (bp::len(B) > 0) ? false : true;
|
||||
EM N;
|
||||
if (!stdPb) {
|
||||
rc = pyarpackServices<RC, EM>::buildSparseMatrice(B, N, debug, "B");
|
||||
if (rc != 0) {pyarpackThrowError("build matrice from B KO"); return rc;}
|
||||
}
|
||||
return arpackItrSolver<RC, FD, EM, SLV>::checkEigVec(M, (stdPb ? NULL : &N), &diffTol);
|
||||
};
|
||||
|
||||
// Public members.
|
||||
|
||||
public:
|
||||
|
||||
a_int debug;
|
||||
|
||||
a_int nopx, nbx, nrorth, nitref, nrstrt;
|
||||
float tsaupd, tsaup2, tsaitr, tseigt, tsgets, tsapps, tsconv;
|
||||
float tnaupd, tnaup2, tnaitr, tneigt, tngets, tnapps, tnconv;
|
||||
float tcaupd, tcaup2, tcaitr, tceigt, tcgets, tcapps, tcconv;
|
||||
float tmvopx, tmvbx, tgetv0, titref, trvec;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
// Local Variables:
|
||||
// mode: c++
|
||||
// c-file-style:"stroustrup"
|
||||
// show-trailing-whitespace: t
|
||||
// End:
|
||||
/* vim: set sw=2 ts=2 et smartindent :*/
|
||||
@@ -0,0 +1,119 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import numpy as np
|
||||
from pyarpack import sparseBiCGDiag as pyarpackSlv
|
||||
|
||||
# Build laplacian.
|
||||
|
||||
n = 8
|
||||
i = np.array([], dtype='@PYINT@')
|
||||
j = np.array([], dtype='@PYINT@')
|
||||
Aij = np.array([], dtype='float64')
|
||||
for k in range(n):
|
||||
for l in [k-1, k, k+1]:
|
||||
if l < 0 or l > n-1:
|
||||
continue
|
||||
i = np.append(i, np.@PYINT@(k)) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
j = np.append(j, np.@PYINT@(l)) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
if l == k:
|
||||
Aij = np.append(Aij, np.float64( 200.)) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
if l == k-1 or l == k+1:
|
||||
Aij = np.append(Aij, np.float64(-100.)) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
for k, l, Akl in zip(i, j, Aij):
|
||||
print("A[", k, ",", l, "] =", Akl)
|
||||
A = (n, i, j, Aij) # coo format: dimension, i 0-based indices, j 0-based indices, Aij values.
|
||||
|
||||
# Get and tune arpack solver.
|
||||
|
||||
arpackSlv = pyarpackSlv.double() # Caution: double <=> np.array(..., dtype='float64')
|
||||
arpackSlv.verbose = 3 # Set to 0 to get a quiet solve.
|
||||
arpackSlv.debug = 1 # Set to 0 to get a quiet solve.
|
||||
arpackSlv.nbEV = 1
|
||||
arpackSlv.nbCV = 2*arpackSlv.nbEV + 1
|
||||
arpackSlv.mag = 'LM'
|
||||
arpackSlv.maxIt = 200
|
||||
arpackSlv.slvTol = 1.e-6
|
||||
arpackSlv.slvMaxIt = 100
|
||||
arpackSlv.dumpToFile = True # Dump eigen vectors to arpackSolver.*.out files.
|
||||
arpackSlv.schur = True # Schur vectors and eigenvectors of A are the same if A is a normal matrix.
|
||||
|
||||
# Solve eigen problem.
|
||||
|
||||
rc = arpackSlv.solve(A)
|
||||
assert rc == 0, "bad solve"
|
||||
rc = arpackSlv.checkEigVec(A)
|
||||
assert rc == 0, "bad checkEigVec"
|
||||
|
||||
nbIt1 = arpackSlv.nbIt
|
||||
|
||||
# Print out results (mode selected, eigen vectors, eigen values, ...).
|
||||
|
||||
assert arpackSlv.nbEV == len(arpackSlv.val), "bad result"
|
||||
print("\nresults:\n")
|
||||
print("mode selected:", arpackSlv.mode)
|
||||
print("nb iterations:", arpackSlv.nbIt)
|
||||
print("Reverse Communication Interface time:", arpackSlv.rciTime, "s")
|
||||
for val, vec in zip(arpackSlv.val, arpackSlv.vec):
|
||||
print("eigen value:", val)
|
||||
print("eigen vector:")
|
||||
print(vec)
|
||||
|
||||
#######################################################################################
|
||||
print("\n##########################################################################\n")
|
||||
#######################################################################################
|
||||
|
||||
# Build laplacian (similar-but-different from the previous one).
|
||||
|
||||
n = 8
|
||||
i = np.array([], dtype='@PYINT@')
|
||||
j = np.array([], dtype='@PYINT@')
|
||||
Aij = np.array([], dtype='float64')
|
||||
for k in range(n):
|
||||
for l in [k-1, k, k+1]:
|
||||
if l < 0 or l > n-1:
|
||||
continue
|
||||
i = np.append(i, np.@PYINT@(k)) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
j = np.append(j, np.@PYINT@(l)) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
if l == k:
|
||||
Aij = np.append(Aij, np.float64( 210.)) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
if l == k-1 or l == k+1:
|
||||
Aij = np.append(Aij, np.float64( -90.)) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
for k, l, Akl in zip(i, j, Aij):
|
||||
print("A[", k, ",", l, "] =", Akl)
|
||||
A = (n, i, j, Aij) # coo format: dimension, i 0-based indices, j 0-based indices, Aij values.
|
||||
|
||||
# Get and tune arpack solver.
|
||||
|
||||
arpackSlv = pyarpackSlv.double() # Caution: double <=> np.array(..., dtype='float64')
|
||||
arpackSlv.verbose = 3 # Set to 0 to get a quiet solve.
|
||||
arpackSlv.debug = 1 # Set to 0 to get a quiet solve.
|
||||
arpackSlv.nbEV = 1
|
||||
arpackSlv.nbCV = 2*arpackSlv.nbEV + 1
|
||||
arpackSlv.mag = 'LM'
|
||||
arpackSlv.maxIt = 200
|
||||
arpackSlv.slvTol = 1.e-6
|
||||
arpackSlv.slvMaxIt = 100
|
||||
arpackSlv.restartFromFile = True # Restart from eigen vectors found in arpackSolver.*.out files.
|
||||
arpackSlv.schur = True # Schur vectors and eigenvectors of A are the same if A is a normal matrix.
|
||||
|
||||
# Solve eigen problem.
|
||||
|
||||
rc = arpackSlv.solve(A)
|
||||
assert rc == 0, "bad solve"
|
||||
rc = arpackSlv.checkEigVec(A)
|
||||
assert rc == 0, "bad checkEigVec"
|
||||
|
||||
nbIt2 = arpackSlv.nbIt
|
||||
assert nbIt2 < nbIt1, "bad restart" # Restart from the first solve to run the second solve for a similar-but-different A.
|
||||
|
||||
# Print out results (mode selected, eigen vectors, eigen values, ...).
|
||||
|
||||
assert arpackSlv.nbEV == len(arpackSlv.val), "bad result"
|
||||
print("\nresults:\n")
|
||||
print("mode selected:", arpackSlv.mode)
|
||||
print("nb iterations:", arpackSlv.nbIt)
|
||||
print("Reverse Communication Interface time:", arpackSlv.rciTime, "s")
|
||||
for val, vec in zip(arpackSlv.val, arpackSlv.vec):
|
||||
print("eigen value:", val)
|
||||
print("eigen vector:")
|
||||
print(vec)
|
||||
@@ -0,0 +1,194 @@
|
||||
#ifndef __PYARPACKSERVICES_HPP__
|
||||
#define __PYARPACKSERVICES_HPP__
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <complex>
|
||||
#include <iostream>
|
||||
#include <cmath> // sqrt.
|
||||
|
||||
#include <Eigen/Sparse>
|
||||
|
||||
#include <boost/python.hpp>
|
||||
#include <boost/python/numpy.hpp>
|
||||
|
||||
namespace bp = boost::python;
|
||||
namespace bn = boost::python::numpy;
|
||||
|
||||
#define ARPACKSOLVERMEMBER(pyarpackSolver) \
|
||||
.def_readwrite("symPb", &pyarpackSolver<RC, FD, EM, SLV>::symPb, \
|
||||
"symmetric problem - default: true") \
|
||||
.def_readwrite("nbEV", &pyarpackSolver<RC, FD, EM, SLV>::nbEV, \
|
||||
"number of eigen vectors to find - default: 1") \
|
||||
.def_readwrite("nbCV", &pyarpackSolver<RC, FD, EM, SLV>::nbCV, \
|
||||
"number of dimensions of the workspace - default: 3") \
|
||||
.def_readwrite("tol", &pyarpackSolver<RC, FD, EM, SLV>::tol, \
|
||||
"tolerance - default: 1.e-6") \
|
||||
.def_readwrite("sigmaReal", &pyarpackSolver<RC, FD, EM, SLV>::sigmaReal, \
|
||||
"shift over real axis - default: 0.") \
|
||||
.def_readwrite("sigmaImag", &pyarpackSolver<RC, FD, EM, SLV>::sigmaImag, \
|
||||
"shift over imaginary axis - default: 0.") \
|
||||
.def_readwrite("dumpToFile", &pyarpackSolver<RC, FD, EM, SLV>::dumpToFile, \
|
||||
"dump eigen vectors to arpackSolver.*.out files - default: false") \
|
||||
.def_readwrite("restartFromFile", &pyarpackSolver<RC, FD, EM, SLV>::restartFromFile, \
|
||||
"restart from eigen vectors found in arpackSolver.*.out files - default: false") \
|
||||
.def_readwrite("mag", &pyarpackSolver<RC, FD, EM, SLV>::mag, \
|
||||
"magnitude - default: LM") \
|
||||
.def_readwrite("maxIt", &pyarpackSolver<RC, FD, EM, SLV>::maxIt, \
|
||||
"maximum number of arpack iterations - default: 100") \
|
||||
.def_readwrite("schur", &pyarpackSolver<RC, FD, EM, SLV>::schur, \
|
||||
"compute schur vectors - default: false") \
|
||||
.def_readwrite("verbose", &pyarpackSolver<RC, FD, EM, SLV>::verbose, \
|
||||
"verbosity level - default: 0") \
|
||||
.def_readonly ("stdPb", &pyarpackSolver<RC, FD, EM, SLV>::stdPb, \
|
||||
"standard or generalised problem - default: true") \
|
||||
.def_readonly ("val", &pyarpackSolver<RC, FD, EM, SLV>::val, \
|
||||
"eigen values found") \
|
||||
.def_readonly ("vec", &pyarpackSolver<RC, FD, EM, SLV>::vec, \
|
||||
"eigen vectors found") \
|
||||
.def_readonly ("mode", &pyarpackSolver<RC, FD, EM, SLV>::mode, \
|
||||
"selected arpack mode (according to input options: std/gen, shift, ...)") \
|
||||
.def_readonly ("nbIt", &pyarpackSolver<RC, FD, EM, SLV>::nbIt, \
|
||||
"number of arpack iterations") \
|
||||
.def_readonly ("imsTime", &pyarpackSolver<RC, FD, EM, SLV>::imsTime, \
|
||||
"time spent to initialize the mode solver if needed") \
|
||||
.def_readonly ("rciTime", &pyarpackSolver<RC, FD, EM, SLV>::rciTime, \
|
||||
"time spent in Reverse Communication Interface") \
|
||||
.def_readwrite("debug", &pyarpackSolver<RC, FD, EM, SLV>::debug, \
|
||||
"debug traces (up to 3) - default: 0") \
|
||||
|
||||
#define ARPACKSOLVERDEBUGSTAT() \
|
||||
if (debug > 3) debug = 3; \
|
||||
debug_c(6, -6, debug, debug, debug, debug, debug, debug, debug, debug, debug, debug, debug, \
|
||||
debug, debug, debug, debug, debug, debug, debug, debug, debug, debug, debug); \
|
||||
stat_c(nopx, nbx, nrorth, nitref, nrstrt, tsaupd, tsaup2, \
|
||||
tsaitr, tseigt, tsgets, tsapps, tsconv, tnaupd, tnaup2, \
|
||||
tnaitr, tneigt, tngets, tnapps, tnconv, tcaupd, tcaup2, \
|
||||
tcaitr, tceigt, tcgets, tcapps, tcconv, tmvopx, tmvbx, \
|
||||
tgetv0, titref, trvec); \
|
||||
|
||||
void pyarpackThrowError(std::string const & msg) {
|
||||
std::string const info = "Error: " + msg;
|
||||
std::cerr << info << std::endl;
|
||||
PyErr_SetString(PyExc_IndexError, info.c_str());
|
||||
bp::throw_error_already_set();
|
||||
};
|
||||
|
||||
template<typename RC, typename EM>
|
||||
class pyarpackServices {
|
||||
// Public methods.
|
||||
|
||||
public:
|
||||
|
||||
static int buildSparseMatrice(bp::tuple const & T, Eigen::SparseMatrix<RC> & M,
|
||||
a_int const & debug, std::string const & msg) {
|
||||
// Get boost data as C++ data.
|
||||
|
||||
if (bp::len(T) != 4) {pyarpackThrowError(msg + " must be a 3-tuple"); return 1;}
|
||||
bp::extract<int> nExt(T[0]);
|
||||
bp::extract<bn::ndarray> iExt(T[1]);
|
||||
bp::extract<bn::ndarray> jExt(T[2]);
|
||||
bp::extract<bn::ndarray> mijExt(T[3]);
|
||||
if (! nExt.check()) {pyarpackThrowError(msg + "[0] must be an integer" ); return 1;}
|
||||
if (! iExt.check()) {pyarpackThrowError(msg + "[1] must be numpy.array"); return 1;}
|
||||
if (! jExt.check()) {pyarpackThrowError(msg + "[2] must be numpy.array"); return 1;}
|
||||
if (!mijExt.check()) {pyarpackThrowError(msg + "[3] must be numpy.array"); return 1;}
|
||||
bn::ndarray iArray = iExt();
|
||||
bn::ndarray jArray = jExt();
|
||||
bn::ndarray mijArray = mijExt();
|
||||
if (iArray.get_dtype() != bn::dtype::get_builtin<a_int>()) {pyarpackThrowError(msg + "[1] type is not consistent"); return 1;}
|
||||
if (jArray.get_dtype() != bn::dtype::get_builtin<a_int>()) {pyarpackThrowError(msg + "[2] type is not consistent"); return 1;}
|
||||
if (mijArray.get_dtype() != bn::dtype::get_builtin<RC>() ) {pyarpackThrowError(msg + "[3] type is not consistent with arpack type"); return 1;}
|
||||
|
||||
a_int iSz = iArray.shape(0);
|
||||
a_int * iPtr = reinterpret_cast<a_int*>(iArray.get_data());
|
||||
a_int jSz = jArray.shape(0);
|
||||
a_int * jPtr = reinterpret_cast<a_int*>(jArray.get_data());
|
||||
a_int mSz = mijArray.shape(0);
|
||||
RC * mPtr = reinterpret_cast<RC*>(mijArray.get_data());
|
||||
|
||||
if (iSz != jSz) {pyarpackThrowError(msg + "[1] and " + msg + "[2] must have same lenght"); return 1;}
|
||||
if (iSz != mSz) {pyarpackThrowError(msg + "[1] and " + msg + "[3] must have same lenght"); return 1;}
|
||||
|
||||
// Debug on demand: casting value on numpy.append is MANDATORY or C++ won't get the expected type..
|
||||
|
||||
for (auto k = 0; debug && k < mSz; k++) {
|
||||
std::cout << "pyarpackServices::buildSparseMatrice - " << msg << "[" << iPtr[k] << ", " << jPtr[k] << "] = " << mPtr[k] << std::endl;
|
||||
};
|
||||
|
||||
// Build sparse matrice.
|
||||
|
||||
a_uint n = nExt();
|
||||
a_uint iMin = n+1, jMin = n+1;
|
||||
for (auto k = 0; k < mSz; k++) {
|
||||
if (iPtr[k] < iMin) iMin = iPtr[k];
|
||||
if (jPtr[k] < jMin) jMin = jPtr[k];
|
||||
};
|
||||
if (iMin != 0 && iMin != 1) {pyarpackThrowError(msg + ": smallest row indice must be 0 or 1"); return 1;}
|
||||
if (jMin != 0 && jMin != 1) {pyarpackThrowError(msg + ": smallest column indice must be 0 or 1"); return 1;}
|
||||
a_int iBased = 0, jBased = 0;
|
||||
if (iMin == 1) iBased = 1;
|
||||
if (jMin == 1) jBased = 1;
|
||||
|
||||
M = Eigen::SparseMatrix<RC>(n, n); // Set matrice dimensions.
|
||||
std::vector<Eigen::Triplet<RC>> triplets;
|
||||
a_uint nnz = mSz;
|
||||
triplets.reserve(nnz);
|
||||
for (auto k = 0; k < nnz; k++) triplets.emplace_back(iPtr[k] - iBased, jPtr[k] - jBased, mPtr[k]);
|
||||
M.setFromTriplets(triplets.begin(), triplets.end()); // Set all (i, j, Mij).
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
||||
static int buildDenseMatrice(bp::tuple const & T, Eigen::Matrix<RC, Eigen::Dynamic, Eigen::Dynamic> & M,
|
||||
a_int const & debug, std::string const & msg) {
|
||||
// Get boost data as C++ data.
|
||||
|
||||
if (bp::len(T) != 2) {pyarpackThrowError(msg + " must be a 2-tuple"); return 1;}
|
||||
bp::extract<bn::ndarray> mijExt(T[0]);
|
||||
bp::extract<bool> oExt(T[1]);
|
||||
if (!mijExt.check()) {pyarpackThrowError(msg + " must be numpy.array"); return 1;}
|
||||
if ( !oExt.check()) {pyarpackThrowError(msg + " must be a boolean"); return 1;}
|
||||
bn::ndarray mijArray = mijExt();
|
||||
bool rowOrdered = oExt();
|
||||
if (mijArray.get_dtype() != bn::dtype::get_builtin<RC>()) {pyarpackThrowError(msg + " type is not consistent with arpack type"); return 1;}
|
||||
|
||||
a_int mSz = mijArray.shape(0);
|
||||
RC * mPtr = reinterpret_cast<RC*>(mijArray.get_data());
|
||||
|
||||
a_uint n = std::sqrt(mSz);
|
||||
if (n*n != mSz) {pyarpackThrowError(msg + " must be a squared matrice"); return 1;}
|
||||
|
||||
// Debug on demand: casting value on numpy.append is MANDATORY or C++ won't get the expected type..
|
||||
|
||||
for (auto k = 0; debug && k < mSz; k++) {
|
||||
std::cout << "pyarpackServices::buildDenseMatrice - " << msg << "[" << k << "] = " << mPtr[k] << std::endl;
|
||||
};
|
||||
|
||||
// Build dense matrice.
|
||||
|
||||
M = Eigen::Matrix<RC, Eigen::Dynamic, Eigen::Dynamic>(n, n); // Set matrice dimensions.
|
||||
M.setZero(n, n); // Avoid spurious/random values which may break solves (LU, QR, ...).
|
||||
if (rowOrdered) {
|
||||
for (size_t k = 0; k < n; k++) {
|
||||
for (size_t l = 0; l < n; l++) M(k, l) = mPtr[l+k*n];
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (size_t l = 0; l < n; l++) {
|
||||
for (size_t k = 0; k < n; k++) M(k, l) = mPtr[k+l*n];
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
// Local Variables:
|
||||
// mode: c++
|
||||
// c-file-style:"stroustrup"
|
||||
// show-trailing-whitespace: t
|
||||
// End:
|
||||
/* vim: set sw=2 ts=2 et smartindent :*/
|
||||
@@ -0,0 +1,118 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import numpy as np
|
||||
from pyarpack import sparseBiCGDiag as pyarpackSlv
|
||||
|
||||
# Build laplacian.
|
||||
|
||||
n = 4
|
||||
i = np.array([], dtype='@PYINT@')
|
||||
j = np.array([], dtype='@PYINT@')
|
||||
Aij = np.array([], dtype='float64')
|
||||
for k in range(n):
|
||||
for l in [k-1, k, k+1]:
|
||||
if l < 0 or l > n-1:
|
||||
continue
|
||||
i = np.append(i, np.@PYINT@(k)) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
j = np.append(j, np.@PYINT@(l)) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
if l == k:
|
||||
Aij = np.append(Aij, np.float64( 200.)) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
if l == k-1 or l == k+1:
|
||||
Aij = np.append(Aij, np.float64(-100.)) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
for k, l, Akl in zip(i, j, Aij):
|
||||
print("A[", k, ",", l, "] =", Akl)
|
||||
A = (n, i, j, Aij) # coo format: dimension, i 0-based indices, j 0-based indices, Aij values.
|
||||
|
||||
# Get and tune arpack solver.
|
||||
|
||||
arpackSlv = pyarpackSlv.double() # Caution: double <=> np.array(..., dtype='float64')
|
||||
arpackSlv.verbose = 3 # Set to 0 to get a quiet solve.
|
||||
arpackSlv.debug = 1 # Set to 0 to get a quiet solve.
|
||||
arpackSlv.nbEV = 1
|
||||
arpackSlv.nbCV = 2*arpackSlv.nbEV + 1
|
||||
arpackSlv.mag = 'LM'
|
||||
arpackSlv.maxIt = 200
|
||||
arpackSlv.slvTol = 1.e-6
|
||||
arpackSlv.slvMaxIt = 100
|
||||
|
||||
# Solve eigen problem.
|
||||
|
||||
rc = arpackSlv.solve(A)
|
||||
assert rc == 0, "bad solve"
|
||||
rc = arpackSlv.checkEigVec(A)
|
||||
assert rc == 0, "bad checkEigVec"
|
||||
|
||||
# Print out results (mode selected, eigen vectors, eigen values, ...).
|
||||
|
||||
assert arpackSlv.nbEV == len(arpackSlv.val), "bad result"
|
||||
print("\nresults:\n")
|
||||
print("mode selected:", arpackSlv.mode)
|
||||
print("nb iterations:", arpackSlv.nbIt)
|
||||
print("Reverse Communication Interface time:", arpackSlv.rciTime, "s")
|
||||
for val, vec in zip(arpackSlv.val, arpackSlv.vec):
|
||||
print("eigen value:", val)
|
||||
print("eigen vector:")
|
||||
print(vec)
|
||||
|
||||
#######################################################################################
|
||||
print("\n##########################################################################\n")
|
||||
#######################################################################################
|
||||
|
||||
# Build laplacian.
|
||||
|
||||
n = 8
|
||||
i = np.array([], dtype='@PYINT@')
|
||||
j = np.array([], dtype='@PYINT@')
|
||||
Aij = np.array([], dtype='float32')
|
||||
Bij = np.array([], dtype='float32')
|
||||
for k in range(n):
|
||||
for l in [k-1, k, k+1]:
|
||||
if l < 0 or l > n-1:
|
||||
continue
|
||||
i = np.append(i, np.@PYINT@(k+1)) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
j = np.append(j, np.@PYINT@(l+1)) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
if l == k:
|
||||
Aij = np.append(Aij, np.float32( 200.)) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
Bij = np.append(Bij, np.float32( 33.3)) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
if l == k-1 or l == k+1:
|
||||
Aij = np.append(Aij, np.float32(-100.)) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
Bij = np.append(Bij, np.float32( 16.6)) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
for k, l, Akl in zip(i, j, Aij):
|
||||
print("A[", k, ",", l, "] =", Akl)
|
||||
for k, l, Bkl in zip(i, j, Bij):
|
||||
print("B[", k, ",", l, "] =", Bkl)
|
||||
A = (n, i, j, Aij) # coo format: dimension, i 1-based indices, j 1-based indices, Aij values.
|
||||
B = (n, i, j, Bij) # coo format: dimension, i 1-based indices, j 1-based indices, Bij values.
|
||||
|
||||
# Get and tune arpack solver.
|
||||
|
||||
arpackSlv = pyarpackSlv.float() # Caution: float <=> np.array(..., dtype='float32')
|
||||
arpackSlv.verbose = 3 # Set to 0 to get a quiet solve.
|
||||
arpackSlv.debug = 1 # Set to 0 to get a quiet solve.
|
||||
arpackSlv.nbEV = 2
|
||||
arpackSlv.nbCV = 2*arpackSlv.nbEV + 1
|
||||
arpackSlv.mag = 'LM'
|
||||
arpackSlv.maxIt = 200
|
||||
arpackSlv.slvTol = 1.e-6
|
||||
arpackSlv.slvMaxIt = 100
|
||||
arpackSlv.sigmaReal = 1
|
||||
|
||||
# Solve eigen problem.
|
||||
|
||||
rc = arpackSlv.solve(A, B)
|
||||
assert rc == 0, "bad solve"
|
||||
rc = arpackSlv.checkEigVec(A, B, 1.e-2)
|
||||
assert rc == 0, "bad checkEigVec"
|
||||
|
||||
# Print out results (mode selected, eigen vectors, eigen values, ...).
|
||||
|
||||
assert arpackSlv.nbEV == len(arpackSlv.val), "bad result"
|
||||
print("\nresults:\n")
|
||||
print("mode selected:", arpackSlv.mode)
|
||||
print("nb iterations:", arpackSlv.nbIt)
|
||||
print("Reverse Communication Interface time:", arpackSlv.rciTime, "s")
|
||||
for val, vec in zip(arpackSlv.val, arpackSlv.vec):
|
||||
print("eigen value:", val)
|
||||
print("eigen vector:")
|
||||
for v in range(n):
|
||||
print(vec[v])
|
||||
@@ -0,0 +1,130 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import numpy as np
|
||||
from pyarpack import sparseBiCGILU as pyarpackSlv
|
||||
|
||||
# Build laplacian.
|
||||
|
||||
n = 4
|
||||
i = np.array([], dtype='@PYINT@')
|
||||
j = np.array([], dtype='@PYINT@')
|
||||
Aij = np.array([], dtype='complex128')
|
||||
for k in range(n):
|
||||
for l in [k-1, k, k+1]:
|
||||
if l < 0 or l > n-1:
|
||||
continue
|
||||
i = np.append(i, np.@PYINT@(k)) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
j = np.append(j, np.@PYINT@(l)) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
if l == k:
|
||||
Aij = np.append(Aij, np.complex128(complex( 200., 200.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
if l == k-1:
|
||||
Aij = np.append(Aij, np.complex128(complex(-101., -101.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
if l == k+1:
|
||||
Aij = np.append(Aij, np.complex128(complex( -99., -99.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
for k, l, Akl in zip(i, j, Aij):
|
||||
print("A[", k, ",", l, "] =", Akl)
|
||||
A = (n, i, j, Aij) # coo format: dimension, i 0-based indices, j 0-based indices, Aij values.
|
||||
|
||||
# Get and tune arpack solver.
|
||||
|
||||
arpackSlv = pyarpackSlv.complexDouble() # Caution: complexDouble <=> np.array(..., dtype='complex128')
|
||||
arpackSlv.verbose = 3 # Set to 0 to get a quiet solve.
|
||||
arpackSlv.debug = 1 # Set to 0 to get a quiet solve.
|
||||
arpackSlv.nbEV = 1
|
||||
arpackSlv.nbCV = 2*arpackSlv.nbEV + 1
|
||||
arpackSlv.mag = 'LM'
|
||||
arpackSlv.maxIt = 200
|
||||
arpackSlv.slvTol = 1.e-6
|
||||
arpackSlv.slvMaxIt = 200
|
||||
arpackSlv.slvILUDropTol = 1.
|
||||
arpackSlv.slvILUFillFactor = 2
|
||||
arpackSlv.symPb = False
|
||||
|
||||
# Solve eigen problem.
|
||||
|
||||
rc = arpackSlv.solve(A)
|
||||
assert rc == 0, "bad solve"
|
||||
rc = arpackSlv.checkEigVec(A)
|
||||
assert rc == 0, "bad checkEigVec"
|
||||
|
||||
# Print out results (mode selected, eigen vectors, eigen values, ...).
|
||||
|
||||
assert arpackSlv.nbEV == len(arpackSlv.val), "bad result"
|
||||
print("\nresults:\n")
|
||||
print("mode selected:", arpackSlv.mode)
|
||||
print("nb iterations:", arpackSlv.nbIt)
|
||||
print("Reverse Communication Interface time:", arpackSlv.rciTime, "s")
|
||||
for val, vec in zip(arpackSlv.val, arpackSlv.vec):
|
||||
print("eigen value:", val)
|
||||
print("eigen vector:")
|
||||
print(vec)
|
||||
|
||||
#######################################################################################
|
||||
print("\n##########################################################################\n")
|
||||
#######################################################################################
|
||||
|
||||
# Build laplacian.
|
||||
|
||||
n = 8
|
||||
i = np.array([], dtype='@PYINT@')
|
||||
j = np.array([], dtype='@PYINT@')
|
||||
Aij = np.array([], dtype='complex64')
|
||||
Bij = np.array([], dtype='complex64')
|
||||
for k in range(n):
|
||||
for l in [k-1, k, k+1]:
|
||||
if l < 0 or l > n-1:
|
||||
continue
|
||||
i = np.append(i, np.@PYINT@(k+1)) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
j = np.append(j, np.@PYINT@(l+1)) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
if l == k:
|
||||
Aij = np.append(Aij, np.complex64(complex( 200., 200.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
Bij = np.append(Bij, np.complex64(complex( 33.3, 33.3))) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
if l == k-1:
|
||||
Aij = np.append(Aij, np.complex64(complex(-101., -101.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
Bij = np.append(Bij, np.complex64(complex( 16.6, 16.6))) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
if l == k+1:
|
||||
Aij = np.append(Aij, np.complex64(complex( -99., -99.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
Bij = np.append(Bij, np.complex64(complex( 16.6, 16.6))) # Casting value on append is MANDATORY or C++ won't get the expected type.
|
||||
for k, l, Akl in zip(i, j, Aij):
|
||||
print("A[", k, ",", l, "] =", Akl)
|
||||
for k, l, Bkl in zip(i, j, Bij):
|
||||
print("B[", k, ",", l, "] =", Bkl)
|
||||
A = (n, i, j, Aij) # coo format: dimension, i 1-based indices, j 1-based indices, Aij values.
|
||||
B = (n, i, j, Bij) # coo format: dimension, i 1-based indices, j 1-based indices, Bij values.
|
||||
|
||||
# Get and tune arpack solver.
|
||||
|
||||
arpackSlv = pyarpackSlv.complexFloat() # Caution: complexFloat <=> np.array(..., dtype='complex64')
|
||||
arpackSlv.verbose = 3 # Set to 0 to get a quiet solve.
|
||||
arpackSlv.debug = 1 # Set to 0 to get a quiet solve.
|
||||
arpackSlv.nbEV = 2
|
||||
arpackSlv.nbCV = 2*arpackSlv.nbEV + 1
|
||||
arpackSlv.mag = 'LM'
|
||||
arpackSlv.maxIt = 200
|
||||
arpackSlv.slvTol = 1.e-6
|
||||
arpackSlv.slvMaxIt = 200
|
||||
arpackSlv.slvILUDropTol = 1.
|
||||
arpackSlv.slvILUFillFactor = 2
|
||||
arpackSlv.sigmaReal = 1
|
||||
arpackSlv.sigmaImag = 1
|
||||
arpackSlv.symPb = False
|
||||
|
||||
# Solve eigen problem.
|
||||
|
||||
rc = arpackSlv.solve(A, B)
|
||||
assert rc == 0, "bad solve"
|
||||
rc = arpackSlv.checkEigVec(A, B, 1.e-2)
|
||||
assert rc == 0, "bad checkEigVec"
|
||||
|
||||
# Print out results (mode selected, eigen vectors, eigen values, ...).
|
||||
|
||||
assert arpackSlv.nbEV == len(arpackSlv.val), "bad result"
|
||||
print("\nresults:\n")
|
||||
print("mode selected:", arpackSlv.mode)
|
||||
print("nb iterations:", arpackSlv.nbIt)
|
||||
print("Reverse Communication Interface time:", arpackSlv.rciTime, "s")
|
||||
for val, vec in zip(arpackSlv.val, arpackSlv.vec):
|
||||
print("eigen value:", val)
|
||||
print("eigen vector:")
|
||||
for v in range(n):
|
||||
print(vec[v])
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user