From 7758075471c79b36acf0a2c6e3e9c9abeee79ee9 Mon Sep 17 00:00:00 2001 From: weiler Date: Fri, 27 Aug 2010 09:45:30 +0000 Subject: [PATCH] new test git-svn-id: https://svn.dealii.org/trunk@21744 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/lac/full_matrix_03.cc | 62 ++++++++++++++++++++++++++++ tests/lac/full_matrix_03/cmp/generic | 2 + 2 files changed, 64 insertions(+) create mode 100644 tests/lac/full_matrix_03.cc create mode 100644 tests/lac/full_matrix_03/cmp/generic diff --git a/tests/lac/full_matrix_03.cc b/tests/lac/full_matrix_03.cc new file mode 100644 index 0000000000..8d46951cbb --- /dev/null +++ b/tests/lac/full_matrix_03.cc @@ -0,0 +1,62 @@ +//---------------------------- full_matrix_03.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_03.cc,v --------------------------- + +//check method TmTmult 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_03/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 Za(3,3,entries_Z); + FullMatrix Zb(3,3,entries_Z); + FullMatrix C(3,3); + FullMatrix D(3,3); + + //compute C= A^T*B^T in two different ways and compare for equality + Za.Tadd(1.,A); + Zb.Tadd(1.,B); + Za.mmult(D,Zb); + A.TmTmult(C,B); + + D.add(-1,C); + Assert ( D.frobenius_norm() < 1e-15, + ExcInternalError()); + deallog << "OK" << std::endl; +} diff --git a/tests/lac/full_matrix_03/cmp/generic b/tests/lac/full_matrix_03/cmp/generic new file mode 100644 index 0000000000..0fd8fc12f0 --- /dev/null +++ b/tests/lac/full_matrix_03/cmp/generic @@ -0,0 +1,2 @@ + +DEAL::OK -- 2.39.5