Boost logo

Ublas :

From: Thomas Klimpel (Thomas.Klimpel_at_[hidden])
Date: 2008-06-21 18:44:28


Hello Jeremy,

I modified your file hseqr.cpp slightly (just update libs/numeric/bindings), to create an example of trecv in use. Hope it helps.

Regards,
Thomas

Index: bindings/lapack/test/hseqr.cpp
===================================================================
--- bindings/lapack/test/hseqr.cpp (Revision 46588)
+++ bindings/lapack/test/hseqr.cpp (Arbeitskopie)
@@ -90,6 +90,30 @@
     cout << "'New' original matrix:\n" << origG << endl;
     cout << "==================================" << endl;
 
+ ublas::matrix<complex<double>, ublas::column_major> cVL(cZ);
+ ublas::matrix<complex<double>, ublas::column_major> cVR(cZ);
+ boost::numeric::bindings::traits::detail::array<complex<double> > work(3*n);
+ lapack::trevc('B','B',G,cVL,cVR,work);
+
+ cout << "\n==================================" << endl;
+ cout << "Testing left & right eigenvectors..." << endl;
+ Hessenberg(G);
+ cout << "Many 'zeros':" << endl;
+ for ( int i=0; i<n; ++i){
+ cout << (ublas::prod( G, column(cVR, i) ) - values(i) * column(cVR, i)) << endl;
+ cout << (ublas::prod( ublas::herm(G), column(cVL, i) ) - conj( values(i) ) * column(cVL, i)) << endl;
+ }
+ cout << "==================================" << endl;
+
+ cout << "\n==================================" << endl;
+ cout << "Verifying diagonal matrix..." << endl;
+ ublas::matrix<complex<double>, ublas::column_major> cG(n,n,0);
+ Hessenberg(G);
+ G = ublas::prod( G, cVR );
+ G = ublas::prod( ublas::herm(cVL), G );
+ cout << "'diagonal' matrix:\n" << G << endl;
+ cout << "==================================" << endl;
+
 }
 
 

-----Ursprüngliche Nachricht-----
Von: ublas-bounces_at_[hidden] im Auftrag von Jeremy Conlin
Gesendet: Do 19.06.2008 21:41
An: ublas mailing list
Betreff: [ublas] Example of using trevc.hpp?
 
I am trying to use the trevc.hpp header with my new hseqr.hpp header. I'm
not getting the results I expected and I'm trying to track down the error.
 Everything compiles and runs, but the result is not what I expected. I can
confirm the results of hseqr by a call to Mathematica, but I can't figure
out an equivalent command for trevc.
Does anyone have an example of trevc in use?

Thanks,
Jeremy