From: Martin Kronbichler Date: Sun, 12 Nov 2023 21:51:50 +0000 (+0100) Subject: SymmetricTensor: Minimalnumber of instructions for multiply by Tensor X-Git-Tag: relicensing~302^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7d7fad3a9ede8429d8aaf2cb3637d96f8006e563;p=dealii.git SymmetricTensor: Minimalnumber of instructions for multiply by Tensor --- diff --git a/include/deal.II/base/symmetric_tensor.h b/include/deal.II/base/symmetric_tensor.h index fa61cdf567..c8b1245c08 100644 --- a/include/deal.II/base/symmetric_tensor.h +++ b/include/deal.II/base/symmetric_tensor.h @@ -4207,8 +4207,11 @@ operator*(const SymmetricTensor<2, dim, Number> &src1, { Tensor<1, dim, typename ProductType::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; }