]> https://gitweb.dealii.org/ - dealii.git/commitdiff
new test
authorweiler <weiler@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 27 Aug 2010 09:45:30 +0000 (09:45 +0000)
committerweiler <weiler@0785d39b-7218-0410-832d-ea1e28bc413d>
Fri, 27 Aug 2010 09:45:30 +0000 (09:45 +0000)
git-svn-id: https://svn.dealii.org/trunk@21744 0785d39b-7218-0410-832d-ea1e28bc413d

tests/lac/full_matrix_03.cc [new file with mode: 0644]
tests/lac/full_matrix_03/cmp/generic [new file with mode: 0644]

diff --git a/tests/lac/full_matrix_03.cc b/tests/lac/full_matrix_03.cc
new file mode 100644 (file)
index 0000000..8d46951
--- /dev/null
@@ -0,0 +1,62 @@
+//----------------------------  full_matrix_03.cc,v  ---------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 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.
+//
+//----------------------------  full_matrix_03.cc,v  ---------------------------
+
+//check method TmTmult of FullMatrix
+
+#include "../tests.h"
+#include <cmath>
+#include <fstream>
+#include <iomanip>
+#include <iomanip>
+#include <cstdlib>
+
+#include <base/logstream.h>
+#include <lac/vector.h>
+#include <lac/full_matrix.h>
+#include <lac/eigen.h>
+
+const double entries_A[9] = { 1,2,3,4,5,6,7,8,9 };
+const double entries_B[9] = { 2,1,1,1,2,3,2,1,2 };
+const double entries_Z[9] = { 0,0,0,0,0,0,0,0,0 };
+
+// Create a positive definite random matrix
+
+int
+main ()
+{
+  std::ofstream logfile("full_matrix_03/output");
+  deallog << std::fixed;
+  deallog << std::setprecision(3);
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+  std::srand(3391466);
+
+  FullMatrix<double> A(3,3,entries_A);
+  FullMatrix<double> B(3,3,entries_B);
+  FullMatrix<double> Za(3,3,entries_Z);
+  FullMatrix<double> Zb(3,3,entries_Z);
+  FullMatrix<double> C(3,3);
+  FullMatrix<double> D(3,3);
+  //compute C= A^T*B^T in two different ways and compare for equality
+  Za.Tadd(1.,A);
+  Zb.Tadd(1.,B);
+  Za.mmult(D,Zb);
+  A.TmTmult(C,B);
+  
+  D.add(-1,C);
+  Assert ( D.frobenius_norm() < 1e-15,
+           ExcInternalError());
+  deallog << "OK" << std::endl;
+}    
diff --git a/tests/lac/full_matrix_03/cmp/generic b/tests/lac/full_matrix_03/cmp/generic
new file mode 100644 (file)
index 0000000..0fd8fc1
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::OK

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.