# PartitionedArrays and DifferentialEquations

**URL:** https://discourse.julialang.org/t/partitionedarrays-and-differentialequations/93853
**Category:** General Usage
**Created:** [February 1, 2023, 6:45am UTC](https://discourse.julialang.org/t/partitionedarrays-and-differentialequations/93853 "2023-02-01T06:45:58Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![bmxam](https://avatars.discourse-cdn.com/v4/letter/b/b38774/32.png) [@bmxam](https://discourse.julialang.org/u/bmxam)
#### Post date: [February 1, 2023, 6:45am UTC](https://discourse.julialang.org/t/partitionedarrays-and-differentialequations/93853/1 "2023-02-01T06:45:58Z")

</div>

Hi everyone,

Are there any example combining `DifferentialEquations` and `PartitionedArrays`?

Of course I’ve tried myself, but I’ve encountered obstacles because `DifferentialEquations` implies explicit indexing `a[i]` while `PartitionedArrays` forbids it (without explicitely selecting the global/local view).

---

<div class="post-metadata">

### Author: ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)
#### Post date: [February 2, 2023, 2:13am UTC](https://discourse.julialang.org/t/partitionedarrays-and-differentialequations/93853/2 "2023-02-02T02:13:11Z")

</div>

> [@bmxam](#):
>
> Are there any example combining `DifferentialEquations` and `PartitionedArrays`?

see [Find the right "default" distributed setup · Issue #1568 · SciML/OrdinaryDiffEq.jl · GitHub](https://github.com/SciML/OrdinaryDiffEq.jl/issues/1568). Some stuff needs to be worked out for it.

> [@bmxam](#):
>
> but I’ve encountered obstacles because `DifferentialEquations` implies explicit indexing `a[i]`

No, it absolutely does not, otherwise CuArrays, which does not allow scalar indexing, would not work with DifferentialEquations.jl. But it works because DifferentialEquations.jl only uses broadcast internally.

---

<div class="post-metadata">

### Author: ![bmxam](https://avatars.discourse-cdn.com/v4/letter/b/b38774/32.png) [@bmxam](https://discourse.julialang.org/u/bmxam)
#### Post date: [February 27, 2023, 9:35am UTC](https://discourse.julialang.org/t/partitionedarrays-and-differentialequations/93853/3 "2023-02-27T09:35:42Z")

</div>

> [@ChrisRackauckas](#):
>
> Some stuff needs to be worked out for it.

Thanks for the confirmation.

> [@ChrisRackauckas](#):
>
> No, it absolutely does not, otherwise CuArrays, which does not allow scalar indexing, would not work with DifferentialEquations.jl. But it works because DifferentialEquations.jl only uses broadcast internally.

I meant the actual combination of DifferentialEquations.jl and PartitionedArrays.jl leads to an attempt of scalar indexing. I’ve tried to tweak PartitionedArrays.jl to achieve my goal but I haven’t succeed yet. Maybe a solution would be to (re)define Broadcast rules for PartitionedArrays, to loop on the internal “parts”. (@ChrisRackauckas : I know you’re not the package author, I am just thinking out loud).

---

<div class="post-metadata">

### Author: ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)
#### Post date: [February 27, 2023, 10:02pm UTC](https://discourse.julialang.org/t/partitionedarrays-and-differentialequations/93853/4 "2023-02-27T22:02:27Z")

</div>

> [@bmxam](#):
>
> I’ve tried to tweak PartitionedArrays.jl to achieve my goal but I haven’t succeed yet. Maybe a solution would be to (re)define Broadcast rules for PartitionedArrays, to loop on the internal “parts”. (@ChrisRackauckas : I know you’re not the package author, I am just thinking out loud).

If broadcast isn’t overloaded, then indeed that will be required.
