#include <deal.II/lac/matrix_lib.h>
#include <deal.II/lac/precondition.h>
#include <deal.II/lac/vector.h>
-
#include <fstream>
deallog << std::endl;
}
-
-
int main()
{
std::ofstream logfile("output");
--- /dev/null
+// ---------------------------------------------------------------------
+// $Id: filtered_matrix.cc 31349 2013-10-20 19:07:06Z maier $
+//
+// Copyright (C) 2007 - 2013 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE at
+// the top level of the deal.II distribution.
+//
+// ---------------------------------------------------------------------
+
+#include "../tests.h"
+#include <deal.II/base/logstream.h>
+#include <deal.II/lac/filtered_matrix.h>
+#include <deal.II/lac/full_matrix.h>
+#include <deal.II/lac/vector.h>
+
+template<typename number>
+void
+checkVmult(FullMatrix<number> &A, Vector<number> &V,
+ bool expect_constrained_source = false)
+{
+ deallog<< "vmult" << std::endl;
+
+ FilteredMatrix < Vector<double> > F;
+ F.initialize(A, expect_constrained_source);
+ F.add_constraint(0, 1);
+
+ Vector<number> O(A.m());
+
+ F.vmult(O, V);
+
+ for (unsigned int i = 0; i < O.size(); ++i)
+ deallog << O(i) << '\t';
+ deallog << std::endl;
+}
+
+int
+main()
+{
+ std::ofstream logfile("output");
+ deallog << std::fixed;
+ deallog << std::setprecision(4);
+ deallog.attach(logfile);
+ deallog.depth_console(0);
+ deallog.threshold_double(1.e-10);
+
+ const double Adata[] =
+ { 1, 2, 3, 4, 5, 6 };
+
+ FullMatrix<double> A(2, 3);
+
+ A.fill(Adata);
+
+ Vector<double> V(3);
+ V(0) = 1;
+ V(1) = 2;
+ V(2) = 3;
+
+ checkVmult<double>(A, V, false);
+ checkVmult<double>(A, V, true);
+}
--- /dev/null
+
+DEAL::vmult
+DEAL::1.0000 28.0000
+DEAL::vmult
+DEAL::1.0000 32.0000
--- /dev/null
+// ---------------------------------------------------------------------
+// $Id: filtered_matrix.cc 31349 2013-10-20 19:07:06Z maier $
+//
+// Copyright (C) 2007 - 2013 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE at
+// the top level of the deal.II distribution.
+//
+// ---------------------------------------------------------------------
+
+#include "../tests.h"
+#include <deal.II/base/logstream.h>
+#include <deal.II/lac/filtered_matrix.h>
+#include <deal.II/lac/full_matrix.h>
+#include <deal.II/lac/vector.h>
+
+template<typename number>
+void
+checkTvmult(FullMatrix<number> &A, Vector<number> &V,
+ bool expect_constrained_source = false)
+{
+ deallog << "Tvmult" << std::endl;
+
+ FilteredMatrix < Vector<double> > F;
+ F.initialize(A, expect_constrained_source);
+ F.add_constraint(0, 1);
+
+ Vector<number> O(A.n());
+
+ F.Tvmult(O, V);
+
+ for (unsigned int i = 0; i < O.size(); ++i)
+ deallog << O(i) << '\t';
+ deallog << std::endl;
+}
+
+int
+main()
+{
+ std::ofstream logfile("output");
+ deallog << std::fixed;
+ deallog << std::setprecision(4);
+ deallog.attach(logfile);
+ deallog.depth_console(0);
+ deallog.threshold_double(1.e-10);
+
+ const double Adata[] =
+ { 1, 2, 3, 4, 5, 6 };
+
+ FullMatrix<double> A(2, 3);
+
+ A.fill(Adata);
+
+ Vector<double> V(2);
+ V(0) = 1;
+ V(1) = 2;
+
+ checkTvmult<double>(A, V, false);
+ checkTvmult<double>(A, V, true);
+}
--- /dev/null
+
+DEAL::Tvmult
+DEAL::1.0000 10.0000 12.0000
+DEAL::Tvmult
+DEAL::1.0000 12.0000 15.0000
--- /dev/null
+// ---------------------------------------------------------------------
+// $Id: filtered_matrix.cc 31349 2013-10-20 19:07:06Z maier $
+//
+// Copyright (C) 2007 - 2013 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE at
+// the top level of the deal.II distribution.
+//
+// ---------------------------------------------------------------------
+
+#include "../tests.h"
+#include <deal.II/base/logstream.h>
+#include <deal.II/lac/filtered_matrix.h>
+#include <deal.II/lac/full_matrix.h>
+#include <deal.II/lac/vector.h>
+
+template<typename number>
+void
+checkVmult_Add(FullMatrix<number> &A, Vector<number> &V,
+ bool expect_constrained_source = false)
+{
+ deallog << "vmult_add" << std::endl;
+
+ FilteredMatrix < Vector<double> > F;
+ F.initialize(A, expect_constrained_source);
+ F.add_constraint(0, 1);
+
+ Vector<number> O(A.m());
+ for (unsigned int i = 0; i < O.size(); ++i)
+ {
+ O(i) = 1;
+ }
+
+ F.vmult_add(O, V);
+
+ for (unsigned int i = 0; i < O.size(); ++i)
+ deallog << O(i) << '\t';
+ deallog << std::endl;
+}
+
+int
+main()
+{
+ std::ofstream logfile("output");
+ deallog << std::fixed;
+ deallog << std::setprecision(4);
+ deallog.attach(logfile);
+ deallog.depth_console(0);
+ deallog.threshold_double(1.e-10);
+
+ const double Adata[] =
+ { 1, 2, 3, 4, 5, 6 };
+
+ FullMatrix<double> A(2, 3);
+
+ A.fill(Adata);
+
+ Vector<double> V(3);
+ V(0) = 1;
+ V(1) = 2;
+ V(2) = 3;
+
+ checkVmult_Add<double>(A, V, false);
+ checkVmult_Add<double>(A, V, true);
+}
--- /dev/null
+
+DEAL::vmult_add
+DEAL::1.0000 29.0000
+DEAL::vmult_add
+DEAL::1.0000 33.0000
--- /dev/null
+// ---------------------------------------------------------------------
+// $Id: filtered_matrix.cc 31349 2013-10-20 19:07:06Z maier $
+//
+// Copyright (C) 2007 - 2013 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE at
+// the top level of the deal.II distribution.
+//
+// ---------------------------------------------------------------------
+
+#include "../tests.h"
+#include <deal.II/base/logstream.h>
+#include <deal.II/lac/filtered_matrix.h>
+#include <deal.II/lac/full_matrix.h>
+#include <deal.II/lac/vector.h>
+
+template<typename number>
+void
+checkTvmult_Add(FullMatrix<number> &A, Vector<number> &V,
+ bool expect_constrained_source = false)
+{
+ deallog << "Tvmult_add" << std::endl;
+
+ FilteredMatrix < Vector<double> > F;
+ F.initialize(A, expect_constrained_source);
+ F.add_constraint(0, 1);
+
+ Vector<number> O(A.n());
+ for (unsigned int i = 0; i < O.size(); ++i)
+ {
+ O(i) = 1;
+ }
+
+ F.Tvmult_add(O, V);
+
+ for (unsigned int i = 0; i < O.size(); ++i)
+ deallog << O(i) << '\t';
+ deallog << std::endl;
+}
+
+int
+main()
+{
+ std::ofstream logfile("output");
+ deallog << std::fixed;
+ deallog << std::setprecision(4);
+ deallog.attach(logfile);
+ deallog.depth_console(0);
+ deallog.threshold_double(1.e-10);
+
+ const double Adata[] =
+ { 1, 2, 3, 4, 5, 6 };
+
+ FullMatrix<double> A(2, 3);
+
+ A.fill(Adata);
+
+ Vector<double> V(2);
+ V(0) = 1;
+ V(1) = 2;
+
+ checkTvmult_Add<double>(A, V, false);
+ checkTvmult_Add<double>(A, V, true);
+}
--- /dev/null
+
+DEAL::Tvmult_add
+DEAL::1.0000 11.0000 13.0000
+DEAL::Tvmult_add
+DEAL::1.0000 13.0000 16.0000
--- /dev/null
+// ---------------------------------------------------------------------
+// $Id: filtered_matrix.cc 31349 2013-10-20 19:07:06Z maier $
+//
+// Copyright (C) 2007 - 2013 by the deal.II authors
+//
+// This file is part of the deal.II library.
+//
+// The deal.II library is free software; you can use it, redistribute
+// it, and/or modify it under the terms of the GNU Lesser General
+// Public License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+// The full text of the license can be found in the file LICENSE at
+// the top level of the deal.II distribution.
+//
+// ---------------------------------------------------------------------
+
+#include "../tests.h"
+#include <deal.II/base/logstream.h>
+#include <deal.II/lac/filtered_matrix.h>
+#include <deal.II/lac/full_matrix.h>
+#include <deal.II/lac/vector.h>
+
+template<typename number>
+void
+checkApply_Constraints(FullMatrix<number> &A, Vector<number> &V,
+ bool matrix_is_symmetric = false)
+{
+ deallog << "apply_constraints" << std::endl;
+
+ FilteredMatrix < Vector<double> > F;
+ F.initialize(A);
+ F.add_constraint(0, 1);
+
+ F.apply_constraints(V, matrix_is_symmetric);
+
+ for (unsigned int i = 0; i < V.size(); ++i)
+ deallog << V(i) << '\t';
+ deallog << std::endl;
+}
+
+int
+main()
+{
+ std::ofstream logfile("output");
+ deallog << std::fixed;
+ deallog << std::setprecision(4);
+ deallog.attach(logfile);
+ deallog.depth_console(0);
+ deallog.threshold_double(1.e-10);
+
+ const double Adata[] =
+ { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
+
+ FullMatrix<double> A(3, 3);
+
+ A.fill(Adata);
+
+ Vector<double> V1(3);
+ Vector<double> V2(3);
+
+ V1(0) = V2(0) = 1;
+ V1(1) = V2(1) = 2;
+ V1(2) = V2(2) = 3;
+
+ checkApply_Constraints<double>(A, V1, false);
+ checkApply_Constraints<double>(A, V2, true);
+}
--- /dev/null
+
+DEAL::apply_constraints
+DEAL::1.0000 -2.0000 -4.0000
+DEAL::apply_constraints
+DEAL::1.0000 -2.0000 -4.0000