NAG FL Interface
F16 (Blast)
Further Linear Algebra Support Routines

Settings help

FL Name Style:


FL Specification Language:


1 Scope of the Chapter

This chapter is concerned with basic linear algebra routines which perform elementary algebraic operations involving scalars, vectors and matrices. Most routines for such operations conform either to the specifications of the BLAS (Basic Linear Algebra Subprograms) or to the specifications of the BLAST (Basic Linear Algebra Subprograms Technical) Forum. This chapter includes routines from the BLAST specifications. Most (BLAS) routines for such operations are available in Chapter F06.

2 Background to the Problems

Most of the routines in this chapter meet the specification of Basic Linear Algebra Subprograms Technical (BLAST) Forum (2001).
They are called extensively by routines in other chapters of the NAG Library, especially in the linear algebra chapters. They are intended to be useful building-blocks for users of the Library who are developing their own applications. The routines fall into four main groups (following the definitions introduced by the BLAS):
The terminology reflects the number of operations involved, so for example a Level 2 routine involves O(n2) operations, for vectors and matrices of order n.
Because of the overlap of functionality with Chapter F06, only a subset of BLAST routines are implemented in this chapter. A full descripion of the

3 Recommendations on Choice and Use of Available Routines

3.1 Naming Scheme

3.1.1 NAG names

Table 1 shows the naming scheme for the routines in this chapter which follows the naming scheme used in Chapter F06.
Table 1
Level-0 Level-1 Level-2 Level-3
integer F16D_F
‘real’ F16E_F
‘real’ F16R_F
‘complex’ F16G_F
‘complex’ F16U_F
‘mixed type’ F16J_F
The heading ‘mixed type’ is for routines where a mixture of data types is involved, such as a routine that returns the real norm of a complex vector. In future marks of the Library, routines may be included in categories that are currently empty and further categories may be introduced.

3.1.2 BLAS names

Those routines which conform to the specifications of the BLAS may be called either by their NAG names or by their BLAS names.
In many implementations of the NAG Library, references to Chapter F06 BLAS names may be linked to an efficient machine-specific implementation of the BLAS, usually provided by the vendor of the machine; Chapter F16 BLAS routines are unlikely to be provide by a vendor. Such implementations are stringently tested before being used with the NAG Library, to ensure that they correctly meet the specifications of the BLAS, and that they return the desired accuracy. Use of BLAS names is recommended for efficiency.
References to NAG routine names (beginning F06- or F16-) are always linked to the code provided in the NAG Library and may be significantly slower (in the case of Chapter F06 routines) than the equivalent BLAS routine.
The names of the Level-2 and Level-3 BLAS follow a simple scheme (which is similar to that used for LAPACK routines in Chapters F07 and F08). Each name has the structure XYYZZZ, where the components have the following meanings:
Thus the routine blas_daxpby performs a sum of two real, scaled vectors in double precision; the corresponding routine for complex scalars and vectors is blas_zaxpby.
The names of the Level-1 BLAS mostly follow the same convention for the initial letter (S-, C-, D- or Z-), except for a few involving data of mixed type, where the first two characters are precision-dependent.

3.2 The Level-0 Scalar Routines

The Level-0 routines perform operations on scalars or on vectors or matrices of order 2.

3.3 The Level-1 Vector Routines

The Level-1 routines perform operations either on a single vector or on a pair of vectors.

3.4 The Level-2 Matrix-vector and Matrix Routines

The Level-2 routines perform operations involving either a matrix on its own, or a matrix and one or more vectors.

3.5 The Level-3 Matrix-matrix Routines

The Level-3 routines perform operations involving matrix-matrix products.

3.6 Vector Arguments

Vector arguments (except in the Level-1 Sparse BLAS) are represented by a one-dimensional array, immediately followed by an increment argument whose name consists of the three characters INC followed by the name of the array. For example, a vector x is represented by the two arguments x and incx. The length of the vector, n say, is passed as a separate argument, n.
The increment argument is the spacing (stride) in the array between the elements of the vector. For instance, if incx=2, then the elements of x are in locations x(1),x(3),,x(2n-1) of the array x and the intermediate locations x(2),x(4),,x(2n-2) are not referenced.
When incx>0, the vector element xi is in the array element x(1+(i-1)×incx). When incx0, the elements are stored in the reverse order so that the vector element xi is in the array element x(1-(n-i)×incx) and hence, in particular, the element xn is in x(1). The declared length of the array x in the calling subroutine must be at least (1+(n-1)×|incx|).
Negative increments are permitted only for:
Zero increments are formally permitted for Level-1 routines with more than one argument (in which case the element x(1) is accessed repeatedly), but their use is strongly discouraged since the effect may be implementation-dependent. There is usually an alternative routine in this chapter, with a simplified argument list, to achieve the required purpose. Zero increments are not permitted in the Level-2 BLAS.

3.7 Matrix Arguments and Storage Schemes

In this chapter the following different storage schemes are used for matrices:
These storage schemes are compatible with those used in Chapters F07 and F08. (Different schemes for packed or band storage are used in a few older routines in Chapters F01, F02, F03 and F04.)
Chapter F01 provides some utility routines for conversion between storage schemes.
In the examples, * indicates an array element which need not be set and is not referenced by the routines. The examples illustrate only the relevant leading rows and columns of the arrays; array arguments may of course have additional rows or columns, according to the usual rules for passing array arguments in Fortran.

3.7.1 Conventional storage

Please see Section 3.3.1 in the F07 Chapter Introduction for full details.

3.7.2 Packed storage

Please see Section 3.3.2 in the F07 Chapter Introduction for full details.

3.7.3 Rectangular Full Packed (RFP) storage

Please see Section 3.3.3 in the F07 Chapter Introduction for full details.

3.7.4 Band storage

Please see Section 3.3.4 in the F07 Chapter Introduction for full details.

3.7.5 Unit triangular matrices

Please see Section 3.3.5 in the F07 Chapter Introduction for full details.

3.7.6 Real diagonal elements of complex Hermitian matrices

Please see Section 3.3.6 in the F07 Chapter Introduction for full details.

3.8 Option Arguments

Many of the routines in this chapter have one or more option arguments, of type CHARACTER. The descriptions in the routine documents refer only to upper-case values (for example uplo='U' or uplo='L'); however, in every case, the corresponding lower-case characters may be supplied (with the same meaning). Any other value is illegal.
A longer character string can be passed as the actual argument, making the calling program more readable, but only the first character is significant. (This is a feature of Fortran.) For example:
Call dtrsv('Upper','Transpose','Non-unit',...)
The following option arguments are used in this chapter:

3.8.1 Matrix norms

The option argument norm specifies different matrix norms whose definitions are given here for reference (for a general m×n matrix A):
If A is symmetric or Hermitian, A1=A.
The argument norm can also be used to specify the maximum absolute value maxi,j|aij| (if norm='M'), but this is not a norm in the strict mathematical sense.

3.9 Error Handling

Routines in this chapter do not use the usual NAG Library error-handling mechanism, involving the argument IFAIL.
If one of the Level-2 or Level-3 BLAS routines is called with an invalid value of one of its arguments, then an error message is output on the error message unit (see x04aaf), giving the name of the routine and the number of the first invalid argument, and execution of the program is terminated. The following values of arguments are invalid:
Zero values for the matrix dimensions m, n or k are considered valid.
The other routines in this chapter do not report any errors in their arguments. Normally, if called, for example, with an unspecified value for one of the option arguments, or with a negative value of one of the problem dimensions m or n, they simply do nothing and return immediately.

4 Functionality Index

Matrix-vector operations,  
complex matrix and vector(s),  
compute a norm or the element of largest absolute value,  
band matrix   f16ubf
real matrix and vector(s),  
compute a norm or the element of largest absolute value,  
band matrix   f16rbf
Scalar and vector operations,  
complex vector(s),  
maximum absolute value and location   f16jsf
minimum absolute value and location   f16jtf
sum of elements   f16glf
sum of two scaled vectors   f16gcf
sum of two scaled vectors preserving input   f16ghf
integer vector(s),  
maximum absolute value and location   f16dqf
maximum value and location   f16dnf
minimum absolute value and location   f16drf
minimum value and location   f16dpf
sum of elements   f16dlf
real vector(s),  
dot product of two vectors with optional scaling and accumulation   f16eaf
maximum absolute value and location   f16jqf
maximum value and location   f16jnf
minimum absolute value and location   f16jrf
minimum value and location   f16jpf
sum of elements   f16elf
sum of two scaled vectors   f16ecf
sum of two scaled vectors preserving input   f16ehf

5 Auxiliary Routines Associated with Library Routine Arguments

None.

6 Withdrawn or Deprecated Routines

None.

7 References

Basic Linear Algebra Subprograms Technical (BLAST) Forum (2001) Basic Linear Algebra Subprograms Technical (BLAST) Forum Standard University of Tennessee, Knoxville, Tennessee https://www.netlib.org/blas/blast-forum/blas-report.pdf
Dodson D S and Grimes R G (1982) Remark on Algorithm 539 ACM Trans. Math. Software 8 403–404
Dodson D S, Grimes R G and Lewis J G (1991) Sparse extensions to the Fortran basic linear algebra subprograms ACM Trans. Math. Software 17 253–263
Dongarra J J, Du Croz J J, Duff I S and Hammarling S (1990) A set of Level 3 basic linear algebra subprograms ACM Trans. Math. Software 16 1–28
Dongarra J J, Du Croz J J, Hammarling S and Hanson R J (1988) An extended set of FORTRAN basic linear algebra subprograms ACM Trans. Math. Software 14 1–32
Dongarra J J, Moler C B, Bunch J R and Stewart G W (1979) LINPACK Users' Guide SIAM, Philadelphia
Golub G H and Van Loan C F (1996) Matrix Computations (3rd Edition) Johns Hopkins University Press, Baltimore
Lawson C L, Hanson R J, Kincaid D R and Krogh F T (1979) Basic linear algebra supbrograms for Fortran usage ACM Trans. Math. Software 5 308–325