/* ARPACK++ v1.2 2/20/2000 c++ interface to ARPACK code. MODULE ARDGNSym.h. Arpack++ class ARluNonSymGenEig definition (dense matrix version). ARPACK Authors Richard Lehoucq Danny Sorensen Chao Yang Dept. of Computational & Applied Mathematics Rice University Houston, Texas */ #ifndef ARDGNSYM_H #define ARDGNSYM_H #include #include #include "arch.h" #include "ardnsmat.h" #include "ardnspen.h" #include "argnsym.h" template class ARluNonSymGenEig: public virtual ARNonSymGenEig, ARdsNonSymPencil > { private: // a) Data structure used to store matrices. ARdsNonSymPencil Pencil; // b) Protected functions: virtual void Copy(const ARluNonSymGenEig& other); // Makes a deep copy of "other" over "this" object. // Old values are not deleted (this function is to be used // by the copy constructor and the assignment operator only). public: // c) Public functions: // c.1) Functions that allow changes in problem parameters. virtual void ChangeShift(ARFLOAT sigmaRp, ARFLOAT sigmaIp = 0.0); virtual void SetRegularMode(); virtual void SetShiftInvertMode(ARFLOAT sigmap); virtual void SetComplexShiftMode(char partp, ARFLOAT sigmaRp,ARFLOAT sigmaIp); // c.2) Constructors and destructor. ARluNonSymGenEig() { } // Short constructor. ARluNonSymGenEig(int nevp, ARdsNonSymMatrix& A, ARdsNonSymMatrix& B, const std::string& whichp = "LM", int ncvp = 0, ARFLOAT tolp = 0.0, int maxitp = 0, ARFLOAT* residp = NULL, bool ishiftp = true); // Long constructor (regular mode). ARluNonSymGenEig(int nevp, ARdsNonSymMatrix& A, ARdsNonSymMatrix& B, ARFLOAT sigma, const std::string& whichp = "LM", int ncvp = 0, ARFLOAT tolp = 0.0, int maxitp = 0, ARFLOAT* residp = NULL, bool ishiftp = true); // Long constructor (real shift and invert mode). ARluNonSymGenEig(int nevp, ARdsNonSymMatrix& A, ARdsNonSymMatrix& B, char partp, ARFLOAT sigmaRp, ARFLOAT sigmaIp, const std::string& whichp = "LM", int ncvp = 0, ARFLOAT tolp = 0.0, int maxitp = 0, ARFLOAT* residp = NULL, bool ishiftp = true); // Long constructor (complex shift and invert mode). ARluNonSymGenEig(const ARluNonSymGenEig& other) { Copy(other); } // Copy constructor. virtual ~ARluNonSymGenEig() { } // Destructor. // d) Operators. ARluNonSymGenEig& operator=(const ARluNonSymGenEig& other); // Assignment operator. }; // class ARluNonSymGenEig. // ------------------------------------------------------------------------ // // ARluNonSymGenEig member functions definition. // // ------------------------------------------------------------------------ // template inline void ARluNonSymGenEig:: Copy(const ARluNonSymGenEig& other) { ARNonSymGenEig, ARdsNonSymPencil >:: Copy(other); Pencil = other.Pencil; this->objOP = &Pencil; this->objB = &Pencil; this->objA = &Pencil; } // Copy. template inline void ARluNonSymGenEig:: ChangeShift(ARFLOAT sigmaRp, ARFLOAT sigmaIp) { if (sigmaIp == 0.0) { this->objOP->FactorAsB(sigmaRp); } else { this->objOP->FactorAsB(sigmaRp, sigmaIp, this->part); } ARrcNonSymGenEig::ChangeShift(sigmaRp, sigmaIp); } // ChangeShift. template inline void ARluNonSymGenEig::SetRegularMode() { ARStdEig >:: SetRegularMode(&Pencil, &ARdsNonSymPencil::MultInvBAv); } // SetRegularMode. template inline void ARluNonSymGenEig::SetShiftInvertMode(ARFLOAT sigmap) { ARNonSymGenEig, ARdsNonSymPencil >:: SetShiftInvertMode(sigmap, &Pencil, &ARdsNonSymPencil::MultInvAsBv); } // SetShiftInvertMode. template inline void ARluNonSymGenEig:: SetComplexShiftMode(char partp, ARFLOAT sigmaRp, ARFLOAT sigmaIp) { ARNonSymGenEig, ARdsNonSymPencil >:: SetComplexShiftMode(partp, sigmaRp, sigmaIp, &Pencil, &ARdsNonSymPencil::MultInvAsBv, &Pencil, &ARdsNonSymPencil::MultAv); } // SetComplexShiftMode. template inline ARluNonSymGenEig:: ARluNonSymGenEig(int nevp, ARdsNonSymMatrix& A, ARdsNonSymMatrix& B, const std::string& whichp, int ncvp, ARFLOAT tolp, int maxitp, ARFLOAT* residp, bool ishiftp) { Pencil.DefineMatrices(A, B); this->NoShift(); this->DefineParameters(A.ncols(), nevp, &Pencil, &ARdsNonSymPencil::MultInvBAv, &Pencil, &ARdsNonSymPencil::MultBv, whichp, ncvp, tolp, maxitp, residp, ishiftp); } // Long constructor (regular mode). template inline ARluNonSymGenEig:: ARluNonSymGenEig(int nevp, ARdsNonSymMatrix& A, ARdsNonSymMatrix& B, ARFLOAT sigmap, const std::string& whichp, int ncvp, ARFLOAT tolp, int maxitp, ARFLOAT* residp, bool ishiftp) { Pencil.DefineMatrices(A, B); this->DefineParameters(A.ncols(), nevp, &Pencil, &ARdsNonSymPencil::MultInvAsBv, &Pencil, &ARdsNonSymPencil::MultBv, whichp, ncvp, tolp, maxitp, residp, ishiftp); SetShiftInvertMode(sigmap); } // Long constructor (real shift and invert mode). template inline ARluNonSymGenEig:: ARluNonSymGenEig(int nevp, ARdsNonSymMatrix& A, ARdsNonSymMatrix& B, char partp, ARFLOAT sigmaRp, ARFLOAT sigmaIp, const std::string& whichp, int ncvp, ARFLOAT tolp, int maxitp, ARFLOAT* residp, bool ishiftp) { Pencil.DefineMatrices(A, B); this->DefineParameters(A.ncols(), nevp, &Pencil, &ARdsNonSymPencil::MultInvAsBv, &Pencil, &ARdsNonSymPencil::MultBv, whichp, ncvp, tolp, maxitp, residp, ishiftp); SetComplexShiftMode(partp, sigmaRp, sigmaIp); } // Long constructor (complex shift and invert mode). template ARluNonSymGenEig& ARluNonSymGenEig:: operator=(const ARluNonSymGenEig& other) { if (this != &other) { // Stroustrup suggestion. this->ClearMem(); Copy(other); } return *this; } // operator=. #endif // ARDGNSYM_H