]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
Fix a bug introduced yesterday.
authorbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 13 Feb 2013 14:01:34 +0000 (14:01 +0000)
committerbangerth <bangerth@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 13 Feb 2013 14:01:34 +0000 (14:01 +0000)
git-svn-id: https://svn.dealii.org/trunk@28367 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/include/deal.II/lac/full_matrix.h
tests/lac/copy_transposed.cc [new file with mode: 0644]
tests/lac/copy_transposed/cmp/generic [new file with mode: 0644]

index e4cf4d500d756a0a28e34661f2458dcba9ffe226..c2a22dd377b54e493bb9c9c82d6e5aa273703ecf 100644 (file)
@@ -1545,7 +1545,7 @@ FullMatrix<number>::copy_transposed (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);
diff --git a/tests/lac/copy_transposed.cc b/tests/lac/copy_transposed.cc
new file mode 100644 (file)
index 0000000..cb24aeb
--- /dev/null
@@ -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 FullMatrix::copy_transposed
+
+#include "../tests.h"
+
+#include <deal.II/base/logstream.h>
+
+#include <deal.II/lac/full_matrix.h>
+#include <deal.II/lac/lapack_full_matrix.h>
+#include <deal.II/lac/sparse_matrix.h>
+#include <deal.II/lac/sparse_matrix_ez.h>
+
+#include <fstream>
+
+int main()
+{
+  std::ofstream logfile("copy_transposed/output");
+  logfile.setf(std::ios::fixed);
+  deallog << std::setprecision(3);
+  deallog.attach(logfile);
+  deallog.depth_console(0);
+  deallog.threshold_double(1.e-10);
+
+  SparseMatrixEZ<double> 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<float>::copy_transposed  SparseMatrixEZ<double>"
+         << std::endl;
+  FullMatrix<float> ff;
+  ff.copy_transposed(ez);
+  ff.print_formatted(logfile, 0, false, 5, "~");
+}
diff --git a/tests/lac/copy_transposed/cmp/generic b/tests/lac/copy_transposed/cmp/generic
new file mode 100644 (file)
index 0000000..bd73872
--- /dev/null
@@ -0,0 +1,6 @@
+
+DEAL::FullMatrix<float>::copy_transposed  SparseMatrixEZ<double>
+2.    5.    8.    ~     12.   
+~     6.    9.    ~     ~     
+3.    ~     10.   ~     13.   
+4.    7.    11.   ~     14.   

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.