Computes the element-wise multiplication between A and B function cdottimesAB = cdottimes(A, B) Returns the element-wise multiplication of A and B. The inputs A and B can be either numeric arrays or structs with fields real and imag. See also: manoptADhelp
0001 function cdottimesAB = cdottimes(A, B) 0002 % Computes the element-wise multiplication between A and B 0003 % 0004 % function cdottimesAB = cdottimes(A, B) 0005 % 0006 % Returns the element-wise multiplication of A and B. The inputs A and B 0007 % can be either numeric arrays or structs with fields real and imag. 0008 % 0009 % See also: manoptADhelp 0010 0011 % This file is part of Manopt: www.manopt.org. 0012 % Original author: Xiaowen Jiang, July 31, 2021. 0013 % Contributors: Nicolas Boumal 0014 % Change log: 0015 0016 if isnumeric(A) && isnumeric(B) 0017 cdottimesAB = A .* B; 0018 0019 elseif iscstruct(A) || iscstruct(B) 0020 A = tocstruct(A); 0021 B = tocstruct(B); 0022 cdottimesAB.real = A.real .* B.real - A.imag .* B.imag; 0023 cdottimesAB.imag = A.real .* B.imag + A.imag .* B.real; 0024 0025 else 0026 ME = MException('cprod:inputError', ... 0027 'Input does not have the expected format.'); 0028 throw(ME); 0029 0030 end 0031 0032 end