1 SUBROUTINE MULP
(XXXX
,YYYY
,ZZZZ
)
3 C THIS SUBROUTINE PERFORMS MULTIPLICATION OF COMPLEX NUMBERS:
6 C NOTE: IN THE CALLING ROUTINE, ZZZZ SHOULD NOT BE THE SAME
7 C AS XXXX OR YYYY. HOWEVER, XXXX MAY BE THE SAME AS YYYY.
8 C THUS, "CALL MULP(X,X,Z)" IS OK, BUT "CALL MULP(X,Y,X)" IS NOT.
12 C XXXX IS AN ARRAY OF LENGTH TWO REPRESENTING THE FIRST COMPLEX
13 C NUMBER, WHERE XXXX(1) = REAL PART OF XXXX AND XXXX(2) =
14 C IMAGINARY PART OF XXXX.
16 C YYYY IS AN ARRAY OF LENGTH TWO REPRESENTING THE SECOND COMPLEX
17 C NUMBER, WHERE YYYY(1) = REAL PART OF YYYY AND YYYY(2) =
18 C IMAGINARY PART OF YYYY.
22 C ZZZZ IS AN ARRAY OF LENGTH TWO REPRESENTING THE RESULT OF
23 C THE MULTIPLICATION, ZZZZ = XXXX*YYYY, WHERE ZZZZ(1) =
24 C REAL PART OF ZZZZ AND ZZZZ(2) = IMAGINARY PART OF ZZZZ.
26 C DECLARATION OF INPUT
27 DOUBLE PRECISION XXXX
,YYYY
28 DIMENSION XXXX
(2),YYYY
(2)
30 C DECLARATION OF OUTPUT
34 ZZZZ
(1) = XXXX
(1)*YYYY
(1) - XXXX
(2)*YYYY
(2)
35 ZZZZ
(2) = XXXX
(1)*YYYY
(2) + XXXX
(2)*YYYY
(1)