NAG FL Interface
f06faf (dvcos)

Settings help

FL Name Style:


FL Specification Language:


1 Purpose

f06faf computes the cosine of the angle between two real vectors.

2 Specification

Fortran Interface
Function f06faf ( n, j, tolx, x, incx, toly, y, incy)
Real (Kind=nag_wp) :: f06faf
Integer, Intent (In) :: n, j, incx, incy
Real (Kind=nag_wp), Intent (In) :: tolx, x(*), toly, y(*)
C Header Interface
#include <nag.h>
double  f06faf_ (const Integer *n, const Integer *j, const double *tolx, const double x[], const Integer *incx, const double *toly, const double y[], const Integer *incy)
The routine may be called by the names f06faf or nagf_blas_dvcos.

3 Description

f06faf returns, via the function name, the cosine of the angle between two n-element real vectors x and y, given by the expression
xTy x2y2 .  
If 1jn, y is taken to be the unit vector ej, in which case the array y is not referenced.
If x2tolx, the routine returns 2.0; if x2>tolx but y2toly, the routine returns -2.0; otherwise the value returned is in the range (-1.0,1.0).

4 References

None.

5 Arguments

1: n Integer Input
On entry: n, the number of elements in x and y.
2: j Integer Input
On entry: if the vector y is supplied in y, j should be set to 0. Otherwise, j specifies the index j of the unit vector ej to be used as y.
3: tolx Real (Kind=nag_wp) Input
On entry: the value tolx, used to determine whether x2 is effectively zero.
If tolx is negative, the value zero is used.
4: x(*) Real (Kind=nag_wp) array Input
Note: the dimension of the array x must be at least max(1, 1+(n-1) ×|incx| ) .
On entry: the n-element vector x.
If incx>0, xi must be stored in x(1+(i-1)×incx), for i=1,2,,n.
If incx<0, xi must be stored in x(1-(n-i)×incx), for i=1,2,,n.
Intermediate elements of x are not referenced.
5: incx Integer Input
On entry: the increment in the subscripts of x between successive elements of x.
6: toly Real (Kind=nag_wp) Input
On entry: the value toly, used to determine whether y2 is effectively zero.
If toly is negative, the value zero is used.
7: y(*) Real (Kind=nag_wp) array Input
Note: the dimension of the array y must be at least max(1, 1+(n-1) ×|incy| ) .
On entry: if 1jn, y is not referenced. Otherwise, y holds the vector y.
If incy>0, yi must be stored in y(1+(i-1)×incy), for i=1,2,,n.
If incy<0, yi must be stored in y(1-(n-i)×incy), for i=1,2,,n.
Intermediate elements of y are not referenced.
8: incy Integer Input
On entry: the increment in the subscripts of y between successive elements of y.

6 Error Indicators and Warnings

None.

7 Accuracy

Not applicable.

8 Parallelism and Performance

f06faf makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this routine. Please also consult the Users' Note for your implementation for any additional implementation-specific information.

9 Further Comments

None.

10 Example

None.