]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
new FullMatrix::operator=
authorguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 8 Jan 2003 10:30:35 +0000 (10:30 +0000)
committerguido <guido@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 8 Jan 2003 10:30:35 +0000 (10:30 +0000)
git-svn-id: https://svn.dealii.org/trunk@6886 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/lac/include/lac/full_matrix.h

index e3ef013dd55d178e2a83a426498dad793e3b30a1..0e972331918af6997b2fe429358ae52a7e7d1dc6 100644 (file)
@@ -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<typename number2>
     FullMatrix<number>& operator = (const FullMatrix<number2>&);
+
+                                    /**
+                                     * Assignment from different
+                                     * matrix classes. This
+                                     * assignment operator uses
+                                     * iterators of the class
+                                     * @p{MATRIX}. Therefore, sparse
+                                     * matrices are possible sources.
+                                     */
+    template <class MATRIX>
+    FullMatrix<number>& operator = (const MATRIX&);
     
                                     /**
                                      * Comparison operator. Be
@@ -756,7 +767,17 @@ void FullMatrix<number>::fill (const number2* src)
   Table<2,number>::fill(src);
 }
 
-
+template <typename number>
+template <class MATRIX>
+FullMatrix<number>&
+FullMatrix<number>::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     ---------------------------*/
 

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.