]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
add lapack tests and produce eigenvalue data for tridiagonal matrix
authorkanschat <kanschat@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 6 Sep 2006 20:27:51 +0000 (20:27 +0000)
committerkanschat <kanschat@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 6 Sep 2006 20:27:51 +0000 (20:27 +0000)
git-svn-id: https://svn.dealii.org/trunk@13839 0785d39b-7218-0410-832d-ea1e28bc413d

tests/Makefile
tests/lapack/tridiagonal_ev1.cc
tests/lapack/tridiagonal_ev1/cmp/generic

index 1fc7e8a8dfd0980ec9a135524fc1376dbf53e442..1ef1b6d2bc95ed81dd7e7b2d8fc51bd6514551b1 100644 (file)
@@ -3,6 +3,9 @@
 # Common Makefile for all test directories
 
 all: base lac fe deal.II multigrid bits hp
+       @if grep 'define HAVE_LIBLAPACK' $D/base/include/base/config.h ; then \
+               cd lapack ; $(MAKE) ; cd .. ; \
+       fi
 
 base:
        cd base ; $(MAKE)
@@ -30,17 +33,28 @@ report:
                echo =======Report: $$i ======= ; \
                cd $$i ; $(MAKE) report ; cd .. ; \
         done
+       @if grep 'define HAVE_LIBLAPACK' $D/base/include/base/config.h ; then \
+               echo =======Report: lapack ======= ; \
+               cd lapack ; $(MAKE) report ; cd .. ; \
+       fi
 
 report+mail:
        @for i in base lac fe deal.II multigrid bits hp all-headers ; do \
                echo =======Report: $$i ======= ; \
                cd $$i ; $(MAKE) report+mail ; cd .. ; \
         done
+       @if grep 'define HAVE_LIBLAPACK' $D/base/include/base/config.h ; then \
+               echo =======Report: lapack ======= ; \
+               cd lapack ; $(MAKE) report+mail ; cd .. ; \
+       fi
 
 
 # compilation of tests only, no execution of tests
 
 build: build-base build-lac build-fe build-deal.II build-multigrid build-bits build-hp
+       @if grep 'define HAVE_LIBLAPACK' $D/base/include/base/config.h ; then \
+               cd lapack ; $(MAKE) build ; cd .. ; \
+       fi
 
 build-base:
        cd base ; $(MAKE) build
@@ -68,6 +82,9 @@ build-hp:
 # reference values
 
 output: output-base output-lac output-fe output-deal.II output-bits output-hp
+       @if grep 'define HAVE_LIBLAPACK' $D/base/include/base/config.h ; then \
+               cd lapack ; $(MAKE) output ; cd .. ; \
+       fi
 
 output-base:
        cd base ; $(MAKE) output
@@ -95,6 +112,9 @@ output-hp:
 # update/generate references
 
 refs: refs-base refs-lac refs-fe refs-deal.II refs-bits refs-hp
+       @if grep 'define HAVE_LIBLAPACK' $D/base/include/base/config.h ; then \
+               cd lapack ; $(MAKE) refs ; cd .. ; \
+       fi
 
 refs-base:
        cd base ; $(MAKE) refs
@@ -122,9 +142,9 @@ refs-hp:
 resultname:
        @echo $(TARGET)+$(GXX-VERSION)
 
-clean: clean-base clean-lac clean-deal.II clean-fe clean-bits clean-hp
+clean: clean-base clean-lac clean-deal.II clean-fe clean-bits clean-hp clean-lapack
 
-distclean: distclean-base distclean-lac distclean-deal.II distclean-fe distclean-bits distclean-hp
+distclean: distclean-base distclean-lac distclean-deal.II distclean-fe distclean-bits distclean-hp distclean-lapack
 
 clean-base:
        cd base ; $(MAKE) clean
@@ -168,6 +188,12 @@ clean-hp:
 distclean-hp:
        cd hp ; $(MAKE) distclean
 
+clean-lapack:
+       cd lapack ; $(MAKE) clean
+
+distclean-lapack:
+       cd lapack ; $(MAKE) distclean
+
 .PHONY : all base lac fe deal.II multigrid bits \
        clean clean-base clean-lac clean-fe \
        clean-deal.II clean-multigrid clean-bits clean-hp \
index 00724939b6a56d62f44d57e3de538ee22439d0a6..30663558047e5b5e7ec5019157cd71ed4b10a4a7 100644 (file)
 #include <iostream>
 
 
+// Build the one dimensional discrete Laplacian for n intervals
 template <typename number>
 void test_laplacian(unsigned int n)
 {
-  TridiagonalMatrix<number> M(n, true);
-  for (unsigned int i=0;i<n-1;++i)
+  TridiagonalMatrix<number> M(n-1, true);
+  for (unsigned int i=0;i<n-2;++i)
     {
       M(i,i) = 2.;
       M(i,i+1) = -1.;
     }
-  M(n-1,n-1) = 2.;
+  M(n-2,n-2) = 2.;
 
   M.compute_eigenvalues();
-  for (unsigned int i=0;i<n;++i)
-    deallog << i << '\t' << M.eigenvalue(i);
+  for (unsigned int i=0;i<5;++i)
+    deallog << '\t' << M.eigenvalue(i)*n*n;
+  deallog << "\t cond " << M.eigenvalue(n-2)/M.eigenvalue(0) << std::endl;
 }
 
 
@@ -46,5 +48,8 @@ int main()
   deallog.depth_console(0);
   deallog.threshold_double(1.e-10);
 
-  test_laplacian<double>(50);
+  test_laplacian<double>(10);
+  test_laplacian<double>(20);
+  test_laplacian<double>(40);
+  test_laplacian<double>(80);
 }
index c8eede55a5f60d61d619855f7682720d1172aff7..eca9a0403264ec1f1acc7dc68b1af9142e770c09 100644 (file)
@@ -1,10 +1,5 @@
 
-DEAL:Rect::operator= (const FullMatrix<number>&) ok
-DEAL:Rect::vmult ok
-DEAL:Rect::vmult_add ok
-DEAL:Rect::Tvmult ok
-DEAL:Rect::Tvmult_add ok
-DEAL::Eigenvalues 5    0
-DEAL::Eigenvalues 1    0
-DEAL::Eigenvalues 5    0
-DEAL::Eigenvalues 5    0
+DEAL:: 9.78870 38.1966 82.4429 138.197 200.000  cond 39.8635
+DEAL:: 9.84933 39.1548 87.1948 152.786 234.315  cond 161.448
+DEAL:: 9.86453 39.3973 88.4163 156.619 243.585  cond 647.789
+DEAL:: 9.86834 39.4581 88.7238 157.589 245.948  cond 2593.16

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.