Skip to content

Commit 3845539

Browse files
committed
refactor: simplify eval code
1 parent 83902e3 commit 3845539

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/Evaluate.jl

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -288,8 +288,7 @@ function _eval_tree_array(
288288
op_idx = tree.op
289289
return dispatch_deg2_eval(tree, cX, op_idx, operators, eval_options)
290290
else
291-
op_idx = tree.op
292-
return dispatch_degn_eval(tree, cX, op_idx, operators, eval_options)
291+
return dispatch_degn_eval(tree, cX, operators, eval_options)
293292
end
294293
end
295294

@@ -336,7 +335,6 @@ end
336335
@generated function inner_dispatch_degn_eval(
337336
tree::AbstractExpressionNode{T},
338337
cX::AbstractMatrix{T},
339-
op_idx::Integer,
340338
::Val{degree},
341339
operators::OperatorEnum{OPS},
342340
eval_options::EvalOptions,
@@ -352,6 +350,7 @@ end
352350
@return_on_nonfinite_array(eval_options, result_i.x)
353351
end
354352
)
353+
op_idx = tree.op
355354
cumulators = Base.Cartesian.@ntuple($degree, i -> result_i.x)
356355
Base.Cartesian.@nif(
357356
$nops,
@@ -363,7 +362,6 @@ end
363362
@generated function dispatch_degn_eval(
364363
tree::AbstractExpressionNode{T},
365364
cX::AbstractMatrix{T},
366-
op_idx::Integer,
367365
operators::OperatorEnum,
368366
eval_options::EvalOptions,
369367
) where {T}
@@ -374,8 +372,7 @@ end
374372
return Base.Cartesian.@nif(
375373
$D,
376374
d -> d == degree,
377-
d ->
378-
inner_dispatch_degn_eval(tree, cX, op_idx, Val(d), operators, eval_options)
375+
d -> inner_dispatch_degn_eval(tree, cX, Val(d), operators, eval_options)
379376
)
380377
end
381378
end

0 commit comments

Comments
 (0)