NAG FL Interface
x03abf (complex_​prec)

Settings help

FL Name Style:


FL Specification Language:


1 Purpose

x03abf calculates the value of a complex scalar product using basic precision or additional precision and adds it to a complex initial value.

2 Specification

Fortran Interface
Subroutine x03abf ( a, isizea, b, isizeb, n, istepa, istepb, cx, dx, sw, ifail)
Integer, Intent (In) :: isizea, isizeb, n, istepa, istepb
Integer, Intent (Inout) :: ifail
Complex (Kind=nag_wp), Intent (In) :: a(isizea), b(isizeb), cx
Complex (Kind=nag_wp), Intent (Out) :: dx
Logical, Intent (In) :: sw
C Header Interface
#include <nag.h>
void  x03abf_ (const Complex a[], const Integer *isizea, const Complex b[], const Integer *isizeb, const Integer *n, const Integer *istepa, const Integer *istepb, const Complex *cx, Complex *dx, const logical *sw, Integer *ifail)
The routine may be called by the names x03abf or nagf_dot_complex_prec.

3 Description

x03abf calculates the scalar product of two complex vectors and adds it to an initial value c to give a correctly rounded result d:
d=c+i=1naibi.  
If n<1, d=c.
The vector elements ai and bi are stored in selected elements of the one-dimensional array arguments a and b, which in the subroutine from which x03abf is called may be identified with parts of possibly multidimensional arrays according to the standard Fortran rules. For example, the vectors may be parts of a row or column of a matrix. See Section 5 for details.
The products are accumulated in basic precision or additional precision depending on the argument sw.
This routine has been designed primarily for use as an auxiliary routine by other routines in the NAG Library, especially those in the chapters on Linear Algebra.

4 References

None.

5 Arguments

1: a(isizea) Complex (Kind=nag_wp) array Input
On entry: the elements of the first vector.
The ith vector element is stored in the array element a((i-1)×istepa+1) . In your subroutine from which x03abf is called, a can be part of a multidimensional array and the actual argument must be the array element containing the first vector element.
2: isizea Integer Input
On entry: the dimension of the array a as declared in the (sub)program from which x03abf is called.
The upper bound for isizea is found by multiplying together the dimensions of a as declared in your subroutine from which x03abf is called, subtracting the starting position and adding 1.
Constraint: isizea(n-1)×istepa+1.
3: b(isizeb) Complex (Kind=nag_wp) array Input
On entry: the elements of the second vector.
The ith vector element is stored in the array element b((i-1)×istepb+1) . In your subroutine from which x03abf is called, b can be part of a multidimensional array and the actual argument must be the array element containing the first vector element.
4: isizeb Integer Input
On entry: the dimension of the array b as declared in the (sub)program from which x03abf is called.
The upper bound for isizeb is found by multiplying together the dimensions of b as declared in your subroutine from which x03abf is called, subtracting the starting position and adding 1.
Constraint: isizeb(n-1)×istepb+1.
5: n Integer Input
On entry: n, the number of elements in the scalar product.
6: istepa Integer Input
On entry: the step length between elements of the first vector in array a.
Constraint: istepa>0.
7: istepb Integer Input
On entry: the step length between elements of the second vector in array b.
Constraint: istepb>0.
8: cx Complex (Kind=nag_wp) Input
On entry: the initial value c.
9: dx Complex (Kind=nag_wp) Output
On exit: the result d.
10: sw Logical Input
On entry: the precision to be used in the calculation.
sw=.TRUE.
additional precision.
sw=.FALSE.
basic precision.
11: ifail Integer Input/Output
On entry: ifail must be set to 0, −1 or 1 to set behaviour on detection of an error; these values have no effect when no error is detected.
A value of 0 causes the printing of an error message and program execution will be halted; otherwise program execution continues. A value of −1 means that an error message is printed while a value of 1 means that it is not.
If halting is not appropriate, the value −1 or 1 is recommended. If message printing is undesirable, then the value 1 is recommended. Otherwise, the value 0 is recommended. When the value -1 or 1 is used it is essential to test the value of ifail on exit.
On exit: ifail=0 unless the routine detects an error or a warning has been flagged (see Section 6).

6 Error Indicators and Warnings

If on entry ifail=0 or −1, explanatory error messages are output on the current error message unit (as defined by x04aaf).
Errors or warnings detected by the routine:
ifail=1
On entry, istepa=value.
Constraint: istepa>0.
On entry, istepb=value.
Constraint: istepb>0.
ifail=2
On entry, isizea=value, n=value and istepa=value.
Constraint: isizea(n-1)×istepa+1.
On entry, isizeb=value, n=value and istepb=value.
Constraint: isizeb(n-1)×istepb+1.
ifail=-99
An unexpected error has been triggered by this routine. Please contact NAG.
See Section 7 in the Introduction to the NAG Library FL Interface for further information.
ifail=-399
Your licence key may have expired or may not have been installed correctly.
See Section 8 in the Introduction to the NAG Library FL Interface for further information.
ifail=-999
Dynamic memory allocation failed.
See Section 9 in the Introduction to the NAG Library FL Interface for further information.

7 Accuracy

If the calculation is in additional precision, the result is correct to full implementation accuracy, provided that exceptionally severe cancellation does not occur in the summation. If the calculation is in basic precision, such accuracy cannot be guaranteed.

8 Parallelism and Performance

Background information to multithreading can be found in the Multithreading documentation.
x03abf is not threaded in any implementation.

9 Further Comments

The time taken by x03abf is approximately proportional to n and also depends on whether basic precision or additional precision is used.

10 Example

This example calculates the scalar product of the second column of the matrix A and the vector b, and add it to an initial value of 1+i, where
A=( −1 -i 1 -2+3i i 2i -0 −1-i 1-2i ) ,  b=( i 1-i -i ) .  

10.1 Program Text

Program Text (x03abfe.f90)

10.2 Program Data

Program Data (x03abfe.d)

10.3 Program Results

Program Results (x03abfe.r)