+++ /dev/null
-// ---------------------------------------------------------------------
-//
-// Copyright (C) 2014 - 2015 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 ShiftedMatrix::checkConstructor
-
-#include "../tests.h"
-#include <deal.II/base/logstream.h>
-#include <deal.II/lac/shifted_matrix.h>
-#include <deal.II/lac/full_matrix.h>
-#include <deal.II/lac/vector.h>
-
-#include <fstream>
-#include <iomanip>
-#include <cmath>
-
-template<typename number>
-void
-checkConstructor(FullMatrix<number> &A, double sigma)
-{
- deallog << "constructor" << std::endl;
-
- ShiftedMatrix < FullMatrix<number> > S(A, sigma);
-
- deallog << "Multiplying with all ones vector" << std::endl;
- Vector<number> V(A.n());
- for (unsigned int i = 0; i < V.size(); ++i)
- V(i) = 1;
-
- Vector<number> O(A.m());
-
- S.vmult(O, V);
-
- // Check the dimensions of the result matrix
- Assert(A.m() == O.size(), ExcInternalError());
- deallog << "Dimensions of result vector 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.threshold_double(1.e-10);
-
- const double Adata[] =
- { 2, 3, 4, 5 };
-
- FullMatrix<double> A(2, 2);
-
- A.fill(Adata);
-
- checkConstructor<double>(A, 2);
-}
+++ /dev/null
-
-DEAL::constructor
-DEAL::Multiplying with all ones vector
-DEAL::Dimensions of result vector verified
-DEAL::7.0000 11.0000
+++ /dev/null
-// ---------------------------------------------------------------------
-//
-// Copyright (C) 2014 - 2015 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 ShiftedMatrix::checkVmult
-
-#include "../tests.h"
-#include <deal.II/base/logstream.h>
-#include <deal.II/lac/shifted_matrix.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, double sigma, Vector<number> &V)
-{
- deallog << "vmult" << std::endl;
-
- ShiftedMatrix < FullMatrix<number> > S(A, sigma);
- Vector<number> O(A.m());
-
- S.vmult(O, V);
-
- // Check the dimensions of the result matrix
- Assert(A.m() == O.size(), ExcInternalError());
- deallog << "Dimensions of result vector 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.threshold_double(1.e-10);
-
- const double Adata[] =
- { 2, 3, 4, 5 };
-
- FullMatrix<double> A(2, 2);
-
- A.fill(Adata);
-
- Vector<double> V(2);
- V(0) = 1;
- V(1) = 2;
-
- checkVmult<double>(A, 2, V);
-}
+++ /dev/null
-
-DEAL::vmult
-DEAL::Dimensions of result vector verified
-DEAL::10.0000 18.0000
+++ /dev/null
-// ---------------------------------------------------------------------
-//
-// Copyright (C) 2014 - 2015 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 ShiftedMatrix::checkResidual
-
-#include "../tests.h"
-#include <deal.II/base/logstream.h>
-#include <deal.II/lac/shifted_matrix.h>
-#include <deal.II/lac/full_matrix.h>
-#include <deal.II/lac/vector.h>
-
-#include <fstream>
-#include <iomanip>
-#include <cmath>
-
-template<typename number>
-void
-checkResidual(FullMatrix<number> &A, double sigma, Vector<number> &V,
- Vector<number> &R)
-{
- deallog << "residual" << std::endl;
-
- ShiftedMatrix < FullMatrix<number> > S(A, sigma);
- Vector<number> O(A.m());
- double residual;
-
- residual = S.residual(O, V, R);
-
- // Check the dimensions of the result matrix
- Assert(A.m() == O.size(), ExcInternalError());
- deallog << "Dimensions of result vector verified" << std::endl;
-
- deallog << "Residual vector" << std::endl;
- for (unsigned int i = 0; i < O.size(); ++i)
- deallog << O(i) << '\t';
- deallog << std::endl;
-
- deallog << "Residual value" << std::endl;
- deallog << residual << std::endl;
-}
-
-int
-main()
-{
- std::ofstream logfile("output");
- deallog << std::fixed;
- deallog << std::setprecision(4);
- deallog.attach(logfile);
- deallog.threshold_double(1.e-10);
-
- const double Adata[] =
- { 2, 3, 4, 5 };
-
- FullMatrix<double> A(2, 2);
-
- A.fill(Adata);
-
- Vector<double> V(2);
- V(0) = 1;
- V(1) = 2;
-
- Vector<double> R(2);
- R(0) = 1;
- R(1) = 1;
-
- checkResidual<double>(A, 2, V, R);
-}
+++ /dev/null
-
-DEAL::residual
-DEAL::Dimensions of result vector verified
-DEAL::Residual vector
-DEAL::-9.0000 -17.0000
-DEAL::Residual value
-DEAL::19.2354
+++ /dev/null
-// ---------------------------------------------------------------------
-//
-// Copyright (C) 2014 - 2015 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 ShiftedMatrix::checkSetSigma
-
-#include "../tests.h"
-#include <deal.II/base/logstream.h>
-#include <deal.II/lac/shifted_matrix.h>
-#include <deal.II/lac/full_matrix.h>
-#include <deal.II/lac/vector.h>
-
-#include <fstream>
-#include <iomanip>
-#include <cmath>
-
-template<typename number>
-void
-checkSetSigma(FullMatrix<number> &A, double sigma)
-{
- deallog << "shift(sigma)" << std::endl;
-
- deallog << "Init ShiftedMatrix with sigma=0" << std::endl;
- ShiftedMatrix < FullMatrix<number> > S(A, 0);
-
- deallog << "Multiplying with all ones vector" << std::endl;
- Vector<number> V(A.n());
- for (unsigned int i = 0; i < V.size(); ++i)
- V(i) = 1;
-
- Vector<number> O(A.m());
-
- S.vmult(O, V);
-
- // Check the dimensions of the result matrix
- Assert(A.m() == O.size(), ExcInternalError());
- deallog << "Dimensions of result vector verified" << std::endl;
-
- for (unsigned int i = 0; i < O.size(); ++i)
- deallog << O(i) << '\t';
- deallog << std::endl;
-
- deallog << "Setting new sigma value" << std::endl;
- S.shift(sigma);
-
- deallog << "Multiplying with all ones vector" << std::endl;
- S.vmult(O, V);
-
- // Check the dimensions of the result matrix
- Assert(A.m() == O.size(), ExcInternalError());
- deallog << "Dimensions of result vector 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.threshold_double(1.e-10);
-
- const double Adata[] =
- { 2, 3, 4, 5 };
-
- FullMatrix<double> A(2, 2);
-
- A.fill(Adata);
-
- checkSetSigma<double>(A, 2);
-}
+++ /dev/null
-
-DEAL::shift(sigma)
-DEAL::Init ShiftedMatrix with sigma=0
-DEAL::Multiplying with all ones vector
-DEAL::Dimensions of result vector verified
-DEAL::5.0000 9.0000
-DEAL::Setting new sigma value
-DEAL::Multiplying with all ones vector
-DEAL::Dimensions of result vector verified
-DEAL::7.0000 11.0000
+++ /dev/null
-// ---------------------------------------------------------------------
-//
-// Copyright (C) 2014 - 2015 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 ShiftedMatrix::checkGetSigma
-
-#include "../tests.h"
-#include <deal.II/base/logstream.h>
-#include <deal.II/lac/shifted_matrix.h>
-#include <deal.II/lac/full_matrix.h>
-#include <deal.II/lac/vector.h>
-
-#include <fstream>
-#include <iomanip>
-#include <cmath>
-
-template<typename number>
-void
-checkGetSigma(FullMatrix<number> &A)
-{
- deallog << "shift()" << std::endl;
-
- deallog << "Init ShiftedMatrix with sigma=0" << std::endl;
- ShiftedMatrix < FullMatrix<number> > S(A, 0);
-
- deallog << "Multiplying with all ones vector" << std::endl;
- Vector<number> V(A.n());
- for (unsigned int i = 0; i < V.size(); ++i)
- V(i) = 1;
-
- Vector<number> O(A.m());
-
- S.vmult(O, V);
-
- // Check the dimensions of the result matrix
- Assert(A.m() == O.size(), ExcInternalError());
- deallog << "Dimensions of result vector verified" << std::endl;
-
- for (unsigned int i = 0; i < O.size(); ++i)
- deallog << O(i) << '\t';
- deallog << std::endl;
-
- deallog << "Setting new sigma value by incrementing old value by 1"
- << std::endl;
-
- deallog << "Old sigma value" << std::endl;
- double sigma = S.shift();
- deallog << sigma << std::endl;
- sigma = sigma + 1;
- deallog << "New sigma value" << std::endl;
- deallog << sigma << std::endl;
-
- S.shift(sigma);
-
- deallog << "Multiplying with all ones vector" << std::endl;
- S.vmult(O, V);
-
- // Check the dimensions of the result matrix
- Assert(A.m() == O.size(), ExcInternalError());
- deallog << "Dimensions of result vector 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.threshold_double(1.e-10);
-
- const double Adata[] =
- { 2, 3, 4, 5 };
-
- FullMatrix<double> A(2, 2);
-
- A.fill(Adata);
-
- checkGetSigma<double>(A);
-}
+++ /dev/null
-
-DEAL::shift()
-DEAL::Init ShiftedMatrix with sigma=0
-DEAL::Multiplying with all ones vector
-DEAL::Dimensions of result vector verified
-DEAL::5.0000 9.0000
-DEAL::Setting new sigma value by incrementing old value by 1
-DEAL::Old sigma value
-DEAL::0
-DEAL::New sigma value
-DEAL::1.0000
-DEAL::Multiplying with all ones vector
-DEAL::Dimensions of result vector verified
-DEAL::6.0000 10.0000
+++ /dev/null
-#include <deal.II/base/logstream.h>
-
-#include <deal.II/lac/full_matrix.h>
-#include <deal.II/lac/shifted_matrix.h>
-#include <deal.II/lac/vector.h>
-
-#include <fstream>
-
-int main()
-{
- using namespace dealii;
-
- std::ofstream logfile("output");
- deallog << std::fixed;
- deallog << std::setprecision(4);
- deallog.attach(logfile);
- deallog.threshold_double(1.e-10);
-
- FullMatrix<double> m1(2, 2);
- FullMatrix<double> m2(2, 2);
-
- m1(0, 0) = 2.0;
- m1(0, 1) = 1.0;
- m1(1, 0) = 1.0;
- m1(1, 1) = 2.0;
-
- m2(0, 0) = 1.0;
- m2(0, 1) = 1.0;
- m2(1, 0) = 1.0;
- m2(1, 1) = 1.0;
-
- ShiftedMatrixGeneralized<FullMatrix<double>, FullMatrix<double>, Vector<double> >
- shifted_matrix(m1, m2, 2.0);
-
- Vector<double> src(2);
- src[0] = 3.0;
- src[1] = 7.0;
- Vector<double> dst(2);
- shifted_matrix.vmult(dst, src);
-
- deallog << dst[0] << ", ";
- deallog << dst[1] << std::endl;
-}
+++ /dev/null
-
-DEAL::33.0000, 37.0000