]> https://gitweb.dealii.org/ - dealii.git/commitdiff
base/tensor.h: remove redundant recursion step
authorMatthias Maier <tamiko@43-1.org>
Thu, 19 Mar 2020 23:40:27 +0000 (18:40 -0500)
committerMatthias Maier <tamiko@43-1.org>
Fri, 20 Mar 2020 00:52:13 +0000 (19:52 -0500)
include/deal.II/base/tensor.h

index 05bae7e4ca8f29ee89ee99ed70ad92f62b7e36d1..553d7fcf25e94a038fc44dc1dfcc396666923fb0 100644 (file)
@@ -1945,25 +1945,6 @@ inline DEAL_II_CONSTEXPR DEAL_II_ALWAYS_INLINE
   return tmp;
 }
 
-/**
- * Entrywise multiplication of two tensor objects of rank 1.
- *
- * @relatesalso Tensor
- */
-template <int dim, typename Number, typename OtherNumber>
-inline DEAL_II_CONSTEXPR DEAL_II_ALWAYS_INLINE
-                         Tensor<1, dim, typename ProductType<Number, OtherNumber>::type>
-                         schur_product(const Tensor<1, dim, Number> &     src1,
-                                       const Tensor<1, dim, OtherNumber> &src2)
-{
-  Tensor<1, dim, typename ProductType<Number, OtherNumber>::type> tmp(src1);
-
-  for (unsigned int i = 0; i < dim; ++i)
-    tmp[i] *= src2[i];
-
-  return tmp;
-}
-
 /**
  * Entrywise multiplication of two tensor objects of general rank.
  *
@@ -1986,10 +1967,11 @@ inline DEAL_II_CONSTEXPR DEAL_II_ALWAYS_INLINE
                          schur_product(const Tensor<rank, dim, Number> &     src1,
                                        const Tensor<rank, dim, OtherNumber> &src2)
 {
-  Tensor<rank, dim, typename ProductType<Number, OtherNumber>::type> tmp(src1);
+  Tensor<rank, dim, typename ProductType<Number, OtherNumber>::type> tmp;
 
   for (unsigned int i = 0; i < dim; ++i)
-    tmp[i] = schur_product(src1[i], src2[i]);
+    tmp[i] = schur_product(Tensor<rank - 1, dim, Number>(src1[i]),
+                           Tensor<rank - 1, dim, OtherNumber>(src2[i]));
 
   return tmp;
 }

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.