@@ -213,7 +213,7 @@ function deg1_l2_ll0_lr0_eval(
213
213
cumulator = Array {T,1} (undef, n)
214
214
@maybe_turbo turbo for j in indices ((cX, cumulator), (2 , 1 ))
215
215
x_l = op_l (val_ll, cX[feature_lr, j]):: T
216
- x = isfinite (x_l) ? op (x_l):: T : T (Inf ) # These will get discovered by _eval_tree_array at end.
216
+ x = isfinite (x_l) ? op (x_l):: T : T (Inf )
217
217
cumulator[j] = x
218
218
end
219
219
return (cumulator, true )
@@ -273,6 +273,7 @@ function deg1_l1_ll0_eval(
273
273
end
274
274
end
275
275
276
+ # op(x, y) for x and y variable/constant
276
277
function deg2_l0_r0_eval (
277
278
tree:: Node{T} ,
278
279
cX:: AbstractMatrix{T} ,
@@ -320,6 +321,7 @@ function deg2_l0_r0_eval(
320
321
return (cumulator, true )
321
322
end
322
323
324
+ # op(x, y) for x variable/constant, y arbitrary
323
325
function deg2_l0_eval (
324
326
tree:: Node{T} ,
325
327
cX:: AbstractMatrix{T} ,
@@ -349,6 +351,7 @@ function deg2_l0_eval(
349
351
return (cumulator, true )
350
352
end
351
353
354
+ # op(x, y) for x arbitrary, y variable/constant
352
355
function deg2_r0_eval (
353
356
tree:: Node{T} ,
354
357
cX:: AbstractMatrix{T} ,
@@ -520,9 +523,9 @@ function eval(current_node)
520
523
function eval_tree_array (
521
524
tree:: Node , cX:: AbstractArray , operators:: GenericOperatorEnum ; throw_errors:: Bool = true
522
525
)
523
- ! throw_errors && return _eval_tree_array (tree, cX, operators, Val (false ))
526
+ ! throw_errors && return _eval_tree_array_generic (tree, cX, operators, Val (false ))
524
527
try
525
- return _eval_tree_array (tree, cX, operators, Val (true ))
528
+ return _eval_tree_array_generic (tree, cX, operators, Val (true ))
526
529
catch e
527
530
tree_s = string_tree (tree, operators)
528
531
error_msg = " Failed to evaluate tree $(tree_s) ."
@@ -537,7 +540,7 @@ function eval_tree_array(
537
540
end
538
541
end
539
542
540
- function _eval_tree_array (
543
+ function _eval_tree_array_generic (
541
544
tree:: Node{T1} ,
542
545
cX:: AbstractArray{T2,N} ,
543
546
operators:: GenericOperatorEnum ,
@@ -554,13 +557,13 @@ function _eval_tree_array(
554
557
end
555
558
end
556
559
elseif tree. degree == 1
557
- return deg1_eval (tree, cX, vals[tree. op], operators, Val (throw_errors))
560
+ return deg1_eval_generic (tree, cX, vals[tree. op], operators, Val (throw_errors))
558
561
else
559
- return deg2_eval (tree, cX, vals[tree. op], operators, Val (throw_errors))
562
+ return deg2_eval_generic (tree, cX, vals[tree. op], operators, Val (throw_errors))
560
563
end
561
564
end
562
565
563
- function deg1_eval (
566
+ function deg1_eval_generic (
564
567
tree, cX, :: Val{op_idx} , operators:: GenericOperatorEnum , :: Val{throw_errors}
565
568
) where {op_idx,throw_errors}
566
569
left, complete = eval_tree_array (tree. l, cX, operators)
@@ -570,7 +573,7 @@ function deg1_eval(
570
573
return op (left), true
571
574
end
572
575
573
- function deg2_eval (
576
+ function deg2_eval_generic (
574
577
tree, cX, :: Val{op_idx} , operators:: GenericOperatorEnum , :: Val{throw_errors}
575
578
) where {op_idx,throw_errors}
576
579
left, complete = eval_tree_array (tree. l, cX, operators)
0 commit comments