From 62d5ca3e348488182fba5ee67560cd49bd834034 Mon Sep 17 00:00:00 2001 From: weiler Date: Fri, 27 Aug 2010 09:37:45 +0000 Subject: [PATCH] new test git-svn-id: https://svn.dealii.org/trunk@21743 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/lac/Makefile | 2 +- tests/lac/full_matrix_02.cc | 60 ++++++++++++++++++++++++++++ tests/lac/full_matrix_02/cmp/generic | 2 + 3 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 tests/lac/full_matrix_02.cc create mode 100644 tests/lac/full_matrix_02/cmp/generic diff --git a/tests/lac/Makefile b/tests/lac/Makefile index b13c42ad00..c4db3fd013 100644 --- a/tests/lac/Makefile +++ b/tests/lac/Makefile @@ -21,7 +21,7 @@ default: run-tests ############################################################ tests_x = vector-vector vector_memory \ - full_matrix \ + full_matrix* \ householder \ tridiagonal_matrix \ tridiagonal_matrix_sym \ diff --git a/tests/lac/full_matrix_02.cc b/tests/lac/full_matrix_02.cc new file mode 100644 index 0000000000..7b66e240dd --- /dev/null +++ b/tests/lac/full_matrix_02.cc @@ -0,0 +1,60 @@ +//---------------------------- full_matrix_02.cc,v --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2010 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. +// +//---------------------------- full_matrix_02.cc,v --------------------------- + +//check method mTmult of FullMatrix + +#include "../tests.h" +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +const double entries_A[9] = { 1,2,3,4,5,6,7,8,9 }; +const double entries_B[9] = { 2,1,1,1,2,3,2,1,2 }; +const double entries_Z[9] = { 0,0,0,0,0,0,0,0,0 }; + +// Create a positive definite random matrix + +int +main () +{ + std::ofstream logfile("full_matrix_02/output"); + deallog << std::fixed; + deallog << std::setprecision(3); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + std::srand(3391466); + + FullMatrix A(3,3,entries_A); + FullMatrix B(3,3,entries_B); + FullMatrix Z(3,3,entries_Z); + FullMatrix C(3,3); + FullMatrix D(3,3); + + //compute C= A*B^T in two different ways and compare for equality + Z.Tadd(1.,B); + A.mmult(D,Z); + A.mTmult(C,B); + + D.add(-1,C); + Assert ( D.frobenius_norm() < 1e-15, + ExcInternalError()); + deallog << "OK" << std::endl; +} diff --git a/tests/lac/full_matrix_02/cmp/generic b/tests/lac/full_matrix_02/cmp/generic new file mode 100644 index 0000000000..0fd8fc12f0 --- /dev/null +++ b/tests/lac/full_matrix_02/cmp/generic @@ -0,0 +1,2 @@ + +DEAL::OK -- 2.39.5