diff --git a/Project.toml b/Project.toml index 7b8120f..b957bb6 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "DerivableInterfaces" uuid = "6c5e35bf-e59e-4898-b73c-732dcc4ba65f" authors = ["ITensor developers and contributors"] -version = "0.3.11" +version = "0.3.12" [deps] Adapt = "79e6a3ab-5dfb-504d-930d-738a2a938a0e" diff --git a/src/abstractarrayinterface.jl b/src/abstractarrayinterface.jl index a855ae0..f3d7758 100644 --- a/src/abstractarrayinterface.jl +++ b/src/abstractarrayinterface.jl @@ -324,12 +324,20 @@ end return a_dest end -@interface interface::AbstractArrayInterface function Base._cat(dims, as::AbstractArray...) +function cat_along(dims, as::AbstractArray...) + return @interface interface(as...) cat_along(dims, as...) +end + +@interface interface::AbstractArrayInterface function cat_along(dims, as::AbstractArray...) a_dest = similar(Cat(as...; dims)) @interface interface cat!(a_dest, as...; dims) return a_dest end +@interface interface::AbstractArrayInterface function Base.cat(as::AbstractArray...; dims) + return @interface interface cat_along(dims, as...) +end + # TODO: Use `@derive` instead: # ```julia # @derive (T=AbstractArray,) begin diff --git a/src/traits.jl b/src/traits.jl index bb77b8c..a05bd75 100644 --- a/src/traits.jl +++ b/src/traits.jl @@ -45,7 +45,7 @@ function derive(::Val{:AbstractArrayOps}, type) Base.permutedims!(::Any, ::$type, ::Any) Broadcast.BroadcastStyle(::Type{<:$type}) Base.copyto!(::$type, ::Broadcast.Broadcasted{Broadcast.DefaultArrayStyle{0}}) - Base._cat(::Any, ::$type...) + Base.cat(::$type...; kwargs...) ArrayLayouts.MemoryLayout(::Type{<:$type}) LinearAlgebra.mul!(::AbstractMatrix, ::$type, ::$type, ::Number, ::Number) end