From a46b125ff416cdbdf6da42dcf8145410e64bfe32 Mon Sep 17 00:00:00 2001 From: David Wells Date: Thu, 17 Dec 2015 16:10:19 -0500 Subject: [PATCH] Add a test for the generalized shifted matrix. --- tests/lac/shifted_matrix_generalized_01.cc | 43 +++++++++++++++++++ .../lac/shifted_matrix_generalized_01.output | 2 + 2 files changed, 45 insertions(+) create mode 100644 tests/lac/shifted_matrix_generalized_01.cc create mode 100644 tests/lac/shifted_matrix_generalized_01.output diff --git a/tests/lac/shifted_matrix_generalized_01.cc b/tests/lac/shifted_matrix_generalized_01.cc new file mode 100644 index 0000000000..47aa057a3d --- /dev/null +++ b/tests/lac/shifted_matrix_generalized_01.cc @@ -0,0 +1,43 @@ +#include + +#include +#include +#include + +#include + +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 m1(2, 2); + FullMatrix 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, Vector > + shifted_matrix(m1, m2, 2.0); + + Vector src(2); + src[0] = 3.0; + src[1] = 7.0; + Vector dst(2); + shifted_matrix.vmult(dst, src); + + deallog << dst[0] << ", "; + deallog << dst[1] << std::endl; +} diff --git a/tests/lac/shifted_matrix_generalized_01.output b/tests/lac/shifted_matrix_generalized_01.output new file mode 100644 index 0000000000..e40ef7690c --- /dev/null +++ b/tests/lac/shifted_matrix_generalized_01.output @@ -0,0 +1,2 @@ + +DEAL::33.0000, 37.0000 -- 2.39.5