Skip to content
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
9798f58
eval_tree_array (generic) reshapes output
grezde Jun 24, 2024
656d232
added type interface so non-generic eval works with any type
grezde Jun 24, 2024
4b6d5e8
added oher types to OperatorEnum
grezde Jun 25, 2024
c7ad68c
fixed most tests
grezde Jun 25, 2024
a5efcd4
added example as test
grezde Jun 25, 2024
5468282
removed unnecessary lines in this branch
grezde Jun 25, 2024
8587599
reset Project.toml
grezde Jun 25, 2024
da1886f
Update src/Evaluate.jl
gca30 Jun 26, 2024
8d2797e
Apply suggestions from code review
gca30 Jun 26, 2024
a3d14e9
applied formatting, all other suggestions from pull request
gca30 Jun 26, 2024
225ba4d
generalized Optim, removed outdated tests
gca30 Jul 3, 2024
a8003ce
added bradcast operator support to expand_operators and showing expre…
gca30 Jul 4, 2024
08b20f6
Merge branch 'master' into pr/gca30/85
MilesCranmer Jul 4, 2024
ae404c3
remove old parsing test
MilesCranmer Jul 4, 2024
c788b38
append_number_constants no longer uses push
gca30 Jul 5, 2024
41c6d37
reformat
gca30 Jul 5, 2024
60dc72e
applied merge
gca30 Jul 5, 2024
7fbe0e6
Apply suggestions from code review
gca30 Jul 5, 2024
85d8b25
reformat
gca30 Jul 5, 2024
bdf4ad0
type interface suggestions
gca30 Jul 5, 2024
a638f84
reformat
gca30 Jul 5, 2024
1213786
rename scalar utility functions
MilesCranmer Jul 5, 2024
f4ab375
specialize type in `get_scalar_constants`
MilesCranmer Jul 5, 2024
150552d
fix tests
MilesCranmer Jul 5, 2024
16fa343
simplify use of interface
MilesCranmer Jul 5, 2024
81fd233
rename `index_constants` to `index_constant_nodes`
MilesCranmer Jul 5, 2024
7b62bd8
ci: compat with deprecated function names
MilesCranmer Jul 6, 2024
1c0d935
deps: remove unused TestItems.jl in main package
MilesCranmer Jul 6, 2024
f2217bd
style: formatting
MilesCranmer Jul 6, 2024
0284229
style: move TypeInterface imports to top of import list
MilesCranmer Jul 6, 2024
2189c7f
fix: update precompile function names
MilesCranmer Jul 6, 2024
70c46fc
style: import all extensions at once for parallel precompilation
MilesCranmer Jul 6, 2024
f8e5acf
style: update name to `set_scalar_constants!` in benchmarks
MilesCranmer Jul 6, 2024
0ad3c93
ci: add extra benchmark for parametric nodes
MilesCranmer Jul 6, 2024
308c5d1
style: clean up ParametricExpression internal methods
MilesCranmer Jul 6, 2024
0b8bd43
feat: add `ValueInterface` to formalize interface
MilesCranmer Jul 6, 2024
6fae896
refactor: rename to `ValueInterface`
MilesCranmer Jul 6, 2024
9347092
refactor: simplify `Max2Tensor`
MilesCranmer Jul 6, 2024
398b640
fix: equality check between dims
MilesCranmer Jul 6, 2024
571518c
fix: name of ValueInterfaceModule
MilesCranmer Jul 6, 2024
bebbe18
refactor: simplify `Max2Tensor` further
MilesCranmer Jul 6, 2024
e2e9b21
fix: `ValueInterface` checker of packing
MilesCranmer Jul 6, 2024
1b1a674
test: full `ValueInterface` for `Max2Tensor`
MilesCranmer Jul 6, 2024
5fa74fc
refactor: `Max2Tensor` to more general `DynamicTensor`
MilesCranmer Jul 6, 2024
455e80f
test: fix more generic `DynamicTensor`
MilesCranmer Jul 6, 2024
6e3db19
refactor: clean up use of `is_valid` throughout library
MilesCranmer Jul 6, 2024
1c878f2
refactor: propagate inbounds to unpacking and packing
MilesCranmer Jul 6, 2024
0c8aab9
refactor: clean up broadcasted operators
MilesCranmer Jul 7, 2024
5ce69c5
feat: warn for `BroadcastFunction`
MilesCranmer Jul 7, 2024
b162f75
feat: use safer `lock` syntax
MilesCranmer Jul 7, 2024
1b576fe
feat: only warn if defining helper functions
MilesCranmer Jul 7, 2024
7ff927b
fix: mark `@unstable`
MilesCranmer Jul 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion ext/DynamicExpressionsOptimExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ using DynamicExpressions:
filter_map,
eval_tree_array,
get_constants,
set_constants!
set_constants!,
get_number_type
using Compat: @inline

import Optim: Optim, OptimizationResults, NLSolversBase
Expand Down Expand Up @@ -47,6 +48,11 @@ function wrap_func(
set_constants!(tree, x, refs)
return @inline(f(first_args..., tree))
end
# without first args, it looks like this
# function wrapped_f(x)
# set_constants!(tree, x, refs)
# return @inline(f(tree))
# end
return wrapped_f
end
function wrap_func(
Expand Down Expand Up @@ -100,6 +106,7 @@ function Optim.optimize(
if make_copy
tree = copy(tree)
end

x0, refs = get_constants(tree)
if !isnothing(h!)
throw(
Expand Down
8 changes: 8 additions & 0 deletions src/DynamicExpressions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ using DispatchDoctor: @stable, @unstable

@stable default_mode = "disable" begin
include("Utils.jl")
include("TypeInterface.jl")
include("ExtensionInterface.jl")
include("OperatorEnum.jl")
include("Node.jl")
Expand Down Expand Up @@ -73,6 +74,13 @@ import .ExpressionModule:
@reexport import .ParseModule: @parse_expression, parse_expression
import .ParseModule: parse_leaf
@reexport import .ParametricExpressionModule: ParametricExpression, ParametricNode
@reexport import .TypeInterfaceModule:
is_valid,
is_valid_array,
get_number_type,
append_number_constants!,
pop_number_constants,
count_number_constants

@stable default_mode = "disable" begin
include("Interfaces.jl")
Expand Down
Loading