Skip to content

Commit

Permalink
vecarr_to_arr changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisRackauckas committed Jun 16, 2017
1 parent 62d556e commit 62f9a56
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions docs/src/analysis/parameter_estimation.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,10 @@ sol = solve(prob,Tsit5())
t = collect(linspace(0,10,200))
randomized = [(sol(t[i]) + .01randn(2)) for i in 1:length(t)]
using RecursiveArrayTools
data = vecvec_to_mat(randomized)
data = vecarr_to_arr(randomized)
```

Here we used `vecvec_to_mat` from [RecursiveArrayTools.jl](https://github.com/ChrisRackauckas/RecursiveArrayTools.jl)
Here we used `vecarr_to_arr` from [RecursiveArrayTools.jl](https://github.com/ChrisRackauckas/RecursiveArrayTools.jl)
to turn the result of an ODE into a matrix.

If we plot the solution with the parameter at `a=1.42`, we get the following:
Expand Down Expand Up @@ -253,7 +253,7 @@ sol = solve(prob,Tsit5())

t = collect(linspace(0,10,200))
randomized = [(sol(t[i]) + .01randn(2)) for i in 1:length(t)]
data = vecvec_to_mat(randomized)
data = vecarr_to_arr(randomized)

obj = build_loss_objective(prob,Tsit5(),L2DistLoss(t,data),maxiters=10000)
```
Expand Down
6 changes: 3 additions & 3 deletions docs/src/analysis/sensitivity.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ Therefore, the solution to the ODE are the first `n` components of the solution.
This means we can grab the matrix of solution values like:

```julia
x = vecvec_to_mat([sol[i][1:sol.prob.indvars] for i in 1:length(sol)])
x = vecarr_to_arr([sol[i][1:sol.prob.indvars] for i in 1:length(sol)])
```

Since each sensitivity is a vector of derivatives for each function, the sensitivities
Expand All @@ -97,11 +97,11 @@ is available in this case, including interpolations and plot recipes (the recipe
will plot the expanded system).

Since the closure returns a vector of vectors, it can be helpful to use
`vecvec_to_mat` from [RecursiveArrayTools.jl](https://github.com/ChrisRackauckas/RecursiveArrayTools.jl)
`vecarr_to_arr` from [RecursiveArrayTools.jl](https://github.com/ChrisRackauckas/RecursiveArrayTools.jl)
in order to plot the solution.

```julia
plot(sol.t,vecvec_to_mat(da),lw=3)
plot(sol.t,vecarr_to_arr(da),lw=3)
```

![Sensitivity Solution](../assets/sensitivityplot.png)
Expand Down
2 changes: 1 addition & 1 deletion docs/src/features/low_dep.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ sol = solve(prob,Tsit5())
t = collect(linspace(0,10,200))
randomized = [(sol(t[i]) + .01randn(2)) for i in 1:length(t)]
using RecursiveArrayTools
data = vecvec_to_mat(randomized)
data = vecarr_to_arr(randomized)
cost_function = build_loss_objective(prob,t,data,Tsit5(),maxiters=10000)
```

Expand Down

0 comments on commit 62f9a56

Please sign in to comment.