|
163 | 163 |
|
164 | 164 | # Version of `permutedims!` that assumes the destination and source
|
165 | 165 | # have the same blocking.
|
166 |
| -# TODO: Delete this and handle this logic in block sparse `map!`. |
167 |
| -function blocksparse_permutedims!(a_dest::AbstractArray, a_src::AbstractArray, perm) |
| 166 | +# TODO: Delete this and handle this logic in block sparse `map[!]`, define |
| 167 | +# `blockisequal_map[!]`. |
| 168 | +# TODO: Maybe define a `BlockIsEqualInterface` for these kinds of functions. |
| 169 | +function blockisequal_permutedims!(a_dest::AbstractArray, a_src::AbstractArray, perm) |
168 | 170 | blocks(a_dest) .= blocks(PermutedDimsArray(a_src, perm))
|
169 | 171 | return a_dest
|
170 | 172 | end
|
|
176 | 178 | a::AbstractArray, perm
|
177 | 179 | )
|
178 | 180 | a_dest = similar(PermutedDimsArray(a, perm))
|
179 |
| - blocksparse_permutedims!(a_dest, a, perm) |
| 181 | + # TODO: Maybe define this as `@interface BlockIsEqualInterface() permutedims!(...)`. |
| 182 | + blockisequal_permutedims!(a_dest, a, perm) |
180 | 183 | return a_dest
|
181 | 184 | end
|
182 | 185 |
|
|
187 | 190 | a_dest::AbstractArray, a_src::AbstractArray, perm
|
188 | 191 | )
|
189 | 192 | if all(blockisequal.(axes(a_dest), axes(PermutedDimsArray(a_src, perm))))
|
190 |
| - blocksparse_permutedims!(a_dest, a_src, perm) |
| 193 | + # TODO: Maybe define this as `@interface BlockIsEqualInterface() permutedims!(...)`. |
| 194 | + blockisequal_permutedims!(a_dest, a_src, perm) |
191 | 195 | return a_dest
|
192 | 196 | end
|
193 | 197 | @interface DefaultArrayInterface() permutedims!(a_dest, a_src, perm)
|
|
0 commit comments