@@ -3,12 +3,7 @@ module EvaluateModule
33using DispatchDoctor: @stable , @unstable
44
55import .. NodeModule:
6- AbstractExpressionNode,
7- constructorof,
8- max_degree,
9- get_children,
10- get_child,
11- with_type_parameters
6+ AbstractExpressionNode, constructorof, get_children, get_child, with_type_parameters
127import .. StringsModule: string_tree
138import .. OperatorEnumModule: AbstractOperatorEnum, OperatorEnum, GenericOperatorEnum
149import .. UtilsModule: fill_similar, counttuple, ResultOk
@@ -264,11 +259,11 @@ end
264259end
265260
266261function _eval_tree_array (
267- tree:: AbstractExpressionNode{T} ,
262+ tree:: AbstractExpressionNode{T,D } ,
268263 cX:: AbstractMatrix{T} ,
269264 operators:: OperatorEnum ,
270265 eval_options:: EvalOptions ,
271- ):: ResultOk where {T}
266+ ):: ResultOk where {T,D }
272267 # First, we see if there are only constants in the tree - meaning
273268 # we can just return the constant result.
274269 if tree. degree == 0
@@ -284,7 +279,7 @@ function _eval_tree_array(
284279 elseif tree. degree == 1
285280 op_idx = tree. op
286281 return dispatch_deg1_eval (tree, cX, op_idx, operators, eval_options)
287- elseif max_degree (tree) == 2 || tree. degree == 2
282+ elseif D == 2 || tree. degree == 2
288283 # TODO - add op(op2(x, y), z) and op(x, op2(y, z))
289284 # op(x, y), where x, y are constants or variables.
290285 op_idx = tree. op
@@ -400,12 +395,11 @@ end
400395
401396# This forms an if statement over the degree of a given node.
402397@generated function dispatch_degn_eval (
403- tree:: AbstractExpressionNode{T} ,
398+ tree:: AbstractExpressionNode{T,D } ,
404399 cX:: AbstractMatrix{T} ,
405400 operators:: OperatorEnum ,
406401 eval_options:: EvalOptions ,
407- ) where {T}
408- D = max_degree (tree)
402+ ) where {T,D}
409403 return quote
410404 # If statement over degrees
411405 degree = tree. degree
0 commit comments