NAG Library Manual, Mark 26
NAG AD Library Manual, Mark 26
NAG C Library Manual, Mark 26
A02 (complex) Chapter Contents
A02 (complex) Chapter Introduction
NAG Library Routine Document
a02aaf (sqrt)
Keyword Search:
NAG Library Manual, Mark 26
NAG AD Library Manual, Mark 26
NAG C Library Manual, Mark 26
A02 (complex) Chapter Contents
A02 (complex) Chapter Introduction
▸
▿
Contents
1
Purpose
2
Specification
3
Description
4
References
5
Arguments
6
Error Indicators and Warnings
7
Accuracy
8
Parallelism and Performance
9
Further Comments
▸
▿
10
Example
10.1
Program Text
10.2
Program Data
10.3
Program Results
© The Numerical Algorithms Group Ltd. 2018
1
Purpose
a02aaf
evaluates the square root of the complex number
x
=
x
r
,
x
i
.
2
Specification
Fortran Interface
Subroutine a02aaf (
xr
,
xi
,
yr
,
yi
)
Real (Kind=nag_wp), Intent (In)
::
xr
,
xi
Real (Kind=nag_wp), Intent (Out)
::
yr
,
yi
C Header Interface
#include <nagmk26.h>
void
a02aaf_ (
const double *
xr
,
const double *
xi
,
double *
yr
,
double *
yi
)
3
Description
The method of evaluating
y
=
x
depends on the value of
x
r
.
For
x
r
≥
0
,
y
r
=
x
r
+
x
r
2
+
x
i
2
2
,
y
i
=
x
i
2
y
r
.
For
x
r
<
0
,
y
i
=
sign
x
i
×
x
r
+
x
r
2
+
x
i
2
2
,
y
r
=
x
i
2
y
i
.
Overflow is avoided when squaring
x
i
and
x
r
by calling
a02abf
to evaluate
x
r
2
+
x
i
2
.
4
References
Wilkinson J H and Reinsch C (1971)
Handbook for Automatic Computation II, Linear Algebra
Springer–Verlag
5
Arguments
1:
xr
– Real (Kind=nag_wp)
Input
2:
xi
– Real (Kind=nag_wp)
Input
On entry
:
x
r
and
x
i
, the real and imaginary parts of
x
, respectively.
3:
yr
– Real (Kind=nag_wp)
Output
4:
yi
– Real (Kind=nag_wp)
Output
On exit
:
y
r
and
y
i
, the real and imaginary parts of
y
, respectively.
6
Error Indicators and Warnings
None.
7
Accuracy
The result should be correct to
machine precision
.
8
Parallelism and Performance
a02aaf
is not threaded in any implementation.
9
Further Comments
The time taken by
a02aaf
is negligible.
10
Example
This example finds the square root of
-
1.7
+
2.6
i
.
10.1
Program Text
Program Text (a02aafe.f90)
10.2
Program Data
Program Data (a02aafe.d)
10.3
Program Results
Program Results (a02aafe.r)
NAG Library Manual, Mark 26
NAG AD Library Manual, Mark 26
NAG C Library Manual, Mark 26
A02 (complex) Chapter Contents
A02 (complex) Chapter Introduction
© The Numerical Algorithms Group Ltd. 2018