From: Wolfgang Bangerth Date: Wed, 13 Feb 2013 14:44:21 +0000 (+0000) Subject: Fix this bug two more times. X-Git-Tag: v8.0.0~1315 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dff14f7a06565558e391d4a91dd6e41b735c6254;p=dealii.git Fix this bug two more times. git-svn-id: https://svn.dealii.org/trunk@28372 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/include/deal.II/lac/lapack_full_matrix.h b/deal.II/include/deal.II/lac/lapack_full_matrix.h index 74ae45cef1..fa0598bfb4 100644 --- a/deal.II/include/deal.II/lac/lapack_full_matrix.h +++ b/deal.II/include/deal.II/lac/lapack_full_matrix.h @@ -1,7 +1,7 @@ //--------------------------------------------------------------------------- // $Id$ // -// Copyright (C) 2005, 2006, 2008, 2009, 2010, 2012 by the deal.II authors +// Copyright (C) 2005, 2006, 2008, 2009, 2010, 2012, 2013 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -709,7 +709,7 @@ LAPACKFullMatrix::copy_from (const MATRIX &M) // loop over the elements of the argument matrix row by row, as suggested // in the documentation of the sparse matrix iterator class, and // copy them into the current object - for (unsigned int row = 0; row < M.n(); ++row) + for (unsigned int row = 0; row < M.m(); ++row) { const typename MATRIX::const_iterator end_row = M.end(row); for (typename MATRIX::const_iterator entry = M.begin(row); @@ -736,7 +736,7 @@ LAPACKFullMatrix::fill ( { // loop over the elements of the argument matrix row by row, as suggested // in the documentation of the sparse matrix iterator class - for (unsigned int row = src_offset_i; row < M.n(); ++row) + for (unsigned int row = src_offset_i; row < M.m(); ++row) { const typename MATRIX::const_iterator end_row = M.end(row); for (typename MATRIX::const_iterator entry = M.begin(row); diff --git a/tests/lac/matrices_lapack.cc b/tests/lac/matrices_lapack.cc new file mode 100644 index 0000000000..a8c0bda385 --- /dev/null +++ b/tests/lac/matrices_lapack.cc @@ -0,0 +1,55 @@ +//---------------------------------------------------------------------- +// $Id$ +// +// Copyright (C) 2005, 2013 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. +// +//---------------------------------------------------------------------- + +// Test LAPACKFullMatrix::copy_from + +#include "../tests.h" + +#include + +#include +#include +#include +#include + +#include + +int main() +{ + std::ofstream logfile("matrices_lapack/output"); + logfile.setf(std::ios::fixed); + deallog << std::setprecision(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 << "SparseMatrixEZ::copy_from SparseMatrixEZ" + << std::endl; + LAPACKFullMatrix ff; + ff.copy_from(ez); + ff.print_formatted(logfile, 0, false, 5, "~"); +} diff --git a/tests/lac/matrices_lapack/cmp/generic b/tests/lac/matrices_lapack/cmp/generic new file mode 100644 index 0000000000..073151f38d --- /dev/null +++ b/tests/lac/matrices_lapack/cmp/generic @@ -0,0 +1,7 @@ + +DEAL::SparseMatrixEZ::copy_from SparseMatrixEZ +2. ~ 3. 4. +5. 6. ~ 7. +8. 9. 10. 11. +~ ~ ~ ~ +12. ~ 13. 14. diff --git a/tests/lac/matrices_lapack_fill.cc b/tests/lac/matrices_lapack_fill.cc new file mode 100644 index 0000000000..eb1ebe4158 --- /dev/null +++ b/tests/lac/matrices_lapack_fill.cc @@ -0,0 +1,66 @@ +//---------------------------------------------------------------------- +// $Id$ +// +// Copyright (C) 2005, 2013 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. +// +//---------------------------------------------------------------------- + +// Test LAPACKFullMatrix::fill + +#include "../tests.h" + +#include + +#include +#include +#include +#include + +#include + +int main() +{ + std::ofstream logfile("matrices_lapack_fill/output"); + logfile.setf(std::ios::fixed); + deallog << std::setprecision(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 << "SparseMatrixEZ::fill SparseMatrixEZ" + << std::endl; + LAPACKFullMatrix ff(ez.m(), ez.n()); + ff.fill(ez, 0,0,0,0, 1, false); + ff.print_formatted(logfile, 0, false, 5, "~"); + } + + { + deallog << "SparseMatrixEZ::fill SparseMatrixEZ transpose" + << std::endl; + LAPACKFullMatrix ff(ez.n(), ez.m()); + ff.fill(ez, 0,0,0,0, 1, true); + ff.print_formatted(logfile, 0, false, 5, "~"); + } + +} diff --git a/tests/lac/matrices_lapack_fill/cmp/generic b/tests/lac/matrices_lapack_fill/cmp/generic new file mode 100644 index 0000000000..073151f38d --- /dev/null +++ b/tests/lac/matrices_lapack_fill/cmp/generic @@ -0,0 +1,7 @@ + +DEAL::SparseMatrixEZ::copy_from SparseMatrixEZ +2. ~ 3. 4. +5. 6. ~ 7. +8. 9. 10. 11. +~ ~ ~ ~ +12. ~ 13. 14.