Skip to content

Commit 1b33574

Browse files
committed
Small improvement based on review
1 parent 34781b9 commit 1b33574

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/setup.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ function def_unary_op(tin, tout, jlname, jlname!, mklname;
5353
(@isdefined jlname) || push!(exports, jlname)
5454
(@isdefined jlname!) || push!(exports, jlname!)
5555
@eval begin
56-
function ($jlname!)(out::Array{$tout,N}, A::Array{$tin,N}) where {N}
56+
function ($jlname!)(out::Array{$tout}, A::Array{$tin})
5757
size(out) == size(A) || throw(DimensionMismatch())
5858
ccall(($mklfn, MKL_jll.libmkl_rt), Nothing, (Int, Ptr{$tin}, Ptr{$tout}), length(A), A, out)
5959
vml_check_error()
@@ -85,14 +85,14 @@ function def_binary_op(tin, tout, jlname, jlname!, mklname, broadcast)
8585
(@isdefined jlname!) || push!(exports, jlname!)
8686
@eval begin
8787
$(isempty(exports) ? nothing : Expr(:export, exports...))
88-
function ($jlname!)(out::Array{$tout,N}, A::Array{$tin,N}, B::Array{$tin,N}) where {N}
89-
size(out) == size(A) == size(B) || $(broadcast ? :(return broadcast!($jlname, out, A, B)) : :(throw(DimensionMismatch())))
88+
function ($jlname!)(out::Array{$tout}, A::Array{$tin}, B::Array{$tin})
89+
size(out) == size(A) == size(B) || throw(DimensionMismatch("Input arrays and output array need to have the same size"))
9090
ccall(($mklfn, MKL_jll.libmkl_rt), Nothing, (Int, Ptr{$tin}, Ptr{$tin}, Ptr{$tout}), length(A), A, B, out)
9191
vml_check_error()
9292
return out
9393
end
94-
function ($jlname)(A::Array{$tout,N}, B::Array{$tin,N}) where {N}
95-
size(A) == size(B) || $(broadcast ? :(return broadcast($jlname, A, B)) : :(throw(DimensionMismatch())))
94+
function ($jlname)(A::Array{$tout}, B::Array{$tin})
95+
size(A) == size(B) || throw(DimensionMismatch("Input arrays need to have the same size"))
9696
out = similar(A)
9797
ccall(($mklfn, MKL_jll.libmkl_rt), Nothing, (Int, Ptr{$tin}, Ptr{$tin}, Ptr{$tout}), length(A), A, B, out)
9898
vml_check_error()

0 commit comments

Comments
 (0)