From b3ef98f87e5625e35259f1b427c85bc1bd54e0bb Mon Sep 17 00:00:00 2001 From: kanschat Date: Fri, 23 Mar 2012 21:55:11 +0000 Subject: [PATCH] add a function to copy from a transposed matrix git-svn-id: https://svn.dealii.org/trunk@25321 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/include/deal.II/lac/full_matrix.h | 24 +++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/deal.II/include/deal.II/lac/full_matrix.h b/deal.II/include/deal.II/lac/full_matrix.h index 4f69a546e4..a21c499a14 100644 --- a/deal.II/include/deal.II/lac/full_matrix.h +++ b/deal.II/include/deal.II/lac/full_matrix.h @@ -354,6 +354,17 @@ class FullMatrix : public Table<2,number> template void copy_from (const MATRIX&); + /** + * Transposing assignment from + * different matrix classes. This + * assignment operator uses + * iterators of the class + * MATRIX. Therefore, sparse + * matrices are possible sources. + */ + template + void copy_transposed (const MATRIX&); + /** * Fill rectangular block. * @@ -1427,6 +1438,19 @@ FullMatrix::copy_from (const MATRIX& M) } +template +template +void +FullMatrix::copy_transposed (const MATRIX& M) +{ + this->reinit (M.n(), M.m()); + const typename MATRIX::const_iterator end = M.end(); + for (typename MATRIX::const_iterator entry = M.begin(); + entry != end; ++entry) + this->el(entry->column(), entry->row()) = entry->value(); +} + + template template void -- 2.39.5