From: guido Date: Tue, 3 May 2005 19:25:46 +0000 (+0000) Subject: test for matrix copy between types X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fafabcbbc7628526e4880e962f0744590c2416f2;p=dealii-svn.git test for matrix copy between types git-svn-id: https://svn.dealii.org/trunk@10636 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/tests/lac/Makefile b/tests/lac/Makefile index 42fd73394d..d1f09eba66 100644 --- a/tests/lac/Makefile +++ b/tests/lac/Makefile @@ -22,7 +22,7 @@ default: run-tests tests_x = vector-vector \ full_matrix householder tridiagonal_matrix \ - sparsity_pattern sparse_matrices \ + sparsity_pattern sparse_matrices matrices \ block_vector block_vector_iterator block_matrices \ matrix_lib matrix_out \ solver eigen \ diff --git a/tests/lac/matrices.cc b/tests/lac/matrices.cc new file mode 100644 index 0000000000..d0b719ab23 --- /dev/null +++ b/tests/lac/matrices.cc @@ -0,0 +1,72 @@ +//---------------------------- full_matrix.cc,v --------------------------- +// $Id$ +// Version: $Name$ +// +// Copyright (C) 2005 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.cc,v --------------------------- + +// Test copying between matrices (copy_from and fill) + +#include "../tests.h" + +#include + +#include +#include +#include +#include + +#include + +int main() +{ + std::ofstream logfile("matrices.output"); + logfile.setf(std::ios::fixed); + logfile.precision(3); + deallog.attach(logfile); + deallog.depth_console(0); + deallog.threshold_double(1.e-10); + + SparseMatrixEZ ez(5,4); + ez.set(0,0,2.); + ez.set(0,2,3.); + ez.set(0,3,4.); + ez.set(1,0,5.); + ez.set(1,1,6.); + ez.set(1,3,7.); + ez.set(2,0,8.); + ez.set(2,1,9.); + ez.set(2,2,10.); + ez.set(2,3,11.); + ez.set(4,0,12.); + ez.set(4,2,13.); + ez.set(4,3,14.); + + deallog << "FullMatrix::copy_from SparseMatrixEZ" + << std::endl; + FullMatrix ff; + ff.copy_from(ez); + ff.print_formatted(logfile, 0, false, 5, "~"); + + deallog << "LAPACKFullMatrix::copy_from SparseMatrixEZ" + << std::endl; + LAPACKFullMatrix lfd; + lfd.copy_from(ez); + lfd.print_formatted(logfile, 0, false, 5, "~"); + + lfd.reinit(2, 3); + deallog << "LAPACKFullMatrix::fill SparseMatrixEZ" + << std::endl; + lfd.fill(ez, 0, 0, 2, 1); + lfd.print_formatted(logfile, 0, false, 5, "~"); + deallog << "LAPACKFullMatrix::fill SparseMatrixEZ" + << std::endl; + lfd.fill(ez, 1, 1, 4, 2); + lfd.print_formatted(logfile, 0, false, 5, "~"); +} diff --git a/tests/results/i686-pc-linux-gnu+gcc3.2/lac/matrices.output b/tests/results/i686-pc-linux-gnu+gcc3.2/lac/matrices.output new file mode 100644 index 0000000000..1301fd7b35 --- /dev/null +++ b/tests/results/i686-pc-linux-gnu+gcc3.2/lac/matrices.output @@ -0,0 +1,19 @@ + +DEAL::FullMatrix::copy_from SparseMatrixEZ +2. ~ 3. 4. +5. 6. ~ 7. +8. 9. 10. 11. +~ ~ ~ ~ +12. ~ 13. 14. +DEAL::LAPACKFullMatrix::copy_from SparseMatrixEZ +2. ~ 3. 4. +5. 6. ~ 7. +8. 9. 10. 11. +~ ~ ~ ~ +12. ~ 13. 14. +DEAL::LAPACKFullMatrix::fill SparseMatrixEZ +9. 10. 11. +~ ~ ~ +DEAL::LAPACKFullMatrix::fill SparseMatrixEZ +9. 10. 11. +~ 13. 14.