2
2
3
3
module BLAS
4
4
5
- import Base: copy!, blasfunc
5
+ import Base: copy!, @ blasfunc
6
6
import Base. LinAlg: axpy!, dot
7
7
8
8
export
@@ -67,7 +67,7 @@ for (fname, elty) in ((:dcopy_,:Float64),
67
67
@eval begin
68
68
# SUBROUTINE DCOPY(N,DX,INCX,DY,INCY)
69
69
function blascopy! (n:: Integer , DX:: Union{Ptr{$elty},StridedArray{$elty}} , incx:: Integer , DY:: Union{Ptr{$elty},StridedArray{$elty}} , incy:: Integer )
70
- ccall (($ ( blasfunc (fname) ), libblas), Void,
70
+ ccall ((@ blasfunc ($ fname), libblas), Void,
71
71
(Ptr{BlasInt}, Ptr{$ elty}, Ptr{BlasInt}, Ptr{$ elty}, Ptr{BlasInt}),
72
72
& n, DX, & incx, DY, & incy)
73
73
DY
@@ -83,7 +83,7 @@ for (fname, elty) in ((:dscal_,:Float64),
83
83
@eval begin
84
84
# SUBROUTINE DSCAL(N,DA,DX,INCX)
85
85
function scal! (n:: Integer , DA:: $elty , DX:: Union{Ptr{$elty},DenseArray{$elty}} , incx:: Integer )
86
- ccall (($ ( blasfunc (fname) ), libblas), Void,
86
+ ccall ((@ blasfunc ($ fname), libblas), Void,
87
87
(Ptr{BlasInt}, Ptr{$ elty}, Ptr{$ elty}, Ptr{BlasInt}),
88
88
& n, & DA, DX, & incx)
89
89
DX
@@ -103,7 +103,7 @@ for (fname, elty) in ((:ddot_,:Float64),
103
103
# * .. Array Arguments ..
104
104
# DOUBLE PRECISION DX(*),DY(*)
105
105
function dot (n:: Integer , DX:: Union{Ptr{$elty},DenseArray{$elty}} , incx:: Integer , DY:: Union{Ptr{$elty},DenseArray{$elty}} , incy:: Integer )
106
- ccall (($ ( blasfunc (fname) ), libblas), $ elty,
106
+ ccall ((@ blasfunc ($ fname), libblas), $ elty,
107
107
(Ptr{BlasInt}, Ptr{$ elty}, Ptr{BlasInt}, Ptr{$ elty}, Ptr{BlasInt}),
108
108
& n, DX, & incx, DY, & incy)
109
109
end
@@ -120,7 +120,7 @@ for (fname, elty) in ((:cblas_zdotc_sub,:Complex128),
120
120
# DOUBLE PRECISION DX(*),DY(*)
121
121
function dotc (n:: Integer , DX:: Union{Ptr{$elty},DenseArray{$elty}} , incx:: Integer , DY:: Union{Ptr{$elty},DenseArray{$elty}} , incy:: Integer )
122
122
result = Array ($ elty, 1 )
123
- ccall (($ ( blasfunc (fname) ), libblas), Void,
123
+ ccall ((@ blasfunc ($ fname), libblas), Void,
124
124
(BlasInt, Ptr{$ elty}, BlasInt, Ptr{$ elty}, BlasInt, Ptr{$ elty}),
125
125
n, DX, incx, DY, incy, result)
126
126
result[1 ]
@@ -138,7 +138,7 @@ for (fname, elty) in ((:cblas_zdotu_sub,:Complex128),
138
138
# DOUBLE PRECISION DX(*),DY(*)
139
139
function dotu (n:: Integer , DX:: Union{Ptr{$elty},DenseArray{$elty}} , incx:: Integer , DY:: Union{Ptr{$elty},DenseArray{$elty}} , incy:: Integer )
140
140
result = Array ($ elty, 1 )
141
- ccall (($ ( blasfunc (fname) ), libblas), Void,
141
+ ccall ((@ blasfunc ($ fname), libblas), Void,
142
142
(BlasInt, Ptr{$ elty}, BlasInt, Ptr{$ elty}, BlasInt, Ptr{$ elty}),
143
143
n, DX, incx, DY, incy, result)
144
144
result[1 ]
@@ -175,7 +175,7 @@ for (fname, elty, ret_type) in ((:dnrm2_,:Float64,:Float64),
175
175
@eval begin
176
176
# SUBROUTINE DNRM2(N,X,INCX)
177
177
function nrm2 (n:: Integer , X:: Union{Ptr{$elty},DenseArray{$elty}} , incx:: Integer )
178
- ccall (($ ( blasfunc (fname) ), libblas), $ ret_type,
178
+ ccall ((@ blasfunc ($ fname), libblas), $ ret_type,
179
179
(Ptr{BlasInt}, Ptr{$ elty}, Ptr{BlasInt}),
180
180
& n, X, & incx)
181
181
end
@@ -192,7 +192,7 @@ for (fname, elty, ret_type) in ((:dasum_,:Float64,:Float64),
192
192
@eval begin
193
193
# SUBROUTINE ASUM(N, X, INCX)
194
194
function asum (n:: Integer , X:: Union{Ptr{$elty},DenseArray{$elty}} , incx:: Integer )
195
- ccall (($ ( blasfunc (fname) ), libblas), $ ret_type,
195
+ ccall ((@ blasfunc ($ fname), libblas), $ ret_type,
196
196
(Ptr{BlasInt}, Ptr{$ elty}, Ptr{BlasInt}),
197
197
& n, X, & incx)
198
198
end
@@ -215,7 +215,7 @@ for (fname, elty) in ((:daxpy_,:Float64),
215
215
# * .. Array Arguments ..
216
216
# DOUBLE PRECISION DX(*),DY(*)
217
217
function axpy! (n:: Integer , alpha:: ($elty) , dx:: Union{Ptr{$elty}, DenseArray{$elty}} , incx:: Integer , dy:: Union{Ptr{$elty}, DenseArray{$elty}} , incy:: Integer )
218
- ccall (($ ( blasfunc (fname) ), libblas), Void,
218
+ ccall ((@ blasfunc ($ fname), libblas), Void,
219
219
(Ptr{BlasInt}, Ptr{$ elty}, Ptr{$ elty}, Ptr{BlasInt}, Ptr{$ elty}, Ptr{BlasInt}),
220
220
& n, & alpha, dx, & incx, dy, & incy)
221
221
dy
@@ -253,7 +253,7 @@ for (fname, elty) in ((:idamax_,:Float64),
253
253
(:icamax_ ,:Complex64 ))
254
254
@eval begin
255
255
function iamax (n:: Integer , dx:: Union{Ptr{$elty}, DenseArray{$elty}} , incx:: Integer )
256
- ccall (($ ( blasfunc (fname) ), libblas),BlasInt,
256
+ ccall ((@ blasfunc ($ fname), libblas),BlasInt,
257
257
(Ptr{BlasInt}, Ptr{$ elty}, Ptr{BlasInt}),
258
258
& n, dx, & incx)
259
259
end
@@ -286,7 +286,7 @@ for (fname, elty) in ((:dgemv_,:Float64),
286
286
elseif trans == ' T' && (length (X) != m || length (Y) != n)
287
287
throw (DimensionMismatch (" A.' has dimensions $n , $m , X has length $(length (X)) and Y has length $(length (Y)) " ))
288
288
end
289
- ccall (($ ( blasfunc (fname) ), libblas), Void,
289
+ ccall ((@ blasfunc ($ fname), libblas), Void,
290
290
(Ptr{UInt8}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$ elty},
291
291
Ptr{$ elty}, Ptr{BlasInt}, Ptr{$ elty}, Ptr{BlasInt},
292
292
Ptr{$ elty}, Ptr{$ elty}, Ptr{BlasInt}),
@@ -318,7 +318,7 @@ for (fname, elty) in ((:dgbmv_,:Float64),
318
318
# * .. Array Arguments ..
319
319
# DOUBLE PRECISION A(LDA,*),X(*),Y(*)
320
320
function gbmv! (trans:: Char , m:: Integer , kl:: Integer , ku:: Integer , alpha:: ($elty) , A:: StridedMatrix{$elty} , x:: StridedVector{$elty} , beta:: ($elty) , y:: StridedVector{$elty} )
321
- ccall (($ ( blasfunc (fname) ), libblas), Void,
321
+ ccall ((@ blasfunc ($ fname), libblas), Void,
322
322
(Ptr{UInt8}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{BlasInt},
323
323
Ptr{BlasInt}, Ptr{$ elty}, Ptr{$ elty}, Ptr{BlasInt},
324
324
Ptr{$ elty}, Ptr{BlasInt}, Ptr{$ elty}, Ptr{$ elty},
@@ -364,7 +364,7 @@ for (fname, elty) in ((:dsymv_,:Float64),
364
364
if m != length (y)
365
365
throw (DimensionMismatch (" A has size $(size (A)) , and y has length $(length (y)) " ))
366
366
end
367
- ccall (($ ( blasfunc (fname) ), libblas), Void,
367
+ ccall ((@ blasfunc ($ fname), libblas), Void,
368
368
(Ptr{UInt8}, Ptr{BlasInt}, Ptr{$ elty}, Ptr{$ elty},
369
369
Ptr{BlasInt}, Ptr{$ elty}, Ptr{BlasInt}, Ptr{$ elty},
370
370
Ptr{$ elty}, Ptr{BlasInt}),
@@ -400,7 +400,7 @@ for (fname, elty) in ((:zhemv_,:Complex128),
400
400
lda = max (1 , stride (A, 2 ))
401
401
incx = stride (x, 1 )
402
402
incy = stride (y, 1 )
403
- ccall (($ ( blasfunc (fname) ), libblas), Void,
403
+ ccall ((@ blasfunc ($ fname), libblas), Void,
404
404
(Ptr{UInt8}, Ptr{BlasInt}, Ptr{$ elty}, Ptr{$ elty},
405
405
Ptr{BlasInt}, Ptr{$ elty}, Ptr{BlasInt}, Ptr{$ elty},
406
406
Ptr{$ elty}, Ptr{BlasInt}),
@@ -430,7 +430,7 @@ for (fname, elty) in ((:dsbmv_,:Float64),
430
430
# * .. Array Arguments ..
431
431
# DOUBLE PRECISION A(LDA,*),X(*),Y(*)
432
432
function sbmv! (uplo:: Char , k:: Integer , alpha:: ($elty) , A:: StridedMatrix{$elty} , x:: StridedVector{$elty} , beta:: ($elty) , y:: StridedVector{$elty} )
433
- ccall (($ ( blasfunc (fname) ), libblas), Void,
433
+ ccall ((@ blasfunc ($ fname), libblas), Void,
434
434
(Ptr{UInt8}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$ elty},
435
435
Ptr{$ elty}, Ptr{BlasInt}, Ptr{$ elty}, Ptr{BlasInt},
436
436
Ptr{$ elty}, Ptr{$ elty}, Ptr{BlasInt}),
@@ -461,7 +461,7 @@ for (fname, elty) in ((:zhbmv_,:Complex128),
461
461
# * .. Array Arguments ..
462
462
# DOUBLE PRECISION A(LDA,*),X(*),Y(*)
463
463
function hbmv! (uplo:: Char , k:: Integer , alpha:: ($elty) , A:: StridedMatrix{$elty} , x:: StridedVector{$elty} , beta:: ($elty) , y:: StridedVector{$elty} )
464
- ccall (($ ( blasfunc (fname) ), libblas), Void,
464
+ ccall ((@ blasfunc ($ fname), libblas), Void,
465
465
(Ptr{UInt8}, Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$ elty},
466
466
Ptr{$ elty}, Ptr{BlasInt}, Ptr{$ elty}, Ptr{BlasInt},
467
467
Ptr{$ elty}, Ptr{$ elty}, Ptr{BlasInt}),
@@ -497,7 +497,7 @@ for (fname, elty) in ((:dtrmv_,:Float64),
497
497
if n != length (x)
498
498
throw (DimensionMismatch (" A has size ($n ,$n ), x has length $(length (x)) " ))
499
499
end
500
- ccall (($ ( blasfunc (fname) ), libblas), Void,
500
+ ccall ((@ blasfunc ($ fname), libblas), Void,
501
501
(Ptr{UInt8}, Ptr{UInt8}, Ptr{UInt8}, Ptr{BlasInt},
502
502
Ptr{$ elty}, Ptr{BlasInt}, Ptr{$ elty}, Ptr{BlasInt}),
503
503
& uplo, & trans, & diag, & n,
@@ -526,7 +526,7 @@ for (fname, elty) in ((:dtrsv_,:Float64),
526
526
if n != length (x)
527
527
throw (DimensionMismatch (" size of A is $n != length(x) = $(length (x)) " ))
528
528
end
529
- ccall (($ ( blasfunc (fname) ), libblas), Void,
529
+ ccall ((@ blasfunc ($ fname), libblas), Void,
530
530
(Ptr{UInt8}, Ptr{UInt8}, Ptr{UInt8}, Ptr{BlasInt},
531
531
Ptr{$ elty}, Ptr{BlasInt}, Ptr{$ elty}, Ptr{BlasInt}),
532
532
& uplo, & trans, & diag, & n,
@@ -550,7 +550,7 @@ for (fname, elty) in ((:dger_,:Float64),
550
550
if m != length (x) || n != length (y)
551
551
throw (DimensionMismatch (" A has size ($m ,$n ), x has length $(length (x)) , y has length $(length (y)) " ))
552
552
end
553
- ccall (($ ( blasfunc (fname) ), libblas), Void,
553
+ ccall ((@ blasfunc ($ fname), libblas), Void,
554
554
(Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$ elty}, Ptr{$ elty},
555
555
Ptr{BlasInt}, Ptr{$ elty}, Ptr{BlasInt}, Ptr{$ elty},
556
556
Ptr{BlasInt}),
@@ -573,7 +573,7 @@ for (fname, elty) in ((:dsyr_,:Float64),
573
573
if length (x) != n
574
574
throw (DimensionMismatch (" A has size ($n ,$n ), x has length $(length (x)) " ))
575
575
end
576
- ccall (($ ( blasfunc (fname) ), libblas), Void,
576
+ ccall ((@ blasfunc ($ fname), libblas), Void,
577
577
(Ptr{UInt8}, Ptr{BlasInt}, Ptr{$ elty}, Ptr{$ elty},
578
578
Ptr{BlasInt}, Ptr{$ elty}, Ptr{BlasInt}),
579
579
& uplo, & n, & α, x,
@@ -592,7 +592,7 @@ for (fname, elty, relty) in ((:zher_,:Complex128, :Float64),
592
592
if length (x) != n
593
593
throw (DimensionMismatch (" A has size ($n ,$n ), x has length $(length (x)) " ))
594
594
end
595
- ccall (($ ( blasfunc (fname) ), libblas), Void,
595
+ ccall ((@ blasfunc ($ fname), libblas), Void,
596
596
(Ptr{UInt8}, Ptr{BlasInt}, Ptr{$ relty}, Ptr{$ elty},
597
597
Ptr{BlasInt}, Ptr{$ elty}, Ptr{BlasInt}),
598
598
& uplo, & n, & α, x,
@@ -627,7 +627,7 @@ for (gemm, elty) in
627
627
if m != size (C,1 ) || n != size (C,2 )
628
628
throw (DimensionMismatch (" A has size ($m ,$k ), B has size ($k ,$n ), C has size $(size (C)) " ))
629
629
end
630
- ccall (($ ( blasfunc (gemm) ), libblas), Void,
630
+ ccall ((@ blasfunc ($ gemm), libblas), Void,
631
631
(Ptr{UInt8}, Ptr{UInt8}, Ptr{BlasInt}, Ptr{BlasInt},
632
632
Ptr{BlasInt}, Ptr{$ elty}, Ptr{$ elty}, Ptr{BlasInt},
633
633
Ptr{$ elty}, Ptr{BlasInt}, Ptr{$ elty}, Ptr{$ elty},
@@ -669,7 +669,7 @@ for (mfname, elty) in ((:dsymm_,:Float64),
669
669
if size (B,2 ) != n
670
670
throw (DimensionMismatch (" B has second dimension $(size (B,2 )) but needs to match second dimension of C, $n " ))
671
671
end
672
- ccall (($ ( blasfunc (mfname) ), libblas), Void,
672
+ ccall ((@ blasfunc ($ mfname), libblas), Void,
673
673
(Ptr{UInt8}, Ptr{UInt8}, Ptr{BlasInt}, Ptr{BlasInt},
674
674
Ptr{$ elty}, Ptr{$ elty}, Ptr{BlasInt}, Ptr{$ elty},
675
675
Ptr{BlasInt}, Ptr{$ elty}, Ptr{$ elty}, Ptr{BlasInt}),
@@ -707,7 +707,7 @@ for (mfname, elty) in ((:zhemm_,:Complex128),
707
707
if size (B,2 ) != n
708
708
throw (DimensionMismatch (" B has second dimension $(size (B,2 )) but needs to match second dimension of C, $n " ))
709
709
end
710
- ccall (($ ( blasfunc (mfname) ), libblas), Void,
710
+ ccall ((@ blasfunc ($ mfname), libblas), Void,
711
711
(Ptr{UInt8}, Ptr{UInt8}, Ptr{BlasInt}, Ptr{BlasInt},
712
712
Ptr{$ elty}, Ptr{$ elty}, Ptr{BlasInt}, Ptr{$ elty},
713
713
Ptr{BlasInt}, Ptr{$ elty}, Ptr{$ elty}, Ptr{BlasInt}),
@@ -745,7 +745,7 @@ for (fname, elty) in ((:dsyrk_,:Float64),
745
745
nn = size (A, trans == ' N' ? 1 : 2 )
746
746
if nn != n throw (DimensionMismatch (" C has size ($n ,$n ), corresponding dimension of A is $nn " )) end
747
747
k = size (A, trans == ' N' ? 2 : 1 )
748
- ccall (($ ( blasfunc (fname) ), libblas), Void,
748
+ ccall ((@ blasfunc ($ fname), libblas), Void,
749
749
(Ptr{UInt8}, Ptr{UInt8}, Ptr{BlasInt}, Ptr{BlasInt},
750
750
Ptr{$ elty}, Ptr{$ elty}, Ptr{BlasInt}, Ptr{$ elty},
751
751
Ptr{$ elty}, Ptr{BlasInt}),
@@ -782,7 +782,7 @@ for (fname, elty, relty) in ((:zherk_, :Complex128, :Float64),
782
782
throw (DimensionMismatch (" the matrix to update has dimension $n but the implied dimension of the update is $(size (A, trans == ' N' ? 1 : 2 )) " ))
783
783
end
784
784
k = size (A, trans == ' N' ? 2 : 1 )
785
- ccall (($ ( blasfunc (fname) ), libblas), Void,
785
+ ccall ((@ blasfunc ($ fname), libblas), Void,
786
786
(Ptr{UInt8}, Ptr{UInt8}, Ptr{BlasInt}, Ptr{BlasInt},
787
787
Ptr{$ relty}, Ptr{$ elty}, Ptr{BlasInt}, Ptr{$ relty},
788
788
Ptr{$ elty}, Ptr{BlasInt}),
@@ -821,7 +821,7 @@ for (fname, elty) in ((:dsyr2k_,:Float64),
821
821
nn = size (A, trans == ' N' ? 1 : 2 )
822
822
if nn != n throw (DimensionMismatch (" C has size ($n ,$n ), corresponding dimension of A is $nn " )) end
823
823
k = size (A, trans == ' N' ? 2 : 1 )
824
- ccall (($ ( blasfunc (fname) ), libblas), Void,
824
+ ccall ((@ blasfunc ($ fname), libblas), Void,
825
825
(Ptr{UInt8}, Ptr{UInt8}, Ptr{BlasInt}, Ptr{BlasInt},
826
826
Ptr{$ elty}, Ptr{$ elty}, Ptr{BlasInt}, Ptr{$ elty}, Ptr{BlasInt}, Ptr{$ elty},
827
827
Ptr{$ elty}, Ptr{BlasInt}),
@@ -858,7 +858,7 @@ for (fname, elty1, elty2) in ((:zher2k_,:Complex128,:Float64), (:cher2k_,:Comple
858
858
nn = size (A, trans == ' N' ? 1 : 2 )
859
859
if nn != n throw (DimensionMismatch (" C has size ($n ,$n ), corresponding dimension of A is $nn " )) end
860
860
k = size (A, trans == ' N' ? 2 : 1 )
861
- ccall (($ ( blasfunc (fname) ), libblas), Void,
861
+ ccall ((@ blasfunc ($ fname), libblas), Void,
862
862
(Ptr{UInt8}, Ptr{UInt8}, Ptr{BlasInt}, Ptr{BlasInt},
863
863
Ptr{$ elty1}, Ptr{$ elty1}, Ptr{BlasInt}, Ptr{$ elty1}, Ptr{BlasInt},
864
864
Ptr{$ elty2}, Ptr{$ elty1}, Ptr{BlasInt}),
@@ -896,7 +896,7 @@ for (mmname, smname, elty) in
896
896
if nA != (side == ' L' ? m : n)
897
897
throw (DimensionMismatch (" size of A, $(size (A)) , doesn't match $side size of B with dims, $(size (B)) " ))
898
898
end
899
- ccall (($ ( blasfunc (mmname) ), libblas), Void,
899
+ ccall ((@ blasfunc ($ mmname), libblas), Void,
900
900
(Ptr{UInt8}, Ptr{UInt8}, Ptr{UInt8}, Ptr{UInt8}, Ptr{BlasInt}, Ptr{BlasInt},
901
901
Ptr{$ elty}, Ptr{$ elty}, Ptr{BlasInt}, Ptr{$ elty}, Ptr{BlasInt}),
902
902
& side, & uplo, & transa, & diag, & m, & n,
@@ -921,7 +921,7 @@ for (mmname, smname, elty) in
921
921
if k != (side == ' L' ? m : n)
922
922
throw (DimensionMismatch (" size of A is $n , size(B)=($m ,$n ) and transa='$transa '" ))
923
923
end
924
- ccall (($ ( blasfunc (smname) ), libblas), Void,
924
+ ccall ((@ blasfunc ($ smname), libblas), Void,
925
925
(Ptr{UInt8}, Ptr{UInt8}, Ptr{UInt8}, Ptr{UInt8},
926
926
Ptr{BlasInt}, Ptr{BlasInt}, Ptr{$ elty}, Ptr{$ elty},
927
927
Ptr{BlasInt}, Ptr{$ elty}, Ptr{BlasInt}),
0 commit comments