Skip to content

Commit dddda50

Browse files
authored
Revert changes to cat in AbstractArrayOps, introduce cat_along (#17)
1 parent 51b1cf7 commit dddda50

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "DerivableInterfaces"
22
uuid = "6c5e35bf-e59e-4898-b73c-732dcc4ba65f"
33
authors = ["ITensor developers <[email protected]> and contributors"]
4-
version = "0.3.11"
4+
version = "0.3.12"
55

66
[deps]
77
Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e"

src/abstractarrayinterface.jl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,12 +324,20 @@ end
324324
return a_dest
325325
end
326326

327-
@interface interface::AbstractArrayInterface function Base._cat(dims, as::AbstractArray...)
327+
function cat_along(dims, as::AbstractArray...)
328+
return @interface interface(as...) cat_along(dims, as...)
329+
end
330+
331+
@interface interface::AbstractArrayInterface function cat_along(dims, as::AbstractArray...)
328332
a_dest = similar(Cat(as...; dims))
329333
@interface interface cat!(a_dest, as...; dims)
330334
return a_dest
331335
end
332336

337+
@interface interface::AbstractArrayInterface function Base.cat(as::AbstractArray...; dims)
338+
return @interface interface cat_along(dims, as...)
339+
end
340+
333341
# TODO: Use `@derive` instead:
334342
# ```julia
335343
# @derive (T=AbstractArray,) begin

src/traits.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ function derive(::Val{:AbstractArrayOps}, type)
4545
Base.permutedims!(::Any, ::$type, ::Any)
4646
Broadcast.BroadcastStyle(::Type{<:$type})
4747
Base.copyto!(::$type, ::Broadcast.Broadcasted{Broadcast.DefaultArrayStyle{0}})
48-
Base._cat(::Any, ::$type...)
48+
Base.cat(::$type...; kwargs...)
4949
ArrayLayouts.MemoryLayout(::Type{<:$type})
5050
LinearAlgebra.mul!(::AbstractMatrix, ::$type, ::$type, ::Number, ::Number)
5151
end

0 commit comments

Comments
 (0)