--- /dev/null
+//--------------------------------------------------------------------
+// $Id: full_matrix_05.cc 23710 2011-05-17 04:50:10Z bangerth $
+// Version: $Name$
+//
+// Copyright (C) 2005, 2006, 2010 by the deal.II authors
+//
+// This file is subject to QPL and may not be distributed
+// without copyright and license information. Please refer
+// to the file deal.II/doc/license.html for the text and
+// further information on this license.
+//
+//--------------------------------------------------------------------
+
+// Tests generalized eigenvalues of FullMatrix
+
+#include "../tests.h"
+#include <deal.II/base/logstream.h>
+#include <deal.II/lac/lapack_full_matrix.h>
+#include <deal.II/lac/full_matrix.h>
+#include <deal.II/lac/vector.h>
+
+#include <fstream>
+#include <iostream>
+#include <vector>
+
+const double left[] =
+{
+ 4., -1., -1., -1.,
+ -1., 4., -1., -1.,
+ -1., -1., 4., -1.,
+ -1., -1., -1., 4.
+};
+
+const double right[] =
+{
+ 4., -1., -1., -1.,
+ -1., 5., -1., -1.,
+ -1., -1., 6., -1.,
+ -1., -1., -1., 7.
+};
+
+
+
+int main()
+{
+ const std::string logname = JobIdentifier::base_name(__FILE__) + std::string("/output");
+ std::ofstream logfile(logname.c_str());
+ logfile.precision(1);
+ deallog.attach(logfile);
+ deallog.depth_console(0);
+
+ FullMatrix<double> A(4,4,left),
+ B(4,4,right);
+ LAPACKFullMatrix<double> LA(4,4),
+ LB(4,4);
+ for(unsigned int itype=1;itype<=3; ++itype)
+ {
+ deallog << std::endl
+ << "generalized eigenvalue problem of type "
+ << itype << std::endl;
+ LA = A;
+ LB = B;
+ std::vector<Vector<double> > eigenvectors(A.m());
+ LA.compute_generalized_eigenvalues_symmetric (LB, eigenvectors, itype);
+
+ for (unsigned int i=0;i<A.m();++i)
+ {
+ std::complex<double> lambda = LA.eigenvalue(i);
+ deallog << "generalized eigenvalue "
+ << std::scientific << lambda.real() << '\t'
+ << std::scientific << lambda.imag() << std::endl
+ << "generalized eigenvector ";
+ for (unsigned int j=0;j<A.m();++j)
+ {
+ deallog << std::scientific
+ << eigenvectors[i](j)/eigenvectors[i](0)
+ << '\t';
+ }
+ deallog << std::endl;
+ }
+ }
+}
--- /dev/null
+
+DEAL::
+DEAL::generalized eigenvalue problem of type 1
+DEAL::generalized eigenvalue 3.726107e-01 0.000000e+00
+DEAL::generalized eigenvector 1.000000e+00 1.134792e+00 1.311583e+00 1.553625e+00
+DEAL::generalized eigenvalue 6.768858e-01 0.000000e+00
+DEAL::generalized eigenvector 1.000000e+00 1.721100e+00 6.171030e+00 -3.892130e+00
+DEAL::generalized eigenvalue 8.071810e-01 0.000000e+00
+DEAL::generalized eigenvector 1.000000e+00 6.144108e+00 -1.482613e+00 -6.614950e-01
+DEAL::generalized eigenvalue 1.000000e+00 0.000000e+00
+DEAL::generalized eigenvector 1.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
+DEAL::
+DEAL::generalized eigenvalue problem of type 2
+DEAL::generalized eigenvalue 2.288432e+00 0.000000e+00
+DEAL::generalized eigenvector 1.000000e+00 8.195699e-01 6.942977e-01 6.022441e-01
+DEAL::generalized eigenvalue 2.698958e+01 0.000000e+00
+DEAL::generalized eigenvector 1.000000e+00 -6.608984e-01 -2.483742e-01 -1.529221e-01
+DEAL::generalized eigenvalue 3.257479e+01 0.000000e+00
+DEAL::generalized eigenvector 1.000000e+00 2.941906e+00 -3.123354e+00 -1.020145e+00
+DEAL::generalized eigenvalue 3.814720e+01 0.000000e+00
+DEAL::generalized eigenvector 1.000000e+00 1.613708e+00 4.177430e+00 -7.095844e+00
+DEAL::
+DEAL::generalized eigenvalue problem of type 3
+DEAL::generalized eigenvalue 2.288432e+00 0.000000e+00
+DEAL::generalized eigenvector 1.000000e+00 9.561649e-01 9.257303e-01 9.033661e-01
+DEAL::generalized eigenvalue 2.698958e+01 0.000000e+00
+DEAL::generalized eigenvector 1.000000e+00 -7.710481e-01 -3.311655e-01 -2.293832e-01
+DEAL::generalized eigenvalue 3.257479e+01 0.000000e+00
+DEAL::generalized eigenvector 1.000000e+00 3.432224e+00 -4.164472e+00 -1.530217e+00
+DEAL::generalized eigenvalue 3.814720e+01 0.000000e+00
+DEAL::generalized eigenvector 1.000000e+00 1.882659e+00 5.569907e+00 -1.064377e+01
--- /dev/null
+
+DEAL::
+DEAL::generalized eigenvalue problem of type 1
+DEAL::generalized eigenvalue 3.726107e-01 0.000000e+00
+DEAL::generalized eigenvector 1.000000e+00 1.134792e+00 1.311583e+00 1.553625e+00
+DEAL::generalized eigenvalue 6.768858e-01 0.000000e+00
+DEAL::generalized eigenvector 1.000000e+00 1.721100e+00 6.171030e+00 -3.892130e+00
+DEAL::generalized eigenvalue 8.071810e-01 0.000000e+00
+DEAL::generalized eigenvector 1.000000e+00 6.144108e+00 -1.482613e+00 -6.614950e-01
+DEAL::generalized eigenvalue 1.000000e+00 0.000000e+00
+DEAL::generalized eigenvector 1.000000e+00 0.000000e+00 0.000000e+00 0.000000e+00
+DEAL::
+DEAL::generalized eigenvalue problem of type 2
+DEAL::generalized eigenvalue 2.288432e+00 0.000000e+00
+DEAL::generalized eigenvector 1.000000e+00 8.195699e-01 6.942977e-01 6.022441e-01
+DEAL::generalized eigenvalue 2.698958e+01 0.000000e+00
+DEAL::generalized eigenvector 1.000000e+00 -6.608984e-01 -2.483742e-01 -1.529221e-01
+DEAL::generalized eigenvalue 3.257479e+01 0.000000e+00
+DEAL::generalized eigenvector 1.000000e+00 2.941906e+00 -3.123354e+00 -1.020145e+00
+DEAL::generalized eigenvalue 3.814720e+01 0.000000e+00
+DEAL::generalized eigenvector 1.000000e+00 1.613708e+00 4.177430e+00 -7.095844e+00
+DEAL::
+DEAL::generalized eigenvalue problem of type 3
+DEAL::generalized eigenvalue 2.288432e+00 0.000000e+00
+DEAL::generalized eigenvector 1.000000e+00 9.561649e-01 9.257303e-01 9.033661e-01
+DEAL::generalized eigenvalue 2.698958e+01 0.000000e+00
+DEAL::generalized eigenvector 1.000000e+00 -7.710481e-01 -3.311655e-01 -2.293832e-01
+DEAL::generalized eigenvalue 3.257479e+01 0.000000e+00
+DEAL::generalized eigenvector 1.000000e+00 3.432224e+00 -4.164472e+00 -1.530217e+00
+DEAL::generalized eigenvalue 3.814720e+01 0.000000e+00
+DEAL::generalized eigenvector 1.000000e+00 1.882659e+00 5.569907e+00 -1.064377e+01