|
38 | 38 |
|
39 | 39 | # Broadcasting implementation |
40 | 40 | # TODO: Delete this in favor of `DerivableInterfaces` version. |
41 | | -function Base.copyto!( |
42 | | - dest::AbstractArray{<:Any,N}, bc::Broadcasted{BlockSparseArrayStyle{N}} |
43 | | -) where {N} |
| 41 | +function copyto_blocksparse!(dest::AbstractArray, bc::Broadcasted) |
44 | 42 | # convert to map |
45 | 43 | # flatten and only keep the AbstractArray arguments |
46 | 44 | m = Mapped(bc) |
47 | 45 | @interface interface(dest, bc) map!(m.f, dest, m.args...) |
48 | 46 | return dest |
49 | 47 | end |
50 | 48 |
|
51 | | -# Broadcasting implementation |
52 | | -# TODO: Delete this in favor of `DerivableInterfaces` version. |
53 | | -function Base.copyto!(dest::AnyAbstractBlockSparseArray, bc::Broadcasted) |
54 | | - # convert to map |
55 | | - # flatten and only keep the AbstractArray arguments |
56 | | - m = Mapped(bc) |
57 | | - # TODO: Include `bc` when determining interface, currently |
58 | | - # `interface(::Type{<:Base.Broadcast.DefaultArrayStyle})` |
59 | | - # isn't defined. |
60 | | - @interface interface(dest) map!(m.f, dest, m.args...) |
61 | | - return dest |
62 | | -end |
63 | | - |
64 | | -# Broadcasting implementation |
65 | | -# TODO: Delete this in favor of `DerivableInterfaces` version. |
66 | 49 | function Base.copyto!( |
67 | | - dest::AnyAbstractBlockSparseArray, bc::Broadcasted{<:Base.Broadcast.AbstractArrayStyle{0}} |
68 | | -) |
69 | | - # convert to map |
70 | | - # flatten and only keep the AbstractArray arguments |
71 | | - m = Mapped(bc) |
72 | | - # TODO: Include `bc` when determining interface, currently |
73 | | - # `interface(::Type{<:Base.Broadcast.DefaultArrayStyle})` |
74 | | - # isn't defined. |
75 | | - @interface interface(dest) map!(m.f, dest, m.args...) |
76 | | - return dest |
77 | | -end |
78 | | - |
79 | | -# Broadcasting implementation |
80 | | -# TODO: Delete this in favor of `DerivableInterfaces` version. |
81 | | -function Base.copyto!( |
82 | | - dest::AnyAbstractBlockSparseArray{<:Any,N}, bc::Broadcasted{BlockSparseArrayStyle{N}} |
| 50 | + dest::AbstractArray{<:Any,N}, bc::Broadcasted{BlockSparseArrayStyle{N}} |
83 | 51 | ) where {N} |
84 | | - # convert to map |
85 | | - # flatten and only keep the AbstractArray arguments |
86 | | - m = Mapped(bc) |
87 | | - @interface interface(dest, bc) map!(m.f, dest, m.args...) |
| 52 | + copyto_blocksparse!(dest, bc) |
88 | 53 | return dest |
89 | 54 | end |
0 commit comments