function z = ppc_cmplx_mult(x,y) multiplies two complex valued vectors by breaking up the multiplication into multiple steps to avoid rounding errors that will return erroneous results if a number is multiplied by its complex conjugate on the PowerMac Use this function if you want a complex vector multiplied by its conjugate to return a real-valued vector. Tech-support at Mathworks suggested this fix.
0001 function z = ppc_cmplx_mult(x,y) 0002 % function z = ppc_cmplx_mult(x,y) 0003 % 0004 % multiplies two complex valued vectors by breaking up 0005 % the multiplication into multiple steps to avoid rounding 0006 % errors that will return erroneous results if a number is multiplied 0007 % by its complex conjugate on the PowerMac 0008 % 0009 % Use this function if you want a complex vector multiplied by its conjugate 0010 % to return a real-valued vector. 0011 % 0012 % Tech-support at Mathworks suggested this fix. 0013 0014 % Written by Petr Janata, Jan. 17, 1996. 0015 0016 z = real(x).*real(y) + real(x).*imag(y) + real(y).*imag(x) - imag(x).*imag(y); 0017 0018 return