]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
test HouseHolder
authorguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Sat, 16 Apr 2005 07:23:34 +0000 (07:23 +0000)
committerguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Sat, 16 Apr 2005 07:23:34 +0000 (07:23 +0000)
git-svn-id: https://svn.dealii.org/trunk@10509 0785d39b-7218-0410-832d-ea1e28bc413d

tests/lac/Makefile
tests/lac/householder.cc [new file with mode: 0644]
tests/results/i686-pc-linux-gnu+gcc3.2/lac/householder.output [new file with mode: 0644]

index ae0260f6e48df6424aebbf11cc61acf461c1b8e8..42fd73394d1ebd4faab2ef4484ef1c8b2f6e7e6e 100644 (file)
@@ -21,7 +21,7 @@ default: run-tests
 ############################################################
 
 tests_x = vector-vector \
-       full_matrix tridiagonal_matrix \
+       full_matrix householder tridiagonal_matrix \
        sparsity_pattern sparse_matrices \
        block_vector block_vector_iterator block_matrices \
        matrix_lib matrix_out \
diff --git a/tests/lac/householder.cc b/tests/lac/householder.cc
new file mode 100644 (file)
index 0000000..d8597e9
--- /dev/null
@@ -0,0 +1,50 @@
+//--------------------------------------------------------------------
+//    $Id$
+//    Version: $Name$ 
+//
+//    Copyright (C) 2005 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 Householder class for QR-decomposition
+
+#include "../tests.h"
+#include <base/logstream.h>
+#include <lac/householder.h>
+#include <lac/full_matrix.h>
+#include <lac/vector.h>
+
+#include <fstream>
+#include <iostream>
+
+const double rect[] =
+{
+      4., 3., 2., 1.,
+      5., 8., 1., -2.,
+      11., 13., -4., -5
+};
+
+
+int main()
+{
+  std::ofstream logfile("householder.output");
+  logfile.precision(3);
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  
+  FullMatrix<double> A(4,3,rect);
+  Householder<double> H(A);
+  
+  Vector<double> u(4);
+  Vector<double> v1(3);
+  Vector<double> v2(3);  
+  
+  for (unsigned int i=0;i<u.size();++i)
+    u(i) = i*i;
+  deallog << "Distance " << H.least_squares(v1,u) << std::endl;
+}
diff --git a/tests/results/i686-pc-linux-gnu+gcc3.2/lac/householder.output b/tests/results/i686-pc-linux-gnu+gcc3.2/lac/householder.output
new file mode 100644 (file)
index 0000000..71fb7aa
--- /dev/null
@@ -0,0 +1,2 @@
+
+DEAL::Distance 1.75

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.