From: willems Date: Wed, 15 Feb 2012 09:06:48 +0000 (+0000) Subject: test for computing generalized eigenvalue problem with LAPACK added. Unlike full_matr... X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9a2ea3c7d854202750771e77f2d6f0325c38240a;p=dealii-svn.git test for computing generalized eigenvalue problem with LAPACK added. Unlike full_matrix_05 this tests the more general function compute_generalized_eigenvalues_symmetric which allows specifying the accuracy up to which the generalized eigenvalues are computed and gives the option to set an interval in which eigenvalues are computed. git-svn-id: https://svn.dealii.org/trunk@25076 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/tests/lapack/full_matrix_06.cc b/tests/lapack/full_matrix_06.cc new file mode 100644 index 0000000000..370579bd7e --- /dev/null +++ b/tests/lapack/full_matrix_06.cc @@ -0,0 +1,87 @@ +//-------------------------------------------------------------------- +// $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 +#include +#include +#include + +#include +#include +#include +#include + +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 A(4,4,left), + B(4,4,right); + LAPACKFullMatrix 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 > eigenvectors(0); + Vector 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