]> https://gitweb.dealii.org/ - dealii.git/commitdiff
SymmetricTensor: Minimalnumber of instructions for multiply by Tensor 16263/head
authorMartin Kronbichler <martin.kronbichler@rub.de>
Sun, 12 Nov 2023 21:51:50 +0000 (22:51 +0100)
committerMartin Kronbichler <martin.kronbichler@rub.de>
Sun, 12 Nov 2023 21:51:50 +0000 (22:51 +0100)
include/deal.II/base/symmetric_tensor.h

index fa61cdf567f13d83f7816c0bbb8cc337a41f0a3c..c8b1245c0855d63a2857791b5da4518b8e739858 100644 (file)
@@ -4207,8 +4207,11 @@ operator*(const SymmetricTensor<2, dim, Number> &src1,
 {
   Tensor<1, dim, typename ProductType<Number, OtherNumber>::type> dest;
   for (unsigned int i = 0; i < dim; ++i)
-    for (unsigned int j = 0; j < dim; ++j)
-      dest[i] += src1[i][j] * src2[j];
+    {
+      dest[i] = src1[i][0] * src2[0];
+      for (unsigned int j = 1; j < dim; ++j)
+        dest[i] += src1[i][j] * src2[j];
+    }
   return dest;
 }
 

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.