1 /*
2    ARPACK++ v1.2 2/20/2000
3    c++ interface to ARPACK code.
4 
5    MODULE ARGComp.h.
6    Arpack++ class ARCompGenEig definition.
7 
8    ARPACK Authors
9       Richard Lehoucq
10       Danny Sorensen
11       Chao Yang
12       Dept. of Computational & Applied Mathematics
13       Rice University
14       Houston, Texas
15 */
16 
17 #ifndef ARGCOMP_H
18 #define ARGCOMP_H
19 
20 #include <cstddef>
21 #include <string>
22 #include "arch.h"
23 #include "arscomp.h"
24 #include "argeig.h"
25 
26 template<class ARFLOAT, class ARFOP, class ARFB>
27 class ARCompGenEig:
28   virtual public ARGenEig<ARFLOAT, arcomplex<ARFLOAT>, ARFOP, ARFB>,
29   virtual public ARCompStdEig<ARFLOAT, ARFOP>  {
30 
31  public:
32 
33   // a) Constructors and destructor.
34 
ARCompGenEig()35   ARCompGenEig() { }
36   // Short constructor (Does nothing but calling base classes constructors).
37 
38   ARCompGenEig(int np, int nevp, ARFOP* objOPp,
39                void (ARFOP::* MultOPxp)(arcomplex<ARFLOAT>[],arcomplex<ARFLOAT>[]),
40                ARFB* objBp,
41                void (ARFB::* MultBxp)(arcomplex<ARFLOAT>[],arcomplex<ARFLOAT>[]),
42                const std::string& whichp = "LM", int ncvp = 0,
43                ARFLOAT tolp = 0.0, int maxitp = 0,
44                arcomplex<ARFLOAT>* residp = NULL, bool ishiftp = true);
45   // Long constructor (regular mode).
46 
47   ARCompGenEig(int np, int nevp, ARFOP* objOPp,
48                void (ARFOP::* MultOPxp)(arcomplex<ARFLOAT>[],arcomplex<ARFLOAT>[]),
49                ARFB* objBp,
50                void (ARFB::* MultBxp)(arcomplex<ARFLOAT>[],arcomplex<ARFLOAT>[]),
51                arcomplex<ARFLOAT> sigmap,
52                const std::string& whichp = "LM", int ncvp = 0, ARFLOAT tolp = 0.0,
53                int maxitp = 0, arcomplex<ARFLOAT>* residp = NULL,
54                bool ishiftp = true);
55   // Long constructor (shift and invert mode).
56 
ARCompGenEig(const ARCompGenEig & other)57   ARCompGenEig(const ARCompGenEig& other) { Copy(other); }
58   // Copy constructor.
59 
~ARCompGenEig()60   virtual ~ARCompGenEig() { }
61   // Destructor.
62 
63  // b) Operators.
64 
65   ARCompGenEig& operator=(const ARCompGenEig& other);
66   // Assignment operator.
67 
68 }; // class ARCompGenEig.
69 
70 
71 // ------------------------------------------------------------------------ //
72 // ARCompGenEig member functions definition.                                //
73 // ------------------------------------------------------------------------ //
74 
75 
76 template<class ARFLOAT, class ARFOP, class ARFB>
77 inline ARCompGenEig<ARFLOAT, ARFOP, ARFB>::
ARCompGenEig(int np,int nevp,ARFOP * objOPp,void (ARFOP::* MultOPxp)(arcomplex<ARFLOAT>[],arcomplex<ARFLOAT>[]),ARFB * objBp,void (ARFB::* MultBxp)(arcomplex<ARFLOAT>[],arcomplex<ARFLOAT>[]),const std::string & whichp,int ncvp,ARFLOAT tolp,int maxitp,arcomplex<ARFLOAT> * residp,bool ishiftp)78 ARCompGenEig(int np, int nevp, ARFOP* objOPp,
79              void (ARFOP::* MultOPxp)(arcomplex<ARFLOAT>[],arcomplex<ARFLOAT>[]),
80              ARFB* objBp,
81              void (ARFB::* MultBxp)(arcomplex<ARFLOAT>[], arcomplex<ARFLOAT>[]),
82              const std::string& whichp, int ncvp, ARFLOAT tolp,
83              int maxitp, arcomplex<ARFLOAT>* residp, bool ishiftp)
84 
85 {
86 
87   this->NoShift();
88   this->DefineParameters(np, nevp, objOPp, MultOPxp, objBp, MultBxp,
89                    whichp, ncvp, tolp, maxitp, residp, ishiftp);
90 
91 } // Long constructor (regular mode).
92 
93 
94 template<class ARFLOAT, class ARFOP, class ARFB>
95 inline ARCompGenEig<ARFLOAT, ARFOP, ARFB>::
ARCompGenEig(int np,int nevp,ARFOP * objOPp,void (ARFOP::* MultOPxp)(arcomplex<ARFLOAT>[],arcomplex<ARFLOAT>[]),ARFB * objBp,void (ARFB::* MultBxp)(arcomplex<ARFLOAT>[],arcomplex<ARFLOAT>[]),arcomplex<ARFLOAT> sigmap,const std::string & whichp,int ncvp,ARFLOAT tolp,int maxitp,arcomplex<ARFLOAT> * residp,bool ishiftp)96 ARCompGenEig(int np, int nevp, ARFOP* objOPp,
97              void (ARFOP::* MultOPxp)(arcomplex<ARFLOAT>[],arcomplex<ARFLOAT>[]),
98              ARFB* objBp,
99              void (ARFB::* MultBxp)(arcomplex<ARFLOAT>[], arcomplex<ARFLOAT>[]),
100              arcomplex<ARFLOAT> sigmap, const std::string& whichp, int ncvp, ARFLOAT tolp,
101              int maxitp, arcomplex<ARFLOAT>* residp, bool ishiftp)
102 
103 {
104 
105   this->ChangeShift(sigmap);
106   this->DefineParameters(np, nevp, objOPp, MultOPxp, objBp, MultBxp,
107                    whichp, ncvp, tolp, maxitp, residp, ishiftp);
108 
109 } // Long constructor (shift and invert mode).
110 
111 
112 template<class ARFLOAT, class ARFOP, class ARFB>
113 ARCompGenEig<ARFLOAT, ARFOP, ARFB>& ARCompGenEig<ARFLOAT, ARFOP, ARFB>::
114 operator=(const ARCompGenEig<ARFLOAT, ARFOP, ARFB>& other)
115 {
116 
117   if (this != &other) { // Stroustrup suggestion.
118     this->ClearMem();
119     Copy(other);
120   }
121   return *this;
122 
123 } // operator=.
124 
125 
126 #endif // ARGCOMP_H
127