17 #define WANT_STREAM // include iostream and iomanipulators 23 using namespace RBD_LIBRARIES;
38 for (i = 1; i <= n; ++i)
for (j = 1; j <= i; ++j)
39 H(i, j) = 1.0 / (i + j - 1);
42 cout <<
"SymmetricMatrix H" << endl;
43 cout << setw(10) << setprecision(7) << H << endl;
48 cout <<
"Eigenvalues of H" << endl;
49 cout << setw(17) << setprecision(14) << D.
as_column() << endl;
50 cout <<
"Eigenvector matrix, U" << endl;
51 cout << setw(10) << setprecision(7) << U << endl;
54 cout <<
"U * U.t() (should be near identity)" << endl;
55 cout << setw(10) << setprecision(7) << (U * U.
t()) << endl;
58 cout <<
"U * D * U.t() (should be near H)" << endl;
59 cout << setw(10) << setprecision(7) << (U * D * U.
t()) << endl;
71 CatchAll { cout <<
"\nProgram fails - exception generated\n\n"; }
TransposedMatrix t() const
The usual rectangular matrix.
static const char * what()
void eigenvalues(const SymmetricMatrix &A, DiagonalMatrix &D, Matrix &Z)
ColedMatrix as_column() const