From 555bc3f08af320c9ad8f1b9f7d57ef0be7a6f7b6 Mon Sep 17 00:00:00 2001 From: Tony Kelman Date: Sun, 19 Oct 2014 14:00:54 -0700 Subject: [PATCH] add and use a blas_suffix macro for all blas and lapack symbols --- base/linalg/blas.jl | 182 +++++++++++++------------- base/linalg/lapack.jl | 298 +++++++++++++++++++++--------------------- base/util.jl | 6 + 3 files changed, 247 insertions(+), 239 deletions(-) diff --git a/base/linalg/blas.jl b/base/linalg/blas.jl index d81a98888d02af..f6a2a559b123f1 100644 --- a/base/linalg/blas.jl +++ b/base/linalg/blas.jl @@ -1,7 +1,7 @@ module BLAS import ..axpy! -import Base.copy! +import Base: copy!, @blas_suffix export # Level 1 @@ -57,10 +57,10 @@ import ..LinAlg: BlasReal, BlasComplex, BlasFloat, BlasChar, BlasInt, blas_int, # Level 1 ## copy -for (fname, elty) in ((:dcopy_,:Float64), - (:scopy_,:Float32), - (:zcopy_,:Complex128), - (:ccopy_,:Complex64)) +for (fname, elty) in ((@blas_suffix(:dcopy_),:Float64), + (@blas_suffix(:scopy_),:Float32), + (@blas_suffix(:zcopy_),:Complex128), + (@blas_suffix(:ccopy_),:Complex64)) @eval begin # SUBROUTINE DCOPY(N,DX,INCX,DY,INCY) function blascopy!(n::Integer, DX::Union(Ptr{$elty},StridedArray{$elty}), incx::Integer, DY::Union(Ptr{$elty},StridedArray{$elty}), incy::Integer) @@ -73,10 +73,10 @@ for (fname, elty) in ((:dcopy_,:Float64), end ## scal -for (fname, elty) in ((:dscal_,:Float64), - (:sscal_,:Float32), - (:zscal_,:Complex128), - (:cscal_,:Complex64)) +for (fname, elty) in ((@blas_suffix(:dscal_),:Float64), + (@blas_suffix(:sscal_),:Float32), + (@blas_suffix(:zscal_),:Complex128), + (@blas_suffix(:cscal_),:Complex64)) @eval begin # SUBROUTINE DSCAL(N,DA,DX,INCX) function scal!(n::Integer, DA::$elty, DX::Union(Ptr{$elty},StridedArray{$elty}), incx::Integer) @@ -89,8 +89,8 @@ for (fname, elty) in ((:dscal_,:Float64), end scal(n, DA, DX, incx) = scal!(n, DA, copy(DX), incx) # In case DX is complex, and DA is real, use dscal/sscal to save flops -for (fname, elty, celty) in ((:sscal_, :Float32, :Complex64), - (:dscal_, :Float64, :Complex128)) +for (fname, elty, celty) in ((@blas_suffix(:sscal_), :Float32, :Complex64), + (@blas_suffix(:dscal_), :Float64, :Complex128)) @eval begin function scal!(n::Integer, DA::$elty, DX::Union(Ptr{$celty},StridedArray{$celty}), incx::Integer) ccall(($(string(fname)),libblas), Void, @@ -102,8 +102,8 @@ for (fname, elty, celty) in ((:sscal_, :Float32, :Complex64), end ## dot -for (fname, elty) in ((:ddot_,:Float64), - (:sdot_,:Float32)) +for (fname, elty) in ((@blas_suffix(:ddot_),:Float64), + (@blas_suffix(:sdot_),:Float32)) @eval begin # DOUBLE PRECISION FUNCTION DDOT(N,DX,INCX,DY,INCY) # * .. Scalar Arguments .. @@ -118,8 +118,8 @@ for (fname, elty) in ((:ddot_,:Float64), end end end -for (fname, elty) in ((:cblas_zdotc_sub,:Complex128), - (:cblas_cdotc_sub,:Complex64)) +for (fname, elty) in ((@blas_suffix(:cblas_zdotc_sub),:Complex128), + (@blas_suffix(:cblas_cdotc_sub),:Complex64)) @eval begin # DOUBLE PRECISION FUNCTION DDOT(N,DX,INCX,DY,INCY) # * .. Scalar Arguments .. @@ -136,8 +136,8 @@ for (fname, elty) in ((:cblas_zdotc_sub,:Complex128), end end end -for (fname, elty) in ((:cblas_zdotu_sub,:Complex128), - (:cblas_cdotu_sub,:Complex64)) +for (fname, elty) in ((@blas_suffix(:cblas_zdotu_sub),:Complex128), + (@blas_suffix(:cblas_cdotu_sub),:Complex64)) @eval begin # DOUBLE PRECISION FUNCTION DDOT(N,DX,INCX,DY,INCY) # * .. Scalar Arguments .. @@ -171,10 +171,10 @@ function dotu{T<:BlasComplex}(DX::StridedArray{T}, DY::StridedArray{T}) end ## nrm2 -for (fname, elty, ret_type) in ((:dnrm2_,:Float64,:Float64), - (:snrm2_,:Float32,:Float32), - (:dznrm2_,:Complex128,:Float64), - (:scnrm2_,:Complex64,:Float32)) +for (fname, elty, ret_type) in ((@blas_suffix(:dnrm2_),:Float64,:Float64), + (@blas_suffix(:snrm2_),:Float32,:Float32), + (@blas_suffix(:dznrm2_),:Complex128,:Float64), + (@blas_suffix(:scnrm2_),:Complex64,:Float32)) @eval begin # SUBROUTINE DNRM2(N,X,INCX) function nrm2(n::Integer, X::Union(Ptr{$elty},StridedVector{$elty}), incx::Integer) @@ -188,10 +188,10 @@ nrm2(x::StridedVector) = nrm2(length(x), x, stride(x,1)) nrm2(x::Array) = nrm2(length(x), pointer(x), 1) ## asum -for (fname, elty, ret_type) in ((:dasum_,:Float64,:Float64), - (:sasum_,:Float32,:Float32), - (:dzasum_,:Complex128,:Float64), - (:scasum_,:Complex64,:Float32)) +for (fname, elty, ret_type) in ((@blas_suffix(:dasum_),:Float64,:Float64), + (@blas_suffix(:sasum_),:Float32,:Float32), + (@blas_suffix(:dzasum_),:Complex128,:Float64), + (@blas_suffix(:scasum_),:Complex64,:Float32)) @eval begin # SUBROUTINE ASUM(N, X, INCX) function asum(n::Integer, X::Union(Ptr{$elty},StridedVector{$elty}), incx::Integer) @@ -205,10 +205,10 @@ asum(x::StridedVector) = asum(length(x), x, stride(x,1)) asum(x::Array) = asum(length(x), pointer(x), 1) ## axpy -for (fname, elty) in ((:daxpy_,:Float64), - (:saxpy_,:Float32), - (:zaxpy_,:Complex128), - (:caxpy_,:Complex64)) +for (fname, elty) in ((@blas_suffix(:daxpy_),:Float64), + (@blas_suffix(:saxpy_),:Float32), + (@blas_suffix(:zaxpy_),:Complex128), + (@blas_suffix(:caxpy_),:Complex64)) @eval begin # SUBROUTINE DAXPY(N,DA,DX,INCX,DY,INCY) # DY <- DA*DX + DY @@ -243,10 +243,10 @@ function axpy!{T<:BlasFloat,Ta<:Number,Ti<:Integer}(alpha::Ta, x::Array{T}, rx:: end ## iamax -for (fname, elty) in ((:idamax_,:Float64), - (:isamax_,:Float32), - (:izamax_,:Complex128), - (:icamax_,:Complex64)) +for (fname, elty) in ((@blas_suffix(:idamax_),:Float64), + (@blas_suffix(:isamax_),:Float32), + (@blas_suffix(:izamax_),:Complex128), + (@blas_suffix(:icamax_),:Complex64)) @eval begin function iamax(n::BlasInt, dx::Union(StridedVector{$elty}, Ptr{$elty}), incx::BlasInt) ccall(($(string(fname)), libblas),BlasInt, @@ -260,10 +260,10 @@ iamax(dx::StridedVector) = iamax(length(dx), dx, 1) # Level 2 ## mv ### gemv -for (fname, elty) in ((:dgemv_,:Float64), - (:sgemv_,:Float32), - (:zgemv_,:Complex128), - (:cgemv_,:Complex64)) +for (fname, elty) in ((@blas_suffix(:dgemv_),:Float64), + (@blas_suffix(:sgemv_),:Float32), + (@blas_suffix(:zgemv_),:Complex128), + (@blas_suffix(:cgemv_),:Complex64)) @eval begin #SUBROUTINE DGEMV(TRANS,M,N,ALPHA,A,LDA,X,INCX,BETA,Y,INCY) #* .. Scalar Arguments .. @@ -294,10 +294,10 @@ for (fname, elty) in ((:dgemv_,:Float64), end ### (GB) general banded matrix-vector multiplication -for (fname, elty) in ((:dgbmv_,:Float64), - (:sgbmv_,:Float32), - (:zgbmv_,:Complex128), - (:cgbmv_,:Complex64)) +for (fname, elty) in ((@blas_suffix(:dgbmv_),:Float64), + (@blas_suffix(:sgbmv_),:Float32), + (@blas_suffix(:zgbmv_),:Complex128), + (@blas_suffix(:cgbmv_),:Complex64)) @eval begin # SUBROUTINE DGBMV(TRANS,M,N,KL,KU,ALPHA,A,LDA,X,INCX,BETA,Y,INCY) # * .. Scalar Arguments .. @@ -329,10 +329,10 @@ for (fname, elty) in ((:dgbmv_,:Float64), end ### symv -for (fname, elty) in ((:dsymv_,:Float64), - (:ssymv_,:Float32), - (:zsymv_,:Complex128), - (:csymv_,:Complex64)) +for (fname, elty) in ((@blas_suffix(:dsymv_),:Float64), + (@blas_suffix(:ssymv_),:Float32), + (@blas_suffix(:zsymv_),:Complex128), + (@blas_suffix(:csymv_),:Complex64)) # Note that the complex symv are not BLAS but auiliary functions in LAPACK @eval begin # SUBROUTINE DSYMV(UPLO,N,ALPHA,A,LDA,X,INCX,BETA,Y,INCY) @@ -365,8 +365,8 @@ for (fname, elty) in ((:dsymv_,:Float64), end ### hemv -for (fname, elty) in ((:zhemv_,:Complex128), - (:chemv_,:Complex64)) +for (fname, elty) in ((@blas_suffix(:zhemv_),:Complex128), + (@blas_suffix(:chemv_),:Complex64)) @eval begin function hemv!(uplo::Char, α::$elty, A::StridedMatrix{$elty}, x::StridedVector{$elty}, β::$elty, y::StridedVector{$elty}) n = size(A, 2) @@ -394,10 +394,10 @@ for (fname, elty) in ((:zhemv_,:Complex128), end ### sbmv, (SB) symmetric banded matrix-vector multiplication -for (fname, elty) in ((:dsbmv_,:Float64), - (:ssbmv_,:Float32), - (:zsbmv_,:Complex128), - (:csbmv_,:Complex64)) +for (fname, elty) in ((@blas_suffix(:dsbmv_),:Float64), + (@blas_suffix(:ssbmv_),:Float32), + (@blas_suffix(:zsbmv_),:Complex128), + (@blas_suffix(:csbmv_),:Complex64)) @eval begin # SUBROUTINE DSBMV(UPLO,N,K,ALPHA,A,LDA,X,INCX,BETA,Y,INCY) # * .. Scalar Arguments .. @@ -427,10 +427,10 @@ for (fname, elty) in ((:dsbmv_,:Float64), end ### trmv, Triangular matrix-vector multiplication -for (fname, elty) in ((:dtrmv_,:Float64), - (:strmv_,:Float32), - (:ztrmv_,:Complex128), - (:ctrmv_,:Complex64)) +for (fname, elty) in ((@blas_suffix(:dtrmv_),:Float64), + (@blas_suffix(:strmv_),:Float32), + (@blas_suffix(:ztrmv_),:Complex128), + (@blas_suffix(:ctrmv_),:Complex64)) @eval begin # SUBROUTINE DTRMV(UPLO,TRANS,DIAG,N,A,LDA,X,INCX) # * .. Scalar Arguments .. @@ -456,10 +456,10 @@ for (fname, elty) in ((:dtrmv_,:Float64), end end ### trsv, Triangular matrix-vector solve -for (fname, elty) in ((:dtrsv_,:Float64), - (:strsv_,:Float32), - (:ztrsv_,:Complex128), - (:ctrsv_,:Complex64)) +for (fname, elty) in ((@blas_suffix(:dtrsv_),:Float64), + (@blas_suffix(:strsv_),:Float32), + (@blas_suffix(:ztrsv_),:Complex128), + (@blas_suffix(:ctrsv_),:Complex64)) @eval begin # SUBROUTINE DTRSV(UPLO,TRANS,DIAG,N,A,LDA,X,INCX) # .. Scalar Arguments .. @@ -484,10 +484,10 @@ for (fname, elty) in ((:dtrsv_,:Float64), end ### ger -for (fname, elty) in ((:dger_,:Float64), - (:sger_,:Float32), - (:zgerc_,:Complex128), - (:cgerc_,:Complex64)) +for (fname, elty) in ((@blas_suffix(:dger_),:Float64), + (@blas_suffix(:sger_),:Float32), + (@blas_suffix(:zgerc_),:Complex128), + (@blas_suffix(:cgerc_),:Complex64)) @eval begin function ger!(α::$elty, x::StridedVector{$elty}, y::StridedVector{$elty}, A::StridedMatrix{$elty}) m, n = size(A) @@ -506,10 +506,10 @@ for (fname, elty) in ((:dger_,:Float64), end ### syr -for (fname, elty) in ((:dsyr_,:Float64), - (:ssyr_,:Float32), - (:zsyr_,:Complex128), - (:csyr_,:Complex64)) +for (fname, elty) in ((@blas_suffix(:dsyr_),:Float64), + (@blas_suffix(:ssyr_),:Float32), + (@blas_suffix(:zsyr_),:Complex128), + (@blas_suffix(:csyr_),:Complex64)) @eval begin function syr!(uplo::Char, α::$elty, x::StridedVector{$elty}, A::StridedMatrix{$elty}) n = chksquare(A) @@ -525,8 +525,8 @@ for (fname, elty) in ((:dsyr_,:Float64), end ### her -for (fname, elty) in ((:zher_,:Complex128), - (:cher_,:Complex64)) +for (fname, elty) in ((@blas_suffix(:zher_),:Complex128), + (@blas_suffix(:cher_),:Complex64)) @eval begin function her!(uplo::Char, α::$elty, x::StridedVector{$elty}, A::StridedMatrix{$elty}) n = chksquare(A) @@ -544,10 +544,10 @@ end # Level 3 ## (GE) general matrix-matrix multiplication for (gemm, elty) in - ((:dgemm_,:Float64), - (:sgemm_,:Float32), - (:zgemm_,:Complex128), - (:cgemm_,:Complex64)) + ((@blas_suffix(:dgemm_),:Float64), + (@blas_suffix(:sgemm_),:Float32), + (@blas_suffix(:zgemm_),:Complex128), + (@blas_suffix(:cgemm_),:Complex64)) @eval begin # SUBROUTINE DGEMM(TRANSA,TRANSB,M,N,K,ALPHA,A,LDA,B,LDB,BETA,C,LDC) # * .. Scalar Arguments .. @@ -587,10 +587,10 @@ for (gemm, elty) in end ## (SY) symmetric matrix-matrix and matrix-vector multiplication -for (mfname, elty) in ((:dsymm_,:Float64), - (:ssymm_,:Float32), - (:zsymm_,:Complex128), - (:csymm_,:Complex64)) +for (mfname, elty) in ((@blas_suffix(:dsymm_),:Float64), + (@blas_suffix(:ssymm_),:Float32), + (@blas_suffix(:zsymm_),:Complex128), + (@blas_suffix(:csymm_),:Complex64)) @eval begin # SUBROUTINE DSYMM(SIDE,UPLO,M,N,ALPHA,A,LDA,B,LDB,BETA,C,LDC) # .. Scalar Arguments .. @@ -622,10 +622,10 @@ for (mfname, elty) in ((:dsymm_,:Float64), end ## syrk -for (fname, elty) in ((:dsyrk_,:Float64), - (:ssyrk_,:Float32), - (:zsyrk_,:Complex128), - (:csyrk_,:Complex64)) +for (fname, elty) in ((@blas_suffix(:dsyrk_),:Float64), + (@blas_suffix(:ssyrk_),:Float32), + (@blas_suffix(:zsyrk_),:Complex128), + (@blas_suffix(:csyrk_),:Complex64)) @eval begin # SUBROUTINE DSYRK(UPLO,TRANS,N,K,ALPHA,A,LDA,BETA,C,LDC) # * .. Scalar Arguments .. @@ -659,7 +659,7 @@ function syrk(uplo::BlasChar, trans::BlasChar, alpha::Number, A::StridedVecOrMat end syrk(uplo::BlasChar, trans::BlasChar, A::StridedVecOrMat) = syrk(uplo, trans, one(eltype(A)), A) -for (fname, elty) in ((:zherk_,:Complex128), (:cherk_,:Complex64)) +for (fname, elty) in ((@blas_suffix(:zherk_),:Complex128), (@blas_suffix(:cherk_),:Complex64)) @eval begin # SUBROUTINE CHERK(UPLO,TRANS,N,K,ALPHA,A,LDA,BETA,C,LDC) # * .. Scalar Arguments .. @@ -692,10 +692,10 @@ for (fname, elty) in ((:zherk_,:Complex128), (:cherk_,:Complex64)) end ## syr2k -for (fname, elty) in ((:dsyr2k_,:Float64), - (:ssyr2k_,:Float32), - (:zsyr2k_,:Complex128), - (:csyr2k_,:Complex64)) +for (fname, elty) in ((@blas_suffix(:dsyr2k_),:Float64), + (@blas_suffix(:ssyr2k_),:Float32), + (@blas_suffix(:zsyr2k_),:Complex128), + (@blas_suffix(:csyr2k_),:Complex64)) @eval begin # SUBROUTINE DSYR2K(UPLO,TRANS,N,K,ALPHA,A,LDA,B,LDB,BETA,C,LDC) # @@ -731,7 +731,7 @@ function syr2k(uplo::BlasChar, trans::BlasChar, alpha::Number, A::StridedVecOrMa end syr2k(uplo::BlasChar, trans::BlasChar, A::StridedVecOrMat, B::StridedVecOrMat) = syr2k(uplo, trans, one(eltype(A)), A, B) -for (fname, elty1, elty2) in ((:zher2k_,:Complex128,:Float64), (:cher2k_,:Complex64,:Float32)) +for (fname, elty1, elty2) in ((@blas_suffix(:zher2k_),:Complex128,:Float64), (@blas_suffix(:cher2k_),:Complex64,:Float32)) @eval begin # SUBROUTINE CHER2K(UPLO,TRANS,N,K,ALPHA,A,LDA,B,LDB,BETA,C,LDC) # @@ -768,10 +768,10 @@ end ## (TR) Triangular matrix and vector multiplication and solution for (mmname, smname, elty) in - ((:dtrmm_,:dtrsm_,:Float64), - (:strmm_,:strsm_,:Float32), - (:ztrmm_,:ztrsm_,:Complex128), - (:ctrmm_,:ctrsm_,:Complex64)) + ((@blas_suffix(:dtrmm_),@blas_suffix(:dtrsm_),:Float64), + (@blas_suffix(:strmm_),@blas_suffix(:strsm_),:Float32), + (@blas_suffix(:ztrmm_),@blas_suffix(:ztrsm_),:Complex128), + (@blas_suffix(:ctrmm_),@blas_suffix(:ctrsm_),:Complex64)) @eval begin # SUBROUTINE DTRMM(SIDE,UPLO,TRANSA,DIAG,M,N,ALPHA,A,LDA,B,LDB) # * .. Scalar Arguments .. diff --git a/base/linalg/lapack.jl b/base/linalg/lapack.jl index 79bee8db9c7bbe..e7bd80a5267162 100644 --- a/base/linalg/lapack.jl +++ b/base/linalg/lapack.jl @@ -3,6 +3,8 @@ module LAPACK const liblapack = Base.liblapack_name +import Base.@blas_suffix + import ..LinAlg: BlasFloat, BlasChar, BlasInt, blas_int, LAPACKException, DimensionMismatch, SingularException, PosDefException, chkstride1, chksquare @@ -30,10 +32,10 @@ end # (GB) general banded matrices, LU decomposition and solver for (gbtrf, gbtrs, elty) in - ((:dgbtrf_,:dgbtrs_,:Float64), - (:sgbtrf_,:sgbtrs_,:Float32), - (:zgbtrf_,:zgbtrs_,:Complex128), - (:cgbtrf_,:cgbtrs_,:Complex64)) + ((@blas_suffix(:dgbtrf_),@blas_suffix(:dgbtrs_),:Float64), + (@blas_suffix(:sgbtrf_),@blas_suffix(:sgbtrs_),:Float32), + (@blas_suffix(:zgbtrf_),@blas_suffix(:zgbtrs_),:Complex128), + (@blas_suffix(:cgbtrf_),@blas_suffix(:cgbtrs_),:Complex64)) @eval begin # SUBROUTINE DGBTRF( M, N, KL, KU, AB, LDAB, IPIV, INFO ) # * .. Scalar Arguments .. @@ -82,10 +84,10 @@ end ## (GE) general matrices: balancing and back-transforming for (gebal, gebak, elty, relty) in - ((:dgebal_, :dgebak_, :Float64, :Float64), - (:sgebal_, :sgebak_, :Float32, :Float32), - (:zgebal_, :zgebak_, :Complex128, :Float64), - (:cgebal_, :cgebak_, :Complex64, :Float32)) + ((@blas_suffix(:dgebal_), @blas_suffix(:dgebak_), :Float64, :Float64), + (@blas_suffix(:sgebal_), @blas_suffix(:sgebak_), :Float32, :Float32), + (@blas_suffix(:zgebal_), @blas_suffix(:zgebak_), :Complex128, :Float64), + (@blas_suffix(:cgebal_), @blas_suffix(:cgebak_), :Complex64, :Float32)) @eval begin # SUBROUTINE DGEBAL( JOB, N, A, LDA, ILO, IHI, SCALE, INFO ) #* .. Scalar Arguments .. @@ -146,10 +148,10 @@ end # updated in place. The condensed mutating functions, usually a # function of A only, are defined after this block. for (gebrd, gelqf, geqlf, geqrf, geqp3, geqrt, geqrt3, gerqf, getrf, elty, relty) in - ((:dgebrd_,:dgelqf_,:dgeqlf_,:dgeqrf_,:dgeqp3_,:dgeqrt_,:dgeqrt3_,:dgerqf_,:dgetrf_,:Float64,:Float64), - (:sgebrd_,:sgelqf_,:sgeqlf_,:sgeqrf_,:sgeqp3_,:sgeqrt_,:sgeqrt3_,:sgerqf_,:sgetrf_,:Float32,:Float32), - (:zgebrd_,:zgelqf_,:zgeqlf_,:zgeqrf_,:zgeqp3_,:zgeqrt_,:zgeqrt3_,:zgerqf_,:zgetrf_,:Complex128,:Float64), - (:cgebrd_,:cgelqf_,:cgeqlf_,:cgeqrf_,:cgeqp3_,:cgeqrt_,:cgeqrt3_,:cgerqf_,:cgetrf_,:Complex64,:Float32)) + ((@blas_suffix(:dgebrd_),@blas_suffix(:dgelqf_),@blas_suffix(:dgeqlf_),@blas_suffix(:dgeqrf_),@blas_suffix(:dgeqp3_),@blas_suffix(:dgeqrt_),@blas_suffix(:dgeqrt3_),@blas_suffix(:dgerqf_),@blas_suffix(:dgetrf_),:Float64,:Float64), + (@blas_suffix(:sgebrd_),@blas_suffix(:sgelqf_),@blas_suffix(:sgeqlf_),@blas_suffix(:sgeqrf_),@blas_suffix(:sgeqp3_),@blas_suffix(:sgeqrt_),@blas_suffix(:sgeqrt3_),@blas_suffix(:sgerqf_),@blas_suffix(:sgetrf_),:Float32,:Float32), + (@blas_suffix(:zgebrd_),@blas_suffix(:zgelqf_),@blas_suffix(:zgeqlf_),@blas_suffix(:zgeqrf_),@blas_suffix(:zgeqp3_),@blas_suffix(:zgeqrt_),@blas_suffix(:zgeqrt3_),@blas_suffix(:zgerqf_),@blas_suffix(:zgetrf_),:Complex128,:Float64), + (@blas_suffix(:cgebrd_),@blas_suffix(:cgelqf_),@blas_suffix(:cgeqlf_),@blas_suffix(:cgeqrf_),@blas_suffix(:cgeqp3_),@blas_suffix(:cgeqrt_),@blas_suffix(:cgeqrt3_),@blas_suffix(:cgerqf_),@blas_suffix(:cgetrf_),:Complex64,:Float32)) @eval begin # SUBROUTINE DGEBRD( M, N, A, LDA, D, E, TAUQ, TAUP, WORK, LWORK, # INFO ) @@ -408,10 +410,10 @@ end ## Complete orthogonaliztion tools for (tzrzf, ormrz, elty) in - ((:dtzrzf_,:dormrz_,:Float64), - (:stzrzf_,:sormrz_,:Float32), - (:ztzrzf_,:zunmrz_,:Complex128), - (:ctzrzf_,:cunmrz_,:Complex64)) + ((@blas_suffix(:dtzrzf_),@blas_suffix(:dormrz_),:Float64), + (@blas_suffix(:stzrzf_),@blas_suffix(:sormrz_),:Float32), + (@blas_suffix(:ztzrzf_),@blas_suffix(:zunmrz_),:Complex128), + (@blas_suffix(:ctzrzf_),@blas_suffix(:cunmrz_),:Complex64)) @eval begin # * SUBROUTINE ZTZRZF( M, N, A, LDA, TAU, WORK, LWORK, INFO ) # 22 * @@ -484,10 +486,10 @@ end ## (GE) general matrices, solvers with factorization, solver and inverse for (gels, gesv, getrs, getri, elty) in - ((:dgels_,:dgesv_,:dgetrs_,:dgetri_,:Float64), - (:sgels_,:sgesv_,:sgetrs_,:sgetri_,:Float32), - (:zgels_,:zgesv_,:zgetrs_,:zgetri_,:Complex128), - (:cgels_,:cgesv_,:cgetrs_,:cgetri_,:Complex64)) + ((@blas_suffix(:dgels_),@blas_suffix(:dgesv_),@blas_suffix(:dgetrs_),@blas_suffix(:dgetri_),:Float64), + (@blas_suffix(:sgels_),@blas_suffix(:sgesv_),@blas_suffix(:sgetrs_),@blas_suffix(:sgetri_),:Float32), + (@blas_suffix(:zgels_),@blas_suffix(:zgesv_),@blas_suffix(:zgetrs_),@blas_suffix(:zgetri_),:Complex128), + (@blas_suffix(:cgels_),@blas_suffix(:cgesv_),@blas_suffix(:cgetrs_),@blas_suffix(:cgetri_),:Complex64)) @eval begin # SUBROUTINE DGELS( TRANS, M, N, NRHS, A, LDA, B, LDB, WORK, LWORK,INFO) # * .. Scalar Arguments .. @@ -595,8 +597,8 @@ for (gels, gesv, getrs, getri, elty) in end end for (gesvx, elty) in - ((:dgesvx_,:Float64), - (:sgesvx_,:Float32)) + ((@blas_suffix(:dgesvx_),:Float64), + (@blas_suffix(:sgesvx_),:Float32)) @eval begin # SUBROUTINE DGESVX( FACT, TRANS, N, NRHS, A, LDA, AF, LDAF, IPIV, # EQUED, R, C, B, LDB, X, LDX, RCOND, FERR, BERR, @@ -650,8 +652,8 @@ for (gesvx, elty) in end end for (gesvx, elty, relty) in - ((:zgesvx_,:Complex128,:Float64), - (:cgesvx_,:Complex64 ,:Float32)) + ((@blas_suffix(:zgesvx_),:Complex128,:Float64), + (@blas_suffix(:cgesvx_),:Complex64 ,:Float32)) @eval begin # SUBROUTINE ZGESVX( FACT, TRANS, N, NRHS, A, LDA, AF, LDAF, IPIV, # EQUED, R, C, B, LDB, X, LDX, RCOND, FERR, BERR, @@ -705,8 +707,8 @@ for (gesvx, elty, relty) in end for (gelsd, gelsy, elty) in - ((:dgelsd_,:dgelsy_,:Float64), - (:sgelsd_,:sgelsy_,:Float32)) + ((@blas_suffix(:dgelsd_),@blas_suffix(:dgelsy_),:Float64), + (@blas_suffix(:sgelsd_),@blas_suffix(:sgelsy_),:Float32)) @eval begin # SUBROUTINE DGELSD( M, N, NRHS, A, LDA, B, LDB, S, RCOND, RANK, # $ WORK, LWORK, IWORK, INFO ) @@ -792,8 +794,8 @@ for (gelsd, gelsy, elty) in end end for (gelsd, gelsy, elty, relty) in - ((:zgelsd_,:zgelsy_,:Complex128,:Float64), - (:cgelsd_,:cgelsy_,:Complex64,:Float32)) + ((@blas_suffix(:zgelsd_),@blas_suffix(:zgelsy_),:Complex128,:Float64), + (@blas_suffix(:cgelsd_),@blas_suffix(:cgelsy_),:Complex64,:Float32)) @eval begin # SUBROUTINE ZGELSD( M, N, NRHS, A, LDA, B, LDB, S, RCOND, RANK, # $ WORK, LWORK, RWORK, IWORK, INFO ) @@ -883,10 +885,10 @@ for (gelsd, gelsy, elty, relty) in end end -for (gglse, elty) in ((:dgglse_, :Float64), - (:sgglse_, :Float32), - (:zgglse_, :Complex128), - (:cgglse_, :Complex64)) +for (gglse, elty) in ((@blas_suffix(:dgglse_), :Float64), + (@blas_suffix(:sgglse_), :Float32), + (@blas_suffix(:zgglse_), :Complex128), + (@blas_suffix(:cgglse_), :Complex64)) @eval begin # SUBROUTINE DGGLSE( M, N, P, A, LDA, B, LDB, C, D, X, WORK, LWORK, # $ INFO ) @@ -929,10 +931,10 @@ end # (GE) general matrices eigenvalue-eigenvector and singular value decompositions for (geev, gesvd, gesdd, ggsvd, elty, relty) in - ((:dgeev_,:dgesvd_,:dgesdd_,:dggsvd_,:Float64,:Float64), - (:sgeev_,:sgesvd_,:sgesdd_,:sggsvd_,:Float32,:Float32), - (:zgeev_,:zgesvd_,:zgesdd_,:zggsvd_,:Complex128,:Float64), - (:cgeev_,:cgesvd_,:cgesdd_,:cggsvd_,:Complex64,:Float32)) + ((@blas_suffix(:dgeev_),@blas_suffix(:dgesvd_),@blas_suffix(:dgesdd_),@blas_suffix(:dggsvd_),:Float64,:Float64), + (@blas_suffix(:sgeev_),@blas_suffix(:sgesvd_),@blas_suffix(:sgesdd_),@blas_suffix(:sggsvd_),:Float32,:Float32), + (@blas_suffix(:zgeev_),@blas_suffix(:zgesvd_),@blas_suffix(:zgesdd_),@blas_suffix(:zggsvd_),:Complex128,:Float64), + (@blas_suffix(:cgeev_),@blas_suffix(:cgesvd_),@blas_suffix(:cgesdd_),@blas_suffix(:cggsvd_),:Complex64,:Float32)) @eval begin # SUBROUTINE DGEEV( JOBVL, JOBVR, N, A, LDA, WR, WI, VL, LDVL, VR, # $ LDVR, WORK, LWORK, INFO ) @@ -1169,8 +1171,8 @@ for (geev, gesvd, gesdd, ggsvd, elty, relty) in end ## Expert driver and generalized eigenvlua problem for (geevx, ggev, elty) in - ((:dgeevx_,:dggev_,:Float64), - (:sgeevx_,:sggev_,:Float32)) + ((@blas_suffix(:dgeevx_),@blas_suffix(:dggev_),:Float64), + (@blas_suffix(:sgeevx_),@blas_suffix(:sggev_),:Float32)) @eval begin # SUBROUTINE DGEEVX( BALANC, JOBVL, JOBVR, SENSE, N, A, LDA, WR, WI, # VL, LDVL, VR, LDVR, ILO, IHI, SCALE, ABNRM, @@ -1275,8 +1277,8 @@ for (geevx, ggev, elty) in end end for (geevx, ggev, elty, relty) in - ((:zgeevx_,:zggev_,:Complex128,:Float64), - (:cgeevx_,:cggev_,:Complex64,:Float32)) + ((@blas_suffix(:zgeevx_),@blas_suffix(:zggev_),:Complex128,:Float64), + (@blas_suffix(:cgeevx_),@blas_suffix(:cggev_),:Complex64,:Float32)) @eval begin # SUBROUTINE ZGEEVX( BALANC, JOBVL, JOBVR, SENSE, N, A, LDA, W, VL, # LDVL, VR, LDVR, ILO, IHI, SCALE, ABNRM, RCONDE, @@ -1382,8 +1384,8 @@ end # One step incremental condition estimation of max/min singular values for (laic1, elty) in - ((:dlaic1_,:Float64), - (:slaic1_,:Float32)) + ((@blas_suffix(:dlaic1_),:Float64), + (@blas_suffix(:slaic1_),:Float32)) @eval begin # 21 * SUBROUTINE DLAIC1( JOB, J, X, SEST, W, GAMMA, SESTPR, S, C ) # 22 * @@ -1411,8 +1413,8 @@ for (laic1, elty) in end end for (laic1, elty, relty) in - ((:zlaic1_,:Complex128,:Float64), - (:claic1_,:Complex64,:Float32)) + ((@blas_suffix(:zlaic1_),:Complex128,:Float64), + (@blas_suffix(:claic1_),:Complex64,:Float32)) @eval begin # 21 * SUBROUTINE ZLAIC1( JOB, J, X, SEST, W, GAMMA, SESTPR, S, C ) # 22 * @@ -1444,10 +1446,10 @@ end # (GT) General tridiagonal, decomposition, solver and direct solver for (gtsv, gttrf, gttrs, elty) in - ((:dgtsv_,:dgttrf_,:dgttrs_,:Float64), - (:sgtsv_,:sgttrf_,:sgttrs_,:Float32), - (:zgtsv_,:zgttrf_,:zgttrs_,:Complex128), - (:cgtsv_,:cgttrf_,:cgttrs_,:Complex64)) + ((@blas_suffix(:dgtsv_),@blas_suffix(:dgttrf_),@blas_suffix(:dgttrs_),:Float64), + (@blas_suffix(:sgtsv_),@blas_suffix(:sgttrf_),@blas_suffix(:sgttrs_),:Float32), + (@blas_suffix(:zgtsv_),@blas_suffix(:zgttrf_),@blas_suffix(:zgttrs_),:Complex128), + (@blas_suffix(:cgtsv_),@blas_suffix(:cgttrf_),@blas_suffix(:cgttrs_),:Complex64)) @eval begin # SUBROUTINE DGTSV( N, NRHS, DL, D, DU, B, LDB, INFO ) # .. Scalar Arguments .. @@ -1518,10 +1520,10 @@ end ## (OR) orthogonal (or UN, unitary) matrices, extractors and multiplication for (orglq, orgqr, ormlq, ormqr, gemqrt, elty) in - ((:dorglq_,:dorgqr_,:dormlq_,:dormqr_,:dgemqrt_,:Float64), - (:sorglq_,:sorgqr_,:sormlq_,:sormqr_,:sgemqrt_,:Float32), - (:zunglq_,:zungqr_,:zunmlq_,:zunmqr_,:zgemqrt_,:Complex128), - (:cunglq_,:cungqr_,:cunmlq_,:cunmqr_,:cgemqrt_,:Complex64)) + ((@blas_suffix(:dorglq_),@blas_suffix(:dorgqr_),@blas_suffix(:dormlq_),@blas_suffix(:dormqr_),@blas_suffix(:dgemqrt_),:Float64), + (@blas_suffix(:sorglq_),@blas_suffix(:sorgqr_),@blas_suffix(:sormlq_),@blas_suffix(:sormqr_),@blas_suffix(:sgemqrt_),:Float32), + (@blas_suffix(:zunglq_),@blas_suffix(:zungqr_),@blas_suffix(:zunmlq_),@blas_suffix(:zunmqr_),@blas_suffix(:zgemqrt_),:Complex128), + (@blas_suffix(:cunglq_),@blas_suffix(:cungqr_),@blas_suffix(:cunmlq_),@blas_suffix(:cunmqr_),@blas_suffix(:cgemqrt_),:Complex64)) @eval begin # SUBROUTINE DORGLQ( M, N, K, A, LDA, TAU, WORK, LWORK, INFO ) # * .. Scalar Arguments .. @@ -1696,10 +1698,10 @@ end # (PO) positive-definite symmetric matrices, # Cholesky decomposition, solvers (direct and factored) and inverse. for (posv, potrf, potri, potrs, pstrf, elty, rtyp) in - ((:dposv_,:dpotrf_,:dpotri_,:dpotrs_,:dpstrf_,:Float64,:Float64), - (:sposv_,:spotrf_,:spotri_,:spotrs_,:spstrf_,:Float32,:Float32), - (:zposv_,:zpotrf_,:zpotri_,:zpotrs_,:zpstrf_,:Complex128,:Float64), - (:cposv_,:cpotrf_,:cpotri_,:cpotrs_,:cpstrf_,:Complex64,:Float32)) + ((@blas_suffix(:dposv_),@blas_suffix(:dpotrf_),@blas_suffix(:dpotri_),@blas_suffix(:dpotrs_),@blas_suffix(:dpstrf_),:Float64,:Float64), + (@blas_suffix(:sposv_),@blas_suffix(:spotrf_),@blas_suffix(:spotri_),@blas_suffix(:spotrs_),@blas_suffix(:spstrf_),:Float32,:Float32), + (@blas_suffix(:zposv_),@blas_suffix(:zpotrf_),@blas_suffix(:zpotri_),@blas_suffix(:zpotrs_),@blas_suffix(:zpstrf_),:Complex128,:Float64), + (@blas_suffix(:cposv_),@blas_suffix(:cpotrf_),@blas_suffix(:cpotri_),@blas_suffix(:cpotrs_),@blas_suffix(:cpstrf_),:Complex64,:Float32)) @eval begin # SUBROUTINE DPOSV( UPLO, N, NRHS, A, LDA, B, LDB, INFO ) #* .. Scalar Arguments .. @@ -1813,10 +1815,10 @@ end ## (PT) positive-definite, symmetric, tri-diagonal matrices ## Direct solvers for general tridiagonal and symmetric positive-definite tridiagonal for (ptsv, pttrf, pttrs, elty, relty) in - ((:dptsv_,:dpttrf_,:dpttrs_,:Float64,:Float64), - (:sptsv_,:spttrf_,:spttrs_,:Float32,:Float32), - (:zptsv_,:zpttrf_,:zpttrs_,:Complex128,:Float64), - (:cptsv_,:cpttrf_,:cpttrs_,:Complex64,:Float32)) + ((@blas_suffix(:dptsv_),@blas_suffix(:dpttrf_),@blas_suffix(:dpttrs_),:Float64,:Float64), + (@blas_suffix(:sptsv_),@blas_suffix(:spttrf_),@blas_suffix(:spttrs_),:Float32,:Float32), + (@blas_suffix(:zptsv_),@blas_suffix(:zpttrf_),@blas_suffix(:zpttrs_),:Complex128,:Float64), + (@blas_suffix(:cptsv_),@blas_suffix(:cpttrf_),@blas_suffix(:cpttrs_),:Complex64,:Float32)) @eval begin # SUBROUTINE DPTSV( N, NRHS, D, E, B, LDB, INFO ) # .. Scalar Arguments .. @@ -1853,8 +1855,8 @@ for (ptsv, pttrf, pttrs, elty, relty) in end end for (pttrs, elty, relty) in - ((:dpttrs_,:Float64,:Float64), - (:spttrs_,:Float32,:Float32)) + ((@blas_suffix(:dpttrs_),:Float64,:Float64), + (@blas_suffix(:spttrs_),:Float32,:Float32)) @eval begin # SUBROUTINE DPTTRS( N, NRHS, D, E, B, LDB, INFO ) # .. Scalar Arguments .. @@ -1876,8 +1878,8 @@ for (pttrs, elty, relty) in end end for (pttrs, elty, relty) in - ((:zpttrs_,:Complex128,:Float64), - (:cpttrs_,:Complex64,:Float32)) + ((@blas_suffix(:zpttrs_),:Complex128,:Float64), + (@blas_suffix(:cpttrs_),:Complex64,:Float32)) @eval begin # SUBROUTINE ZPTTRS( UPLO, N, NRHS, D, E, B, LDB, INFO ) # * .. Scalar Arguments .. @@ -1905,10 +1907,10 @@ end ## (TR) triangular matrices: solver and inverse for (trtri, trtrs, elty) in - ((:dtrtri_,:dtrtrs_,:Float64), - (:strtri_,:strtrs_,:Float32), - (:ztrtri_,:ztrtrs_,:Complex128), - (:ctrtri_,:ctrtrs_,:Complex64)) + ((@blas_suffix(:dtrtri_),@blas_suffix(:dtrtrs_),:Float64), + (@blas_suffix(:strtri_),@blas_suffix(:strtrs_),:Float32), + (@blas_suffix(:ztrtri_),@blas_suffix(:ztrtrs_),:Complex128), + (@blas_suffix(:ctrtri_),@blas_suffix(:ctrtrs_),:Complex64)) @eval begin # SUBROUTINE DTRTRI( UPLO, DIAG, N, A, LDA, INFO ) #* .. Scalar Arguments .. @@ -1955,8 +1957,8 @@ end #Eigenvector computation and condition number estimation for (trcon, trevc, trrfs, elty) in - ((:dtrcon_,:dtrevc_,:dtrrfs_,:Float64), - (:strcon_,:strevc_,:strrfs_,:Float32)) + ((@blas_suffix(:dtrcon_),@blas_suffix(:dtrevc_),@blas_suffix(:dtrrfs_),:Float64), + (@blas_suffix(:strcon_),@blas_suffix(:strevc_),@blas_suffix(:strrfs_),:Float32)) @eval begin #SUBROUTINE DTRCON( NORM, UPLO, DIAG, N, A, LDA, RCOND, WORK, # IWORK, INFO ) @@ -2071,8 +2073,8 @@ for (trcon, trevc, trrfs, elty) in end end for (trcon, trevc, trrfs, elty, relty) in - ((:ztrcon_,:ztrevc_,:ztrrfs_,:Complex128,:Float64), - (:ctrcon_,:ctrevc_,:ctrrfs_,:Complex64, :Float32)) + ((@blas_suffix(:ztrcon_),@blas_suffix(:ztrevc_),@blas_suffix(:ztrrfs_),:Complex128,:Float64), + (@blas_suffix(:ctrcon_),@blas_suffix(:ctrevc_),@blas_suffix(:ctrrfs_),:Complex64, :Float32)) @eval begin #SUBROUTINE ZTRCON( NORM, UPLO, DIAG, N, A, LDA, RCOND, WORK, # RWORK, INFO ) @@ -2192,10 +2194,10 @@ end ## (ST) Symmetric tridiagonal - eigendecomposition for (stev, stebz, stegr, stein, elty) in - ((:dstev_,:dstebz_,:dstegr_,:dstein_,:Float64), - (:sstev_,:sstebz_,:sstegr_,:sstein_,:Float32) -# , (:zstev_,:Complex128) Need to rewrite for ZHEEV, rwork, etc. -# , (:cstev_,:Complex64) + ((@blas_suffix(:dstev_),@blas_suffix(:dstebz_),@blas_suffix(:dstegr_),@blas_suffix(:dstein_),:Float64), + (@blas_suffix(:sstev_),@blas_suffix(:sstebz_),@blas_suffix(:sstegr_),@blas_suffix(:sstein_),:Float32) +# , (@blas_suffix(:zstev_),:Complex128) Need to rewrite for ZHEEV, rwork, etc. +# , (@blas_suffix(:cstev_),:Complex64) ) @eval begin #* DSTEV computes all eigenvalues and, optionally, eigenvectors of a @@ -2349,8 +2351,8 @@ stein!(dv::Vector, ev::Vector, eval::Real)=stein!(dv, ev, [eval], zeros(BlasInt, ## (SY) symmetric real matrices - Bunch-Kaufman decomposition, ## solvers (direct and factored) and inverse. for (syconv, sysv, sytrf, sytri, sytrs, elty) in - ((:dsyconv_,:dsysv_,:dsytrf_,:dsytri_,:dsytrs_,:Float64), - (:ssyconv_,:ssysv_,:ssytrf_,:ssytri_,:ssytrs_,:Float32)) + ((@blas_suffix(:dsyconv_),@blas_suffix(:dsysv_),@blas_suffix(:dsytrf_),@blas_suffix(:dsytri_),@blas_suffix(:dsytrs_),:Float64), + (@blas_suffix(:ssyconv_),@blas_suffix(:ssysv_),@blas_suffix(:ssytrf_),@blas_suffix(:ssytri_),@blas_suffix(:ssytrs_),:Float32)) @eval begin # SUBROUTINE DSYCONV( UPLO, WAY, N, A, LDA, IPIV, WORK, INFO ) # * .. Scalar Arguments .. @@ -2510,8 +2512,8 @@ end ## (SY) hermitian matrices - eigendecomposition, Bunch-Kaufman decomposition, ## solvers (direct and factored) and inverse. for (syconv, hesv, hetrf, hetri, hetrs, elty, relty) in - ((:zsyconv_,:zhesv_,:zhetrf_,:zhetri_,:zhetrs_,:Complex128, :Float64), - (:csyconv_,:chesv_,:chetrf_,:chetri_,:chetrs_,:Complex64, :Float32)) + ((@blas_suffix(:zsyconv_),@blas_suffix(:zhesv_),@blas_suffix(:zhetrf_),@blas_suffix(:zhetri_),@blas_suffix(:zhetrs_),:Complex128, :Float64), + (@blas_suffix(:csyconv_),@blas_suffix(:chesv_),@blas_suffix(:chetrf_),@blas_suffix(:chetri_),@blas_suffix(:chetrs_),:Complex64, :Float32)) @eval begin # SUBROUTINE ZSYCONV( UPLO, WAY, N, A, LDA, IPIV, WORK, INFO ) # 22 * @@ -2669,8 +2671,8 @@ for (syconv, hesv, hetrf, hetri, hetrs, elty, relty) in end end for (sysv, sytrf, sytri, sytrs, elty, relty) in - ((:zsysv_,:zsytrf_,:zsytri_,:zsytrs_,:Complex128, :Float64), - (:csysv_,:csytrf_,:csytri_,:csytrs_,:Complex64, :Float32)) + ((@blas_suffix(:zsysv_),@blas_suffix(:zsytrf_),@blas_suffix(:zsytri_),@blas_suffix(:zsytrs_),:Complex128, :Float64), + (@blas_suffix(:csysv_),@blas_suffix(:csytrf_),@blas_suffix(:csytri_),@blas_suffix(:csytrs_),:Complex64, :Float32)) @eval begin # SUBROUTINE ZSYSV( UPLO, N, NRHS, A, LDA, IPIV, B, LDB, WORK, # $ LWORK, INFO ) @@ -2811,8 +2813,8 @@ end # Symmetric (real) eigensolvers for (syev, syevr, sygvd, elty) in - ((:dsyev_,:dsyevr_,:dsygvd_,:Float64), - (:ssyev_,:ssyevr_,:ssygvd_,:Float32)) + ((@blas_suffix(:dsyev_),@blas_suffix(:dsyevr_),@blas_suffix(:dsygvd_),:Float64), + (@blas_suffix(:ssyev_),@blas_suffix(:ssyevr_),@blas_suffix(:ssygvd_),:Float32)) @eval begin # SUBROUTINE DSYEV( JOBZ, UPLO, N, A, LDA, W, WORK, LWORK, INFO ) # * .. Scalar Arguments .. @@ -2947,8 +2949,8 @@ for (syev, syevr, sygvd, elty) in end # Hermitian eigensolvers for (syev, syevr, sygvd, elty, relty) in - ((:zheev_,:zheevr_,:zhegvd_,:Complex128,:Float64), - (:cheev_,:cheevr_,:chegvd_,:Complex64,:Float32)) + ((@blas_suffix(:zheev_),@blas_suffix(:zheevr_),@blas_suffix(:zhegvd_),:Complex128,:Float64), + (@blas_suffix(:cheev_),@blas_suffix(:cheevr_),@blas_suffix(:chegvd_),:Complex64,:Float32)) @eval begin # SUBROUTINE ZHEEV( JOBZ, UPLO, N, A, LDA, W, WORK, LWORK, RWORK, INFO ) # * .. Scalar Arguments .. @@ -3103,10 +3105,10 @@ end ## (BD) Bidiagonal matrices - singular value decomposition for (bdsqr, relty, elty) in - ((:dbdsqr_,:Float64,:Float64), - (:sbdsqr_,:Float32,:Float32), - (:zbdsqr_,:Float64,:Complex128), - (:cbdsqr_,:Float32,:Complex64)) + ((@blas_suffix(:dbdsqr_),:Float64,:Float64), + (@blas_suffix(:sbdsqr_),:Float32,:Float32), + (@blas_suffix(:zbdsqr_),:Float64,:Complex128), + (@blas_suffix(:cbdsqr_),:Float32,:Complex64)) @eval begin #*> DBDSQR computes the singular values and, optionally, the right and/or #*> left singular vectors from the singular value decomposition (SVD) of @@ -3154,8 +3156,8 @@ end #Defined only for real types for (bdsdc, elty) in - ((:dbdsdc_,:Float64), - (:sbdsdc_,:Float32)) + ((@blas_suffix(:dbdsdc_),:Float64), + (@blas_suffix(:sbdsdc_),:Float32)) @eval begin #* DBDSDC computes the singular value decomposition (SVD) of a real #* N-by-N (upper or lower) bidiagonal matrix B: B = U * S * VT, @@ -3210,8 +3212,8 @@ end # Estimate condition number for (gecon, elty) in - ((:dgecon_,:Float64), - (:sgecon_,:Float32)) + ((@blas_suffix(:dgecon_),:Float64), + (@blas_suffix(:sgecon_),:Float32)) @eval begin function gecon!(normtype::BlasChar, A::StridedMatrix{$elty}, anorm::$elty) # SUBROUTINE DGECON( NORM, N, A, LDA, ANORM, RCOND, WORK, IWORK, @@ -3243,8 +3245,8 @@ for (gecon, elty) in end end for (gecon, elty, relty) in - ((:zgecon_,:Complex128,:Float64), - (:cgecon_,:Complex64, :Float32)) + ((@blas_suffix(:zgecon_),:Complex128,:Float64), + (@blas_suffix(:cgecon_),:Complex64, :Float32)) @eval begin function gecon!(normtype::BlasChar, A::StridedMatrix{$elty}, anorm::$relty) chkstride1(A) @@ -3279,10 +3281,10 @@ end # Hessenberg form for (gehrd, elty) in - ((:dgehrd_,:Float64), - (:sgehrd_,:Float32), - (:zgehrd_,:Complex128), - (:cgehrd_,:Complex64)) + ((@blas_suffix(:dgehrd_),:Float64), + (@blas_suffix(:sgehrd_),:Float32), + (@blas_suffix(:zgehrd_),:Complex128), + (@blas_suffix(:cgehrd_),:Complex64)) @eval begin function gehrd!(ilo::Integer, ihi::Integer, A::StridedMatrix{$elty}) # .. Scalar Arguments .. @@ -3318,10 +3320,10 @@ gehrd!(A::StridedMatrix) = gehrd!(1, size(A, 1), A) # construct Q from Hessenberg for (orghr, elty) in - ((:dorghr_,:Float64), - (:sorghr_,:Float32), - (:zunghr_,:Complex128), - (:cunghr_,:Complex64)) + ((@blas_suffix(:dorghr_),:Float64), + (@blas_suffix(:sorghr_),:Float32), + (@blas_suffix(:zunghr_),:Complex128), + (@blas_suffix(:cunghr_),:Complex64)) @eval begin function orghr!(ilo::Integer, ihi::Integer, A::StridedMatrix{$elty}, tau::StridedVector{$elty}) # * .. Scalar Arguments .. @@ -3355,8 +3357,8 @@ for (orghr, elty) in end # Schur forms for (gees, gges, elty) in - ((:dgees_,:dgges_,:Float64), - (:sgees_,:sgges_,:Float32)) + ((@blas_suffix(:dgees_),@blas_suffix(:dgges_),:Float64), + (@blas_suffix(:sgees_),@blas_suffix(:sgges_),:Float32)) @eval begin function gees!(jobvs::BlasChar, A::StridedMatrix{$elty}) # .. Scalar Arguments .. @@ -3444,8 +3446,8 @@ for (gees, gges, elty) in end end for (gees, gges, elty, relty) in - ((:zgees_,:zgges_,:Complex128,:Float64), - (:cgees_,:cgges_,:Complex64,:Float32)) + ((@blas_suffix(:zgees_),@blas_suffix(:zgges_),:Complex128,:Float64), + (@blas_suffix(:cgees_),@blas_suffix(:cgges_),:Complex64,:Float32)) @eval begin function gees!(jobvs::BlasChar, A::StridedMatrix{$elty}) # * .. Scalar Arguments .. @@ -3536,8 +3538,8 @@ for (gees, gges, elty, relty) in end # Reorder Schur forms for (trsen, elty) in - ((:dtrsen_,:Float64), - (:strsen_,:Float32)) + ((@blas_suffix(:dtrsen_),:Float64), + (@blas_suffix(:strsen_),:Float32)) @eval begin function trsen!(select::Array{Int}, T::StridedMatrix{$elty}, Q::StridedMatrix{$elty}) # * .. Scalar Arguments .. @@ -3588,8 +3590,8 @@ for (trsen, elty) in end for (trsen, elty) in - ((:ztrsen_,:Complex128), - (:ctrsen_,:Complex64)) + ((@blas_suffix(:ztrsen_),:Complex128), + (@blas_suffix(:ctrsen_),:Complex64)) @eval begin function trsen!(select::Array{Int}, T::StridedMatrix{$elty}, Q::StridedMatrix{$elty}) # * .. Scalar Arguments .. @@ -3636,10 +3638,10 @@ end ### Rectangular full packed format # Symmetric rank-k operation for matrix in RFP format. -for (fn, elty, relty) in ((:dsfrk_, :Float64, :Float64), - (:ssfrk_, :Float32, :Float32), - (:zhfrk_, :Complex128, :Float64), - (:chfrk_, :Complex64, :Float32)) +for (fn, elty, relty) in ((@blas_suffix(:dsfrk_), :Float64, :Float64), + (@blas_suffix(:ssfrk_), :Float32, :Float32), + (@blas_suffix(:zhfrk_), :Complex128, :Float64), + (@blas_suffix(:chfrk_), :Complex64, :Float32)) @eval begin function sfrk!(transr::Char, uplo::Char, trans::Char, alpha::Real, A::StridedMatrix{$elty}, beta::Real, C::StridedVector{$elty}) chkstride1(A) @@ -3662,10 +3664,10 @@ for (fn, elty, relty) in ((:dsfrk_, :Float64, :Float64), end # Cholesky factorization of a real symmetric positive definite matrix A -for (fn, elty) in ((:dpftrf_, :Float64), - (:spftrf_, :Float32), - (:zpftrf_, :Complex128), - (:cpftrf_, :Complex64)) +for (fn, elty) in ((@blas_suffix(:dpftrf_), :Float64), + (@blas_suffix(:spftrf_), :Float32), + (@blas_suffix(:zpftrf_), :Complex128), + (@blas_suffix(:cpftrf_), :Complex64)) @eval begin function pftrf!(transr::Char, uplo::Char, A::StridedVector{$elty}) n = int(div(sqrt(8length(A)), 2)) @@ -3683,10 +3685,10 @@ for (fn, elty) in ((:dpftrf_, :Float64), end # Computes the inverse of a (real) symmetric positive definite matrix A using the Cholesky factorization -for (fn, elty) in ((:dpftri_, :Float64), - (:spftri_, :Float32), - (:zpftri_, :Complex128), - (:cpftri_, :Complex64)) +for (fn, elty) in ((@blas_suffix(:dpftri_), :Float64), + (@blas_suffix(:spftri_), :Float32), + (@blas_suffix(:zpftri_), :Complex128), + (@blas_suffix(:cpftri_), :Complex64)) @eval begin function pftri!(transr::Char, uplo::Char, A::StridedVector{$elty}) n = int(div(sqrt(8length(A)), 2)) @@ -3704,10 +3706,10 @@ for (fn, elty) in ((:dpftri_, :Float64), end # DPFTRS solves a system of linear equations A*X = B with a symmetric positive definite matrix A using the Cholesky factorization -for (fn, elty) in ((:dpftrs_, :Float64), - (:spftrs_, :Float32), - (:zpftrs_, :Complex128), - (:cpftrs_, :Complex64)) +for (fn, elty) in ((@blas_suffix(:dpftrs_), :Float64), + (@blas_suffix(:spftrs_), :Float32), + (@blas_suffix(:zpftrs_), :Complex128), + (@blas_suffix(:cpftrs_), :Complex64)) @eval begin function pftrs!(transr::Char, uplo::Char, A::StridedVector{$elty}, B::StridedVecOrMat{$elty}) chkstride1(B) @@ -3729,10 +3731,10 @@ for (fn, elty) in ((:dpftrs_, :Float64), end # Solves a matrix equation (one operand is a triangular matrix in RFP format) -for (fn, elty) in ((:dtfsm_, :Float64), - (:stfsm_, :Float32), - (:ztfsm_, :Complex128), - (:ctfsm_, :Complex64)) +for (fn, elty) in ((@blas_suffix(:dtfsm_), :Float64), + (@blas_suffix(:stfsm_), :Float32), + (@blas_suffix(:ztfsm_), :Complex128), + (@blas_suffix(:ctfsm_), :Complex64)) @eval begin function pftrs!(transr::Char, side::Char, uplo::Char, trans::Char, diag::Char, alpha::Real, A::StridedVector{$elty}, B::StridedMatrix{$elty}) chkstride1(B) @@ -3752,10 +3754,10 @@ for (fn, elty) in ((:dtfsm_, :Float64), end # Computes the inverse of a triangular matrix A stored in RFP format. -for (fn, elty) in ((:dtftri_, :Float64), - (:stftri_, :Float32), - (:ztftri_, :Complex128), - (:ctftri_, :Complex64)) +for (fn, elty) in ((@blas_suffix(:dtftri_), :Float64), + (@blas_suffix(:stftri_), :Float32), + (@blas_suffix(:ztftri_), :Complex128), + (@blas_suffix(:ctftri_), :Complex64)) @eval begin function tftri!(transr::Char, uplo::Char, diag::Char, A::StridedVector{$elty}) n = int(div(sqrt(8length(A)), 2)) @@ -3773,10 +3775,10 @@ for (fn, elty) in ((:dtftri_, :Float64), end # Copies a triangular matrix from the rectangular full packed format (TF) to the standard full format (TR) -for (fn, elty) in ((:dtfttr_, :Float64), - (:stfttr_, :Float32), - (:ztfttr_, :Complex128), - (:ctfttr_, :Complex64)) +for (fn, elty) in ((@blas_suffix(:dtfttr_), :Float64), + (@blas_suffix(:stfttr_), :Float32), + (@blas_suffix(:ztfttr_), :Complex128), + (@blas_suffix(:ctfttr_), :Complex64)) @eval begin function tfttr!(transr::Char, uplo::Char, Arf::StridedVector{$elty}) n = int(div(sqrt(8length(Arf)), 2)) @@ -3794,10 +3796,10 @@ for (fn, elty) in ((:dtfttr_, :Float64), end # Copies a triangular matrix from the standard full format (TR) to the rectangular full packed format (TF). -for (fn, elty) in ((:dtrttf_, :Float64), - (:strttf_, :Float32), - (:ztrttf_, :Complex128), - (:ctrttf_, :Complex64)) +for (fn, elty) in ((@blas_suffix(:dtrttf_), :Float64), + (@blas_suffix(:strttf_), :Float32), + (@blas_suffix(:ztrttf_), :Complex128), + (@blas_suffix(:ctrttf_), :Complex64)) @eval begin function trttf!(transr::Char, uplo::Char, A::StridedMatrix{$elty}) chkstride1(A) @@ -3817,10 +3819,10 @@ for (fn, elty) in ((:dtrttf_, :Float64), end # Solves the real Sylvester matrix equation: op(A)*X +- X*op(B) = scale*C and A and B are both upper quasi triangular. -for (fn, elty, relty) in ((:dtrsyl_, :Float64, :Float64), - (:strsyl_, :Float32, :Float32), - (:ztrsyl_, :Complex128, :Float64), - (:ctrsyl_, :Complex64, :Float32)) +for (fn, elty, relty) in ((@blas_suffix(:dtrsyl_), :Float64, :Float64), + (@blas_suffix(:strsyl_), :Float32, :Float32), + (@blas_suffix(:ztrsyl_), :Complex128, :Float64), + (@blas_suffix(:ctrsyl_), :Complex64, :Float32)) @eval begin function trsyl!(transa::BlasChar, transb::BlasChar, A::StridedMatrix{$elty}, B::StridedMatrix{$elty}, C::StridedMatrix{$elty}, isgn::Int=1) chkstride1(A, B, C) diff --git a/base/util.jl b/base/util.jl index 421856b62dbf3d..906501b38703e8 100644 --- a/base/util.jl +++ b/base/util.jl @@ -119,8 +119,14 @@ function blas_vendor() end if blas_vendor() == :openblas64 + macro blas_suffix(x) + return :(symbol(string($x)*"64_")) + end openblas_get_config() = strip(bytestring( ccall((:openblas_get_config64_, Base.libblas_name), Ptr{Uint8}, () ))) else + macro blas_suffix(x) + return x + end openblas_get_config() = strip(bytestring( ccall((:openblas_get_config, Base.libblas_name), Ptr{Uint8}, () ))) end