From: Wolfgang Bangerth Date: Fri, 29 Feb 2008 22:04:35 +0000 (+0000) Subject: Add a test where we use the ILU to compute actual inverses that we can check. X-Git-Tag: v8.0.0~9342 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=211c6989765b0237b6795c53fcf4744bd5ab8179;p=dealii.git Add a test where we use the ILU to compute actual inverses that we can check. git-svn-id: https://svn.dealii.org/trunk@15818 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/tests/lac/Makefile b/tests/lac/Makefile index 7ae78a04de..b30389e76f 100644 --- a/tests/lac/Makefile +++ b/tests/lac/Makefile @@ -1,6 +1,6 @@ ############################################################ # $Id$ -# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 by the deal.II authors +# Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 by the deal.II authors ############################################################ ############################################################ @@ -39,8 +39,7 @@ tests_x = vector-vector vector_memory \ solver \ eigen \ filtered_matrix \ - sparse_ilu \ - sparse_ilu_t \ + sparse_ilu* \ lapack_fill \ block_minres \ identity_matrix* \ diff --git a/tests/lac/sparse_ilu_inverse.cc b/tests/lac/sparse_ilu_inverse.cc new file mode 100644 index 0000000000..24f02cf90e --- /dev/null +++ b/tests/lac/sparse_ilu_inverse.cc @@ -0,0 +1,87 @@ +//---------------------------- sparse_ilu_inverse.cc --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2008 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. +// +//---------------------------- sparse_ilu_inverse.cc --------------------------- + + +// compute the inverse of a small matrix using the SparseILU with +// infinite fill-in + +#include "../tests.h" +#include +#include +#include +#include +#include +#include "testmatrix.h" +#include +#include +#include +#include +#include + + +int main() +{ + std::ofstream logfile("sparse_ilu_inverse/output"); + deallog << std::fixed; + deallog << std::setprecision(3); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + + for (unsigned int N=1; N<5; ++N) + { + deallog << "N=" << N << std::endl; + + SparsityPattern structure(N, N, N); + for (unsigned int i=0; i A(structure); + for (unsigned int i=0; i=1) + A.set(i,i-1, -1); + if (i ilu; + ilu.initialize (A, SparseILU::AdditionalData()); + + // now get an explicit + // representation of the + // inverse + FullMatrix inverse (N,N); + Vector tmp1(N), tmp2(N); + for (unsigned int i=0; i