@@ -79,39 +79,18 @@ nodes, you can evaluate or print a given expression.
7979
8080# Constructors
8181
82- ## Leafs
8382
84- Node(; val=nothing, feature::Union{Integer,Nothing} =nothing)
85- Node{T}(; val=nothing, feature::Union{Integer,Nothing} =nothing) where {T}
83+ Node([T] ; val=nothing, feature=nothing, op =nothing, l=nothing, r=nothing, allocator=default_allocator )
84+ Node{T}(; val=nothing, feature=nothing, op =nothing, l=nothing, r=nothing, allocator=default_allocator)
8685
87- Create a leaf node: either a constant, or a variable.
86+ Create a new node in an expression tree. If `T` is not specified in either the type or the
87+ first argument, it will be inferred from the value of `val` passed or `l` and/or `r`.
88+ If it cannot be inferred from these, it will default to `Float32`.
8889
89- - `::Type{T}`, optionally specify the type of the
90- node, if not already given by the type of
91- `val`.
92- - `val`, if you are specifying a constant, pass
93- the value of the constant here.
94- - `feature::Integer`, if you are specifying a variable,
95- pass the index of the variable here.
90+ You may also construct nodes via the convenience operators generated by creating an `OperatorEnum`.
9691
97- You can also create a leaf node from variable names:
98-
99- Node(; var_string::String, variable_names::Array{String,1})
100- Node{T}(; var_string::String, variable_names::Array{String,1}) where {T}
101-
102- ## Unary operator
103-
104- Node(op::Integer, l::Node)
105-
106- Apply unary operator `op` (enumerating over the order given in `OperatorEnum`)
107- to `Node` `l`.
108-
109- ## Binary operator
110-
111- Node(op::Integer, l::Node, r::Node)
112-
113- Apply binary operator `op` (enumerating over the order given in `OperatorEnum`)
114- to `Node`s `l` and `r`.
92+ You may also choose to specify a default memory allocator for the node other than simply `Node{T}()`
93+ in the `allocator` keyword argument.
11594"""
11695mutable struct Node{T} <: AbstractExpressionNode{T}
11796 degree:: UInt8 # 0 for constant/variable, 1 for cos/sin, 2 for +/* etc.
0 commit comments