Commit ae21b37
authored
Fix ambiguity error in
I found that `similar` calls such as:
```julia
using BlockArrays
r = blockedrange([2, 2])
similar(Array{Float64}, (r, r, r))
```
(with inputs of 3 or more blocked axes) lead to ambiguity errors between
the `StridedArray` and `AbstractArray` versions which output
`BlockedArray` and `BlockArray` respectively, this PR fixes that
ambiguity by defining a more specialized `similar` method only for
`AbstractBlockedUnitRange` inputs. The existing definitions accept
mixtures of blocked, non-blocked, and integer dimensions which is more
prone to ambiguities.
Related to #196 and #489.
I also noticed these definitions are not so friendly for GPU array types
but that is a separate matter...similar with 3 or more blocked axes (#494)1 parent 4fc19a9 commit ae21b37
File tree
4 files changed
+13
-1
lines changed- src
- test
4 files changed
+13
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
448 | 448 | | |
449 | 449 | | |
450 | 450 | | |
| 451 | + | |
| 452 | + | |
451 | 453 | | |
452 | 454 | | |
453 | 455 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
215 | 215 | | |
216 | 216 | | |
217 | 217 | | |
| 218 | + | |
| 219 | + | |
218 | 220 | | |
219 | 221 | | |
220 | 222 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
260 | 260 | | |
261 | 261 | | |
262 | 262 | | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
263 | 271 | | |
264 | 272 | | |
265 | 273 | | |
| |||
0 commit comments