Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved direct usage #156

Merged
merged 6 commits into from Jul 28, 2019
Merged

Improved direct usage #156

merged 6 commits into from Jul 28, 2019

Conversation

ChrisRackauckas
Copy link
Member

For things that @dpsanders wants to do, a simplified form of expression building is quite handy.

@codecov
Copy link

codecov bot commented Jul 28, 2019

Codecov Report

Merging #156 into master will increase coverage by 0.33%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #156      +/-   ##
==========================================
+ Coverage   92.36%   92.69%   +0.33%     
==========================================
  Files          11       12       +1     
  Lines         432      452      +20     
==========================================
+ Hits          399      419      +20     
  Misses         33       33
Impacted Files Coverage Δ
src/ModelingToolkit.jl 75% <ø> (ø) ⬆️
src/systems/nonlinear/nonlinear_system.jl 93.93% <ø> (ø) ⬆️
src/direct.jl 100% <100%> (ø)
src/utils.jl 93.22% <100%> (+0.23%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bdcf035...04e4c69. Read the comment docs.

@ChrisRackauckas ChrisRackauckas changed the title simplified_expr Improved direct usage Jul 28, 2019
@ChrisRackauckas
Copy link
Member Author

Direct usage is usage outside of an AbstractSystem. This PR adds calculus (gradients, Jacobians, and Hessians) to generic systems of equations, has a way of displaying the functions in a simplified way (no ()), has helpers for building functions with and without parameters, and tests the world-age fix.

@ChrisRackauckas
Copy link
Member Author

Fixes #109

end

macro I(ex)
name = :ICompile
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a nicer way to handle this than returning the macro and then requiring the macro to be called? If we do this with a gensym we can write a macro which calls this macro to return a macro and then calls the returned macro, which is a crazy definition of "identity"

eqs = [σ*(y-x),
x*(ρ-z)-y,
x*y - β*z]
_f = eval(ModelingToolkit.build_function(eqs,[x,y,z],[σ,ρ,β]))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eval on the user side makes it easier to pick the appropriate module, which is important for newly registered function calls

@ChrisRackauckas
Copy link
Member Author

I there's a lot of other fixes in here, so I'm going to merge and tag and we can continue refining this, especially the @I macro which is a little peculiar. All of this will remain undocumented for now.

@ChrisRackauckas ChrisRackauckas merged commit 5a06b38 into master Jul 28, 2019
@ChrisRackauckas ChrisRackauckas deleted the simplified_expr branch July 28, 2019 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant