Home > manopt > autodiff > functions_AD > cdottimes.m

# cdottimes

## PURPOSE

Computes the element-wise multiplication between A and B

## SYNOPSIS

function cdottimesAB = cdottimes(A, B)

## DESCRIPTION

``` 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.

## CROSS-REFERENCE INFORMATION

This function calls: This function is called by:
• cinnerprodgeneral Computes the Euclidean inner product between x and y in the complex case
• cmultiscale Multiplies the 2D slices in a 3D array by individual scalars.

## SOURCE CODE

```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 %
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```

Generated on Fri 30-Sep-2022 13:18:25 by m2html © 2005