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)

    symv()

    Generic interface for SSYMV and DSYMV subroutines (matrix-vector multiply, symmetric, y = a.Ax + b.y)

    spmv()

    Generic interface for SSPMV and DSPMV subroutines (matrix-vector multiply, symmetric packed, 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)

    her2()

    Generic interface for CHER2 and ZHER2 subroutines (rank 2 update, conjugated, A = a.xyH + conj(a).yxH + A )

    syr2()

    Generic interface for SSYR2 and DSYR2 subroutines (rank 2 update, A = a.xyT + a.yxT + A )

    hpr2()

    Generic interface for CHPR2 and ZHPR2 subroutines (rank 2 update, hermitian packed, A = a.xyH + conj(a).yxH + A )

    spr2()

    Generic interface for SSPR2 and DSPR2 subroutines (rank 2 update, symmetric packed, A = a.xyT + a.yxT + A )

  • BLAS3 subroutines:

    gemm()

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

    symm()

    Generic interface for SSYMM, DSYMM, CSYMM and ZSYMM subroutines (matrix-matrix multiply, symmetric, C = a.AB + b.C )

    hemm()

    Generic interface for CHEMM and ZHEMM subroutines (matrix-matrix multiply, hermitian, C = a.AB + b.C )

    trmm()

    Generic interface for STRMM, DTRMM, CTRMM and ZTRMM subroutines (matrix-matrix multiply, triangular, C = a.AB + b.C )

    trsm()

    Generic interface for STRSM, DTRSM, CTRSM and ZTRSM subroutines (triangular solve multiple rhs, triangular, TX = a.B )

    syrk()

    Generic interface for SSYRK, DSYRK, CSYRK and ZSYRK subroutines (rank k update, symmetric, C = a.AAT + b.C )

    herk()

    Generic interface for CHERK and ZHERK subroutines (rank k update, hermitian, C = a.AAH + b.C )

    syr2k()

    Generic interface for SSYR2K, DSYR2K, CSYR2K and ZSYR2K subroutines (rank 2k update, symmetric, C = a.ABT + a.BAT + b.C )

    her2k()

    Generic interface for CHER2K and ZHER2K subroutines (rank 2k update, hermitian, C = a.ABH + conj(a).BAH + 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

The following example programs illustrate the use of the BLAS_interfaces module in the framework of STATPACK:

Examples:

ex1_random_svd_with_blas.F90

ex1_random_eig_with_blas.F90

ex1_random_eig_pos_with_blas.F90

Flag Counter