--- /dev/null
+// ---------------------------------------------------------------------
+// $Id: product_matrix_01.cc 32491 2014-02-14 20:52:51Z bangerth $
+//
+// Copyright (C) 2014 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.
+//
+// ---------------------------------------------------------------------
+
+// Check ProductMatrix::constructor1
+
+#include "../tests.h"
+#include <deal.II/base/logstream.h>
+#include <deal.II/lac/matrix_lib.h>
+#include <deal.II/lac/full_matrix.h>
+#include <deal.II/lac/vector.h>
+
+#include <fstream>
+#include <iomanip>
+#include <cmath>
+
+template<typename number>
+ void
+ checkConstructor1(FullMatrix<number> &A, FullMatrix<number> &B)
+ {
+ deallog << "Init with empty constructor" << std::endl;
+ GrowingVectorMemory < Vector<number> > mem;
+ ProductMatrix < Vector<number> > P;
+ P.initialize(A, B, mem);
+
+ deallog << "Multiplying with all ones vector" << std::endl;
+ Vector<number> V(B.n());
+ for (unsigned int i = 0; i < V.size(); ++i)
+ V(i) = 1;
+
+ Vector<number> O(A.m());
+
+ P.vmult(O, V);
+
+ // Check the dimensions of the result matrix
+ Assert(A.m() == O.size(), ExcInternalError());
+ deallog << "Dimensions of result vector verified" << std::endl;
+
+ // Verifying results with Method 2: O=(A*B)*V
+ FullMatrix<number> AB_Product(A.m(), B.n());
+ Vector<number> O_(A.m());
+
+ A.mmult(AB_Product, B, false);
+ AB_Product.vmult(O_, V);
+
+ Assert(O == O_, ExcInternalError());
+ deallog << "Result vector data verified" << std::endl;
+
+ 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[] =
+ { 2, 3, 4, 5 };
+
+ const double Bdata[] =
+ { 0, 1, 2, 3 };
+
+ FullMatrix<double> A(2, 2);
+ FullMatrix<double> B(2, 2);
+
+ A.fill(Adata);
+ B.fill(Bdata);
+
+ checkConstructor1<double>(A, B);
+
+}
--- /dev/null
+
+DEAL::Init with empty constructor
+DEAL::Multiplying with all ones vector
+DEAL::Dimensions of result vector verified
+DEAL::Result vector data verified
+DEAL::17.0000 29.0000
--- /dev/null
+// ---------------------------------------------------------------------
+// $Id: product_matrix_01.cc 32491 2014-02-14 20:52:51Z bangerth $
+//
+// Copyright (C) 2014 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.
+//
+// ---------------------------------------------------------------------
+
+// Check ProductMatrix::constructor2
+
+#include "../tests.h"
+#include <deal.II/base/logstream.h>
+#include <deal.II/lac/matrix_lib.h>
+#include <deal.II/lac/full_matrix.h>
+#include <deal.II/lac/vector.h>
+
+#include <fstream>
+#include <iomanip>
+#include <cmath>
+
+template<typename number>
+ void
+ checkConstructor2(FullMatrix<number> &A, FullMatrix<number> &B)
+ {
+ deallog << "Init with vector memory. Delayed reinit" << std::endl;
+ GrowingVectorMemory < Vector<number> > mem;
+ ProductMatrix < Vector<number> > P(mem);
+ P.reinit(A, B);
+
+ deallog << "Multiplying with all ones vector" << std::endl;
+ Vector<number> V(B.n());
+ for (unsigned int i = 0; i < V.size(); ++i)
+ V(i) = 1;
+ Vector<number> O(A.m());
+
+ P.vmult(O, V);
+
+ // Check the dimensions of the result matrix
+ Assert(A.m() == O.size(), ExcInternalError());
+ deallog << "Dimensions of result vector verified" << std::endl;
+
+ // Verifying results with Method 2: O=(A*B)*V
+ FullMatrix<number> AB_Product(A.m(), B.n());
+ Vector<number> O_(A.m());
+
+ A.mmult(AB_Product, B, false);
+ AB_Product.vmult(O_, V);
+
+ Assert(O == O_, ExcInternalError());
+ deallog << "Result vector data verified" << std::endl;
+
+ 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[] =
+ { 2, 3, 4, 5 };
+
+ const double Bdata[] =
+ { 0, 1, 2, 3 };
+
+ FullMatrix<double> A(2, 2);
+ FullMatrix<double> B(2, 2);
+
+ A.fill(Adata);
+ B.fill(Bdata);
+
+ checkConstructor2<double>(A, B);
+
+}
--- /dev/null
+
+DEAL::Init with vector memory. Delayed reinit
+DEAL::Multiplying with all ones vector
+DEAL::Dimensions of result vector verified
+DEAL::Result vector data verified
+DEAL::17.0000 29.0000
--- /dev/null
+// ---------------------------------------------------------------------
+// $Id: product_matrix_01.cc 32491 2014-02-14 20:52:51Z bangerth $
+//
+// Copyright (C) 2014 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.
+//
+// ---------------------------------------------------------------------
+
+// Check ProductMatrix::constructor3
+
+#include "../tests.h"
+#include <deal.II/base/logstream.h>
+#include <deal.II/lac/matrix_lib.h>
+#include <deal.II/lac/full_matrix.h>
+#include <deal.II/lac/vector.h>
+
+#include <fstream>
+#include <iomanip>
+#include <cmath>
+
+template<typename number>
+ void
+ checkConstructor3(FullMatrix<number> &A, FullMatrix<number> &B)
+ {
+ deallog << "Init with vector memory, matrix 1 and matrix 2" << std::endl;
+ GrowingVectorMemory < Vector<number> > mem;
+ ProductMatrix < Vector<number> > P(A, B, mem);
+
+ deallog << "Multiplying with all ones vector" << std::endl;
+ Vector<number> V(B.n());
+ for (unsigned int i = 0; i < V.size(); ++i)
+ V(i) = 1;
+ Vector<number> O(A.m());
+
+ P.vmult(O, V);
+
+ // Check the dimensions of the result matrix
+ Assert(A.m() == O.size(), ExcInternalError());
+ deallog << "Dimensions of result vector verified" << std::endl;
+
+ // Verifying results with Method 2: O=(A*B)*V
+ FullMatrix<number> AB_Product(A.m(), B.n());
+ Vector<number> O_(A.m());
+
+ A.mmult(AB_Product, B, false);
+ AB_Product.vmult(O_, V);
+
+ Assert(O == O_, ExcInternalError());
+ deallog << "Result vector data verified" << std::endl;
+
+ 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[] =
+ { 2, 3, 4, 5 };
+
+ const double Bdata[] =
+ { 0, 1, 2, 3 };
+
+ FullMatrix<double> A(2, 2);
+ FullMatrix<double> B(2, 2);
+
+ A.fill(Adata);
+ B.fill(Bdata);
+
+ checkConstructor3<double>(A, B);
+
+}
--- /dev/null
+
+DEAL::Init with vector memory, matrix 1 and matrix 2
+DEAL::Multiplying with all ones vector
+DEAL::Dimensions of result vector verified
+DEAL::Result vector data verified
+DEAL::17.0000 29.0000
--- /dev/null
+// ---------------------------------------------------------------------
+// $Id: product_matrix_01.cc 32491 2014-02-14 20:52:51Z bangerth $
+//
+// Copyright (C) 2014 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.
+//
+// ---------------------------------------------------------------------
+
+// Check ProductMatrix::vmult
+
+#include "../tests.h"
+#include <deal.II/base/logstream.h>
+#include <deal.II/lac/matrix_lib.h>
+#include <deal.II/lac/full_matrix.h>
+#include <deal.II/lac/vector.h>
+
+#include <fstream>
+#include <iomanip>
+#include <cmath>
+
+template<typename number>
+ void
+ checkVmult(FullMatrix<number> &A, FullMatrix<number> &B, Vector<number> &V)
+ {
+ deallog << "vmult" << std::endl;
+
+ GrowingVectorMemory < Vector<number> > mem;
+ ProductMatrix < Vector<number> > P(A, B, mem);
+
+ Vector<number> O(A.m());
+
+ P.vmult(O, V);
+
+ // Check the dimensions of the result matrix
+ Assert(A.m() == O.size(), ExcInternalError());
+ deallog << "Dimensions of result vector verified" << std::endl;
+
+ // Verifying results with Method 2: O=(A*B)*V
+ FullMatrix<number> AB_Product(A.m(), B.n());
+ Vector<number> O_(A.m());
+
+ A.mmult(AB_Product, B, false);
+ AB_Product.vmult(O_, V);
+
+ Assert(O == O_, ExcInternalError());
+ deallog << "Result vector data verified" << std::endl;
+
+ 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[] =
+ { 2, 3, 4, 5 };
+
+ const double Bdata[] =
+ { 0, 1, 2, 3 };
+
+ FullMatrix<double> A(2, 2);
+ FullMatrix<double> B(2, 2);
+
+ A.fill(Adata);
+ B.fill(Bdata);
+
+ Vector<double> V(2);
+ V(0) = 1;
+ V(1) = 2;
+
+ checkVmult<double>(A, B, V);
+
+}
--- /dev/null
+
+DEAL::vmult
+DEAL::Dimensions of result vector verified
+DEAL::Result vector data verified
+DEAL::28.0000 48.0000
--- /dev/null
+// ---------------------------------------------------------------------
+// $Id: product_matrix_01.cc 32491 2014-02-14 20:52:51Z bangerth $
+//
+// Copyright (C) 2014 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.
+//
+// ---------------------------------------------------------------------
+
+// Check ProductMatrix::vmult_add
+
+#include "../tests.h"
+#include <deal.II/base/logstream.h>
+#include <deal.II/lac/matrix_lib.h>
+#include <deal.II/lac/full_matrix.h>
+#include <deal.II/lac/vector.h>
+
+#include <fstream>
+#include <iomanip>
+#include <cmath>
+
+template<typename number>
+ void
+ checkVmult_add(FullMatrix<number> &A, FullMatrix<number> &B,
+ Vector<number> &V)
+ {
+ deallog << "vmult_add" << std::endl;
+ GrowingVectorMemory < Vector<number> > mem;
+ ProductMatrix < Vector<number> > P(A, B, mem);
+
+ deallog
+ << "Result vector set to all ones and to be added with product result vector"
+ << std::endl;
+ Vector<number> O(V.size());
+ for (unsigned int i = 0; i < O.size(); ++i)
+ O(i) = 1;
+
+ P.vmult_add(O, V);
+
+ // Check the dimensions of the result matrix
+ Assert(A.m() == O.size(), ExcInternalError());
+ deallog << "Dimensions of result vector verified" << std::endl;
+
+ // Verifying results with Method 2: O=(A*B)*V
+ FullMatrix<number> AB_Product(A.m(), B.n());
+ Vector<number> O_(A.m());
+ for (unsigned int i = 0; i < O_.size(); ++i)
+ O_(i) = 1;
+
+ A.mmult(AB_Product, B, false);
+ AB_Product.vmult_add(O_, V);
+
+ Assert(O == O_, ExcInternalError());
+ deallog << "Result vector data verified" << std::endl;
+
+ 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[] =
+ { 2, 3, 4, 5 };
+
+ const double Bdata[] =
+ { 0, 1, 2, 3 };
+
+ FullMatrix<double> A(2, 2);
+ FullMatrix<double> B(2, 2);
+
+ A.fill(Adata);
+ B.fill(Bdata);
+
+ Vector<double> V(2);
+ V(0) = 1;
+ V(1) = 2;
+
+ checkVmult_add<double>(A, B, V);
+
+}
--- /dev/null
+
+DEAL::vmult_add
+DEAL::Result vector set to all ones and to be added with product result vector
+DEAL::Dimensions of result vector verified
+DEAL::Result vector data verified
+DEAL::29.0000 49.0000
--- /dev/null
+// ---------------------------------------------------------------------
+// $Id: product_matrix_01.cc 32491 2014-02-14 20:52:51Z bangerth $
+//
+// Copyright (C) 2014 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.
+//
+// ---------------------------------------------------------------------
+
+// Check ProductMatrix::Tvmult
+
+#include "../tests.h"
+#include <deal.II/base/logstream.h>
+#include <deal.II/lac/matrix_lib.h>
+#include <deal.II/lac/full_matrix.h>
+#include <deal.II/lac/vector.h>
+
+#include <fstream>
+#include <iomanip>
+#include <cmath>
+
+template<typename number>
+ void
+ checkTvmult(FullMatrix<number> &A, FullMatrix<number> &B, Vector<number> &V)
+ {
+ deallog << "Tvmult" << std::endl;
+ GrowingVectorMemory < Vector<number> > mem;
+ ProductMatrix < Vector<number> > P(A, B, mem);
+
+ Vector<number> O(V.size());
+
+ P.Tvmult(O, V);
+
+ // Check the dimensions of the result matrix
+ Assert(A.m() == O.size(), ExcInternalError());
+ deallog << "Dimensions of result vector verified" << std::endl;
+
+ // Verifying results with Method 2: O=(A*B)*V
+ FullMatrix<number> AB_Product(A.m(), B.n());
+ Vector<number> O_(A.m());
+
+ A.mmult(AB_Product, B, false);
+ AB_Product.Tvmult(O_, V);
+
+ Assert(O == O_, ExcInternalError());
+ deallog << "Result vector data verified" << std::endl;
+
+ 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[] =
+ { 2, 3, 4, 5 };
+
+ const double Bdata[] =
+ { 0, 1, 2, 3 };
+
+ FullMatrix<double> A(2, 2);
+ FullMatrix<double> B(2, 2);
+
+ A.fill(Adata);
+ B.fill(Bdata);
+
+ Vector<double> V(2);
+ V(0) = 1;
+ V(1) = 2;
+
+ checkTvmult<double>(A, B, V);
+
+}
--- /dev/null
+
+DEAL::Tvmult
+DEAL::Dimensions of result vector verified
+DEAL::Result vector data verified
+DEAL::26.0000 49.0000
--- /dev/null
+// ---------------------------------------------------------------------
+// $Id: product_matrix_01.cc 32491 2014-02-14 20:52:51Z bangerth $
+//
+// Copyright (C) 2014 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.
+//
+// ---------------------------------------------------------------------
+
+// Check ProductMatrix::Tvmult_add
+
+#include "../tests.h"
+#include <deal.II/base/logstream.h>
+#include <deal.II/lac/matrix_lib.h>
+#include <deal.II/lac/full_matrix.h>
+#include <deal.II/lac/vector.h>
+
+#include <fstream>
+#include <iomanip>
+#include <cmath>
+
+template<typename number>
+ void
+ checkTvmult_add(FullMatrix<number> &A, FullMatrix<number> &B,
+ Vector<number> &V)
+ {
+ deallog << "Tvmult_add" << std::endl;
+ GrowingVectorMemory < Vector<number> > mem;
+ ProductMatrix < Vector<number> > P(A, B, mem);
+
+ deallog
+ << "Result vector set to all ones and to be added with product result vector"
+ << std::endl;
+ Vector<number> O(V.size());
+ for (unsigned int i = 0; i < O.size(); ++i)
+ O(i) = 1;
+
+ P.Tvmult_add(O, V);
+
+ // Check the dimensions of the result matrix
+ Assert(A.m() == O.size(), ExcInternalError());
+ deallog << "Dimensions of result vector verified" << std::endl;
+
+ // Verifying results with Method 2: O=(A*B)*V
+ FullMatrix<number> AB_Product(A.m(), B.n());
+ Vector<number> O_(A.m());
+ for (unsigned int i = 0; i < O_.size(); ++i)
+ O_(i) = 1;
+
+ A.mmult(AB_Product, B, false);
+ AB_Product.Tvmult_add(O_, V);
+
+ Assert(O == O_, ExcInternalError());
+ deallog << "Result vector data verified" << std::endl;
+
+ 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[] =
+ { 2, 3, 4, 5 };
+
+ const double Bdata[] =
+ { 0, 1, 2, 3 };
+
+ FullMatrix<double> A(2, 2);
+ FullMatrix<double> B(2, 2);
+
+ A.fill(Adata);
+ B.fill(Bdata);
+
+ Vector<double> V(2);
+ V(0) = 1;
+ V(1) = 2;
+
+ checkTvmult_add<double>(A, B, V);
+
+}
--- /dev/null
+
+DEAL::Tvmult_add
+DEAL::Result vector set to all ones and to be added with product result vector
+DEAL::Dimensions of result vector verified
+DEAL::Result vector data verified
+DEAL::27.0000 50.0000
--- /dev/null
+// ---------------------------------------------------------------------
+// $Id: product_matrix_01.cc 32491 2014-02-14 20:52:51Z bangerth $
+//
+// Copyright (C) 2014 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.
+//
+// ---------------------------------------------------------------------
+
+// Check ProductMatrix::clear
+
+#include "../tests.h"
+#include <deal.II/base/logstream.h>
+#include <deal.II/lac/matrix_lib.h>
+#include <deal.II/lac/full_matrix.h>
+#include <deal.II/lac/vector.h>
+
+#include <fstream>
+#include <iomanip>
+#include <cmath>
+
+template<typename number>
+ void
+ checkClear(FullMatrix<number> &A, FullMatrix<number> &B,
+ FullMatrix<number> &C, FullMatrix<number> &D)
+ {
+ deallog << "clear" << std::endl;
+ deallog << "Init with vector memory, matrix 1 and matrix 2" << std::endl;
+ GrowingVectorMemory < Vector<number> > mem;
+ ProductMatrix < Vector<number> > P(A, B, mem);
+
+ deallog << "Multiplying with all ones vector" << std::endl;
+ Vector<number> V(B.n());
+ for (unsigned int i = 0; i < V.size(); ++i)
+ V(i) = 1;
+
+ Vector<number> O(A.m());
+
+ P.vmult(O, V);
+
+ // Check the dimensions of the result vector
+ Assert(A.m() == O.size(), ExcInternalError());
+ deallog << "Dimensions of result vector verified" << std::endl;
+
+ // Verifying results with Method 2: O=(A*B)*V
+ FullMatrix<number> AB_Product(A.m(), B.n());
+ Vector<number> O_(A.m());
+
+ A.mmult(AB_Product, B, false);
+ AB_Product.vmult(O_, V);
+
+ Assert(O == O_, ExcInternalError());
+ deallog << "Result vector data verified" << std::endl;
+
+ for (unsigned int i = 0; i < O.size(); ++i)
+ deallog << O(i) << '\t';
+ deallog << std::endl;
+
+ deallog << "Clearing product matrix" << std::endl;
+ P.clear();
+
+ deallog << "Reinitializing product matrix with matrix 3 and matrix 4"
+ << std::endl;
+ P.reinit(C, D);
+
+ deallog << "Multiplying with all ones vector" << std::endl;
+ Vector<number> _V(D.n());
+ for (unsigned int i = 0; i < _V.size(); ++i)
+ _V(i) = 1;
+
+ Vector<number> _O(C.m());
+
+ P.vmult(_O, _V);
+
+ // Check the dimensions of the result vector
+ Assert(C.m() == _O.size(), ExcInternalError());
+ deallog << "Dimensions of result vector verified" << std::endl;
+
+ // Verifying results with Method 2: _O=(C*D)*_V
+ FullMatrix<number> CD_Product(C.m(), D.n());
+ Vector<number> _O_(C.m());
+
+ C.mmult(CD_Product, D, false);
+ CD_Product.vmult(_O_, _V);
+
+ Assert(_O == _O_, ExcInternalError());
+ deallog << "Result vector data verified" << std::endl;
+
+ 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[] =
+ { 2, 3, 4, 5 };
+
+ const double Bdata[] =
+ { 0, 1, 2, 3 };
+
+ const double Cdata[] =
+ { 1, 2, 3, 4, 5, 6, 7, 8, 9 };
+
+ const double Ddata[] =
+ { 10, 11, 12, 13, 14, 15, 16, 17, 18 };
+
+ FullMatrix<double> A(2, 2);
+ FullMatrix<double> B(2, 2);
+ FullMatrix<double> C(3, 3);
+ FullMatrix<double> D(3, 3);
+
+ A.fill(Adata);
+ B.fill(Bdata);
+ C.fill(Cdata);
+ D.fill(Ddata);
+
+ checkClear<double>(A, B, C, D);
+
+}
--- /dev/null
+
+DEAL::clear
+DEAL::Init with vector memory, matrix 1 and matrix 2
+DEAL::Multiplying with all ones vector
+DEAL::Dimensions of result vector verified
+DEAL::Result vector data verified
+DEAL::17.0000 29.0000
+DEAL::Clearing product matrix
+DEAL::Reinitializing product matrix with matrix 3 and matrix 4
+DEAL::Multiplying with all ones vector
+DEAL::Dimensions of result vector verified
+DEAL::Result vector data verified
+DEAL::270.0000 648.0000 1026.0000