From 7d7a939c5ee9c11f61f273573ecfdb313f7c0b1d Mon Sep 17 00:00:00 2001 From: Sheehan Olver Date: Tue, 25 Jul 2023 10:23:56 +0100 Subject: [PATCH] Allow overloading on axes for paddeddata (#266) --- Project.toml | 2 +- src/padded.jl | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Project.toml b/Project.toml index fae5b852..4c0626cb 100644 --- a/Project.toml +++ b/Project.toml @@ -1,6 +1,6 @@ name = "LazyArrays" uuid = "5078a376-72f3-5289-bfd5-ec5146d43c02" -version = "1.5.0" +version = "1.5.1" [deps] ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a" diff --git a/src/padded.jl b/src/padded.jl index 4918765c..4f99c48f 100644 --- a/src/padded.jl +++ b/src/padded.jl @@ -488,7 +488,8 @@ const PaddedVector{T,M} = PaddedArray{T,1,M} const PaddedMatrix{T,M} = PaddedArray{T,2,M} MemoryLayout(::Type{<:PaddedArray{T,N,M}}) where {T,N,M} = PaddedLayout{typeof(MemoryLayout(M))}() -paddeddata(A::PaddedArray) = A.args[2] +paddeddata(A::PaddedArray) = paddeddata_axes(axes(A), A) +paddeddata_axes(_, A) = A.args[2] PaddedArray(A::AbstractArray{T,N}, n::Vararg{Integer,N}) where {T,N} = PaddedArray(A, map(oneto,n)) PaddedArray(A::AbstractArray{T,N}, ax::NTuple{N,Any}) where {T,N} = ApplyArray{T,N}(setindex, Zeros{T,N}(ax), A, axes(A)...)