From: guido Date: Wed, 8 Jan 2003 10:30:35 +0000 (+0000) Subject: new FullMatrix::operator= X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5eff5ef9ea60bb808e3aa30f23939a3216e0a089;p=dealii-svn.git new FullMatrix::operator= git-svn-id: https://svn.dealii.org/trunk@6886 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/lac/include/lac/full_matrix.h b/deal.II/lac/include/lac/full_matrix.h index e3ef013dd5..0e97233191 100644 --- a/deal.II/lac/include/lac/full_matrix.h +++ b/deal.II/lac/include/lac/full_matrix.h @@ -2,7 +2,7 @@ // $Id$ // Version: $Name$ // -// Copyright (C) 1998, 1999, 2000, 2001, 2002 by the deal.II authors +// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 by the deal.II authors // // This file is subject to QPL and may not be distributed // without copyright and license information. Please refer @@ -103,7 +103,7 @@ class FullMatrix : public Table<2,number> * as @p{std::vector}. The * responsibility to check * performance of programs must - * therefore remains with the + * therefore remain with the * user of this class. */ FullMatrix (const FullMatrix&); @@ -128,6 +128,17 @@ class FullMatrix : public Table<2,number> */ template FullMatrix& operator = (const FullMatrix&); + + /** + * Assignment from different + * matrix classes. This + * assignment operator uses + * iterators of the class + * @p{MATRIX}. Therefore, sparse + * matrices are possible sources. + */ + template + FullMatrix& operator = (const MATRIX&); /** * Comparison operator. Be @@ -756,7 +767,17 @@ void FullMatrix::fill (const number2* src) Table<2,number>::fill(src); } - +template +template +FullMatrix& +FullMatrix::operator = (const MATRIX& M) +{ + reinit (M.m(), M.n()); + typename MATRIX::const_iterator entry; + const typename MATRIX::const_iterator end = M.end(); + for (entry = M.begin();entry != end;++entry) + el(entry->row(), entry->column()) = entry->value(); +} /*---------------------------- fullmatrix.h ---------------------------*/