BLAS 1

Description

The Level 1 Basic Linear Algebra Subroutines (BLAS) perform basic vector-vector operations. The following three types of vector-vector operations are available:

  • Dot products and various vector norms

  • Scaling, copying, swapping, and computing linear combination of vectors

  • Generate or apply plane or modified plane rotations

Increment Arguments

A vector’s description consists of the name of the array (x or y) followed by the storage spacing (increment) in the array of vector elements (incx or incy). The increment can be positive or negative. When a vector x consists of n elements, the corresponding actual array arguments must be of a length at least 1+(n-1)*incx. For a negative increment, the first element of x is assumed to be x(1+(n-1)*|incx|).

Setting an increment argument to 0 can cause unpredictable results.

Fortran type declaration for functions

Always declare the data type of external functions. Declaring the data type of the complex Level 1 BLAS functions is particularly important because, based on the first letter of their names and the Fortran data typing rules, the default implied data type may be incorrect.

Fortran type declarations for function names follow:

Type

Function Name

INTEGER

ISAMAX, ICAMAX, IDAMAX, IZAMAX

REAL

SASUM, SCASUM, SDOT, SDSDOT, SNRM2, SCNRM2

DOUBLE PRECISION

DASUM, DZASUM, DDOT, DNRM2, DZNRM2, DSDOT

COMPLEX

CDOTC, CDOTU

DOUBLE COMPLEX

ZDOTC, ZDOTU

Table of Level 1 BLAS routines

The following table contains the purpose, operation, and name of each Level 1 BLAS routine.

Purpose

Operation

Name

Returns the index of the vector element having
maximum absolute value for a vector

ISAMAX, IDAMAX, ICAMAX, IZAMAX

Sums the absolute values of the elements of a real
vector (also called L1 norm)

_asum := SUM(i=1 to n)[abs(x(i))]

SASUM, DASUM

Sums the absolute values of the real and imaginary
parts of the elements of a complex vector

__asum := SUM(i=1 to n)[ abs(real(x(i))) + (abs(imag(x(i))) ]

SCASUM, DZASUM

Adds a scalar multiple of a vector to another vector

y := alpha*x + y

SAXPY, DAXPY, CAXPY, DAXPY

Copies a vector x into vector y

y := x

SCOPY, DCOPY, CCOPY, DCOPY

Computes a dot product of two vectors

_dot := x**T*y = SUM(i=1 to n)[ x(i)*y(i) ]
_dotc := x**H*y = SUM(i=1 to n)[ x(i)**H*y(i) ]
_dotu := x**T*y = SUM(i=1 to n)[ x(i)*y(i) ]

SDOT, DDOT, CDOTC, ZDOTC,
CDOTU, ZDOTU

Computes the inner product of two vectors with
extended precision accumulation

_dsdot := sb + x**T*y = SUM(i=1 to n)[ x(i)*y(i) ]

SDSDOT, DSDOT

Computes the Euclidean norm (also called L2 norm)
of a vector

_nrm2 := sqrt( x'*x )
__nrm2 := sqrt( x**H*x )

SNRM2, DNRM2, SCNRM2, DZNRM2

Applies an orthogonal plane rotation

SROT, DROT

Constructs a Givens plane rotation

SROTG, DROTG, CROTG, ZROTG

Scales a vector by a constant

x := alpha*x

SSCAL, DSCAL, CSSCAL, CSCAL,
ZDSCAL, ZSCAL

Swaps two vectors

x <--> y

SSWAP, DSWAP, CSWAP, DSWAP

Environment Variables

CRAYBLAS_LEVEL1_LEGACY

    When set to 1, it entirely disables the CrayBLAS framework for
    BLAS Level 1 calls, resulting in all BLAS calls to fallback to
    the basis code. When CRAYBLAS_LEVEL1_LEGACY=1, none of the other
    environment variables in this section will be checked by BLAS
    Level 1 routines, as this is a top-level disable switch.

    Default: 0

CRAYBLAS_ABORT_ON_ERROR

    When an invalid call to a BLAS routine is made, the library
    prints an error message to the stdout stream and then calls the
    abort() function to stop program execution, as it is the likely
    case that a bug is present and the results would be invalid.
    Setting CRAYBLAS_ABORT_ON_ERROR=0 will cause the library only to
    report an error to the stdout stream and return from the BLAS
    call. This option is provided for codes that can tolerate invalid
    BLAS calls without the need to abort. This option is available
    even when any of the CRAYBLAS_LEVELn_LEGACY options are set.

    Default: 1

CRAYBLAS_PROFILING_VERBOSITY

    This environment variable causes CrayBLAS routines to report
    their routine name and argument values, and optionally runtime in
    seconds to stdout. When CRAYBLAS_PROFILING_VERBOSITY=1, only the
    routine name and argument values and printed. To also print the
    runtime in seconds, set CRAYBLAS_PROFILING_VERBOSITY=2. The run
    times reported do NOT include the time it takes to print the
    information to the output stream. However, other times outside of
    the BLAS calls may be skewed as the calls will take some time to
    print this information. This option is available even when any of
    the CRAYBLAS_LEVELn_LEGACY options are set.

    Default: not set