Skip to content

Conversation

@ChrisRackauckas
Copy link
Member

Should fix the segfaults on SciMLSensitivity, and there are tests to ensure it does not regress

Should fix the segfaults on SciMLSensitivity, and there are tests to ensure it does not regress
prob = ODEProblem((u, p, t) -> 1.01u, 0.5, (0.0, 1.0))
A = [1 2
3 4]
prob = ODEProblem((u, p, t) -> A*u, ones(2,2), (0.0, 1.0))
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
prob = ODEProblem((u, p, t) -> A*u, ones(2,2), (0.0, 1.0))
prob = ODEProblem((u, p, t) -> A * u, ones(2, 2), (0.0, 1.0))

ensemble_prob = EnsembleProblem(prob, prob_func = prob_func)
sim = solve(ensemble_prob, Tsit5(), EnsembleThreads(), trajectories = 10)
sim = solve(ensemble_prob, Tsit5(), EnsembleThreads(), trajectories = 10, saveat=0.01)
@test sim isa EnsembleSolution
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
sim = solve(ensemble_prob, Tsit5(), EnsembleThreads(), trajectories = 10, saveat=0.01)
sim = solve(ensemble_prob, Tsit5(), EnsembleThreads(), trajectories = 10, saveat = 0.01)

Comment on lines +12 to +19
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
@test size(sim[1,:,:,:]) == (2,101,10)
@test size(sim[:,1,:,:]) == (2,101,10)
@test size(sim[:,:,1,:]) == (2,2,10)
@test size(sim[:,:,:,1]) == (2,2,101)
@test Array(sim)[1,:,:,:] == sim[1,:,:,:]
@test Array(sim)[:,1,:,:] == sim[:,1,:,:]
@test Array(sim)[:,:,1,:] == sim[:,:,1,:]
@test Array(sim)[:,:,:,1] == sim[:,:,:,1]
@test size(sim[1, :, :, :]) == (2, 101, 10)
@test size(sim[:, 1, :, :]) == (2, 101, 10)
@test size(sim[:, :, 1, :]) == (2, 2, 10)
@test size(sim[:, :, :, 1]) == (2, 2, 101)
@test Array(sim)[1, :, :, :] == sim[1, :, :, :]
@test Array(sim)[:, 1, :, :] == sim[:, 1, :, :]
@test Array(sim)[:, :, 1, :] == sim[:, :, 1, :]
@test Array(sim)[:, :, :, 1] == sim[:, :, :, 1]

Comment on lines +20 to +21
@test sol[1,:,i] == sol.u[i][x]
@test sol[2,:,i] == sol.u[i][y]
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
@test sol[1,:,i] == sol.u[i][x]
@test sol[2,:,i] == sol.u[i][y]
@test sol[1, :, i] == sol.u[i][x]
@test sol[2, :, i] == sol.u[i][y]

# TODO: fix the interpolation
@test only.(sol(1.0, idxs = [x])) last.(sol[x, :])
@test only.(sol(0.0, idxs = [x])) == sol[1, 1, :]
@test only.(sol(1.0, idxs = [x])) [sol[i][1, end] for i in 1:3]
Copy link
Contributor

Choose a reason for hiding this comment

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

[JuliaFormatter] reported by reviewdog 🐶

Suggested change
@test only.(sol(1.0, idxs = [x])) [sol[i][1, end] for i in 1:3]
@test only.(sol(1.0, idxs = [x])) [sol[i][1, end] for i in 1:3]

@ChrisRackauckas ChrisRackauckas merged commit 1180779 into master Oct 30, 2024
27 of 51 checks passed
@ChrisRackauckas ChrisRackauckas deleted the ensemble_indexing branch October 30, 2024 13:16
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.

2 participants