function f(x,y)
@boundscheck size(x) == size(y) || error("sizes do not match")
x'y
end
written by someone else and I want to use arguments x = rand(2,2); y = rand(2). Is there a way to suppress the @boundscheck so that I can call the function with the aforementioned arguments without triggering the error?
julia> function f(x,y)
@boundscheck size(x) == size(y) || error("sizes do not match")
x'y
end
f (generic function with 1 method)
julia> g(x,y) = @inbounds f(x,y)
g (generic function with 1 method)
julia> f(rand(2,2), rand(2))
ERROR: sizes do not match
Stacktrace:
[1] error(s::String)
@ Base ./error.jl:33
[2] f(x::Matrix{Float64}, y::Vector{Float64})
@ Main ./REPL[6]:2
[3] top-level scope
@ REPL[8]:1
julia> g(rand(2,2), rand(2))
2-element Vector{Float64}:
0.5974016405805198
0.49780565668703575