--- /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 <float.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(0);
+ Vector<double> eigenvalues(0);
+
+ LA.compute_generalized_eigenvalues_symmetric (LB, 0.5, 3.0,
+ 2.0*DBL_MIN,
+ eigenvalues,
+ eigenvectors,
+ itype);
+
+ for (unsigned int i=0;i<eigenvectors.size();++i)
+ {
+ deallog << "generalized eigenvalue "
+ << std::scientific << eigenvalues(i) << 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 6.768858e-01
+DEAL::generalized eigenvector 1.000000e+00 1.721100e+00 6.171030e+00 -3.892130e+00
+DEAL::generalized eigenvalue 8.071810e-01
+DEAL::generalized eigenvector 1.000000e+00 6.144108e+00 -1.482613e+00 -6.614950e-01
+DEAL::generalized eigenvalue 1.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
+DEAL::generalized eigenvector 1.000000e+00 8.195699e-01 6.942977e-01 6.022441e-01
+DEAL::
+DEAL::generalized eigenvalue problem of type 3
+DEAL::generalized eigenvalue 2.288432e+00
+DEAL::generalized eigenvector 1.000000e+00 9.561649e-01 9.257303e-01 9.033661e-01
--- /dev/null
+
+DEAL::
+DEAL::generalized eigenvalue problem of type 1
+DEAL::generalized eigenvalue 6.768858e-01
+DEAL::generalized eigenvector 1.000000e+00 1.721100e+00 6.171030e+00 -3.892130e+00
+DEAL::generalized eigenvalue 8.071810e-01
+DEAL::generalized eigenvector 1.000000e+00 6.144108e+00 -1.482613e+00 -6.614950e-01
+DEAL::generalized eigenvalue 1.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
+DEAL::generalized eigenvector 1.000000e+00 8.195699e-01 6.942977e-01 6.022441e-01
+DEAL::
+DEAL::generalized eigenvalue problem of type 3
+DEAL::generalized eigenvalue 2.288432e+00
+DEAL::generalized eigenvector 1.000000e+00 9.561649e-01 9.257303e-01 9.033661e-01