MODULE BLAS_interfaces

Module BLAS_interfaces contains/exports generic interfaces for selected routines available in the BLAS library for use inside of the STATPACK library when the cpp macro _BLAS is activated at compilation of the STATPACK library.

Use of these interface blocks exported by module BLAS_interfaces unsures that calls to BLAS routines are correct, when used inside the STATPACK library.

Since the BLAS library provides routines only for single and double precision real/complex data, the interface blocks defined in the module BLAS_interfaces will work obviously only if the real/complex kind type stnd defined in module Select_Parameters is equivalent to single or double precision real/complex data. In other words, you cannot activate BLAS support in STATPACK with the cpp macro _BLAS if the real/complex kind type stnd defined in module Select_Parameters is equivalent to quadruple precision real/complex data because current versions of the BLAS library do not support quadruple precision real/complex data.

Generic interfaces are presently provided for the following BLAS routines:

  • BLAS1 subroutines:

    axpy()

    Generic interface for SAXPY, DAXPY, CAXPY and ZAXPY subroutines (add vectors, y = a.x + y)

    copy()

    Generic interface for SCOPY, DCOPY, CCOPY and ZCOPY subroutines (copy vector, y = x)

    dot()

    Generic interface for SDOT, DDOT, CDOTC and ZDOTC subroutines (dot product, xH y)

    dotu()

    Generic interface for CDOTU and ZDOTU subroutines (dot product, unconjugated xT y)

    rot()

    Generic interface for SROT, DROT, CSROT and ZDROT subroutines (apply Givens plane rotation)

    swap()

    Generic interface for SSWAP, DSWAP, CSWAP and ZSWAP subroutines (swap vectors)

    scal()

    Generic interface for SSCAL, DSCAL, CSCAL, ZSCAL, CSSCAL and ZDSCAL subroutines (scale vector, y = a.y)

    nrm2()

    Generic interface for SNRM2, DNRM2, SCNRM2 and DZNRM2subroutines (vector 2-norm, ||x||2)

  • BLAS2 subroutines:

    gemv()

    Generic interface for SGEMV, DGEMV, CGEMV and ZGEMV subroutines (matrix-vector multiply, y = a.Ax + b.y)

    ger()

    Generic interface for SGER, DGER, CGERC and ZGERC subroutines (rank 1 update, conjugated, A = a.xyH + A)

    geru()

    Generic interface for CGERU and ZGERU subroutines (rank 1 update, unconjugated, A = a.xyT + A)

    trsv()

    Generic interface for STRSV, DTRSV, CTRSV and ZTRSV subroutines (triangular solve Tx = b)

  • BLAS3 subroutines:

    gemm()

    Generic interface for SGEMM, DGEMM, CGEMM and ZGEMM subroutines (matrix-matrix multiply, C = a.AB + b.C )

Consult the official BLAS site at BLAS, the hyper-text documentation at BLAS documentation or the nice summary available at http://www.icl.utk.edu/~mgates3/docs/lapack.html for the definition/documentation of the BLAS routines.

Finally, note that you can add at your convenience interface blocks for other BLAS routines in module BLAS_interfaces, which is in the file Module_BLAS_Interfaces.F90. Here, is an example of the generic interface for the SDOT, DDOT, CDOTC and ZDOTC functions available in BLAS, which can be used as a model for creating a generic interface for other BLAS routines:

!
!   Interface for DOT functions in BLAS
!
interface dot
!
    REAL function sdot( N, SX, INCX, SY, INCY )
!     ..
!     .. Scalar Arguments ..
       INTEGER          INCX, INCY, N
!     ..
!     .. Array Arguments ..
       REAL             SX( * ), SY( * )
    end function
!
    DOUBLE PRECISION function ddot( N, DX, INCX, DY, INCY )
!     ..
!     .. Scalar Arguments ..
       INTEGER          INCX, INCY, N
!     ..
!     .. Array Arguments ..
       DOUBLE PRECISION DX( * ), DY( * )
    end function
!
    COMPLEX function cdotc( N, CX, INCX, CY, INCY )
!     ..
!     .. Scalar Arguments ..
       INTEGER          INCX, INCY, N
!     ..
!     .. Array Arguments ..
       COMPLEX          CX( * ), CY( * )
    end function
!
    COMPLEX*16 function zdotc( N, ZX, INCX, ZY, INCY )
!     ..
!     .. Scalar Arguments ..
       INTEGER          INCX, INCY, N
!     ..
!     .. Array Arguments ..
       COMPLEX*16       ZX( * ), ZY( * )
    end function
!
end interface