Purpose
To compute an approximate symmetric chordal metric for two complex numbers A1 and A2 in real arithmetic. Each number Aj, j = 1, 2, is represented as a rational number with numerator ARj + i*AIj, and denominator Bj, with Bj >= 0. A value Bj = 0, when ARj or AIj is nonzero, means that the number Aj is infinite. The case when ARj = AIj = Bj = 0 means that the pair (Aj,Bj) is not a number.Specification
SUBROUTINE MA01DZ( AR1, AI1, B1, AR2, AI2, B2, EPS, SAFEMN, D1, $ D2, IWARN ) C .. Scalar Arguments .. DOUBLE PRECISION AI1, AI2, AR1, AR2, B1, B2, D1, D2, EPS, SAFEMN INTEGER IWARNArguments
Input/Output Parameters
AR1 (input) DOUBLE PRECISION AI1 (input) DOUBLE PRECISION These scalars define the real and imaginary parts of the numerator of A1. B1 (input) DOUBLE PRECISION The denominator of A1. B1 >= 0. AR2 (input) DOUBLE PRECISION AI2 (input) DOUBLE PRECISION These scalars define the real and imaginary parts of the numerator of A2. B2 (input) DOUBLE PRECISION The denominator of A2. B2 >= 0. EPS (input) DOUBLE PRECISION The relative machine precision. See the LAPACK Library routine DLAMCH. SAFEMN (input) DOUBLE PRECISION The "safe minimum", such that its reciprocal does not overflow. See the LAPACK Library routine DLAMCH. D1 (output) DOUBLE PRECISION The numerator of the chordal metric D. D1 >= 0. D2 (output) DOUBLE PRECISION The denominator of the chordal metric D. D2 is 0 or 1. If D2 = 0, and D1 = 0, the chordal metric is undefined, so either A1 and/or A2 are undefined.Warning Indicator
IWARN INTEGER = 0: no warning; = 1: A1 or A2 is not a number (NaN); D1 and D2 are both set to 0.Method
The approximate symmetric chordal metric is evaluated using the formula D = MIN( | A1 - A2 |, |1/A1 - 1/A2| ), taking into account the special cases of infinite or NaN values. The chordal metric is finite even if A1 and A2 are both infinite, or if one of them is infinite and the other is finite, nonzero.Further Comments
NoneExample
Program Text
NoneProgram Data
NoneProgram Results
None