Skip to content

Commit

Permalink
Merge pull request #180 from matthieubulte/master
Browse files Browse the repository at this point in the history
Update _build_function to use inbounds keyword of DestructuredArgs
  • Loading branch information
ChrisRackauckas authored Apr 7, 2021
2 parents 116eeb6 + 7cab78e commit 27eca59
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ SafeTestsets = "0"
SciMLBase = "1.8"
Setfield = "0.7"
SpecialFunctions = "0.7, 0.8, 0.9, 0.10, 1.0"
SymbolicUtils = "0.9.0, 0.10"
SymbolicUtils = "0.10.1"
TreeViews = "0.3"
julia = "1.5"

Expand Down
8 changes: 4 additions & 4 deletions src/build_function.jl
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ end

# Scalar output

destructure_arg(arg::Union{AbstractArray, Tuple}) = DestructuredArgs(map(value, arg))
destructure_arg(arg) = arg
destructure_arg(arg::Union{AbstractArray, Tuple}, inbounds) = DestructuredArgs(map(value, arg), inbounds=inbounds)
destructure_arg(arg, _) = arg

function _build_function(target::JuliaTarget, op, args...;
conv = toexpr,
Expand All @@ -88,7 +88,7 @@ function _build_function(target::JuliaTarget, op, args...;
checkbounds = false,
linenumbers = true)

dargs = map(destructure_arg, [args...])
dargs = map(arg -> destructure_arg(arg, !checkbounds), [args...])
expr = toexpr(Func(dargs, [], unflatten_long_ops(op)))

if expression == Val{true}
Expand Down Expand Up @@ -185,7 +185,7 @@ function _build_function(target::JuliaTarget, rhss::AbstractArray, args...;
fillzeros = skipzeros && !(typeof(rhss)<:SparseMatrixCSC),
parallel=SerialForm(), kwargs...)

dargs = map(destructure_arg, [args...])
dargs = map(arg -> destructure_arg(arg, !checkbounds), [args...])
i = findfirst(x->x isa DestructuredArgs, dargs)
similarto = i === nothing ? Array : dargs[i].name
oop_expr = Func(dargs, [], make_array(parallel, dargs, rhss, similarto))
Expand Down

0 comments on commit 27eca59

Please sign in to comment.