From 349dad173c0d3222e4d8c01de11b825b1f89d83b Mon Sep 17 00:00:00 2001 From: Dae Woo Kim Date: Tue, 28 Apr 2026 20:08:02 -0500 Subject: [PATCH] Apply runic formatting --- src/RegisterCore.jl | 118 ++++++++++++++++++++++---------------------- src/deprecations.jl | 2 +- test/runtests.jl | 70 +++++++++++++------------- 3 files changed, 95 insertions(+), 95 deletions(-) diff --git a/src/RegisterCore.jl b/src/RegisterCore.jl index 481c3f2..a8affe7 100644 --- a/src/RegisterCore.jl +++ b/src/RegisterCore.jl @@ -58,7 +58,7 @@ As a consequence, there is no `convert(Float64, nd::NumDenom)` method, because t above breaks any pretense that `NumDenom` numbers are somehow equivalent to ratios. If you want to convert to a ratio, see [`ratio`](@ref). """ -struct NumDenom{T<:Number} +struct NumDenom{T <: Number} num::T denom::T end @@ -67,24 +67,24 @@ NumDenom(n::Gray, d) = NumDenom(gray(n), d) NumDenom(n, d::Gray) = NumDenom(n, gray(d)) NumDenom(n, d) = NumDenom(promote(n, d)...) -(+)(p1::NumDenom, p2::NumDenom) = NumDenom(p1.num+p2.num, p1.denom+p2.denom) -(-)(p1::NumDenom, p2::NumDenom) = NumDenom(p1.num-p2.num, p1.denom-p2.denom) -(*)(n::Number, p::NumDenom) = NumDenom(n*p.num, n*p.denom) -(*)(p::NumDenom, n::Number) = n*p -(/)(p::NumDenom, n::Number) = NumDenom(p.num/n, p.denom/n) -Base.oneunit(::Type{NumDenom{T}}) where {T} = NumDenom{T}(oneunit(T),oneunit(T)) +(+)(p1::NumDenom, p2::NumDenom) = NumDenom(p1.num + p2.num, p1.denom + p2.denom) +(-)(p1::NumDenom, p2::NumDenom) = NumDenom(p1.num - p2.num, p1.denom - p2.denom) +(*)(n::Number, p::NumDenom) = NumDenom(n * p.num, n * p.denom) +(*)(p::NumDenom, n::Number) = n * p +(/)(p::NumDenom, n::Number) = NumDenom(p.num / n, p.denom / n) +Base.oneunit(::Type{NumDenom{T}}) where {T} = NumDenom{T}(oneunit(T), oneunit(T)) Base.oneunit(p::NumDenom) = oneunit(typeof(p)) -Base.zero(::Type{NumDenom{T}}) where {T} = NumDenom(zero(T),zero(T)) +Base.zero(::Type{NumDenom{T}}) where {T} = NumDenom(zero(T), zero(T)) Base.zero(p::NumDenom) = zero(typeof(p)) -Base.promote_rule(::Type{NumDenom{T1}}, ::Type{T2}) where {T1,T2<:Number} = NumDenom{promote_type(T1,T2)} -Base.promote_rule(::Type{NumDenom{T1}}, ::Type{NumDenom{T2}}) where {T1,T2} = NumDenom{promote_type(T1,T2)} +Base.promote_rule(::Type{NumDenom{T1}}, ::Type{T2}) where {T1, T2 <: Number} = NumDenom{promote_type(T1, T2)} +Base.promote_rule(::Type{NumDenom{T1}}, ::Type{NumDenom{T2}}) where {T1, T2} = NumDenom{promote_type(T1, T2)} Base.eltype(::Type{NumDenom{T}}) where {T} = T Base.convert(::Type{NumDenom{T}}, p::NumDenom{T}) where {T} = p Base.convert(::Type{NumDenom{T}}, p::NumDenom) where {T} = NumDenom{T}(p.num, p.denom) -Base.round(::Type{NumDenom{T}}, p::NumDenom) where T = NumDenom{T}(round(T, p.num), round(T, p.denom)) +Base.round(::Type{NumDenom{T}}, p::NumDenom) where {T} = NumDenom{T}(round(T, p.num), round(T, p.denom)) -Base.convert(::Type{F}, p::NumDenom) where F<:AbstractFloat = error("`convert($F, ::NumDenom)` is deliberately not defined, see `?NumDenom`.") +Base.convert(::Type{F}, p::NumDenom) where {F <: AbstractFloat} = error("`convert($F, ::NumDenom)` is deliberately not defined, see `?NumDenom`.") function Base.show(io::IO, p::NumDenom) print(io, "NumDenom(") @@ -95,7 +95,7 @@ function Base.show(io::IO, p::NumDenom) return end -const MismatchArray{ND<:NumDenom,N,A} = CenterIndexedArray{ND,N,A} +const MismatchArray{ND <: NumDenom, N, A} = CenterIndexedArray{ND, N, A} """ mxs = maxshift(D) @@ -109,11 +109,11 @@ maxshift(A::MismatchArray) = A.halfsize `(num,denom)` into a single `MismatchArray`. This is useful preparation for interpolation. """ -function (::Type{M})(num::AbstractArray, denom::AbstractArray) where M<:MismatchArray +function (::Type{M})(num::AbstractArray, denom::AbstractArray) where {M <: MismatchArray} size(num) == size(denom) || throw(DimensionMismatch("num and denom must have the same size")) T = promote_type(eltype(num), eltype(denom)) numdenom = CenterIndexedArray{NumDenom{T}}(undef, size(num)) - _packnd!(numdenom, num, denom) + return _packnd!(numdenom, num, denom) end function _packnd!(numdenom::AbstractArray, num::AbstractArray, denom::AbstractArray) @@ -131,14 +131,14 @@ function _packnd!(numdenom::AbstractArray, num::AbstractArray, denom::AbstractAr @inbounds numdenom[Ind] = NumDenom(num[Inum], denom[Idenom]) end end - numdenom + return numdenom end function _packnd!(numdenom::CenterIndexedArray, num::CenterIndexedArray, denom::CenterIndexedArray) @simd for I in eachindex(num) @inbounds numdenom[I] = NumDenom(num[I], denom[I]) end - numdenom + return numdenom end # The next are mostly used just for testing @@ -147,7 +147,7 @@ end `mms = mismatcharrays(nums, denom)`, for `denom` a single array, uses the same `denom` array for all `nums`. """ -function mismatcharrays(nums::AbstractArray{A}, denom::AbstractArray{T}) where {A<:AbstractArray,T<:Number} +function mismatcharrays(nums::AbstractArray{A}, denom::AbstractArray{T}) where {A <: AbstractArray, T <: Number} first = true local mms for i in eachindex(nums) @@ -159,10 +159,10 @@ function mismatcharrays(nums::AbstractArray{A}, denom::AbstractArray{T}) where { end mms[i] = mm end - mms + return mms end -function mismatcharrays(nums::AbstractArray{A1}, denoms::AbstractArray{A2}) where {A1<:AbstractArray,A2<:AbstractArray} +function mismatcharrays(nums::AbstractArray{A1}, denoms::AbstractArray{A2}) where {A1 <: AbstractArray, A2 <: AbstractArray} size(nums) == size(denoms) || throw(DimensionMismatch("nums and denoms arrays must have the same number of apertures")) first = true local mms @@ -174,14 +174,14 @@ function mismatcharrays(nums::AbstractArray{A1}, denoms::AbstractArray{A2}) wher end mms[i] = mm end - mms + return mms end """ `num, denom = separate(mm)` splits an `AbstractArray{NumDenom}` into separate numerator and denominator arrays. """ -function separate(data::AbstractArray{NumDenom{T}}) where T +function separate(data::AbstractArray{NumDenom{T}}) where {T} num = Array{T}(undef, size(data)) denom = similar(num) for I in eachindex(data) @@ -189,22 +189,22 @@ function separate(data::AbstractArray{NumDenom{T}}) where T num[I] = nd.num denom[I] = nd.denom end - num, denom + return num, denom end function separate(mm::MismatchArray) num, denom = separate(mm.data) - CenterIndexedArray(num), CenterIndexedArray(denom) + return CenterIndexedArray(num), CenterIndexedArray(denom) end -function separate(mma::AbstractArray{M}) where M<:MismatchArray +function separate(mma::AbstractArray{M}) where {M <: MismatchArray} T = eltype(eltype(M)) - nums = Array{CenterIndexedArray{T,ndims(M)}}(undef, size(mma)) + nums = Array{CenterIndexedArray{T, ndims(M)}}(undef, size(mma)) denoms = similar(nums) - for (i,mm) in enumerate(mma) + for (i, mm) in enumerate(mma) nums[i], denoms[i] = separate(mm) end - nums, denoms + return nums, denoms end """ @@ -214,14 +214,14 @@ Return `nd.num/nd.denom`, unless `nd.denom < thresh`, in which case return `fill to the same type as the ratio. Choosing a `thresh` of zero will always return the ratio. """ -@inline function ratio(nd::NumDenom{T}, thresh, fillval=convert(T,NaN)) where {T} - r = nd.num/nd.denom +@inline function ratio(nd::NumDenom{T}, thresh, fillval = convert(T, NaN)) where {T} + r = nd.num / nd.denom return nd.denom < thresh ? oftype(r, fillval) : r end -ratio(r::Real, thresh, fillval=NaN) = r +ratio(r::Real, thresh, fillval = NaN) = r -(::Type{M})(::Type{T}, dims::Dims) where {M<:MismatchArray,T} = CenterIndexedArray{NumDenom{T}}(undef, dims) -(::Type{M})(::Type{T}, dims::Integer...) where {M<:MismatchArray,T} = CenterIndexedArray{NumDenom{T}}(undef, dims) +(::Type{M})(::Type{T}, dims::Dims) where {M <: MismatchArray, T} = CenterIndexedArray{NumDenom{T}}(undef, dims) +(::Type{M})(::Type{T}, dims::Integer...) where {M <: MismatchArray, T} = CenterIndexedArray{NumDenom{T}}(undef, dims) function Base.copyto!(M::MismatchArray, nd::Tuple{AbstractArray, AbstractArray}) num, denom = nd @@ -229,7 +229,7 @@ function Base.copyto!(M::MismatchArray, nd::Tuple{AbstractArray, AbstractArray}) for (IM, Ind) in zip(eachindex(M), eachindex(num)) M[IM] = NumDenom(num[Ind], denom[Ind]) end - M + return M end @@ -242,14 +242,14 @@ considers only those points for which `denom .> thresh`; moreover, it will never choose an edge point. `index` is a CartesianIndex into the arrays. """ -function indmin_mismatch(numdenom::MismatchArray{NumDenom{T},N}, thresh::Real) where {T,N} - imin = CartesianIndex(ntuple(d->0, Val(N))) +function indmin_mismatch(numdenom::MismatchArray{NumDenom{T}, N}, thresh::Real) where {T, N} + imin = CartesianIndex(ntuple(d -> 0, Val(N))) rmin = typemax(T) threshT = convert(T, thresh) @inbounds for I in CartesianIndices(map(trimedges, axes(numdenom))) nd = numdenom[I] if nd.denom > threshT - r = nd.num/nd.denom + r = nd.num / nd.denom if r < rmin imin = I rmin = r @@ -259,8 +259,8 @@ function indmin_mismatch(numdenom::MismatchArray{NumDenom{T},N}, thresh::Real) w return imin end -function indmin_mismatch(r::CenterIndexedArray{T,N}) where {T<:Number,N} - imin = CartesianIndex(ntuple(d->0, Val(N))) +function indmin_mismatch(r::CenterIndexedArray{T, N}) where {T <: Number, N} + imin = CartesianIndex(ntuple(d -> 0, Val(N))) rmin = typemax(T) @inbounds for I in CartesianIndices(map(trimedges, axes(r))) rval = r[I] @@ -272,7 +272,7 @@ function indmin_mismatch(r::CenterIndexedArray{T,N}) where {T<:Number,N} return imin end -trimedges(r::AbstractUnitRange) = first(r)+1:last(r)-1 +trimedges(r::AbstractUnitRange) = (first(r) + 1):(last(r) - 1) ### Miscellaneous @@ -289,16 +289,16 @@ If you do not wish to highpass-filter along a particular axis, put You may optionally specify the element type of the result, which for `Integer` or `FixedPoint` inputs defaults to `Float32`. """ -function highpass(::Type{T}, data::AbstractArray, sigma) where T +function highpass(::Type{T}, data::AbstractArray, sigma) where {T} if any(isinf, sigma) - datahp = convert(Array{T,ndims(data)}, data) + datahp = convert(Array{T, ndims(data)}, data) else datahp = data - imfilter(T, data, KernelFactors.IIRGaussian(T, (sigma...,)), NA()) end datahp[datahp .< 0] .= 0 # truncate anything below 0 - datahp + return datahp end -highpass(data::AbstractArray{T}, sigma) where {T<:AbstractFloat} = highpass(T, data, sigma) +highpass(data::AbstractArray{T}, sigma) where {T <: AbstractFloat} = highpass(T, data, sigma) highpass(data::AbstractArray, sigma) = highpass(Float32, data, sigma) """ @@ -327,25 +327,25 @@ end function preprocess(pp::PreprocessSNF, A::AbstractArray) Af = sqrt_subtract_bias(A, pp.bias) - imfilter(highpass(Af, pp.sigmahp), KernelFactors.IIRGaussian((pp.sigmalp...,)), NA()) + return imfilter(highpass(Af, pp.sigmahp), KernelFactors.IIRGaussian((pp.sigmalp...,)), NA()) end (pp::PreprocessSNF)(A::AbstractArray) = preprocess(pp, A) # For SubArrays, extend to the parent along any non-sliced # dimension. That way, we keep any information from padding. function (pp::PreprocessSNF)(A::SubArray) Bpad = preprocess(pp, paddedview(A)) - trimmedview(Bpad, A) + return trimmedview(Bpad, A) end # ImageMeta method is defined under @require in __init__ function sqrt_subtract_bias(A, bias) -# T = typeof(sqrt(one(promote_type(eltype(A), typeof(bias))))) + # T = typeof(sqrt(one(promote_type(eltype(A), typeof(bias))))) T = Float32 out = Array{T}(undef, size(A)) for I in eachindex(A) @inbounds out[I] = sqrt(max(zero(T), convert(T, A[I]) - bias)) end - out + return out end @@ -355,20 +355,20 @@ extends to the full parent along any non-sliced dimensions of the parent. See also [`trimmedview`](@ref). """ paddedview(A::SubArray) = _paddedview(A, (), (), A.indices...) -_paddedview(A::SubArray{T,N,P,I}, newindexes, newsize) where {T,N,P,I} = +_paddedview(A::SubArray{T, N, P, I}, newindexes, newsize) where {T, N, P, I} = SubArray(A.parent, newindexes) @inline function _paddedview(A, newindexes, newsize, index, indexes...) - d = length(newindexes)+1 - _paddedview(A, (newindexes..., pdindex(A.parent, d, index)), pdsize(A.parent, newsize, d, index), indexes...) + d = length(newindexes) + 1 + return _paddedview(A, (newindexes..., pdindex(A.parent, d, index)), pdsize(A.parent, newsize, d, index), indexes...) end pdindex(A, d, i::Base.Slice) = i pdindex(A, d, i::Real) = i -pdindex(A, d, i::UnitRange) = 1:size(A,d) +pdindex(A, d, i::UnitRange) = 1:size(A, d) pdindex(A, d, i) = error("Cannot pad with an index of type ", typeof(i)) -pdsize(A, newsize, d, i::Base.Slice) = tuple(newsize..., size(A,d)) +pdsize(A, newsize, d, i::Base.Slice) = tuple(newsize..., size(A, d)) pdsize(A, newsize, d, i::Real) = newsize -pdsize(A, newsize, d, i::UnitRange) = tuple(newsize..., size(A,d)) +pdsize(A, newsize, d, i::UnitRange) = tuple(newsize..., size(A, d)) """ `B = trimmedview(Bpad, A::SubArray)` returns a SubArray `B` with @@ -376,17 +376,17 @@ pdsize(A, newsize, d, i::UnitRange) = tuple(newsize..., size(A,d)) """ function trimmedview(Bpad, A::SubArray) ndims(Bpad) == ndims(A) || throw(DimensionMismatch("dimensions $(ndims(Bpad)) and $(ndims(A)) of Bpad and A must match")) - _trimmedview(Bpad, A.parent, 1, (), A.indices...) + return _trimmedview(Bpad, A.parent, 1, (), A.indices...) end _trimmedview(Bpad, P, d, newindexes) = view(Bpad, newindexes...) @inline _trimmedview(Bpad, P, d, newindexes, index::Real, indexes...) = - _trimmedview(Bpad, P, d+1, newindexes, indexes...) + _trimmedview(Bpad, P, d + 1, newindexes, indexes...) @inline function _trimmedview(Bpad, P, d, newindexes, index, indexes...) - dB = length(newindexes)+1 + dB = length(newindexes) + 1 Bsz = size(Bpad, dB) Psz = size(P, d) Bsz == Psz || throw(DimensionMismatch("dimension $dB of Bpad has size $Bsz, should have size $Psz")) - _trimmedview(Bpad, P, d+1, (newindexes..., index), indexes...) + return _trimmedview(Bpad, P, d + 1, (newindexes..., index), indexes...) end # For faster and type-stable slicing @@ -394,7 +394,7 @@ struct ColonFun end ColonFun(::Int) = Colon() function __init__() - @require ImageMetadata="bc367c6b-8a6b-528e-b4bd-a4b897500b49" begin + return @require ImageMetadata = "bc367c6b-8a6b-528e-b4bd-a4b897500b49" begin (pp::PreprocessSNF)(A::ImageMetadata.ImageMeta) = ImageMetadata.shareproperties(A, pp(ImageMetadata.arraydata(A))) end end diff --git a/src/deprecations.jl b/src/deprecations.jl index 3564c43..1e6ab13 100644 --- a/src/deprecations.jl +++ b/src/deprecations.jl @@ -1,5 +1,5 @@ import Base: one -@deprecate one(::Type{NumDenom{T}}) where T oneunit(NumDenom{T}) +@deprecate one(::Type{NumDenom{T}}) where {T} oneunit(NumDenom{T}) @deprecate one(p::NumDenom) oneunit(p) @deprecate ratio(mm::AbstractArray, args...) ratio.(mm, args...) diff --git a/test/runtests.jl b/test/runtests.jl index c3174d8..61c9bac 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -3,12 +3,12 @@ using CenterIndexedArrays, ImageCore, ImageMetadata, Interpolations using Test @testset "NumDenom and arrays" begin - nd = NumDenom(3.5,10) - @test ratio(nd, 5) == 3.5/10 + nd = NumDenom(3.5, 10) + @test ratio(nd, 5) == 3.5 / 10 @test isnan(ratio(nd, 20)) - @test convert(NumDenom{Float32}, nd) === NumDenom(3.5f0,10) + @test convert(NumDenom{Float32}, nd) === NumDenom(3.5f0, 10) @test convert(typeof(nd), nd) === nd - nd = NumDenom(3.5f0,10) + nd = NumDenom(3.5f0, 10) @test isa(ratio(nd, 5), Float32) @test isa(ratio(nd, 20), Float32) col = Gray(0.2) @@ -27,9 +27,9 @@ using Test mm = MismatchArray(Float16, (3, 3)) @test axes(mm) == Base.IdentityUnitRange.((-1:1, -1:1)) - numer, denom = rand(3,3), rand(3,3).+0.5 + numer, denom = rand(3, 3), rand(3, 3) .+ 0.5 mm = MismatchArray(numer, denom) - r = CenterIndexedArray(numer./denom) + r = CenterIndexedArray(numer ./ denom) @test ratio.(mm, 0.25) == r @test ratio.(r, 0.25) == r @test maxshift(mm) == (1, 1) @@ -47,33 +47,33 @@ using Test @test_throws Exception convert(Float64, NumDenom(1, 2)) # Interpolation of NumDenom arrays (and supporting or related arithmetic operations) - @test 2.0*nd === nd*2.0 === NumDenom(7.0, 20.0) # This multiplication rule is used in interpolation (also tests promotion) - @test nd/2 === NumDenom(nd.num/2, nd.denom/2) + @test 2.0 * nd === nd * 2.0 === NumDenom(7.0, 20.0) # This multiplication rule is used in interpolation (also tests promotion) + @test nd / 2 === NumDenom(nd.num / 2, nd.denom / 2) @test nd - nd === NumDenom(0.0f0, 0.0f0) a = CenterIndexedArray([NumDenom(0, 0), NumDenom(1.0, 5.0), NumDenom(2.0, 2.0)]) # promotion @test eltype(a) === NumDenom{Float64} aitp = interpolate(a, BSpline(Linear())) - @test ratio(aitp(-0.5), 1) ≈ 1/5 - @test ratio(aitp(+0.5), 1) ≈ 1.5/3.5 + @test ratio(aitp(-0.5), 1) ≈ 1 / 5 + @test ratio(aitp(+0.5), 1) ≈ 1.5 / 3.5 @test round(NumDenom{Int}, NumDenom(1.2, 4.8)) === NumDenom{Int}(1, 5) # Finding the location of the minimum - numer = [5,4,3,4.5,7].*[2,1,1.5,2,3]' - numer[1,5] = -1 # on the edge, so it shouldn't be selected - denom = ones(5,5) - mma = MismatchArray(numer,denom) - @test indmin_mismatch(mma, 0) == CartesianIndex((0,-1)) + numer = [5, 4, 3, 4.5, 7] .* [2, 1, 1.5, 2, 3]' + numer[1, 5] = -1 # on the edge, so it shouldn't be selected + denom = ones(5, 5) + mma = MismatchArray(numer, denom) + @test indmin_mismatch(mma, 0) == CartesianIndex((0, -1)) denom = reshape(float(1:25), 5, 5) - mma = MismatchArray(numer,denom) - @test indmin_mismatch(mma, 0) == CartesianIndex((0,1)) + mma = MismatchArray(numer, denom) + @test indmin_mismatch(mma, 0) == CartesianIndex((0, 1)) rat = ratio.(mma, 0.5) - @test indmin_mismatch(rat) == CartesianIndex((0,1)) + @test indmin_mismatch(rat) == CartesianIndex((0, 1)) end @testset "mismatcharrays and separate" begin - nums = [rand(3,3), rand(3,3)] - denom = ones(3,3) + nums = [rand(3, 3), rand(3, 3)] + denom = ones(3, 3) mms = mismatcharrays(nums, denom) @test mms[1] == MismatchArray(nums[1], denom) numss, denomss = separate(mms) @@ -90,33 +90,33 @@ end @testset "highpass" begin a = [1, 1, 1, 1] ahp = highpass(a, (2,)) - @test all(x->abs(x)<1e-6, ahp) + @test all(x -> abs(x) < 1.0e-6, ahp) ahp = highpass(Float64, a, (2,)) - @test all(x->abs(x)<1e-12, ahp) + @test all(x -> abs(x) < 1.0e-12, ahp) af = float.(a) ahp = highpass(af, (2,)) - @test all(x->abs(x)<1e-12, ahp) + @test all(x -> abs(x) < 1.0e-12, ahp) end @testset "PreprocessSNF" begin A = [200 100; 10 1000] - pp = PreprocessSNF(100, [0,0], [Inf,Inf]) + pp = PreprocessSNF(100, [0, 0], [Inf, Inf]) @test pp(A) ≈ [10 0; 0 30] B = fill(1000, 21, 17) - B[10:11,8:9] .+= A - pp = PreprocessSNF(100, [0,0], [3,3]) + B[10:11, 8:9] .+= A + pp = PreprocessSNF(100, [0, 0], [3, 3]) ppB = pp(B) - @test count(x->abs(x) < 1e-8, ppB) == length(B)-3 - @test count(x->abs(x) > 1, ppB[10:11,8:9]) == 3 + @test count(x -> abs(x) < 1.0e-8, ppB) == length(B) - 3 + @test count(x -> abs(x) > 1, ppB[10:11, 8:9]) == 3 - B = [1000*(isodd(i) ⊻ isodd(j)) for i = 1:21, j=1:17] - pp = PreprocessSNF(100, [2,2], [Inf,Inf]) + B = [1000 * (isodd(i) ⊻ isodd(j)) for i in 1:21, j in 1:17] + pp = PreprocessSNF(100, [2, 2], [Inf, Inf]) ppB = pp(B) - @test all(x->14 14 < x < 16, ppB) - Bmeta = ImageMeta(B, date="today") + Bmeta = ImageMeta(B, date = "today") @test isa(pp(Bmeta), ImageMeta) end @@ -125,8 +125,8 @@ end A = reshape(1:125, 5, 5, 5) S = view(A, 2:4, 1:3, 2) Spad = paddedview(S) - @test Spad == A[:,:,2] - S2 = trimmedview(A[:,:,2], S) + @test Spad == A[:, :, 2] + S2 = trimmedview(A[:, :, 2], S) @test S2 == S S = view(A, 2:4, 2, 1:3) Spad = paddedview(S) @@ -139,5 +139,5 @@ end S = view(A, :, 1:3, 2) Spad = paddedview(S) - @test Spad == A[:,:,2] + @test Spad == A[:, :, 2] end