Commit fbfcc7f
committed
Fix zeromatrix to preserve GPU array types for ArrayPartition
The previous implementation used `reduce(vcat, vec.(A.x))` which could
cause type conversion issues with GPU arrays, leading to scalar indexing
errors when using implicit ODE solvers with ArrayPartition of CuArrays.
The fix uses `foldl` with an explicit `init` value from the first element
of the tuple, ensuring the result array type matches the input type.
This preserves GPU array types (CuArray, MtlArray, etc.) when building
the zero matrix.
Fixes #496
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>1 parent adf6fb5 commit fbfcc7f
2 files changed
+9
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
548 | 548 | | |
549 | 549 | | |
550 | 550 | | |
551 | | - | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
552 | 556 | | |
553 | 557 | | |
554 | 558 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
174 | 174 | | |
175 | 175 | | |
176 | 176 | | |
177 | | - | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
178 | 181 | | |
179 | 182 | | |
180 | 183 | | |
| |||
0 commit comments