Debian Codegraph @

src/Eigen/eigenvalue.cpp

raw symbols SCIP
1 /****************************************************************************/cxx . . $ `<file>/src/Eigen/eigenvalue.cpp`/
2 /* This file is part of FreeFEM. */
3 /* */
4 /* FreeFEM is free software: you can redistribute it and/or modify */
5 /* it under the terms of the GNU Lesser General Public License as */
6 /* published by the Free Software Foundation, either version 3 of */
7 /* the License, or (at your option) any later version. */
8 /* */
9 /* FreeFEM is distributed in the hope that it will be useful, */
10 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
11 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
12 /* GNU Lesser General Public License for more details. */
13 /* */
14 /* You should have received a copy of the GNU Lesser General Public License */
15 /* along with FreeFEM. If not, see <http://www.gnu.org/licenses/>. */
16 /****************************************************************************/
17 // SUMMARY : ...
18 // LICENSE : LGPLv3
19 // ORG : LJLL Universite Pierre et Marie Curie, Paris, FRANCE
20 // AUTHORS : Frederic Hecht
21 // E-MAIL : [email protected]
22
23 #include <fstream>
24 #include <iostream>
25 #include <cassert>
26 #include <algorithm>
27 #include <complex>
28
29 using namespace std;
30 //#include "ff++.hpp"
31
32 #include "error.hpp"cxx . . $ `<file>/src/fflib/error.hpp`/
33 #include "arpackff.hpp"cxx . . $ `<file>/src/Eigen/arpackff.hpp`/
34 #include "AFunction.hpp"cxx . . $ `<file>/src/fflib/AFunction.hpp`/
35 #include "rgraph.hpp"cxx . . $ `<file>/src/Graphics/rgraph.hpp`/
36 #include "RNM.hpp"cxx . . $ `<file>/src/femlib/RNM.hpp`/
37
38 #include "HashMatrix.hpp"cxx . . $ `<file>/src/femlib/HashMatrix.hpp`/
39
40 #include "SparseLinearSolver.hpp"cxx . . $ `<file>/src/femlib/SparseLinearSolver.hpp`/
41
42 #include "Mesh3dn.hpp"cxx . . $ `<file>/src/femlib/Mesh3dn.hpp`/
43 #include "MeshPoint.hpp"cxx . . $ `<file>/src/femlib/MeshPoint.hpp`/
44 #include "lgfem.hpp"cxx . . $ `<file>/src/fflib/lgfem.hpp`/
45 #include "lgmesh3.hpp"cxx . . $ `<file>/src/fflib/lgmesh3.hpp`/
46 #include "lgsolver.hpp"cxx . . $ `<file>/src/fflib/lgsolver.hpp`/
47 #include "problem.hpp"cxx . . $ `<file>/src/fflib/problem.hpp`/
48 //#include "ffstack.hpp"
49
50 extern Blockcxx . . $ Block# *currentblockcxx . . $ currentblock.;
51
52 typedef double Rcxx . . $ Fem2D/R#;
53 static bool ddddcxx . . $ dddd. = false;
54 template<class K>
55 void Showcxx . . $ Show(81d787db3d17eb37).(int ido, KN_cxx . . $ KN_#<K> w, const char *cmm) {
56 coutcxx . . $ cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). cmm <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). ido <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " max = " <<cxx . . $ `operator<<`(9ced1f356fedeebb). w.maxcxx . . $ KN_#max(8f5363d873dd4781).() <<cxx . . $ `operator<<`(9ced1f356fedeebb). " - min = " <<cxx . . $ `operator<<`(9ced1f356fedeebb). w.mincxx . . $ KN_#min(8f5363d873dd4781).() <<cxx . . $ `operator<<`(9ced1f356fedeebb). " - sum = " <<cxx . . $ `operator<<`(9ced1f356fedeebb). w.sumcxx . . $ KN_#sum(8f5363d873dd4781).() <<cxx . . $ `operator<<`(9ced1f356fedeebb). endlcxx . . $ endl(345bf97a19cc83a9).;
57 }
58
59 template<class R>
60 class FuncMatcxx . . $ FuncMat# : public RNM_VirtualMatrixcxx . . $ RNM_VirtualMatrix#<R> {
61 public:
62 // typedef double K;
63 typedef KNcxx . . $ KN#<R> Kncxx . . $ FuncMat#Kn#;
64 typedef KN_cxx . . $ KN_#<R> Kn_cxx . . $ FuncMat#Kn_#;
65
66 Stackcxx . . $ Stack# stackcxx . . $ FuncMat#stack.;
67
68 mutable Kncxx . . $ FuncMat#Kn# xcxx . . $ FuncMat#x.;
69 C_F0cxx . . $ C_F0# c_xcxx . . $ FuncMat#c_x.;
70 Kncxx . . $ FuncMat#Kn# *bcxx . . $ FuncMat#b.;
71 Expressioncxx . . $ Expression# mat1cxx . . $ FuncMat#mat1., matcxx . . $ FuncMat#mat.;
72 typedef typename RNM_VirtualMatrixcxx . . $ RNM_VirtualMatrix#<R>::plusAx plusAxcxx . . $ FuncMat#plusAx#;
73
74 FuncMatcxx . . $ FuncMat#`FuncMat<R>`(1e413aa5ff706ac2). (int n, Stackcxx . . $ Stack# stk, const OneOperatorcxx . . $ OneOperator# *op, const OneOperatorcxx . . $ OneOperator# *op1, Kncxx . . $ FuncMat#Kn# *bb=0)
75 : RNM_VirtualMatrixcxx . . $ RNM_VirtualMatrix#<R>(n),
76 stackcxx . . $ FuncMat#stack.(stk),
77 xcxx . . $ FuncMat#x.(n), c_xcxx . . $ FuncMat#c_x.(CPValuecxx . . $ CPValue(3fe4e6a3636734dc).(xcxx . . $ FuncMat#x.)), bcxx . . $ FuncMat#b.(bb),
78 mat1cxx . . $ FuncMat#mat1.(op1 ? CastTocxx . . $ CastTo(b9a14f5cb71c17fe).<Kn_cxx . . $ FuncMat#Kn_#>(C_F0cxx . . $ C_F0#C_F0(22fb85d958f4256a).(op1->codecxx . . $ OneOperator#code(f771666770a2e724).(basicAC_F0_wacxx . . $ basicAC_F0_wa#(c_xcxx . . $ FuncMat#c_x.)), (aTypecxx . . $ aType#)*op1)) : 0),
79 matcxx . . $ FuncMat#mat.(op ? CastTocxx . . $ CastTo(b9a14f5cb71c17fe).<Kn_cxx . . $ FuncMat#Kn_#>(C_F0cxx . . $ C_F0#C_F0(22fb85d958f4256a).(op->codecxx . . $ OneOperator#code(f771666770a2e724).(basicAC_F0_wacxx . . $ basicAC_F0_wa#(c_xcxx . . $ FuncMat#c_x.)), (aTypecxx . . $ aType#)*op)) : 0)
80 {}
81
82 FuncMatcxx . . $ FuncMat#`FuncMat<R>`(49f6e7a06ebc5aa8). () { if (mat1cxx . . $ FuncMat#mat1. != matcxx . . $ FuncMat#mat.) delete matcxx . . $ FuncMat#mat.; delete mat1cxx . . $ FuncMat#mat1.; delete c_xcxx . . $ FuncMat#c_x..LeftValuecxx . . $ C_F0#LeftValue(432a84b242fccb01).(); }
83
84 void addMatMulcxx . . $ FuncMat#addMatMul(c4b9a7787362be16). (const Kn_cxx . . $ FuncMat#Kn_# &xx, Kn_cxx . . $ FuncMat#Kn_# &Ax) const {
85 // cout << " addMatMul " << xx.N() << " " << Ax.N() << " " << cas << endl;
86 ffassertcxx . . $ `src/fflib/throwassert.hpp:49:9`!(xx.N() == Ax.N() && mat);
87 xcxx . . $ FuncMat#x. =xx;
88 Ax +=cxx . . $ `operator+=`(d02e6a613fcf7dc7). GetAnycxx . . $ GetAny(4ae00c582f151d1b).<Kn_cxx . . $ FuncMat#Kn_#>((*matcxx . . $ FuncMat#mat.)(cxx . . $ E_F0#`operator()`(29b3b217a13aa28b).stackcxx . . $ FuncMat#stack.));
89 if (bcxx . . $ FuncMat#b. && &cxx . . $ std/`operator&`(9272523886439dff).Ax !=cxx . . $ std/`operator!=`(bf4c77cd91c4b201). bcxx . . $ FuncMat#b.) Ax +=cxx . . $ `operator+=`(d02e6a613fcf7dc7). *bcxx . . $ FuncMat#b.; // Ax - b => add b (not in cas of init. b c.a.d &Ax == b)
90 WhereStackOfPtr2Freecxx . . $ WhereStackOfPtr2Free(7a08698bfc529990).(stackcxx . . $ FuncMat#stack.)->cleancxx . . $ StackOfPtr2Free#clean(83c267b20bac841a).(); // add dec 2008
91 }
92
93 void Solvecxx . . $ FuncMat#Solve(9ba22eec2884cbc1). (KN_cxx . . $ KN_#<R> &Ax, const KN_cxx . . $ KN_#<R> & xx) const {
94 ffassertcxx . . $ `src/fflib/throwassert.hpp:49:9`!(xx.N() == Ax.N() && mat1);
95 xcxx . . $ FuncMat#x. = xx;
96 Ax = GetAnycxx . . $ GetAny(4ae00c582f151d1b).<Kn_cxx . . $ FuncMat#Kn_#>((*mat1cxx . . $ FuncMat#mat1.)(cxx . . $ E_F0#`operator()`(29b3b217a13aa28b).stackcxx . . $ FuncMat#stack.));
97 if (bcxx . . $ FuncMat#b. && &cxx . . $ std/`operator&`(9272523886439dff).Ax !=cxx . . $ std/`operator!=`(bf4c77cd91c4b201). bcxx . . $ FuncMat#b.) Ax +=cxx . . $ `operator+=`(d02e6a613fcf7dc7). *bcxx . . $ FuncMat#b.; // Ax -b => add b (not in cas of init. b c.a.d &Ax == b)
98 WhereStackOfPtr2Freecxx . . $ WhereStackOfPtr2Free(7a08698bfc529990).(stackcxx . . $ FuncMat#stack.)->cleancxx . . $ StackOfPtr2Free#clean(83c267b20bac841a).(); // add dec 2008
99 }
100
101 plusAxcxx . . $ FuncMat#plusAx# operatorcxx . . $ FuncMat#`operator*`(3443257ee551297). * (const Kncxx . . $ FuncMat#Kn# &x) const { return plusAxcxx . . $ FuncMat#plusAx#(this,x); }
102 virtual bool ChecknbLinecxx . . $ FuncMat#ChecknbLine(4a668f6de69bf818). (int n) const { return true; }
103 virtual bool ChecknbColumncxx . . $ FuncMat#ChecknbColumn(4a668f6de69bf818). (int m) const { return true; }
104 bool WithSolvercxx . . $ FuncMat#WithSolver(50ce9a9e25b4a850). () const { return mat1cxx . . $ FuncMat#mat1.; }
105 };
106
107 void ToWhichcxx . . $ ToWhich(d9072312faeff126). (Stackcxx . . $ Stack# stack, char *which, Expressioncxx . . $ Expression# ew) {
108 if (!ew) strcpy(which, "LM");
109 else {
110 stringcxx . . $ std/string# *sw = GetAnycxx . . $ GetAny(4ae00c582f151d1b).<stringcxx . . $ std/string#*>((*ew)(cxx . . $ E_F0#`operator()`(29b3b217a13aa28b).stack));
111 if (sw && sw->lengthcxx . . $ std/__cxx11/basic_string#length(48278e53df7b52a5).() == 2)
112 strcpy(which, sw->c_strcxx . . $ std/__cxx11/basic_string#c_str(1016ee5406d91ab9).());
113 int ok = 0;
114 if (strcmp(which, "LM") == 0) ok = 1;
115 else if (strcmp(which, "LA") == 0) ok = 1;
116 else if (strcmp(which, "SM") == 0) ok = 1;
117 else if (strcmp(which, "SA") == 0) ok = 1;
118 else if (strcmp(which, "SR") == 0) ok = 1;
119 else if (strcmp(which, "LR") == 0) ok = 1;
120 else if (strcmp(which, "BE") == 0) ok = 1;
121 ffassertcxx . . $ `src/fflib/throwassert.hpp:49:9`!(ok);
122 }
123 }
124
125 void CheckModecxx . . $ CheckMode(159ba41c422375bb). (int mode, bool A, bool A1, bool B, bool B1) {
126 if (mode == 1) { ffassertcxx . . $ `src/fflib/throwassert.hpp:49:9`!(A); }
127 if (mode == 2) { ffassertcxx . . $ `src/fflib/throwassert.hpp:49:9`!(A && B && B1 ); }
128 if (mode == 3) { ffassertcxx . . $ `src/fflib/throwassert.hpp:49:9`!(A1 && B); }
129 }
130
131 template<class K,class Mat>
132 void DoIdoActioncxx . . $ DoIdoAction(1bab2854b46d15d). (int ido, char bmat, int mode, KN_cxx . . $ KN_#<K> &xx, KN_cxx . . $ KN_#<K> &yy, KN_cxx . . $ KN_#<K> &zz, KN_cxx . . $ KN_#<K> &work, Mat &OP1, Mat &B) {
133 if ((mode == 3) && (bmat == 'G')) // shift-invert mode, generalized problem
134 switch (ido) {
135 case -1: //y <--- OP*x = inv[A-SIGMA*M]*M*x
136 if(ddddcxx . . $ dddd.) Showcxx . . $ Show(81d787db3d17eb37).(ido, xx, " <- (xx) ");
137 OP1.Solve(yy, work=B*cxx . . $ `operator*`(ca0d58f853b0940).xx);
138 if(ddddcxx . . $ dddd.) Showcxx . . $ Show(81d787db3d17eb37).(ido, yy, " -> (yy) ");
139 break;
140 case 1:// y <-- OP*x = inv[A-sigma*M]*z
141 if(ddddcxx . . $ dddd.) Showcxx . . $ Show(81d787db3d17eb37).(ido, zz, " <- (zz) ");
142 OP1.Solve(yy, zz);
143 if(ddddcxx . . $ dddd.) Showcxx . . $ Show(81d787db3d17eb37).(ido, yy, " -> (yy) ");
144 break;
145 case 2: // y <--- M*x
146 if(ddddcxx . . $ dddd.) Showcxx . . $ Show(81d787db3d17eb37).(ido, xx, " <- (xx) ");
147 yy = B*cxx . . $ `operator*`(ca0d58f853b0940).xx;
148 if(ddddcxx . . $ dddd.) Showcxx . . $ Show(81d787db3d17eb37).(ido, yy, " -> (yy) ");
149 break;
150 default:
151 ffassertcxx . . $ `src/fflib/throwassert.hpp:49:9`!(0);
152 }
153 else if ((mode == 2) && (bmat == 'G')) { // shift-invert mode, generalized problem
154 switch (ido) {
155 case -1: // y <--- OP*x = inv[M]*A*x
156 case 1:
157 if (mode == 1) // M = Id //TODO there is a non-sens here: mode == 2 && mode == 1
158 yy = OP1*cxx . . $ `operator*`(ca0d58f853b0940).xx;
159 else
160 B.Solve(yy, work=OP1*cxx . . $ `operator*`(ca0d58f853b0940).xx);
161 break;
162 case 2: // y <--- M*x. // not use mode = 1
163 yy = B*cxx . . $ `operator*`(ca0d58f853b0940).xx;
164 break;
165 default :
166 ffassertcxx . . $ `src/fflib/throwassert.hpp:49:9`!(0);
167 }
168 }
169 else if ((mode == 1) && (bmat == 'I')) // direct mode, simple problem
170 switch (ido) {
171 case 1:
172 B.Solve(yy, work=OP1*cxx . . $ `operator*`(ca0d58f853b0940).xx);
173 break;
174 default :
175 ffassertcxx . . $ `src/fflib/throwassert.hpp:49:9`!(0);
176 }
177 else if ((mode == 3) && (bmat == 'I')) // shift-invert mode, simple problem
178 switch (ido) {
179 case -1:
180 case 1:
181 OP1.Solve(yy, work=B*cxx . . $ `operator*`(ca0d58f853b0940).xx);
182 break;
183 default :
184 ffassertcxx . . $ `src/fflib/throwassert.hpp:49:9`!(0);
185 }
186 }
187
188 /*void DoIdoAction(int ido,int mode,KN_<K> &xx,KN_<K> &yy,KN_<K> &zz,KN_<K> &work,Mat &A,Mat &B)
189 {
190 if(mode>2) // inverse mode
191 switch (ido) {
192 case -1: //y <--- OP*x = inv[A-SIGMA*M]*M*x
193 if(dddd) Show(ido,xx," <- (xx) ");
194 A.Solve(yy,work=B*xx);
195 if(dddd) Show(ido,yy," -> (yy) ");
196 break;
197 case 1:// y <-- OP*x = inv[A-sigma*M]*z
198 if(dddd) Show(ido,zz," <- (zz) ");
199 A.Solve(yy,zz);
200 if(dddd) Show(ido,yy," -> (yy) ");
201 break;
202 case 2: // y <--- M*x
203 if(dddd) Show(ido,xx," <- (xx) ");
204 yy = B*xx;
205 if(dddd) Show(ido,yy," -> (yy) ");
206 break;
207 default :
208 ffassert(0);
209 }
210 else // direct mode
211 switch (ido)
212 {
213 case -1: // y <--- OP*x = inv[M]*A*x
214 case 1:
215 if(mode== 1) // M = Id
216 yy=A*xx;
217 else
218 B.Solve(yy,work=A*xx);
219 break;
220 case 2: // y <--- M*x. // not use mode = 1
221 yy = B*xx;
222 break;
223 default :
224 ffassert(0);
225 }
226 }*/
227
228 template<class K>
229 const OneOperatorcxx . . $ OneOperator# *ToCodecxx . . $ ToCode(d564ba170abc4d9b).(Expressioncxx . . $ Expression# e) {
230 const OneOperatorcxx . . $ OneOperator# *code = 0;
231 if (e != 0) {
232 const Polymorphiccxx . . $ Polymorphic# *op = dynamic_cast<const Polymorphiccxx . . $ Polymorphic#*>(e);
233 ffassertcxx . . $ `src/fflib/throwassert.hpp:49:9`!(op);
234 code = op->Findcxx . . $ Polymorphic#Find(51143f33d2c4400e).("(", ArrayOfaTypecxx . . $ ArrayOfaType#(atypecxx . . $ atype(f7e2cbc52f11d57).<KNcxx . . $ KN#<K>* >(), false));
235 if(code == 0)
236 {
237 cerrcxx . . $ `src/fflib/throwassert.hpp:33:9`! <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " Erreur we are in Eigen "<<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). typeid(K).namecxx . . $ std/type_info#name(a9f41ea0e82d88cf).() <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " "<<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ endl(345bf97a19cc83a9).;
238 coutcxx . . $ cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " bad type of function : Maybe we need to use complexEigenValue or EigenValue" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ endl(345bf97a19cc83a9).;
239 ffassertcxx . . $ `src/fflib/throwassert.hpp:49:9`!(code);
240 }
241 }
242 return code;
243 }
244
245 class EigenValuecxx . . $ EigenValue# : public OneOperatorcxx . . $ OneOperator# {
246 public:
247 typedef Rcxx . . $ Fem2D/R# Kcxx . . $ EigenValue#K#;
248 typedef KNcxx . . $ KN#<Kcxx . . $ EigenValue#K#> Kncxx . . $ EigenValue#Kn#;
249 typedef KN_cxx . . $ KN_#<Kcxx . . $ EigenValue#K#> Kn_cxx . . $ EigenValue#Kn_#;
250 const int cascxx . . $ EigenValue#cas.;
251 class E_EVcxx . . $ EigenValue#E_EV# : public E_F0mpscxx . . $ E_F0mps# {
252 public:
253 const int cascxx . . $ EigenValue#E_EV#cas.;
254
255 static basicAC_F0cxx . . $ basicAC_F0#::name_and_typecxx . . $ basicAC_F0#name_and_type# name_paramcxx . . $ EigenValue#E_EV#name_param.[];
256 static const int n_name_paramcxx . . $ EigenValue#E_EV#n_name_param. = 18;
257 Expressioncxx . . $ Expression# nargscxx . . $ EigenValue#E_EV#nargs.[n_name_paramcxx . . $ EigenValue#E_EV#n_name_param.];
258 Expressioncxx . . $ Expression# expOP1cxx . . $ EigenValue#E_EV#expOP1., expBcxx . . $ EigenValue#E_EV#expB., expncxx . . $ EigenValue#E_EV#expn.;
259 const OneOperatorcxx . . $ OneOperator# *codeOP1cxx . . $ EigenValue#E_EV#codeOP1., *codeBcxx . . $ EigenValue#E_EV#codeB., *codeOPcxx . . $ EigenValue#E_EV#codeOP., *codeB1cxx . . $ EigenValue#E_EV#codeB1.;
260 template<class T>
261 T argcxx . . $ EigenValue#E_EV#arg(a14a6e1927d78e40). (int i, Stackcxx . . $ Stack# stack, const T &a) const { return nargscxx . . $ EigenValue#E_EV#nargs.[i] ? GetAnycxx . . $ GetAny(4ae00c582f151d1b).<T>((*nargscxx . . $ EigenValue#E_EV#nargs.[i])(cxx . . $ E_F0#`operator()`(29b3b217a13aa28b).stack)) : a; }
262 E_EVcxx . . $ EigenValue#E_EV#E_EV(a65e77a1106337ff). (const basicAC_F0cxx . . $ basicAC_F0# &args, int cc) :
263 cascxx . . $ EigenValue#E_EV#cas.(cc), expOP1cxx . . $ EigenValue#E_EV#expOP1.(0), expBcxx . . $ EigenValue#E_EV#expB.(0), expncxx . . $ EigenValue#E_EV#expn.(0), codeOP1cxx . . $ EigenValue#E_EV#codeOP1.(0), codeBcxx . . $ EigenValue#E_EV#codeB.(0), codeOPcxx . . $ EigenValue#E_EV#codeOP.(0), codeB1cxx . . $ EigenValue#E_EV#codeB1.(0) {
264 // OP1 = (A-sigma*B)
265 // int nbj= args.size()-1;
266 args.SetNameParamcxx . . $ basicAC_F0#SetNameParam(2755858438fb170b).(n_name_paramcxx . . $ EigenValue#E_EV#n_name_param., name_paramcxx . . $ EigenValue#E_EV#name_param., nargscxx . . $ EigenValue#E_EV#nargs.);
267 if (cascxx . . $ EigenValue#E_EV#cas. == 1 || cascxx . . $ EigenValue#E_EV#cas. == 2) {
268 expncxx . . $ EigenValue#E_EV#expn. = tocxx . . $ to(7813c32c88d11da9).< long>(args[cxx . . $ basicAC_F0#`operator[]`(4717a974d14df1e6).0]);
269 const Polymorphiccxx . . $ Polymorphic# *op = dynamic_cast<const Polymorphiccxx . . $ Polymorphic#*>(args[cxx . . $ basicAC_F0#`operator[]`(4717a974d14df1e6).1].LeftValuecxx . . $ C_F0#LeftValue(432a84b242fccb01).());
270 ffassertcxx . . $ `src/fflib/throwassert.hpp:49:9`!(op);
271 codeOP1cxx . . $ EigenValue#E_EV#codeOP1. = op->Findcxx . . $ Polymorphic#Find(51143f33d2c4400e).("(", ArrayOfaTypecxx . . $ ArrayOfaType#ArrayOfaType(4c647a0b8390f62d).(atypecxx . . $ atype(f7e2cbc52f11d57).<Kncxx . . $ EigenValue#Kn#* >(), false));
272 ffassertcxx . . $ `src/fflib/throwassert.hpp:49:9`!(codeOP1);
273 if (cascxx . . $ EigenValue#E_EV#cas. == 2) {
274 const Polymorphiccxx . . $ Polymorphic# *op = dynamic_cast<const Polymorphiccxx . . $ Polymorphic#*>(args[cxx . . $ basicAC_F0#`operator[]`(4717a974d14df1e6).2].LeftValuecxx . . $ C_F0#LeftValue(432a84b242fccb01).());
275 ffassertcxx . . $ `src/fflib/throwassert.hpp:49:9`!(op);
276 codeBcxx . . $ EigenValue#E_EV#codeB. = op->Findcxx . . $ Polymorphic#Find(51143f33d2c4400e).("(", ArrayOfaTypecxx . . $ ArrayOfaType#ArrayOfaType(4c647a0b8390f62d).(atypecxx . . $ atype(f7e2cbc52f11d57).<Kncxx . . $ EigenValue#Kn#* >(), false));
277 ffassertcxx . . $ `src/fflib/throwassert.hpp:49:9`!(codeB);
278 }
279 } else if (cascxx . . $ EigenValue#E_EV#cas. == 3) {
280 expncxx . . $ EigenValue#E_EV#expn. = tocxx . . $ to(7813c32c88d11da9).< long>(args[cxx . . $ basicAC_F0#`operator[]`(4717a974d14df1e6).0]);
281 } else {
282 expOP1cxx . . $ EigenValue#E_EV#expOP1. = tocxx . . $ to(7813c32c88d11da9).<Matrice_Creusecxx . . $ Matrice_Creuse#<Kcxx . . $ EigenValue#K#> *>(args[cxx . . $ basicAC_F0#`operator[]`(4717a974d14df1e6).0]);
283 expBcxx . . $ EigenValue#E_EV#expB. = tocxx . . $ to(7813c32c88d11da9).<Matrice_Creusecxx . . $ Matrice_Creuse#<Kcxx . . $ EigenValue#K#> *>(args[cxx . . $ basicAC_F0#`operator[]`(4717a974d14df1e6).1]);
284 }
285 ffassertcxx . . $ `src/fflib/throwassert.hpp:49:9`!((codeOP1 == 0) || (nargs[15] == 0)); // Double def
286 ffassertcxx . . $ `src/fflib/throwassert.hpp:49:9`!((codeB == 0) || (nargs[14] == 0)); // Double def
287 codeOPcxx . . $ EigenValue#E_EV#codeOP. = ToCodecxx . . $ ToCode(d564ba170abc4d9b).<double>(nargscxx . . $ EigenValue#E_EV#nargs.[13]);
288 if (!codeBcxx . . $ EigenValue#E_EV#codeB.) codeBcxx . . $ EigenValue#E_EV#codeB. = ToCodecxx . . $ ToCode(d564ba170abc4d9b).<double>(nargscxx . . $ EigenValue#E_EV#nargs.[14]);
289 if (!codeOP1cxx . . $ EigenValue#E_EV#codeOP1.) codeOP1cxx . . $ EigenValue#E_EV#codeOP1. = ToCodecxx . . $ ToCode(d564ba170abc4d9b).<double>(nargscxx . . $ EigenValue#E_EV#nargs.[15]);
290 codeB1cxx . . $ EigenValue#E_EV#codeB1. = ToCodecxx . . $ ToCode(d564ba170abc4d9b).<double>(nargscxx . . $ EigenValue#E_EV#nargs.[16]);
291 }
292
293 AnyTypecxx . . $ AnyType# operatorcxx . . $ EigenValue#E_EV#`operator()`(29b3b217a13aa28b). () (Stackcxx . . $ Stack# stack) const;
294 operatorcxx . . $ EigenValue#E_EV#`operator const basicForEachType *`(473004fba94dfb53). aTypecxx . . $ aType# () const { return atypecxx . . $ atype(f7e2cbc52f11d57).<long>(); }
295 };
296
297 E_F0cxx . . $ E_F0# * codecxx . . $ EigenValue#code(f771666770a2e724). (const basicAC_F0cxx . . $ basicAC_F0# & args) const { return new E_EVcxx . . $ EigenValue#E_EV#(args,cascxx . . $ EigenValue#cas.); }
298
299 EigenValuecxx . . $ EigenValue#EigenValue(49f6e7a06ebc5aa8). () :
300 OneOperatorcxx . . $ OneOperator#OneOperator(62eded790a0abda1).(atypecxx . . $ atype(f7e2cbc52f11d57).<long>(),
301 atypecxx . . $ atype(f7e2cbc52f11d57).<Matrice_Creusecxx . . $ Matrice_Creuse#<Kcxx . . $ EigenValue#K#> *>(),
302 atypecxx . . $ atype(f7e2cbc52f11d57).<Matrice_Creusecxx . . $ Matrice_Creuse#<Kcxx . . $ EigenValue#K#> *>()),
303 cascxx . . $ EigenValue#cas.(0) {}
304
305 EigenValuecxx . . $ EigenValue#EigenValue(3e454b8ccf442868). (int, int) :
306 OneOperatorcxx . . $ OneOperator#OneOperator(91bbe39e279bb652).(atypecxx . . $ atype(f7e2cbc52f11d57).<long>(), atypecxx . . $ atype(f7e2cbc52f11d57).<long>(),
307 atypecxx . . $ atype(f7e2cbc52f11d57).<Polymorphiccxx . . $ Polymorphic# *>(),
308 atypecxx . . $ atype(f7e2cbc52f11d57).<Polymorphiccxx . . $ Polymorphic# *>()),
309 cascxx . . $ EigenValue#cas.(2) {}
310
311 EigenValuecxx . . $ EigenValue#EigenValue(d4f767463ce0a6b3). (int) :
312 OneOperatorcxx . . $ OneOperator#OneOperator(62eded790a0abda1).(atypecxx . . $ atype(f7e2cbc52f11d57).<long>(), atypecxx . . $ atype(f7e2cbc52f11d57).<long>(),
313 atypecxx . . $ atype(f7e2cbc52f11d57).<Polymorphiccxx . . $ Polymorphic# *>()),
314 cascxx . . $ EigenValue#cas.(1) {}
315
316 EigenValuecxx . . $ EigenValue#EigenValue(b1146eedae1e1d0b).(int, int, int) : // All data are given through A=, B= A1=, B1=
317 OneOperatorcxx . . $ OneOperator#OneOperator(1e24cd3a60d5e5fe).(atypecxx . . $ atype(f7e2cbc52f11d57).<long>(), atypecxx . . $ atype(f7e2cbc52f11d57).<long>()),
318 cascxx . . $ EigenValue#cas.(3) {}
319 };
320
321 class EigenValueCcxx . . $ EigenValueC# : public OneOperatorcxx . . $ OneOperator# {
322 public:
323 typedef Complexcxx . . $ Complex# Kcxx . . $ EigenValueC#K#;
324 typedef double Rcxx . . $ EigenValueC#R#;
325 typedef KNcxx . . $ KN#<Kcxx . . $ EigenValueC#K#> Kncxx . . $ EigenValueC#Kn#;
326 typedef KN_cxx . . $ KN_#<Kcxx . . $ EigenValueC#K#> Kn_cxx . . $ EigenValueC#Kn_#;
327 const int cascxx . . $ EigenValueC#cas.;
328 class E_EVcxx . . $ EigenValueC#E_EV# : public E_F0mpscxx . . $ E_F0mps# {
329 public:
330 const int cascxx . . $ EigenValueC#E_EV#cas.;
331
332 static basicAC_F0cxx . . $ basicAC_F0#::name_and_typecxx . . $ basicAC_F0#name_and_type# name_paramcxx . . $ EigenValueC#E_EV#name_param.[];
333 static const int n_name_paramcxx . . $ EigenValueC#E_EV#n_name_param. = 16;
334 Expressioncxx . . $ Expression# nargscxx . . $ EigenValueC#E_EV#nargs.[n_name_paramcxx . . $ EigenValueC#E_EV#n_name_param.];
335 Expressioncxx . . $ Expression# expOP1cxx . . $ EigenValueC#E_EV#expOP1., expBcxx . . $ EigenValueC#E_EV#expB., expncxx . . $ EigenValueC#E_EV#expn.;
336 const OneOperatorcxx . . $ OneOperator# *codeOP1cxx . . $ EigenValueC#E_EV#codeOP1., *codeBcxx . . $ EigenValueC#E_EV#codeB., *codeOPcxx . . $ EigenValueC#E_EV#codeOP., *codeB1cxx . . $ EigenValueC#E_EV#codeB1.;
337 template<class T>
338 T argcxx . . $ EigenValueC#E_EV#arg(a14a6e1927d78e40). (int i, Stackcxx . . $ Stack# stack, const T &a) const { return nargscxx . . $ EigenValueC#E_EV#nargs.[i] ? GetAnycxx . . $ GetAny(4ae00c582f151d1b).<T>((*nargscxx . . $ EigenValueC#E_EV#nargs.[i])(cxx . . $ E_F0#`operator()`(29b3b217a13aa28b).stack)) : a; }
339 E_EVcxx . . $ EigenValueC#E_EV#E_EV(a65e77a1106337ff). (const basicAC_F0cxx . . $ basicAC_F0# &args, int cc) :
340 cascxx . . $ EigenValueC#E_EV#cas.(cc), expOP1cxx . . $ EigenValueC#E_EV#expOP1.(0), expBcxx . . $ EigenValueC#E_EV#expB.(0), expncxx . . $ EigenValueC#E_EV#expn.(0), codeOP1cxx . . $ EigenValueC#E_EV#codeOP1.(0), codeBcxx . . $ EigenValueC#E_EV#codeB.(0), codeOPcxx . . $ EigenValueC#E_EV#codeOP.(0), codeB1cxx . . $ EigenValueC#E_EV#codeB1.(0) {
341 // OP1 = (A-sigma*B)
342 // int nbj = args.size()-1;
343 args.SetNameParamcxx . . $ basicAC_F0#SetNameParam(2755858438fb170b).(n_name_paramcxx . . $ EigenValueC#E_EV#n_name_param., name_paramcxx . . $ EigenValueC#E_EV#name_param., nargscxx . . $ EigenValueC#E_EV#nargs.);
344 if (cascxx . . $ EigenValueC#E_EV#cas. == 1 || cascxx . . $ EigenValueC#E_EV#cas. == 2) {
345 expncxx . . $ EigenValueC#E_EV#expn. = tocxx . . $ to(7813c32c88d11da9).<long>(args[cxx . . $ basicAC_F0#`operator[]`(4717a974d14df1e6).0]);
346 const Polymorphiccxx . . $ Polymorphic# *op = dynamic_cast<const Polymorphiccxx . . $ Polymorphic#*>(args[cxx . . $ basicAC_F0#`operator[]`(4717a974d14df1e6).1].LeftValuecxx . . $ C_F0#LeftValue(432a84b242fccb01).());
347 ffassertcxx . . $ `src/fflib/throwassert.hpp:49:9`!(op);
348 codeOP1cxx . . $ EigenValueC#E_EV#codeOP1. = op->Findcxx . . $ Polymorphic#Find(51143f33d2c4400e).("(", ArrayOfaTypecxx . . $ ArrayOfaType#ArrayOfaType(4c647a0b8390f62d).(atypecxx . . $ atype(f7e2cbc52f11d57).<Kncxx . . $ EigenValueC#Kn#* >(), false));
349 ffassertcxx . . $ `src/fflib/throwassert.hpp:49:9`!(codeOP1);
350 if (cascxx . . $ EigenValueC#E_EV#cas. == 2) {
351 const Polymorphiccxx . . $ Polymorphic# *op = dynamic_cast<const Polymorphiccxx . . $ Polymorphic#*>(args[cxx . . $ basicAC_F0#`operator[]`(4717a974d14df1e6).2].LeftValuecxx . . $ C_F0#LeftValue(432a84b242fccb01).());
352 ffassertcxx . . $ `src/fflib/throwassert.hpp:49:9`!(op);
353 codeBcxx . . $ EigenValueC#E_EV#codeB. = op->Findcxx . . $ Polymorphic#Find(51143f33d2c4400e).("(", ArrayOfaTypecxx . . $ ArrayOfaType#ArrayOfaType(4c647a0b8390f62d).(atypecxx . . $ atype(f7e2cbc52f11d57).<Kncxx . . $ EigenValueC#Kn#* >(), false));
354 ffassertcxx . . $ `src/fflib/throwassert.hpp:49:9`!(codeB);
355 }
356 } else if (cascxx . . $ EigenValueC#E_EV#cas. == 3) {
357 expncxx . . $ EigenValueC#E_EV#expn. = tocxx . . $ to(7813c32c88d11da9).<long>(args[cxx . . $ basicAC_F0#`operator[]`(4717a974d14df1e6).0]);
358 } else {
359 expOP1cxx . . $ EigenValueC#E_EV#expOP1. = tocxx . . $ to(7813c32c88d11da9).<Matrice_Creusecxx . . $ Matrice_Creuse#<Kcxx . . $ EigenValueC#K#> *>(args[cxx . . $ basicAC_F0#`operator[]`(4717a974d14df1e6).0]);
360 expBcxx . . $ EigenValueC#E_EV#expB. = tocxx . . $ to(7813c32c88d11da9).<Matrice_Creusecxx . . $ Matrice_Creuse#<Kcxx . . $ EigenValueC#K#> *>(args[cxx . . $ basicAC_F0#`operator[]`(4717a974d14df1e6).1]);
361 }
362 ffassertcxx . . $ `src/fflib/throwassert.hpp:49:9`!((codeOP1 == 0) || (nargs[13] == 0)); // Double def
363 ffassertcxx . . $ `src/fflib/throwassert.hpp:49:9`!((codeB == 0) || (nargs[12] == 0)); // Double def
364 codeOPcxx . . $ EigenValueC#E_EV#codeOP. = ToCodecxx . . $ ToCode(d564ba170abc4d9b).<Kcxx . . $ EigenValueC#K#>(nargscxx . . $ EigenValueC#E_EV#nargs.[11]);
365 if (!codeBcxx . . $ EigenValueC#E_EV#codeB.) codeBcxx . . $ EigenValueC#E_EV#codeB. = ToCodecxx . . $ ToCode(d564ba170abc4d9b).<Kcxx . . $ EigenValueC#K#>(nargscxx . . $ EigenValueC#E_EV#nargs.[12]);
366 if (!codeOP1cxx . . $ EigenValueC#E_EV#codeOP1.) codeOP1cxx . . $ EigenValueC#E_EV#codeOP1. = ToCodecxx . . $ ToCode(d564ba170abc4d9b).<Kcxx . . $ EigenValueC#K#>(nargscxx . . $ EigenValueC#E_EV#nargs.[13]);
367 codeB1cxx . . $ EigenValueC#E_EV#codeB1. = ToCodecxx . . $ ToCode(d564ba170abc4d9b).<Kcxx . . $ EigenValueC#K#>(nargscxx . . $ EigenValueC#E_EV#nargs.[14]);
368 }
369
370 AnyTypecxx . . $ AnyType# operatorcxx . . $ EigenValueC#E_EV#`operator()`(29b3b217a13aa28b). () (Stackcxx . . $ Stack# stack) const;
371 operatorcxx . . $ EigenValueC#E_EV#`operator const basicForEachType *`(473004fba94dfb53). aTypecxx . . $ aType# () const { return atypecxx . . $ atype(f7e2cbc52f11d57).<long>(); }
372 };
373
374 E_F0cxx . . $ E_F0# *codecxx . . $ EigenValueC#code(f771666770a2e724). (const basicAC_F0cxx . . $ basicAC_F0# &args) const { return new E_EVcxx . . $ EigenValueC#E_EV#(args,cascxx . . $ EigenValueC#cas.); }
375
376 EigenValueCcxx . . $ EigenValueC#EigenValueC(49f6e7a06ebc5aa8). () :
377 OneOperatorcxx . . $ OneOperator#OneOperator(62eded790a0abda1).(atypecxx . . $ atype(f7e2cbc52f11d57).<long>(),
378 atypecxx . . $ atype(f7e2cbc52f11d57).<Matrice_Creusecxx . . $ Matrice_Creuse#<Kcxx . . $ EigenValueC#K#> *>(),
379 atypecxx . . $ atype(f7e2cbc52f11d57).<Matrice_Creusecxx . . $ Matrice_Creuse#<Kcxx . . $ EigenValueC#K#> *>()),
380 cascxx . . $ EigenValueC#cas.(0) {}
381
382 EigenValueCcxx . . $ EigenValueC#EigenValueC(3e454b8ccf442868). (int, int ) :
383 OneOperatorcxx . . $ OneOperator#OneOperator(91bbe39e279bb652).(atypecxx . . $ atype(f7e2cbc52f11d57).<long>(), atypecxx . . $ atype(f7e2cbc52f11d57).<long>(),
384 atypecxx . . $ atype(f7e2cbc52f11d57).<Polymorphiccxx . . $ Polymorphic# *>(),
385 atypecxx . . $ atype(f7e2cbc52f11d57).<Polymorphiccxx . . $ Polymorphic# *>()),
386 cascxx . . $ EigenValueC#cas.(2) {}
387
388 EigenValueCcxx . . $ EigenValueC#EigenValueC(d4f767463ce0a6b3). (int) :
389 OneOperatorcxx . . $ OneOperator#OneOperator(62eded790a0abda1).(atypecxx . . $ atype(f7e2cbc52f11d57).<long>(), atypecxx . . $ atype(f7e2cbc52f11d57).<long>(),
390 atypecxx . . $ atype(f7e2cbc52f11d57).<Polymorphiccxx . . $ Polymorphic# *>()),
391 cascxx . . $ EigenValueC#cas.(1) {}
392
393 EigenValueCcxx . . $ EigenValueC#EigenValueC(b1146eedae1e1d0b). (int, int, int) : // All data are given through A=, B= A1=, B1=
394 OneOperatorcxx . . $ OneOperator#OneOperator(1e24cd3a60d5e5fe).(atypecxx . . $ atype(f7e2cbc52f11d57).<long>(), atypecxx . . $ atype(f7e2cbc52f11d57).<long>()),
395 cascxx . . $ EigenValueC#cas.(3) {}
396 };
397
398
399
400 basicAC_F0cxx . . $ basicAC_F0#::name_and_typecxx . . $ basicAC_F0#name_and_type# EigenValuecxx . . $ EigenValue#::E_EVcxx . . $ EigenValue#E_EV#::name_paramcxx . . $ EigenValue#E_EV#name_param.[] = {
401 {"tol", &typeid(double)},
402 {"nev", &typeid(long)},
403 {"sym", &typeid(bool)},
404 {"sigma", &typeid(double)},
405 {"value", &typeid(KNcxx . . $ KN#<double> *)},
406 {"vector", &typeid(FEbaseArrayKncxx . . $ FEbaseArrayKn#<double> *)}, // pferarray
407 {"ncv", &typeid(long)}, // the number of Arnoldi vectors generated
408 {"maxit", &typeid(long)}, // the maximum number of Arnoldi iterations
409 {"ivalue", &typeid(KNcxx . . $ KN#<double> *)},
410 {"rawvector", &typeid(KNMcxx . . $ KNM#<double> *)},
411 {"resid", &typeid(KNcxx . . $ KN#<double> *)},
412 {"driver", &typeid(long)}, // 11th
413 {"which", &typeid(stringcxx . . $ std/string#*)}, // 12th
414 {"A", &typeid(Polymorphiccxx . . $ Polymorphic#*)},
415 {"B", &typeid(Polymorphiccxx . . $ Polymorphic#*)},
416 {"A1", &typeid(Polymorphiccxx . . $ Polymorphic#*)},
417 {"B1", &typeid(Polymorphiccxx . . $ Polymorphic#*)},
418 {"mode", &typeid(long)} // 17th
419 };
420
421 basicAC_F0cxx . . $ basicAC_F0#::name_and_typecxx . . $ basicAC_F0#name_and_type# EigenValueCcxx . . $ EigenValueC#::E_EVcxx . . $ EigenValueC#E_EV#::name_paramcxx . . $ EigenValueC#E_EV#name_param.[] = {
422 {"tol", &typeid(double)},
423 {"nev", &typeid(long)},
424 {"sigma", &typeid(Complexcxx . . $ Complex#)},
425 {"value", &typeid(KNcxx . . $ KN#<Complexcxx . . $ Complex#> *)},
426 {"vector", &typeid(FEbaseArrayKncxx . . $ FEbaseArrayKn#<Complexcxx . . $ Complex#> *)}, // pfecarray
427 {"ncv", &typeid(long)}, // the number of Arnoldi vectors generated
428 {"maxit", &typeid(long)}, // the maximum number of Arnoldi iterations
429 {"rawvector", &typeid(KNMcxx . . $ KNM#<Complexcxx . . $ Complex#> *)},
430 {"resid", &typeid(KNcxx . . $ KN#<Complexcxx . . $ Complex#> *)},
431 {"driver", &typeid(long)},// 9th
432 {"which", &typeid(stringcxx . . $ std/string#*)}, // 10th
433 {"A", &typeid(Polymorphiccxx . . $ Polymorphic#*)},
434 {"B", &typeid(Polymorphiccxx . . $ Polymorphic#*)},
435 {"A1", &typeid(Polymorphiccxx . . $ Polymorphic#*)},
436 {"B1", &typeid(Polymorphiccxx . . $ Polymorphic#*)},
437 {"mode", &typeid(long)} // 15th
438 };
439
440 AnyTypecxx . . $ AnyType# EigenValuecxx . . $ EigenValue#::E_EVcxx . . $ EigenValue#E_EV#::operatorcxx . . $ EigenValue#E_EV#`operator()`(29b3b217a13aa28b). () (Stackcxx . . $ Stack# stack) const {
441 ddddcxx . . $ dddd. = (verbositycxx . . $ verbosity. >= 200);
442 double tol = 1e-6;
443 long nconv = 0;
444 long nbev = 1;
445 bool sym = false;
446 long ncv = 0; // the number of Arnoldi vectors generated
447 long maxit = 0; // the maximum number of Arnoldi iterations
448 double sigma = 0;
449 int driver = 4; //
450 int mymode = -1; // unset
451 KNcxx . . $ KN#<double> *evalue = 0;
452 KNcxx . . $ KN#<double> *evaluei = 0;
453 KNcxx . . $ KN#<double> *resid = 0;
454 KNMcxx . . $ KNM#<double> *rawvector = 0;
455 //double ws, vs; // for debugging FH ++++++++++
456 // pferarray evector2;
457 FEbaseArrayKncxx . . $ FEbaseArrayKn#<double> *evector = 0; // change may 2009
458 tol = argcxx . . $ EigenValue#E_EV#arg(a14a6e1927d78e40).<double>(0, stack, tol);// correct 26/06/24 thanks to PHT
459 nbev = argcxx . . $ EigenValue#E_EV#arg(a14a6e1927d78e40).<long>(1, stack, 10);
460 sym = argcxx . . $ EigenValue#E_EV#arg(a14a6e1927d78e40).<bool>(2, stack, false);
461 sigma = argcxx . . $ EigenValue#E_EV#arg(a14a6e1927d78e40).<double>(3, stack, 0.0);
462 evalue = argcxx . . $ EigenValue#E_EV#arg(a14a6e1927d78e40).<KNcxx . . $ KN#<double>*>(4, stack, 0);
463 evector = argcxx . . $ EigenValue#E_EV#arg(a14a6e1927d78e40).<FEbaseArrayKncxx . . $ FEbaseArrayKn#<double>*>(5, stack, 0);
464 ncv = argcxx . . $ EigenValue#E_EV#arg(a14a6e1927d78e40).<long>(6, stack, 0);
465 maxit = argcxx . . $ EigenValue#E_EV#arg(a14a6e1927d78e40).<long>(7, stack, 0);
466 evaluei = argcxx . . $ EigenValue#E_EV#arg(a14a6e1927d78e40).<KNcxx . . $ KN#<double>*>(8, stack, 0);
467 rawvector = argcxx . . $ EigenValue#E_EV#arg(a14a6e1927d78e40).<KNMcxx . . $ KNM#<double>*>(9, stack, 0);
468 resid = argcxx . . $ EigenValue#E_EV#arg(a14a6e1927d78e40).<KNcxx . . $ KN#<double>*>(10, stack, 0);
469 mymode = argcxx . . $ EigenValue#E_EV#arg(a14a6e1927d78e40).<long>(17, stack, -1);
470 driver = argcxx . . $ EigenValue#E_EV#arg(a14a6e1927d78e40).<long>(11, stack, mymode==2 ? 3 : 4);
471
472 char which[3];
473 ToWhichcxx . . $ ToWhich(d9072312faeff126). (stack, which, nargscxx . . $ EigenValue#E_EV#nargs.[12]);
474
475 // evector=evector2.first;
476
477 Matrice_Creusecxx . . $ Matrice_Creuse#<Kcxx . . $ EigenValue#K#> *pOP1 = 0, *pB = 0;
478 if (expOP1cxx . . $ EigenValue#E_EV#expOP1.)
479 pOP1 = GetAnycxx . . $ GetAny(4ae00c582f151d1b).<Matrice_Creusecxx . . $ Matrice_Creuse#<Kcxx . . $ EigenValue#K#> *>((*expOP1cxx . . $ EigenValue#E_EV#expOP1.)(cxx . . $ E_F0#`operator()`(29b3b217a13aa28b).stack));
480 if (expBcxx . . $ EigenValue#E_EV#expB.)
481 pB = GetAnycxx . . $ GetAny(4ae00c582f151d1b).<Matrice_Creusecxx . . $ Matrice_Creuse#<Kcxx . . $ EigenValue#K#> *>((*expBcxx . . $ EigenValue#E_EV#expB.)(cxx . . $ E_F0#`operator()`(29b3b217a13aa28b).stack));
482 double *residptr = resid ? (double*) *resid : 0;
483 long n = 0;
484 if (pOP1)
485 n = pOP1->Acxx . . $ Matrice_Creuse#A.->cxx . . $ CountPointer#`operator->`(5a2a78a048fb49a8).ncxx . . $ VirtualMatrix#n.;
486 else {
487 ffassertcxx . . $ `src/fflib/throwassert.hpp:49:9`!(expn);
488 n = GetAnycxx . . $ GetAny(4ae00c582f151d1b).<long>((*expncxx . . $ EigenValue#E_EV#expn.)(cxx . . $ E_F0#`operator()`(29b3b217a13aa28b).stack));
489 }
490
491 if (evalue) nbev = Maxcxx . . $ Max(cc50c6e2a630e621).((long)evalue->Ncxx . . $ KN_#N(57a65ae535d7db84).(), nbev);
492
493 const RNM_VirtualMatrixcxx . . $ RNM_VirtualMatrix#<Kcxx . . $ EigenValue#K#> *ptOP1 = 0, *ptB = 0, *ptOP = 0, *ptB1 = 0;
494
495 if (pOP1)
496 ptOP1 = &(const RNM_VirtualMatrixcxx . . $ RNM_VirtualMatrix#<Kcxx . . $ EigenValue#K#>&)(pOP1->Acxx . . $ Matrice_Creuse#A.);
497 if (pB)
498 ptB = &(const RNM_VirtualMatrixcxx . . $ RNM_VirtualMatrix#<Kcxx . . $ EigenValue#K#>&)(pB->Acxx . . $ Matrice_Creuse#A.);
499 FuncMatcxx . . $ FuncMat#<Kcxx . . $ EigenValue#K#> *pcOP = 0, *pcB = 0;
500 if (codeOP1cxx . . $ EigenValue#E_EV#codeOP1. || codeOPcxx . . $ EigenValue#E_EV#codeOP.)
501 ptOP1 = pcOP = new FuncMatcxx . . $ FuncMat#<Kcxx . . $ EigenValue#K#>(n, stack, codeOPcxx . . $ EigenValue#E_EV#codeOP., codeOP1cxx . . $ EigenValue#E_EV#codeOP1.);
502 if (codeBcxx . . $ EigenValue#E_EV#codeB. || codeB1cxx . . $ EigenValue#E_EV#codeB1.)
503 ptB = pcB = new FuncMatcxx . . $ FuncMat#<Kcxx . . $ EigenValue#K#>(n, stack, codeBcxx . . $ EigenValue#E_EV#codeB., codeB1cxx . . $ EigenValue#E_EV#codeB1.);
504
505 MatriceIdentitecxx . . $ MatriceIdentite#<Kcxx . . $ EigenValue#K#> Idcxx . . $ MatriceIdentite#MatriceIdentite(d4f767463ce0a6b3).(n);
506
507 if (!ptB) ptB = &Id;
508 const RNM_VirtualMatrixcxx . . $ RNM_VirtualMatrix#<Kcxx . . $ EigenValue#K#> &OP1 = *ptOP1, &B = *ptB;
509 if (sym) {
510 nbev = mincxx . . $ min(2a338fce5842aa6a).(n-1, nbev);
511 if (!ncv) ncv = mincxx . . $ min(2a338fce5842aa6a).(nbev*2+1, n);
512 } else {
513 nbev = mincxx . . $ min(2a338fce5842aa6a).(nbev, n-2);
514 if (!ncv) ncv = nbev*2 + 1;
515 }
516 ncv = maxcxx . . $ max(2a338fce5842aa6a).(nbev+2, ncv);
517 ncv = mincxx . . $ min(2a338fce5842aa6a).(ncv, n);
518
519 if (!maxit) maxit = 100*nbev;
520
521 const char *serr[10];
522 int err = 0;
523 if (!(nbev < n))
524 serr[err++] = " Number of eigenvalues of OP to be computed nev <= n ";
525
526 if ((driver < 1 || driver > 5) && sym)
527 serr[err++] = " the driver = 1, 2, 3, 4, 5 ";
528 if ((driver < 1 || driver > 4) && !sym)
529 serr[err++] = " the driver = 1, 2, 3, 4 ";
530 // 2 <= NCV-NEV and NCV <= N
531
532 if (!(ncv <= n) && sym)
533 serr[err++] = " ( ncv <= n) (symmetric case) ";
534 if (!((ncv <= n) && 2 <= (ncv-nbev )) && !sym )
535 serr[err++] = " ( ncv <= n) 2 <= (ncv-nev ) (non-symmetric case) ";
536
537 if (n != OP1.Mcxx . . $ RNM_VirtualMatrix#M.)
538 serr[err++] = " the first matrix in EigneValue is not square.";
539 if (n != B.Ncxx . . $ RNM_VirtualMatrix#N.)
540 serr[err++] = "Sorry the row's number of the secand matrix in EigneValue is wrong.";
541 if (n != B.Mcxx . . $ RNM_VirtualMatrix#M.)
542 serr[err++] = "Sorry the column's number of the secand matrix in EigneValue is wrong.";
543
544 if (verbositycxx . . $ verbosity. && mpirankcxx . . $ mpirank. == 0) {
545 if(sym)
546 coutcxx . . $ cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Real symmetric eigenvalue problem: A*x - B*x*lambda" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ endl(345bf97a19cc83a9).;
547 else
548 coutcxx . . $ cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Real non symmetric eigenvalue problem: A*x - B*x*lambda" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ endl(345bf97a19cc83a9).;
549 }
550
551 if (verbositycxx . . $ verbosity. > 9 || err)
552 coutcxx . . $ cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " n " <<cxx . . $ std/basic_ostream#`operator<<`(761e6a6e6922c86). n <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). ", nev "<<cxx . . $ std/basic_ostream#`operator<<`(761e6a6e6922c86). nbev <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). ", tol =" <<cxx . . $ std/basic_ostream#`operator<<`(968942d578224538). tol <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). ", maxit =" <<cxx . . $ std/basic_ostream#`operator<<`(761e6a6e6922c86). maxit
553 <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). ", ncv = " <<cxx . . $ std/basic_ostream#`operator<<`(761e6a6e6922c86).ncv <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). ", driver = " <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). driver <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " which = " <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). which <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ endl(345bf97a19cc83a9).;
554 if (err) {
555 cerrcxx . . $ `src/fflib/throwassert.hpp:33:9`! <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " list of the error " <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ endl(345bf97a19cc83a9).;
556 for (int i = 0; i < err; ++i)
557 cerrcxx . . $ `src/fflib/throwassert.hpp:33:9`! <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n- " <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). serr[i] <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ endl(345bf97a19cc83a9).;
558 ExecErrorcxx . . $ ExecError(8d4ab0a187bf9331).("Fatal Error in EigenValue (real)"cxx . . $ std/__cxx11/basic_string#basic_string(3bc0f77cdfbaa67f).);
559 }
560
561 KNcxx . . $ KN#<Kcxx . . $ EigenValue#K#> workcxx . . $ KN#KN(1624ee8275b10bda).(n);
562 int dmode[] = {-1, 1, 3, 2, 3};
563
564 if (sym) {
565 int ido = 0;
566 //char bmat= mode == 1 ? 'I' : 'G';
567 char bmat = (driver<3)? 'I' : 'G';
568 int mode = dmode[driver];
569 if (mymode > 0 && (mymode != mode)) {
570 cerrcxx . . $ `src/fflib/throwassert.hpp:33:9`! <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " Error mode == " <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). mymode <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " == " <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). mode <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " driver =" <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). driver <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ endl(345bf97a19cc83a9).;
571 ExecErrorcxx . . $ ExecError(8d4ab0a187bf9331).("Wrong mod in Arpack sym"cxx . . $ std/__cxx11/basic_string#basic_string(3bc0f77cdfbaa67f).);
572 }
573
574 // char which[3]= "LM"; // larger value
575 // if(mode >2) which[0] ='S'; // smaller value
576 int ishift = 1; // Auto Shift true by default
577 int iparam[12] = {0, ishift, 0, (int)maxit, 1, (int)nconv, 0, mode, 0, 0, 0, 0};
578 int ipntr[12] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
579 KNcxx . . $ KN#<double> workdcxx . . $ KN#KN(1624ee8275b10bda).(3*n+1);
580 int lworkl = ncv*(ncv+9);
581 KNcxx . . $ KN#<double> worklcxx . . $ KN#KN(1624ee8275b10bda).(lworkl+1);
582 KNcxx . . $ KN#<double> vpcxx . . $ KN#KN(1624ee8275b10bda).(ncv*n+1);
583
584 int info = (residptr !=0);
585 KNcxx . . $ KN#<double> vresidcxx . . $ KN#KN(1624ee8275b10bda).(residptr ? 1 : n);
586 if (!residptr) residptr = &vresid[cxx . . $ KN_#`operator[]`(106a727bdc027555).0];
587
588 while (1) {
589 sauppcxx . . $ saupp(27fe76f7d9265d28).(ido, bmat, n, which, nbev, tol, residptr, ncv, vp, n,
590 iparam, ipntr, workd, workl, lworkl, info);
591 if (verbositycxx . . $ verbosity. > 99)
592 coutcxx . . $ cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " saupp ido: " <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). ido <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " info : " <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). info <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ endl(345bf97a19cc83a9).;
593 if (info < 0) { cerrcxx . . $ `src/fflib/throwassert.hpp:33:9`! <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " -- err arpack info = " <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). info <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ endl(345bf97a19cc83a9).; }
594 sauppErrorcxx . . $ sauppError(d4f767463ce0a6b3).(info);
595
596 if (ido == 99) break;
597
598 KN_cxx . . $ KN_#<double> xxcxx . . $ KN_#KN_(3aadefc30ed88664).(&workd[cxx . . $ KN_#`operator[]`(106a727bdc027555).ipntr[1]], n);
599 KN_cxx . . $ KN_#<double> yycxx . . $ KN_#KN_(3aadefc30ed88664).(&workd[cxx . . $ KN_#`operator[]`(106a727bdc027555).ipntr[2]], n);
600 KN_cxx . . $ KN_#<double> zzcxx . . $ KN_#KN_(3aadefc30ed88664).(&workd[cxx . . $ KN_#`operator[]`(106a727bdc027555).ipntr[3]], n);
601 DoIdoActioncxx . . $ DoIdoAction(1bab2854b46d15d).(ido, bmat, mode, xx, yy, zz, work, OP1, B);
602 }
603
604 nconv = iparam[5];
605 if (nconv == 0) cerrcxx . . $ `src/fflib/throwassert.hpp:33:9`! <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " -- Strange: no eigens values ??? " <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ endl(345bf97a19cc83a9).;
606 // Finding eigenvalues and eigenvectors.
607 if (nconv) {
608 int newdim = nbev;
609 if (nconv > nbev) {
610 cerrcxx . . $ `src/fflib/throwassert.hpp:33:9`! <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "WARNING: nconv(saupp) > nbev: " <<cxx . . $ std/basic_ostream#`operator<<`(761e6a6e6922c86). nconv <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " > " <<cxx . . $ std/basic_ostream#`operator<<`(761e6a6e6922c86). nbev <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ endl(345bf97a19cc83a9).;
611 newdim = nconv;
612 }
613 KNcxx . . $ KN#<double> evrcxx . . $ KN#KN(1624ee8275b10bda).(newdim);
614 KNMcxx . . $ KNM#<double> Zcxx . . $ KNM#KNM(a8896fd0f69df779).(n, newdim);
615 int ldz = n;
616 char HowMny ='A';
617 int rvec = 1;
618
619 seuppcxx . . $ seupp(51e715b702cb09d6).(rvec, HowMny, evr, Z, ldz, sigma, bmat, n,
620 which, nbev, tol, residptr, ncv, vp, n, iparam,ipntr, workd, workl, lworkl, info);
621
622 if (verbositycxx . . $ verbosity. > 5) {
623 coutcxx . . $ cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Dimension of the system : " <<cxx . . $ std/basic_ostream#`operator<<`(761e6a6e6922c86). n <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ endl(345bf97a19cc83a9).;
624 coutcxx . . $ cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Number of 'requested' eigenvalues : " <<cxx . . $ std/basic_ostream#`operator<<`(761e6a6e6922c86). nbev <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ endl(345bf97a19cc83a9).;
625 coutcxx . . $ cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Number of 'converged' eigenvalues : " <<cxx . . $ std/basic_ostream#`operator<<`(761e6a6e6922c86). nconv <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ endl(345bf97a19cc83a9).;
626 coutcxx . . $ cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Number of Arnoldi vectors generated: " <<cxx . . $ std/basic_ostream#`operator<<`(761e6a6e6922c86). ncv <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ endl(345bf97a19cc83a9).;
627 coutcxx . . $ cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Number of iterations taken : " <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). iparam[3] <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ endl(345bf97a19cc83a9).;
628 coutcxx . . $ cout. <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ endl(345bf97a19cc83a9).;
629 nconv = mincxx . . $ min(2a338fce5842aa6a).(nconv, nbev);
630 //if (prob.EigenvaluesFound()) {
631 coutcxx . . $ cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Eigenvalues:" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ endl(345bf97a19cc83a9).;// Add FH feb 2016
632 for (int i = 0; i < nconv; i++) {
633 coutcxx . . $ cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " lambda[" <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). (i+1) <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "]: " <<cxx . . $ std/basic_ostream#`operator<<`(968942d578224538). evr(cxx . . $ KN_#`operator()`(106a727bdc027555).i) <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ endl(345bf97a19cc83a9).;
634 KN_cxx . . $ KN_#<Kcxx . . $ EigenValue#K#> vicxx . . $ KN_#KN_(20dd2e12a3f212fc).(Z(cxx . . $ KNM_#`operator()`(e74df1ebb13df7cd).':', i)) ;
635 if (verbositycxx . . $ verbosity. > 99)
636 coutcxx . . $ cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7)." Eigenvector: :" <<cxx . . $ `operator<<`(59acb43378ac9ebd). vi <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ endl(345bf97a19cc83a9).;
637 }
638 coutcxx . . $ cout. <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ endl(345bf97a19cc83a9).;
639 }
640
641 if (evalue) {
642 KNcxx . . $ KN#<double> & ev(*evalue);
643 int m = Mincxx . . $ Min(cc50c6e2a630e621).(nconv, ev.Ncxx . . $ KN_#N(57a65ae535d7db84).());
644 for (int i = 0; i < m; i++)
645 ev[cxx . . $ KN_#`operator[]`(106a727bdc027555).i] = evr(cxx . . $ KN_#`operator()`(106a727bdc027555).i);
646 }
647 if (rawvector) {
648 int m = Mincxx . . $ Min(cc50c6e2a630e621).(nconv, rawvector->Mcxx . . $ KNM_#M(57a65ae535d7db84).());
649 ffassertcxx . . $ `src/fflib/throwassert.hpp:49:9`!(rawvector->N() == n);
650 for (int i = 0; i < m; i++) {
651 KN_cxx . . $ KN_#<Kcxx . . $ EigenValue#K#> vicxx . . $ KN_#KN_(20dd2e12a3f212fc).(Z(cxx . . $ KNM_#`operator()`(e74df1ebb13df7cd).':', i)) ;
652 // cout << " ------ EV--raw " << vi.min() << " " << vi.max() << endl;
653 (*rawvector)(cxx . . $ KNM_#`operator()`(e74df1ebb13df7cd).':', i) =cxx . . $ KN_#`operator=`(d11fa393e949916). vi;
654 }
655 }
656
657 if (evector) {
658 FEbaseArrayKncxx . . $ FEbaseArrayKn#<Kcxx . . $ EigenValue#K#> & ev(*evector);
659 int m = Mincxx . . $ Min(cc50c6e2a630e621).(nconv, (long)ev.Ncxx . . $ FEbaseArrayKn#N.);
660 for (int i = 0; i < m; i++) {
661 //KN<K> & xx= *(ev(i));
662 //if(xx.pVh->NbDoF != n)
663 //ExecError("Wrong Type size of FEspace to store the eigen vector ");
664 // if (xx.pVh != pOP1->pUh)
665 // ExecError("Wrong Type of FEspace to store the eigen vector ");
666 //xx.Vh = pOP1->Uh;
667 KN_cxx . . $ KN_#<Kcxx . . $ EigenValue#K#> vicxx . . $ KN_#KN_(20dd2e12a3f212fc).(Z(cxx . . $ KNM_#`operator()`(e74df1ebb13df7cd).':', i));
668 ev.setcxx . . $ FEbaseArrayKn#set(d162b5d404c6bf88).(i, vicxx . . $ KN_#KN_(20dd2e12a3f212fc).);
669 }
670 }
671 }
672 } else {
673 // non symmetric case ,
674 // Finding an Arnoldi basis.
675 //int mode = 3; // Shift invert
676 int ido = 0;
677 //char bmat='G';
678 char bmat = (driver<3) ? 'I' : 'G';
679 int mode = dmode[driver];
680
681 if (mymode > 0 && (mymode != mode)) {
682 cerrcxx . . $ `src/fflib/throwassert.hpp:33:9`! <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " Error nonsym mode == " <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). mymode <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " == " <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). mode <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " driver =" <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). driver <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ endl(345bf97a19cc83a9).;
683 ExecErrorcxx . . $ ExecError(8d4ab0a187bf9331).("Wrong mod in Arpack non-sym"cxx . . $ std/__cxx11/basic_string#basic_string(3bc0f77cdfbaa67f).);
684 }
685
686 // char which[] = "LM";
687 int ishift = 1; // Auto Shift true by default
688 int iparam[12] = {0, ishift, 0, (int)maxit, 1, (int)nconv, 0, mode, 0, 0, 0, 0};
689 int ipntr[15] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
690 KNcxx . . $ KN#<double> workdcxx . . $ KN#KN(1624ee8275b10bda).(3*n+1);
691 int lworkl = 3*ncv*(ncv+2);
692 KNcxx . . $ KN#<double> worklcxx . . $ KN#KN(1624ee8275b10bda).(lworkl+1);
693 KNcxx . . $ KN#<double> vpcxx . . $ KN#KN(1624ee8275b10bda).(ncv*n+1);
694 int info = (residptr != 0);
695 KNcxx . . $ KN#<double> vresidcxx . . $ KN#KN(1624ee8275b10bda).(residptr ? 1 : n);
696 if (!residptr) residptr = &vresid[cxx . . $ KN_#`operator[]`(106a727bdc027555).0];
697 if (verbositycxx . . $ verbosity. > 9)
698 coutcxx . . $ cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " n " <<cxx . . $ std/basic_ostream#`operator<<`(761e6a6e6922c86). n <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " nbev "<<cxx . . $ std/basic_ostream#`operator<<`(761e6a6e6922c86). nbev <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " tol =" <<cxx . . $ std/basic_ostream#`operator<<`(968942d578224538). tol <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " maxit =" <<cxx . . $ std/basic_ostream#`operator<<`(761e6a6e6922c86). maxit <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " ncv = " <<cxx . . $ std/basic_ostream#`operator<<`(761e6a6e6922c86). ncv <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ endl(345bf97a19cc83a9).;
699
700 while (1) {
701 nauppcxx . . $ naupp(27fe76f7d9265d28).(ido, bmat, n, which, nbev, tol, residptr, ncv, vp, n,
702 iparam, ipntr, workd, workl, lworkl, info);
703 if (verbositycxx . . $ verbosity. > 99) { coutcxx . . $ cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " naupp ido: " <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). ido <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " info : " <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). info <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ endl(345bf97a19cc83a9).; }
704 if (info < 0) { cerrcxx . . $ `src/fflib/throwassert.hpp:33:9`! <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " -- err arpack info = " <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). info <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ endl(345bf97a19cc83a9).; }
705 sauppErrorcxx . . $ sauppError(d4f767463ce0a6b3).(info);
706 if (ido == 99) break;
707 KN_cxx . . $ KN_#<double> xxcxx . . $ KN_#KN_(3aadefc30ed88664).(&workd[cxx . . $ KN_#`operator[]`(106a727bdc027555).ipntr[1]], n);
708 KN_cxx . . $ KN_#<double> yycxx . . $ KN_#KN_(3aadefc30ed88664).(&workd[cxx . . $ KN_#`operator[]`(106a727bdc027555).ipntr[2]], n);
709 KN_cxx . . $ KN_#<double> zzcxx . . $ KN_#KN_(3aadefc30ed88664).(&workd[cxx . . $ KN_#`operator[]`(106a727bdc027555).ipntr[3]], n);
710 DoIdoActioncxx . . $ DoIdoAction(1bab2854b46d15d).(ido, bmat, mode, xx, yy, zz, work, OP1, B);
711 }
712
713 nconv = iparam[5];
714 if (nconv) {
715 int newdim = nbev;
716 if (nconv > nbev) {
717 cerrcxx . . $ `src/fflib/throwassert.hpp:33:9`! <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "WARNING: nconv(naupp) > nbev: " <<cxx . . $ std/basic_ostream#`operator<<`(761e6a6e6922c86). nconv <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " > " <<cxx . . $ std/basic_ostream#`operator<<`(761e6a6e6922c86). nbev <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ endl(345bf97a19cc83a9).;
718 newdim = nconv;
719 }
720 KNcxx . . $ KN#<double> evrcxx . . $ KN#KN(1624ee8275b10bda).(newdim+1), evicxx . . $ KN#KN(1624ee8275b10bda).(newdim+1);
721 KNMcxx . . $ KNM#<double> Zcxx . . $ KNM#KNM(a8896fd0f69df779).(n, newdim+1);
722 KNcxx . . $ KN#<double> workevcxx . . $ KN#KN(1624ee8275b10bda).(3*ncv);
723 int ldz = n;
724 char HowMny = 'A';
725 int rvec = 1;
726 double sigmai = 0;
727 neuppcxx . . $ neupp(b538c5558a611c18).(rvec, HowMny, evr,evi, Z , ldz, sigma, sigmai, workev,
728 bmat, n, which, nbev, tol, residptr, ncv,
729 vp, n, iparam, ipntr, workd, workl, lworkl, info);
730
731 if (verbositycxx . . $ verbosity.) {
732 coutcxx . . $ cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Real non-symmetric eigenvalue problem: A*x - B*x*lambda" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ endl(345bf97a19cc83a9).;
733 coutcxx . . $ cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "mode " <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). mode <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " sigma=" <<cxx . . $ std/basic_ostream#`operator<<`(968942d578224538). sigma <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ endl(345bf97a19cc83a9). <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ endl(345bf97a19cc83a9).;
734
735 coutcxx . . $ cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Dimension of the system : " <<cxx . . $ std/basic_ostream#`operator<<`(761e6a6e6922c86). n <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ endl(345bf97a19cc83a9).;
736 coutcxx . . $ cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Number of 'requested' eigenvalues : " <<cxx . . $ std/basic_ostream#`operator<<`(761e6a6e6922c86). nbev <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ endl(345bf97a19cc83a9).;
737 coutcxx . . $ cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Number of 'converged' eigenvalues : " <<cxx . . $ std/basic_ostream#`operator<<`(761e6a6e6922c86). nconv <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ endl(345bf97a19cc83a9).;
738 coutcxx . . $ cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Number of Arnoldi vectors generated: " <<cxx . . $ std/basic_ostream#`operator<<`(761e6a6e6922c86). ncv <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ endl(345bf97a19cc83a9).;
739 coutcxx . . $ cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Number of iterations taken : " <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). iparam[3] <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ endl(345bf97a19cc83a9).;
740 coutcxx . . $ cout. <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ endl(345bf97a19cc83a9).;
741 nconv = mincxx . . $ min(2a338fce5842aa6a).(nconv, nbev);// Add FH feb 2016
742
743 coutcxx . . $ cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Eigenvalues:" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ endl(345bf97a19cc83a9).;
744 for (int i = 0; i < nconv; i++) {
745 coutcxx . . $ cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " lambda[" <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). (i+1) <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "]: ";
746 ioscxx . . $ std/ios#::fmtflagscxx . . $ std/ios_base#fmtflags# oldflag = coutcxx . . $ cout..flagscxx . . $ std/ios_base#flags(ce39a176cc3dc355).();
747 coutcxx . . $ cout..setfcxx . . $ std/ios_base#setf(79f645757f7c3f1c).(ioscxx . . $ std/ios#::showposcxx . . $ std/ios_base#showpos.);
748 coutcxx . . $ cout. <<cxx . . $ std/basic_ostream#`operator<<`(968942d578224538). evr(cxx . . $ KN_#`operator()`(106a727bdc027555).i) <<cxx . . $ std/basic_ostream#`operator<<`(968942d578224538). evi(cxx . . $ KN_#`operator()`(106a727bdc027555).i) <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "i" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ endl(345bf97a19cc83a9).;
749 coutcxx . . $ cout..flagscxx . . $ std/ios_base#flags(79f645757f7c3f1c).(oldflag); // restore flags
750 KN_cxx . . $ KN_#<double> vicxx . . $ KN_#KN_(20dd2e12a3f212fc).(Z(cxx . . $ KNM_#`operator()`(e74df1ebb13df7cd).':', i));
751 if (verbositycxx . . $ verbosity. > 99) {
752 coutcxx . . $ cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " Eigenvector: " <<cxx . . $ `operator<<`(59acb43378ac9ebd). vi <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ endl(345bf97a19cc83a9).;
753 coutcxx . . $ cout. <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ endl(345bf97a19cc83a9).;
754 }
755 }
756 }
757
758 if (evalue) {
759 KNcxx . . $ KN#<double> &ev(*evalue);
760 int m = Mincxx . . $ Min(cc50c6e2a630e621).(nconv, ev.Ncxx . . $ KN_#N(57a65ae535d7db84).());
761 for (int i = 0; i < m; i++)
762 ev[cxx . . $ KN_#`operator[]`(106a727bdc027555).i] = evr(cxx . . $ KN_#`operator()`(106a727bdc027555).i);
763 }
764
765 if (evaluei) {
766 KNcxx . . $ KN#<double> &ev(*evaluei);
767 int m = Mincxx . . $ Min(cc50c6e2a630e621).(nconv, ev.Ncxx . . $ KN_#N(57a65ae535d7db84).());
768 for (int i = 0; i < m; i++)
769 ev[cxx . . $ KN_#`operator[]`(106a727bdc027555).i] = evi(cxx . . $ KN_#`operator()`(106a727bdc027555).i);
770 }
771
772 if (rawvector) {
773 //K* rawev(prob.RawEigenvectors());
774 int m = Mincxx . . $ Min(cc50c6e2a630e621).(nconv, rawvector->Mcxx . . $ KNM_#M(57a65ae535d7db84).());
775 ffassertcxx . . $ `src/fflib/throwassert.hpp:49:9`!(rawvector->N() == n);
776 for (int i = 0; i < m; i++) {
777 //int k = i;
778 KN_cxx . . $ KN_#<Kcxx . . $ EigenValue#K#> vicxx . . $ KN_#KN_(20dd2e12a3f212fc).(Z(cxx . . $ KNM_#`operator()`(e74df1ebb13df7cd).':', i));
779 if (verbositycxx . . $ verbosity. > 2 && mpirankcxx . . $ mpirank. ==0)
780 coutcxx . . $ cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " ------ EV--raw " <<cxx . . $ std/basic_ostream#`operator<<`(968942d578224538). vi.mincxx . . $ KN_#min(8f5363d873dd4781).() <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " " <<cxx . . $ std/basic_ostream#`operator<<`(968942d578224538). vi.maxcxx . . $ KN_#max(8f5363d873dd4781).() <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ endl(345bf97a19cc83a9).;
781 (*rawvector)(cxx . . $ KNM_#`operator()`(e74df1ebb13df7cd).':', i) =cxx . . $ KN_#`operator=`(d11fa393e949916). vi;
782 }
783 }
784
785 if (evector) {
786 // K* rawev(prob.RawEigenvectors());
787 // rawev + n*k is
788 // iev = prob.EigenvalueImag(k)
789 // iev==0 => the eigen vector
790 // iev> 0 => real
791 // start real : rawev + n*k
792 // start imag : ramev +n*(k+1)
793 // iev < 0 => complex
794 // start real : rawev + n*(k-1)
795 // -start imag : ramev +n*(k)
796 FEbaseArrayKncxx . . $ FEbaseArrayKn#<Kcxx . . $ EigenValue#K#> &ev(*evector);
797 int m = Mincxx . . $ Min(cc50c6e2a630e621).(nconv, (long)ev.Ncxx . . $ FEbaseArrayKn#N.);
798 for (int i = 0; i < m; i++) {
799 // K ev_i=
800 //prob.EigenvalueImag(i);
801 //KN<K> & xx= *(ev[i]);
802 // if (xx.pVh != pOP1->pUh)
803 // ExecError("Wrong Type of FEspace to store the eigen vector ");
804 // xx.Vh = pOP1->Uh;
805 // int k=(ev_i < 0) ? i-1 : i;
806 //int k=i;
807 KN_cxx . . $ KN_#<Kcxx . . $ EigenValue#K#> vicxx . . $ KN_#KN_(20dd2e12a3f212fc).(Z(cxx . . $ KNM_#`operator()`(e74df1ebb13df7cd).':', i));//rawev+n*k,n) ;
808 //xx= new KN<K>(vi);
809 ev.setcxx . . $ FEbaseArrayKn#set(d162b5d404c6bf88).(i, vicxx . . $ KN_#KN_(20dd2e12a3f212fc).);//new KN<K>(vi));
810 }
811 }
812 }
813 }
814 if(pcOP) delete pcOP;
815 if(pcB) delete pcB;
816
817 return (cxx . . $ AnyTypeWithOutCheck#AnyTypeWithOutCheck(1624ee8275b10bda).long)nconv;
818 }
819
820 AnyTypecxx . . $ AnyType# EigenValueCcxx . . $ EigenValueC#::E_EVcxx . . $ EigenValueC#E_EV#::operatorcxx . . $ EigenValueC#E_EV#`operator()`(29b3b217a13aa28b). () (Stackcxx . . $ Stack# stack) const {
821 ddddcxx . . $ dddd. = (verbositycxx . . $ verbosity. >= 200);
822 double tol = 1e-6;
823 long nconv = 0;
824 long nbev = 1;
825 long ncv = 0; // the number of Arnoldi vectors generated
826 long maxit = 0; // the maximum number of Arnoldi iterations
827 long driver = 4;
828 Kcxx . . $ EigenValueC#K# sigmacxx . . $ std/complex#complex(98ba57bc733a049). = 0cxx . . $ std/complex#complex(bc12c9ec15586e6a).;
829 KNcxx . . $ KN#<Kcxx . . $ EigenValueC#K#> *evalue = 0;
830 KNcxx . . $ KN#<Kcxx . . $ EigenValueC#K#> *resid = 0;
831 KNMcxx . . $ KNM#<Kcxx . . $ EigenValueC#K#> *rawvector = 0;
832
833 // pfecarray evector2;
834 FEbaseArrayKncxx . . $ FEbaseArrayKn#<Complexcxx . . $ Complex#> *evector = 0;
835 tol = argcxx . . $ EigenValueC#E_EV#arg(a14a6e1927d78e40).<double>(0, stack, 0);
836 nbev = argcxx . . $ EigenValueC#E_EV#arg(a14a6e1927d78e40).<long>(1, stack, 10);
837 sigma =cxx . . $ std/complex#`operator=`(3191d50049a1229). argcxx . . $ EigenValueC#E_EV#arg(a14a6e1927d78e40).<Kcxx . . $ EigenValueC#K#>(2, stack, 0.0cxx . . $ std/complex#complex(bc12c9ec15586e6a).);
838 evalue = argcxx . . $ EigenValueC#E_EV#arg(a14a6e1927d78e40).<KNcxx . . $ KN#<Kcxx . . $ EigenValueC#K#>*>(3, stack, 0);
839 // evector2 =arg<pfecarray>(4,stack,make_pair<pfecbasearray,int>(0,0));
840 evector = argcxx . . $ EigenValueC#E_EV#arg(a14a6e1927d78e40).<FEbaseArrayKncxx . . $ FEbaseArrayKn#<Complexcxx . . $ Complex#>*>(4, stack, 0);
841 ncv = argcxx . . $ EigenValueC#E_EV#arg(a14a6e1927d78e40).<long>(5, stack, 0);
842 maxit = argcxx . . $ EigenValueC#E_EV#arg(a14a6e1927d78e40).<long>(6, stack, 0);
843 rawvector = argcxx . . $ EigenValueC#E_EV#arg(a14a6e1927d78e40).<KNMcxx . . $ KNM#<Kcxx . . $ EigenValueC#K#>*>(7, stack, 0);
844 resid = argcxx . . $ EigenValueC#E_EV#arg(a14a6e1927d78e40).<KNcxx . . $ KN#<Kcxx . . $ EigenValueC#K#>*>(8, stack, 0);
845 int mymode = argcxx . . $ EigenValueC#E_EV#arg(a14a6e1927d78e40).<long>(15, stack, -1);
846 driver = argcxx . . $ EigenValueC#E_EV#arg(a14a6e1927d78e40).<long>(9, stack, mymode==2 ? 3 : 4);
847 Kcxx . . $ EigenValueC#K# *residptr = resid ? (Kcxx . . $ EigenValueC#K#*)*resid : 0;
848 char which[3];
849 ToWhichcxx . . $ ToWhich(d9072312faeff126).(stack, which, nargscxx . . $ EigenValueC#E_EV#nargs.[10]);
850
851 //evector=evector2.first;
852 ffassertcxx . . $ `src/fflib/throwassert.hpp:49:9`!(driver > 0 && driver < 5);
853 // Matrice_Creuse<K> *pOP1 = GetAny<Matrice_Creuse<K> *>((*expOP1)(stack));
854 // Matrice_Creuse<K> *pB = GetAny<Matrice_Creuse<K> *>((*expB)(stack));
855
856 if (evalue) nbev = Maxcxx . . $ Max(cc50c6e2a630e621).((long)evalue->Ncxx . . $ KN_#N(57a65ae535d7db84).(), nbev);
857 if (!maxit) maxit = 100*nbev;
858
859 //const MatriceCreuse<K> & OP1 = pOP1->A;
860 //const MatriceCreuse<K> & B = pB->A;
861
862 //long n=OP1.n;
863
864 Matrice_Creusecxx . . $ Matrice_Creuse#<Kcxx . . $ EigenValueC#K#> *pOP1 = 0, *pB = 0;
865 if (expOP1cxx . . $ EigenValueC#E_EV#expOP1.)
866 pOP1 = GetAnycxx . . $ GetAny(4ae00c582f151d1b).<Matrice_Creusecxx . . $ Matrice_Creuse#<Kcxx . . $ EigenValueC#K#>*>((*expOP1cxx . . $ EigenValueC#E_EV#expOP1.)(cxx . . $ E_F0#`operator()`(29b3b217a13aa28b).stack));
867 if (expBcxx . . $ EigenValueC#E_EV#expB.)
868 pB = GetAnycxx . . $ GetAny(4ae00c582f151d1b).<Matrice_Creusecxx . . $ Matrice_Creuse#<Kcxx . . $ EigenValueC#K#>*>((*expBcxx . . $ EigenValueC#E_EV#expB.)(cxx . . $ E_F0#`operator()`(29b3b217a13aa28b).stack));
869 // double * residptr=resid? (double*) *resid : 0;
870 // cout << " residptr = " << residptr <<endl;
871 long n = 0;
872 if (pOP1)
873 n = pOP1->Acxx . . $ Matrice_Creuse#A.->cxx . . $ CountPointer#`operator->`(5a2a78a048fb49a8).ncxx . . $ VirtualMatrix#n.;
874 else {
875 ffassertcxx . . $ `src/fflib/throwassert.hpp:49:9`!(expn);
876 n = GetAnycxx . . $ GetAny(4ae00c582f151d1b).<long>((*expncxx . . $ EigenValueC#E_EV#expn.)(cxx . . $ E_F0#`operator()`(29b3b217a13aa28b).stack));
877 }
878
879
880 const RNM_VirtualMatrixcxx . . $ RNM_VirtualMatrix#<Kcxx . . $ EigenValueC#K#> *ptOP1, *ptB;
881 if (pOP1)
882 ptOP1 = &(const RNM_VirtualMatrixcxx . . $ RNM_VirtualMatrix#<Kcxx . . $ EigenValueC#K#>&)(pOP1->Acxx . . $ Matrice_Creuse#A.);
883 if (pB)
884 ptB = &(const RNM_VirtualMatrixcxx . . $ RNM_VirtualMatrix#<Kcxx . . $ EigenValueC#K#>&)(pB->Acxx . . $ Matrice_Creuse#A.);
885 FuncMatcxx . . $ FuncMat#<Kcxx . . $ EigenValueC#K#> *pcOP1 = 0, *pcB = 0;
886 if (codeOP1cxx . . $ EigenValueC#E_EV#codeOP1. || codeOPcxx . . $ EigenValueC#E_EV#codeOP.)
887 ptOP1 = pcOP1 = new FuncMatcxx . . $ FuncMat#<Kcxx . . $ EigenValueC#K#>(n, stack, codeOPcxx . . $ EigenValueC#E_EV#codeOP., codeOP1cxx . . $ EigenValueC#E_EV#codeOP1.);
888 if (codeBcxx . . $ EigenValueC#E_EV#codeB. || codeB1cxx . . $ EigenValueC#E_EV#codeB1.)
889 ptB = pcB = new FuncMatcxx . . $ FuncMat#<Kcxx . . $ EigenValueC#K#>(n, stack, codeBcxx . . $ EigenValueC#E_EV#codeB., codeB1cxx . . $ EigenValueC#E_EV#codeB1.);
890 MatriceIdentitecxx . . $ MatriceIdentite#<Kcxx . . $ EigenValueC#K#> Idcxx . . $ MatriceIdentite#MatriceIdentite(d4f767463ce0a6b3).(n);
891
892 if (!ptB) ptB = &Id;
893 const RNM_VirtualMatrixcxx . . $ RNM_VirtualMatrix#<Kcxx . . $ EigenValueC#K#> &OP1 = *ptOP1, &B = *ptB;
894
895 nbev = mincxx . . $ min(2a338fce5842aa6a).(nbev, n-2);
896 if (!ncv) ncv = nbev*2+1;
897 ncv = maxcxx . . $ max(2a338fce5842aa6a).(nbev+2, ncv);
898 ncv = mincxx . . $ min(2a338fce5842aa6a).(ncv, n);
899 const char *serr[10];
900 int err = 0;
901 if (nbev >= n-1)
902 serr[err++] = " Number of eigenvalues of OP to be computed <= n-2 ";
903 if (driver < 1 || driver > 4)
904 serr[err++] = " the driver = 1 ,2 ,4 ";
905 // 2 <= NCV-NEV and NCV <= N
906 if (!(2 <= nbev && ncv <= n))
907 serr[err++] = " ( 2 <= nbev && nvc <= n) ";
908 if (n != OP1.Ncxx . . $ RNM_VirtualMatrix#N.)
909 serr[err++] = " the first matrix in EigneValue is not Hermitien.";
910 if (n != B.Ncxx . . $ RNM_VirtualMatrix#N.)
911 serr[err++] = "Sorry the row's number of the secand matrix in EigneValue is wrong.";
912 if (n != B.Mcxx . . $ RNM_VirtualMatrix#M.)
913 serr[err++] = "Sorry the column's number of the secand matrix in EigneValue is wrong.";
914 if (verbositycxx . . $ verbosity.)
915 coutcxx . . $ cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Complex eigenvalue problem: A*x - B*x*lambda" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ endl(345bf97a19cc83a9).;
916 if (verbositycxx . . $ verbosity. > 9 || err)
917 coutcxx . . $ cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " n " <<cxx . . $ std/basic_ostream#`operator<<`(761e6a6e6922c86). n <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " nev "<<cxx . . $ std/basic_ostream#`operator<<`(761e6a6e6922c86). nbev <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " tol = " <<cxx . . $ std/basic_ostream#`operator<<`(968942d578224538). tol <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " maxit = " <<cxx . . $ std/basic_ostream#`operator<<`(761e6a6e6922c86). maxit <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " ncv = " <<cxx . . $ std/basic_ostream#`operator<<`(761e6a6e6922c86). ncv
918 <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " driver = " <<cxx . . $ std/basic_ostream#`operator<<`(761e6a6e6922c86). driver <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " which = " <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). which <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ endl(345bf97a19cc83a9).;
919 if (err) {
920 cerrcxx . . $ `src/fflib/throwassert.hpp:33:9`! <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " list of the error " <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ endl(345bf97a19cc83a9).;
921 for (int i = 0; i < err; ++i)
922 cerrcxx . . $ `src/fflib/throwassert.hpp:33:9`! <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "\n- " <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). serr[i] <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ endl(345bf97a19cc83a9).;
923 ExecErrorcxx . . $ ExecError(8d4ab0a187bf9331).("Fatal Error in EigenValue (complex)"cxx . . $ std/__cxx11/basic_string#basic_string(3bc0f77cdfbaa67f).);
924 }
925
926 KNcxx . . $ KN#<Kcxx . . $ EigenValueC#K#> workcxx . . $ KN#KN(1624ee8275b10bda).(n);
927 // ARrcSymGenEig is a class that requires the user to provide a
928 // way to perform the matrix-vector products w = OP*Bv =
929 // inv(A-sigma*B)*B*v and w = B*v, where sigma is the adopted shift.
930 // OP1 = (A-sigma*B)
931 // OP = inv(OP)
932 /*
933 ffassert(0);
934
935
936 ARrcCompGenEig<R> prob( n, nbev, sigma,"LM",ncv,tol,maxit,residptr);
937
938
939 // OP = inv[A - sigma*I]
940
941
942 // Finding an Arnoldi basis.
943
944 while (!prob.ArnoldiBasisFound()) {
945
946 // Calling ARPACK FORTRAN code. Almost all work needed to
947
948 prob.TakeStep();
949 */
950
951 // cas non symetrique ,
952 // Finding an Arnoldi basis.\
953
954 // int mode=3; // Shift invert \
955
956 int ido = 0;
957 //char bmat='G';
958 int dmode[] = {-1, 1, 3, 2, 3};
959 char bmat = (driver<3) ? 'I' : 'G';
960 int mode = dmode[driver];
961 // char which[]="LM";
962 int ishift = 1; // Auto Shift true by default
963 if (mymode > 0 && (mymode != mode)) {
964 cerrcxx . . $ `src/fflib/throwassert.hpp:33:9`! <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " Error complex case: mode == " <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). mymode <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " == " <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). mode <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " driver = " <<cxx . . $ std/basic_ostream#`operator<<`(761e6a6e6922c86). driver <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ endl(345bf97a19cc83a9).;
965 ExecErrorcxx . . $ ExecError(8d4ab0a187bf9331).("Wrong mod in Arpack complex case:"cxx . . $ std/__cxx11/basic_string#basic_string(3bc0f77cdfbaa67f).);
966 }
967
968 int iparam[12] = {0, ishift, 0, (int)maxit, 1, (int)nconv, 0, (int)mode, 0, 0, 0, 0};
969 int ipntr[15] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
970 KNcxx . . $ KN#<Kcxx . . $ EigenValueC#K#> workdcxx . . $ KN#KN(1624ee8275b10bda).(3*n+1);
971 int lworkl = 3*ncv*ncv + 5*ncv;
972 KNcxx . . $ KN#<Kcxx . . $ EigenValueC#K#> worklcxx . . $ KN#KN(1624ee8275b10bda).(lworkl+1);
973 KNcxx . . $ KN#<Kcxx . . $ EigenValueC#K#> vpcxx . . $ KN#KN(1624ee8275b10bda).(ncv*n+1);
974 int info = (residptr != 0);
975 KNcxx . . $ KN#<double> rworkcxx . . $ KN#KN(1624ee8275b10bda).(ncv+1);
976 KNcxx . . $ KN#<Kcxx . . $ EigenValueC#K#> vresidcxx . . $ KN#KN(1624ee8275b10bda).(residptr ? 1 : n);
977 if (!residptr) residptr = &vresid[cxx . . $ KN_#`operator[]`(106a727bdc027555).0];
978
979 while(1) {
980 cauppcxx . . $ caupp(f3065c544f440f10).(ido, bmat, n, which, nbev,
981 tol, residptr, ncv,
982 vp, n, iparam, ipntr, workd, workl,
983 lworkl, rwork, info);
984
985 if (verbositycxx . . $ verbosity. > 99) { coutcxx . . $ cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " caupp ido: " <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). ido <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " info : " <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). info <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ endl(345bf97a19cc83a9).; }
986 if (info < 0) { cerrcxx . . $ `src/fflib/throwassert.hpp:33:9`! <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " -- err arpack info = " <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). info <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ endl(345bf97a19cc83a9).; }
987 sauppErrorcxx . . $ sauppError(d4f767463ce0a6b3).(info);
988
989 if (ido == 99) break;
990
991 KN_cxx . . $ KN_#<Kcxx . . $ EigenValueC#K#> xxcxx . . $ KN_#KN_(3aadefc30ed88664).(&workd[cxx . . $ KN_#`operator[]`(106a727bdc027555).ipntr[1]], n);
992 KN_cxx . . $ KN_#<Kcxx . . $ EigenValueC#K#> yycxx . . $ KN_#KN_(3aadefc30ed88664).(&workd[cxx . . $ KN_#`operator[]`(106a727bdc027555).ipntr[2]], n);
993 KN_cxx . . $ KN_#<Kcxx . . $ EigenValueC#K#> zzcxx . . $ KN_#KN_(3aadefc30ed88664).(&workd[cxx . . $ KN_#`operator[]`(106a727bdc027555).ipntr[3]], n);
994
995 DoIdoActioncxx . . $ DoIdoAction(1bab2854b46d15d).(ido, bmat, mode, xx, yy, zz, work, OP1, B);
996 }
997
998 nconv = iparam[5];
999 if (nconv) {
1000 int newdim = nbev;
1001 if (nconv > nbev) {
1002 cerrcxx . . $ `src/fflib/throwassert.hpp:33:9`! <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "WARNING: nconv(caupp) > nbev: " <<cxx . . $ std/basic_ostream#`operator<<`(761e6a6e6922c86). nconv <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " > " <<cxx . . $ std/basic_ostream#`operator<<`(761e6a6e6922c86). nbev <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ endl(345bf97a19cc83a9).;
1003 newdim = nconv;
1004 }
1005 KNcxx . . $ KN#<Kcxx . . $ EigenValueC#K#> evccxx . . $ KN#KN(1624ee8275b10bda).(newdim);
1006 KNMcxx . . $ KNM#<Kcxx . . $ EigenValueC#K#> Zcxx . . $ KNM#KNM(a8896fd0f69df779).(n, newdim);
1007 KNcxx . . $ KN#<Kcxx . . $ EigenValueC#K#> workevcxx . . $ KN#KN(1624ee8275b10bda).(3*ncv);
1008 //int ldz=n;
1009 char HowMny ='A';
1010 int rvec = 1;
1011 ceuppcxx . . $ ceupp(d8975355feccf290).(rvec, HowMny, evc, Z, n, sigmacxx . . $ std/complex#complex(98ba57bc733a049)., workev, bmat, n, which,
1012 nbev, tol, residptr, ncv,
1013 vp, n, iparam, ipntr, workd, workl, lworkl, rwork, info);
1014
1015 if (verbositycxx . . $ verbosity.) {
1016 coutcxx . . $ cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Complex eigenvalue problem: A*x - B*x*lambda" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ endl(345bf97a19cc83a9).;
1017 coutcxx . . $ cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "driver = " <<cxx . . $ std/basic_ostream#`operator<<`(761e6a6e6922c86). driver <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " - sigma= " <<cxx . . $ std/`operator<<`(28af0d25a80608b4). sigma <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ endl(345bf97a19cc83a9). <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ endl(345bf97a19cc83a9).;
1018
1019 coutcxx . . $ cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Dimension of the system : " <<cxx . . $ std/basic_ostream#`operator<<`(761e6a6e6922c86). n <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ endl(345bf97a19cc83a9).;
1020 coutcxx . . $ cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Number of 'requested' eigenvalues : " <<cxx . . $ std/basic_ostream#`operator<<`(761e6a6e6922c86). nbev <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ endl(345bf97a19cc83a9).;
1021 coutcxx . . $ cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Number of 'converged' eigenvalues : " <<cxx . . $ std/basic_ostream#`operator<<`(761e6a6e6922c86). nconv <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ endl(345bf97a19cc83a9).;
1022 coutcxx . . $ cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Number of Arnoldi vectors generated: " <<cxx . . $ std/basic_ostream#`operator<<`(761e6a6e6922c86). ncv <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ endl(345bf97a19cc83a9).;
1023 coutcxx . . $ cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Number of iterations taken : " <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). iparam[3] <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ endl(345bf97a19cc83a9).;
1024 coutcxx . . $ cout. <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ endl(345bf97a19cc83a9).;
1025 nconv = mincxx . . $ min(2a338fce5842aa6a).(nconv, nbev);
1026 coutcxx . . $ cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "Eigenvalues:" <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ endl(345bf97a19cc83a9).;// Add FH feb 2016
1027 for (int i = 0; i < nconv; i++) {
1028 coutcxx . . $ cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " lambda[" <<cxx . . $ std/basic_ostream#`operator<<`(23b6575433a77e57). (i+1) <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "]: " <<cxx . . $ std/`operator<<`(28af0d25a80608b4). evc(cxx . . $ KN_#`operator()`(106a727bdc027555).i) <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ endl(345bf97a19cc83a9).;
1029 KN_cxx . . $ KN_#<Kcxx . . $ EigenValueC#K#> vicxx . . $ KN_#KN_(20dd2e12a3f212fc).(Z(cxx . . $ KNM_#`operator()`(e74df1ebb13df7cd).':', i)) ;
1030 if (verbositycxx . . $ verbosity. > 99)
1031 coutcxx . . $ cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7)." Eigenvector: :" <<cxx . . $ `operator<<`(59acb43378ac9ebd). vi <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ endl(345bf97a19cc83a9).;
1032 }
1033 coutcxx . . $ cout. <<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ endl(345bf97a19cc83a9).;
1034 }
1035
1036 if (evalue) {
1037 KNcxx . . $ KN#<Kcxx . . $ EigenValueC#K#> & ev(*evalue);
1038 int m = Mincxx . . $ Min(cc50c6e2a630e621).(nconv, ev.Ncxx . . $ KN_#N(57a65ae535d7db84).());
1039 for (int i = 0; i < m; i++)
1040 ev[cxx . . $ KN_#`operator[]`(106a727bdc027555).i] =cxx . . $ std/complex#`operator=`(3191d50049a1229). evc(cxx . . $ KN_#`operator()`(106a727bdc027555).i);
1041 }
1042 if (evector) {
1043 //FEbaseArray<K,v_fes> & ev(*evector);
1044 FEbaseArrayKncxx . . $ FEbaseArrayKn#<Kcxx . . $ EigenValueC#K#> &ev(*evector);
1045 int m = Mincxx . . $ Min(cc50c6e2a630e621).(nconv, (long)ev.Ncxx . . $ FEbaseArrayKn#N.);
1046 for (int i = 0; i < m; i++) {
1047 //FEbase<K,v_fes> & xx= **(ev[i]);
1048 //KN_<K> vi(Z(':',i)) ;
1049 //xx= new KN<K>(vi);
1050 ev.setcxx . . $ FEbaseArrayKn#set(d162b5d404c6bf88).(i, Zcxx . . $ KN_#KN_(20dd2e12a3f212fc).(cxx . . $ KNM_#`operator()`(e74df1ebb13df7cd).':', i));
1051 }
1052 }
1053 if(rawvector) {
1054 int m = Mincxx . . $ Min(cc50c6e2a630e621).(nconv, rawvector->Mcxx . . $ KNM_#M(57a65ae535d7db84).());
1055 ffassertcxx . . $ `src/fflib/throwassert.hpp:49:9`!(rawvector->N() == n);
1056 for (int i = 0; i < m; i++) {
1057 KN_cxx . . $ KN_#<Kcxx . . $ EigenValueC#K#> vicxx . . $ KN_#KN_(20dd2e12a3f212fc).(Z(cxx . . $ KNM_#`operator()`(e74df1ebb13df7cd).':', i)) ;
1058 (*rawvector)(cxx . . $ KNM_#`operator()`(e74df1ebb13df7cd).':', i) =cxx . . $ KN_#`operator=`(d11fa393e949916). vi;
1059 if (verbositycxx . . $ verbosity. > 2 && mpirankcxx . . $ mpirank. == 0)
1060 coutcxx . . $ cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " raw " <<cxx . . $ std/basic_ostream#`operator<<`(968942d578224538). vi.l2cxx . . $ KN_#l2(21b6c25e127938e2).() <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). " == " <<cxx . . $ std/basic_ostream#`operator<<`(968942d578224538). (*rawvector)(cxx . . $ KNM_#`operator()`(e74df1ebb13df7cd).':', i).l2cxx . . $ KN_#l2(21b6c25e127938e2).()<<cxx . . $ std/basic_ostream#`operator<<`(f46f7e25851d787a). endlcxx . . $ endl(345bf97a19cc83a9).;
1061 }
1062 }
1063 }
1064
1065 return (cxx . . $ AnyTypeWithOutCheck#AnyTypeWithOutCheck(1624ee8275b10bda).long)nconv;
1066 }
1067
1068 #ifndef DYNM_LOAD
1069 void init_eigenvaluecxx . . $ init_eigenvalue(49f6e7a06ebc5aa8). () {
1070 if (verbositycxx . . $ verbosity. && (mpirankcxx . . $ mpirank. == 0)) coutcxx . . $ cout. <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "eigenvalue ";
1071 Globalcxx . . $ Global..Addcxx . . $ TableOfIdentifier#Add(4c37bf6e5ab65edf).("EigenValue", "(", new EigenValuecxx . . $ EigenValue#()); // j + dJ
1072 Globalcxx . . $ Global..Addcxx . . $ TableOfIdentifier#Add(4c37bf6e5ab65edf).("EigenValue", "(", new EigenValueCcxx . . $ EigenValueC#()); // j + dJ
1073 Globalcxx . . $ Global..Addcxx . . $ TableOfIdentifier#Add(4c37bf6e5ab65edf).("EigenValue", "(", new EigenValuecxx . . $ EigenValue#(1)); // j + dJ
1074 Globalcxx . . $ Global..Addcxx . . $ TableOfIdentifier#Add(4c37bf6e5ab65edf).("EigenValue", "(", new EigenValuecxx . . $ EigenValue#(1, 1)); // j + dJ
1075 Globalcxx . . $ Global..Addcxx . . $ TableOfIdentifier#Add(4c37bf6e5ab65edf).("EigenValue", "(", new EigenValuecxx . . $ EigenValue#(1, 1, 1)); // A=, B=
1076 // sorry no to solve ambiguity => change of name
1077 Globalcxx . . $ Global..Addcxx . . $ TableOfIdentifier#Add(4c37bf6e5ab65edf).("complexEigenValue", "(", new EigenValueCcxx . . $ EigenValueC#(1)); // j + dJ
1078 Globalcxx . . $ Global..Addcxx . . $ TableOfIdentifier#Add(4c37bf6e5ab65edf).("complexEigenValue", "(", new EigenValueCcxx . . $ EigenValueC#(1, 1)); // j + dJ
1079 Globalcxx . . $ Global..Addcxx . . $ TableOfIdentifier#Add(4c37bf6e5ab65edf).("complexEigenValue", "(", new EigenValueCcxx . . $ EigenValueC#(1, 1, 1)); // A=, B= ...
1080 }
1081 #else
1082 class Init {
1083 public:
1084 Init() {
1085 if (verbosity && (mpirank == 0)) cout << "eigenvalue ";
1086 Global.Add("EigenValue2", "(", new EigenValue()); // j + dJ
1087 Global.Add("EigenValue2", "(", new EigenValueC(1)); // j + dJ
1088 }
1089 };
1090 Init init;
1091 #endif