From 12d8432ca8e4005ea36a0ffa4437299bf8748c96 Mon Sep 17 00:00:00 2001 From: Wolfgang Bangerth Date: Tue, 20 Mar 2018 17:06:50 -0600 Subject: [PATCH] Add a test. --- .../sparsity_pattern_full_matrix_01.cc | 62 +++++++++++++++++++ .../sparsity_pattern_full_matrix_01.output | 4 ++ 2 files changed, 66 insertions(+) create mode 100644 tests/sparsity/sparsity_pattern_full_matrix_01.cc create mode 100644 tests/sparsity/sparsity_pattern_full_matrix_01.output diff --git a/tests/sparsity/sparsity_pattern_full_matrix_01.cc b/tests/sparsity/sparsity_pattern_full_matrix_01.cc new file mode 100644 index 0000000000..be189878a8 --- /dev/null +++ b/tests/sparsity/sparsity_pattern_full_matrix_01.cc @@ -0,0 +1,62 @@ + +// --------------------------------------------------------------------- +// +// Copyright (C) 2004 - 2017 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 SparsityPattern::copy_from(FullMatrix). This function took +// extraordinary amounts of CPU time: for a 1 x 400,000 matrix, it +// took around 50 seconds; after the patch that fixed the quadratic +// behavior, it takes less than one second +// +// To make sure we really catch the old bevahior through the test +// suite time out, we also do a matrix of size 1 x 4,000,000, which +// would have taken more than an hour before and now still takes less +// than one second. Finally, also try a square matrix because this +// case is treated specially in the function. + +#include "../tests.h" +#include +#include + + +void test (const unsigned int M, + const unsigned int N) +{ + SparsityPattern sp (M,N); + + // fill a full matrix completely + FullMatrix mat(M,N); + for (unsigned int m=0; m