complex ops not as should be

View: New views
3 Messages — Rating Filter:   Alert me  

complex ops not as should be

by boazilan :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Octave does not obey A.*conj(A) = abs(A).^2 for complex A. In fact,  
imag(A.*conj(A)) returns small (around 1e-16) nonzero values. Here  
'A' can be a matrix or scalar, so long as it has floating point  
values, e.g., A=pi*(1+1i). A temporary solution to the problem above  
is to use abs(A).^2, but the real issue at hand is that either  
complex conjugation and/or complex multiplication (I suspect it is  
the latter) are not computed as precisely as they should be.

Thank you very much for your consideration.

  - Boaz

uname output:   Darwin Kernel Version 8.11.0: Wed Oct 10 18:26:00 PDT  
2007; root:xnu-792.24.17~1/RELEASE_PPC Power Macintosh powerpc
configure opts:   '--prefix=/sw' 'FLIBS=/sw/lib/gcc4.3/lib/
libgfortran.dylib' 'F77=/sw/bin/gfortran' '--infodir=/sw/share/info'  
'--mandir=/sw/share/man' '--libexecdir=/sw/lib' '-enable-shared' '-
enable-dl' '--disable-static' '--without-mpi' '--with-hdf5' '--with-
fftw' '--with-lapack=-Wl,-framework,Accelerate,-dylib_file,/System/
Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/
vecLib.framework/Versions/A/libLAPACK.dylib:/System/Library/
Frameworks/Accelerate.framework/Versions/A/Frameworks/
vecLib.framework/Versions/A/libLAPACK.dylib' '--with-blas=-Wl,-
framework,Accelerate,-dylib_file,/System/Library/Frameworks/
Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/
A/libBLAS.dylib:/System/Library/Frameworks/Accelerate.framework/
Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib'  
'CFLAGS=-O3' 'LDFLAGS=-L/sw/lib' 'CPPFLAGS=-I/sw/include' 'CXXFLAGS=-
O3' 'FFLAGS=-O3'
Fortran compiler: /sw/bin/gfortran
FFLAGS:           -O3
F2C:              @F2C@
F2CFLAGS:         @F2CFLAGS@
FLIBS:            /sw/lib/gcc4.3/lib/libgfortran.dylib
CPPFLAGS:         -I/sw/include -I/sw/include
INCFLAGS:         -I. -I. -I./liboctave -I./src -I./libcruft/misc
C compiler:       gcc, version 4.0.1 (Apple Computer, Inc. build 5370)
CFLAGS:           -O3
CPICFLAG:
C++ compiler:     g++, version 4.0.1
CXXFLAGS:         -O3
CXXPICFLAG:
LD_CXX:           g++


_______________________________________________
Bug-octave mailing list
Bug-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/bug-octave

Re: complex ops not as should be

by dbateman :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


boazilan wrote:
Octave does not obey A.*conj(A) = abs(A).^2 for complex A. In fact,  
imag(A.*conj(A)) returns small (around 1e-16) nonzero values. Here  
'A' can be a matrix or scalar, so long as it has floating point  
values, e.g., A=pi*(1+1i). A temporary solution to the problem above  
is to use abs(A).^2, but the real issue at hand is that either  
complex conjugation and/or complex multiplication (I suspect it is  
the latter) are not computed as precisely as they should be.
An understanding of IEEE754 floating point representation is necessary in my mind for all engineers and scientists. This arises because of small rounding errors in calculation. Note 1e-16 is the EPS and so the error is within the precision of the minimum difference between two floating point numbers near the value 1. This however is not a bug.

D.


Re: complex ops not as should be

by Sergei Steshenko-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message




--- On Fri, 9/12/08, Boaz Ilan <bilan@...> wrote:

> From: Boaz Ilan <bilan@...>
> Subject: complex ops not as should be
> To: bug@...
> Date: Friday, September 12, 2008, 8:48 PM
> Octave does not obey A.*conj(A) = abs(A).^2 for complex A.
> In fact,  
> imag(A.*conj(A)) returns small (around 1e-16) nonzero
> values.

???

Why should it be different ? Do you have a computer with infinite
precision ?

Regards,
  Sergei.


     
_______________________________________________
Bug-octave mailing list
Bug-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/bug-octave