Vector Arguments in BLAS

Vector arguments are passed in one-dimensional arrays. The array dimension (length) and vector increment are passed as integer variables. The length determines the number of elements in the vector. The increment (also called stride) determines the spacing between vector elements and the order of the elements in the array in which the vector is passed.

A vector of length n and increment incx is passed in a one-dimensional array x whose values are defined as

x(1), x(1+|incx|), ..., x(1+(n-1)* |incx|)

If incx is positive, then the elements in array x are stored in increasing order. If incx is negative, the elements in array x are stored in decreasing order with the first element defined as x(1+(n-1)* |incx|). If incx is zero, then all elements of the vector have the same value, x(1). The dimension of the one-dimensional array that stores the vector must always be at least

idimx = 1 + (n-1)* |incx |

Example. One-dimensional Real Array

Let x(1:7) be the one-dimensional real array

x = (1.0, 3.0, 5.0, 7.0, 9.0, 11.0, 13.0).

If incx =2 and n = 3, then the vector argument with elements in order from first to last is (1.0, 5.0, 9.0).

If incx = -2 and n = 4, then the vector elements in order from first to last is (13.0, 9.0, 5.0, 1.0).

If incx = 0 and n = 4, then the vector elements in order from first to last is (1.0, 1.0, 1.0, 1.0).

One-dimensional substructures of a matrix, such as the rows, columns, and diagonals, can be passed as vector arguments with the starting address and increment specified. In Fortran, storing the m-by-n matrix is based on column-major ordering where the increment between elements in the same column is 1, the increment between elements in the same row is m, and the increment between elements on the same diagonal is m + 1.

Example. Two-dimensional Real Matrix

Let a be the real 5 x 4 matrix declared as REAL A (5,4).

To scale the third column of a by 2.0, use the BLAS routine sscal with the following calling sequence:

callsscal (5, 2.0, a(1,3), 1)

To scale the second row, use the statement:

callsscal (4, 2.0, a(2,1), 5)

To scale the main diagonal of A by 2.0, use the statement:

callsscal (5, 2.0, a(1,1), 6)

Note

The default vector argument is assumed to be 1.

Pour de plus amples informations sur les optimisations de compilation, consultez notre Avertissement concernant les optimisations.