dgematrix.dgeev dgematrix.dggev dsymatrix.dsyev zgematrix.zgeev zgematrix.zggev zsymatrix.zsyev
double
型の実一般行列を例に紹介します.
A.dgeev(wr,wi);ここで,
wr
,wi
は固有値の実部と虚部を出力するdouble
型ベクトルコンテナです.
dcovector
型ベクトルコンテナ,
vrr
,vri
を用意して,
A.dgeev(wr,wi,vrr,vri);と記述します.
drovector
型ベクトルコンテナ,vlr
,vli
を用意して,
A.dgeev(wr,wi,vli,vri);と記述します. また,一般化固有値,一般化固有ベクトルが欲しい場合は,
dggev
を利用してください.
//====================================================================[include] #include ``cpplapack.h'' //=======================================================================[main] /*! main */ int main(int argc, char** argv) { //// make dgematrix A //// CPPL::dgematrix A(3,3); A(0,0)=3; A(0,1)=2; A(0,2)=1; A(1,0)=2; A(1,1)=0; A(1,2)=0; A(2,0)=4; A(2,1)=2; A(2,2)=1; //// make wr wi vr //// std::vector<double> wr, wi; std::vector<CPPL::dcovector> vrr, vri; //// dgeev //// A.dgeev(wr, wi ,vrr, vri); //// print //// for(int i=0; i<3; i++){ std::cout << ``#### `` << i << ``th eigen ####'' << std::endl; std::cout << ``wr='' << wr[i] << std::endl; std::cout << ``wi='' << wi[i] << std::endl; std::cout << ``vrr=\n'' << vrr[i] << std::endl; std::cout << ``vri=\n'' << vri[i] << std::endl; } }
#### 0th eigen #### wr=5 wi=0 vrr= 0.620174 0.248069 0.744208 vri= 0 0 0 #### 1th eigen #### wr=-1 wi=0 vrr= 0.447214 -0.894427 1.23361e-16 vri= 0 0 0 #### 2th eigen #### wr=1.36434e-16 wi=0 vrr= -5.22952e-17 -0.447214 0.894427 vri= 0 0 0