From: young Date: Thu, 13 Feb 2014 09:51:05 +0000 (+0000) Subject: A patch by Denis Davydov: Multiply a real tensor by a complex number. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d1def995a46f69c346b9ffbbfb466ac944010d99;p=dealii-svn.git A patch by Denis Davydov: Multiply a real tensor by a complex number. git-svn-id: https://svn.dealii.org/trunk@32475 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/include/deal.II/base/tensor.h b/deal.II/include/deal.II/base/tensor.h index 5ddc7dc752..c3c6dab702 100644 --- a/deal.II/include/deal.II/base/tensor.h +++ b/deal.II/include/deal.II/base/tensor.h @@ -2093,6 +2093,48 @@ operator / (const Tensor &t, return tt; } + + +/** + * Multiplication of a tensor of general rank by a scalar + * complex from the left. + * + * @relates Tensor + */ +template + inline + Tensor > + operator * (const std::complex factor, + const Tensor &t) +{ + Tensor > tt; + for (unsigned int d=0; d from the right. + * + * @relates Tensor + */ +template + inline + Tensor > + operator * (const Tensor &t, + const std::complex factor) +{ + Tensor > tt; + for (unsigned int d=0; d &t, } + +/** + * Multiplication of a tensor of rank 1 by a scalar complex + * from the right. + * + * @relates Tensor<1,dim,Number> + */ +template +inline +Tensor<1,dim,std::complex > + operator * (const Tensor<1,dim> &t, + const std::complex factor) +{ + Tensor<1,dim,std::complex > tt (false); + for (unsigned int d=0; d + * from the left. + * + * @relates Tensor<1,dim,Number> + */ +template +inline +Tensor<1,dim,std::complex > + operator * (const std::complex factor, + const Tensor<1,dim> &t) +{ + Tensor<1,dim,std::complex > tt (false); + for (unsigned int d=0; d