Skip to content

Commit b50fcea

Browse files
committed
Merge remote-tracking branch 'origin/master' into sm/symutils3
2 parents 00bdc80 + 6a9b682 commit b50fcea

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1284
-257
lines changed

.github/workflows/CompatHelper.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ${{ matrix.os }}
1212
strategy:
1313
matrix:
14-
julia-version: [1.2.0]
14+
julia-version: [1.5.0]
1515
julia-arch: [x86]
1616
os: [ubuntu-latest]
1717
steps:

Project.toml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "ModelingToolkit"
22
uuid = "961ee093-0014-501f-94e3-6117800e7a78"
33
authors = ["Chris Rackauckas <[email protected]>"]
4-
version = "3.13.0"
4+
version = "3.20.0"
55

66
[deps]
77
ArrayInterface = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9"
@@ -12,8 +12,10 @@ DiffRules = "b552c78f-8df3-52c6-915a-8e097449b14b"
1212
Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b"
1313
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
1414
GeneralizedGenerated = "6b9d7cbe-bcb9-11e9-073f-15a7a543e2eb"
15+
IfElse = "615f187c-cbe4-4ef1-ba3b-2fcf58d6d173"
1516
LabelledArrays = "2ee39098-c373-598a-b85f-a56591580800"
1617
Latexify = "23fbe1c1-3f47-55db-b15f-69d7ec21a316"
18+
Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
1719
LightGraphs = "093fc24a-ae57-5d10-9952-331d41423f4d"
1820
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
1921
MacroTools = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09"
@@ -31,14 +33,15 @@ Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d"
3133

3234
[compat]
3335
ArrayInterface = "2.8"
34-
DataStructures = "0.17"
36+
DataStructures = "0.17, 0.18"
3537
DiffEqBase = "6.38"
3638
DiffEqJump = "6.7.5"
3739
DiffRules = "0.1, 1.0"
3840
DocStringExtensions = "0.7, 0.8"
3941
GeneralizedGenerated = "0.1.4, 0.2"
42+
IfElse = "0.1"
4043
LabelledArrays = "1.3"
41-
Latexify = "0.11, 0.12, 0.13"
44+
Latexify = "0.11, 0.12, 0.13, 0.14"
4245
LightGraphs = "1.3"
4346
MacroTools = "0.5"
4447
NaNMath = "0.3"
@@ -47,7 +50,7 @@ Requires = "1.0"
4750
SafeTestsets = "0.0.1"
4851
SpecialFunctions = "0.7, 0.8, 0.9, 0.10"
4952
StaticArrays = "0.10, 0.11, 0.12"
50-
SymbolicUtils = "0.4.3"
53+
SymbolicUtils = "0.5"
5154
TreeViews = "0.3"
5255
UnPack = "0.1, 1.0"
5356
Unitful = "1.1"

docs/make.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ makedocs(
1616
"tutorials/higher_order.md",
1717
"tutorials/nonlinear.md",
1818
"tutorials/modelingtoolkitize.md",
19-
"tutorials/auto_parallel.md"
19+
"tutorials/auto_parallel.md",
20+
"tutorials/converting_to_C.md"
2021
],
2122
"Systems" => Any[
2223
"systems/AbstractSystem.md",
@@ -25,12 +26,14 @@ makedocs(
2526
"systems/JumpSystem.md",
2627
"systems/NonlinearSystem.md",
2728
"systems/OptimizationSystem.md",
29+
"systems/ControlSystem.md",
2830
"systems/ReactionSystem.md",
2931
"systems/PDESystem.md",
3032
"systems/DependencyGraphs.md"
3133
],
3234
"Comparison Against SymPy" => "comparison.md",
3335
"highlevel.md",
36+
"build_function.md",
3437
"IR.md"
3538
]
3639
)

docs/src/IR.md

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -111,18 +111,3 @@ rename
111111
get_variables
112112
substitute_expr!
113113
```
114-
115-
### Expression Generation and `build_function`
116-
117-
At any time, Julia expressions can be generated from ModelingToolkit IR by using
118-
`convert(Expr,x)`. This performs some cleaning to return an expression without
119-
extraneous pieces that commonly matches expressions one would write in functions
120-
like those for differential equation solvers and optimization libraries.
121-
122-
Additionally, the core compilation process of ModelingToolkit IR is `build_function`.
123-
`build_function` takes an operation or an `AbstractArray` of operations and
124-
generates a compilable version of the model for numerical solvers.
125-
126-
```@docs
127-
build_function
128-
```

docs/src/build_function.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Function Building and Compilation (build_function)
2+
3+
At any time, callable functions can be generated from ModelingToolkit IR by using
4+
`convert(Expr,x)`. This performs some cleaning to return an expression without
5+
extraneous pieces that commonly matches expressions one would write in functions
6+
like those for differential equation solvers and optimization libraries. These
7+
functions can be automatically parallelize and specialize on Julia types like
8+
static arrays and sparse matrices.
9+
10+
The core compilation process of ModelingToolkit IR is `build_function`.
11+
`build_function` takes an operation or an `AbstractArray` of operations and
12+
generates a compilable version of the model for numerical solvers. The form of
13+
this output is dependent on the `target`. By default, the target outputs
14+
Julia code, but other formats, such as C, Stan, and MATLAB are available.
15+
These can be generated as expressions which can then be evaluated into a callable
16+
function, or the compilers for the respective targets can be invoked to directly
17+
give back the function handle.
18+
19+
## build_function
20+
21+
```@docs
22+
build_function
23+
```
24+
25+
## Target-Specific Definitions
26+
27+
```@docs
28+
_build_function(target::JuliaTarget,args...;kwargs...)
29+
_build_function(target::CTarget,args...;kwargs...)
30+
_build_function(target::StanTarget,args...;kwargs...)
31+
_build_function(target::MATLABTarget,args...;kwargs...)
32+
```

docs/src/systems/AbstractSystem.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ generate_factorized_W
5656
generate_hessian
5757
```
5858

59+
Additionally, `jacobian_sparsity(sys)` and `hessian_sparsity(sys)`
60+
exist on the appropriate systems for fast generation of the sparsity
61+
patterns via an abstract interpretation without requiring differentiation.
62+
5963
## Problem Constructors
6064

6165
At the end, the system types have `DEProblem` constructors, like `ODEProblem`,

docs/src/systems/ControlSystem.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# ControlSystem
2+
3+
## System Constructors
4+
5+
```@docs
6+
ControlSystem
7+
```
8+
9+
## Composition and Accessor Functions
10+
11+
- `sys.eqs` or `equations(sys)`: The equations that define the system.
12+
- `sys.states` or `states(sys)`: The set of states in the system.
13+
- `sys.parameters` or `parameters(sys)`: The parameters of the system.
14+
- `sys.controls` or `controls(sys)`: The control variables of the system
15+
16+
## Transformations
17+
18+
```@docs
19+
runge_kutta_discretize
20+
```

docs/src/systems/NonlinearSystem.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ NonlinearSystem
1919
```julia
2020
calculate_jacobian
2121
generate_jacobian
22+
jacobian_sparsity
2223
```
2324

2425
## Problem Constructors

docs/src/systems/ODESystem.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ calculate_factorized_W
2828
generate_jacobian
2929
generate_tgrad
3030
generate_factorized_W
31+
jacobian_sparsity
3132
```
3233

3334
## Problem Constructors

docs/src/systems/OptimizationSystem.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ calculate_gradient
2121
calculate_hessian
2222
generate_gradient
2323
generate_hessian
24+
hessian_sparsity
2425
```
2526

2627
## Problem Constructors

0 commit comments

Comments
 (0)