- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I had some strange result when I compiled my program that contains the dot product of complex matrix and real matrix. Below the example of the program PROGRAM test_dotproduct IMPLICIT NONE REAL :: c(3) COMPLEX :: a(3),b a(1) = CMPLX(1,1) a(2) = CMPLX(2,2) a(3) = CMPLX(4,4) c(1) = 1 c(2) = 0 c(3) = 0 b = DOT_PRODUCT(a,c) write(*,*) 'b = DOT_PRODUCT(a,c)' and the result was: Result of b: (1.000000,-1.000000) The imaginary part of the result should be positif, but I dont know why I got negative ones. is there any body have the similar problems...? As information, I compiled my program on Intel Fortran under linux with non commercial version. regards Iswandi
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Dear Iswandi,
Note that the DOT_PRODUCT on complex data is defined as follows:
SUM( CONJG(VECTOR_A) * VECTOR_B)
(and not simply as sumof pair-wise products).So, in your example:
CONJG(a(1)) *c(1) + 0 + 0 = (1,-1)
Hope this makes more sense now.
Aart Bik
http://www.aartbik.com/
Message Edited by abik on 04-18-2005 10:56 AM

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page