]> https://gitweb.dealii.org/ - dealii.git/commitdiff
add forgotten variant
authorMatthias Maier <tamiko@43-1.org>
Sun, 10 May 2015 11:00:58 +0000 (13:00 +0200)
committerMatthias Maier <tamiko@43-1.org>
Mon, 11 May 2015 21:05:21 +0000 (23:05 +0200)
include/deal.II/lac/linear_operator.h

index 6996ab89861c82d303327c44b8467a31001242d2..f3b1c69662f9cd980604270a328361cce976ed23 100644 (file)
@@ -1762,6 +1762,7 @@ namespace
   };
 }
 
+
 /**
  * @relates PackagedOperation
  *
@@ -1849,6 +1850,52 @@ PackagedOperation<Range> operator-(const Range &u, const Range &v)
 }
 
 
+/**
+ * @relates PackagedOperation
+ *
+ * Create a PackagedOperation object that stores the scaling of a vector
+ * with a @p number.
+ *
+ * The PackagedOperation object that is created stores a reference to @p u.
+ * Thus, the vectors must remain valid references for the whole lifetime of
+ * the PackagedOperation object. All changes made on @p u or @p v after the
+ * creation of the PackagedOperation object are reflected by the operator
+ * object.
+ *
+ * @ingroup LAOperators
+ */
+template <typename Range,
+          typename = typename std::enable_if<has_vector_interface<Range>::type::value>::type>
+PackagedOperation<Range> operator*(const Range &u,
+                                   typename Range::value_type number)
+{
+  return PackagedOperation<Range>(u) * number;
+}
+
+
+/**
+ * @relates PackagedOperation
+ *
+ * Create a PackagedOperation object that stores the scaling of a vector
+ * with a @p number.
+ *
+ * The PackagedOperation object that is created stores a reference to @p u.
+ * Thus, the vectors must remain valid references for the whole lifetime of
+ * the PackagedOperation object. All changes made on @p u or @p v after the
+ * creation of the PackagedOperation object are reflected by the operator
+ * object.
+ *
+ * @ingroup LAOperators
+ */
+template <typename Range,
+          typename = typename std::enable_if<has_vector_interface<Range>::type::value>::type>
+PackagedOperation<Range> operator*(typename Range::value_type number,
+                                   const Range &u)
+{
+  return number * PackagedOperation<Range>(u);
+}
+
+
 /**
  * @relates PackagedOperation
  *

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.