Description

nag_dot_real_prec (x03aa) calculates the scalar product of two double vectors and adds it to an initial value cc to give a correctly rounded result dd:

n

d = c +

∑

aibi.

i = 1

d=c+∑i=1naibi.

If n < 1n<1, d = cd=c.

The vector elements aiai and bibi are stored in selected elements of the one-dimensional array parameters a and b, which in the function from which nag_dot_real_prec (x03aa) 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 [Parameters] for details, and Section [Example] for an example.

Both the initial value cc and the result dd are defined by a pair of double variables, so that they may take either basic precision or additional precision values.

(a)

If sw = truesw=true, the products are accumulated in additional precision, and on exit the result is available either in basic precision, correctly rounded, or in additional precision.

(b)

If sw = falsesw=false, the products are accumulated in basic precision, and the result is returned in basic precision.

This function is designed primarily for use as an auxiliary function by other functions in the NAG Toolbox, especially those in the chapters on Linear Algebra.

References

None.

Parameters

Compulsory Input Parameters

The iith vector element is stored in the array element a((i − 1) × istepa + 1)a((i-1)×istepa+1). In your function from which nag_dot_real_prec (x03aa) is called, a can be part of a multidimensional array and the actual argument must be the array element containing the first vector element.

The iith vector element is stored in the array element b((i − 1) × istepb + 1)b((i-1)×istepb+1). In your function from which nag_dot_real_prec (x03aa) is called, b can be part of a multidimensional array and the actual argument must be the array element containing the first vector element.

c1 and c2 must specify the initial value cc: c = c1 + c2c=c1+c2. Normally, if cc is in additional precision, c1 specifies the most significant part and c2 the least significant part; if cc is in basic precision, then c1 specifies cc and c2 must have the value 0.00.0. Both c1 and c2 must be defined on entry.

Optional Input Parameters

The dimension of the array a as declared in the (sub)program from which nag_dot_real_prec (x03aa) is called.

The upper bound for isizea is found by multiplying together the dimensions of a as declared in your function from which nag_dot_real_prec (x03aa) is called, subtracting the starting position and adding 11.

The dimension of the array b as declared in the (sub)program from which nag_dot_real_prec (x03aa) is called.

The upper bound for isizeb is found by multiplying together the dimensions of b as declared in your function from which nag_dot_real_prec (x03aa) is called, subtracting the starting position and adding 11.

Accuracy

If the calculation is an additional precision, the rounded basic precision result d1 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.

Further Comments

The time taken by nag_dot_real_prec (x03aa) is approximately proportional to nn and also depends on whether basic precision or additional precision is used.

On exit the variables d1 and d2 may be used directly to supply a basic precision or additional precision initial value for a subsequent call of nag_dot_real_prec (x03aa).