Skip to content

Commit 4e67b20

Browse files
authored
remove unbound type parameters (#221)
I didn't check, but unbound type parameters often cause performance issues, so this may not be merely cosmetic.
1 parent a4f2a6a commit 4e67b20

File tree

7 files changed

+9
-9
lines changed

7 files changed

+9
-9
lines changed

src/abstractblockarray.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ end
114114

115115
blockcheckbounds(A::AbstractArray{T, N}, i::Block{N}) where {T,N} = blockcheckbounds(A, i.n...)
116116
blockcheckbounds(A::AbstractArray{T, N}, i::Vararg{Block{1},N}) where {T,N} = blockcheckbounds(A, Int.(i)...)
117-
blockcheckbounds(A::AbstractVector{T}, i::Block{1}) where {T,N} = blockcheckbounds(A, Int(i))
117+
blockcheckbounds(A::AbstractVector{T}, i::Block{1}) where {T} = blockcheckbounds(A, Int(i))
118118

119119
@propagate_inbounds Base.setindex!(block_arr::AbstractBlockArray{T,N}, v, block::Block{N}) where {T,N} =
120120
setindex!(block_arr, v, Block.(block.n)...)

src/blockarray.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@ end
7171
_BlockArray(blocks, map(blockedrange, block_sizes))
7272

7373
# support non-concrete eltypes in blocks
74-
_BlockArray(blocks::R, block_axes::BS) where {T, N, R<:AbstractArray{<:AbstractArray{V,N} where V,N}, BS<:NTuple{N,AbstractUnitRange{Int}}} =
74+
_BlockArray(blocks::R, block_axes::BS) where {N, R<:AbstractArray{<:AbstractArray{V,N} where V,N}, BS<:NTuple{N,AbstractUnitRange{Int}}} =
7575
_BlockArray(convert(AbstractArray{AbstractArray{mapreduce(eltype,promote_type,blocks),N},N}, blocks), block_axes)
76-
_BlockArray(blocks::R, block_sizes::Vararg{AbstractVector{<:Integer}, N}) where {T, N, R<:AbstractArray{<:AbstractArray{V,N} where V,N}} =
76+
_BlockArray(blocks::R, block_sizes::Vararg{AbstractVector{<:Integer}, N}) where {N, R<:AbstractArray{<:AbstractArray{V,N} where V,N}} =
7777
_BlockArray(convert(AbstractArray{AbstractArray{mapreduce(eltype,promote_type,blocks),N},N}, blocks), block_sizes...)
7878

7979
const BlockMatrix{T, R <: AbstractMatrix{<:AbstractMatrix{T}}} = BlockArray{T, 2, R}

src/blockbroadcast.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ end
144144
@inline _bview(arg, ::Vararg) = arg
145145
@inline _bview(A::AbstractArray, I...) = view(A, I...)
146146

147-
@inline function Base.Broadcast.materialize!(dest, bc::Broadcasted{BS}) where {Style,BS<:AbstractBlockStyle}
147+
@inline function Base.Broadcast.materialize!(dest, bc::Broadcasted{BS}) where {BS<:AbstractBlockStyle}
148148
return copyto!(dest, Base.Broadcast.instantiate(Base.Broadcast.Broadcasted{BS}(bc.f, bc.args, combine_blockaxes.(axes(dest),axes(bc)))))
149149
end
150150

src/blockindices.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ end
2626
Block{N, T}(n::Tuple{Vararg{Any, N}}) where {N,T} = Block{N, T}(convert(NTuple{N,T}, n))
2727
Block{N, T}(n::Vararg{Any, N}) where {N,T} = Block{N, T}(n)
2828
Block{N}(n::Vararg{T, N}) where {N,T} = Block{N, T}(n)
29-
Block{1, T}(n::Tuple{Any}) where {N,T} = Block{1, T}(convert(Tuple{T}, n))
29+
Block{1, T}(n::Tuple{Any}) where {T} = Block{1, T}(convert(Tuple{T}, n))
3030
Block{0}() = Block{0,Int}()
3131
Block() = Block{0}()
3232
Block(n::Vararg{T, N}) where {N,T} = Block{N, T}(n)

src/blocklinalg.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ end
4444

4545

4646

47-
similar(M::MulAdd{<:AbstractBlockLayout,<:AbstractBlockLayout}, ::Type{T}, axes) where {T,N} =
47+
similar(M::MulAdd{<:AbstractBlockLayout,<:AbstractBlockLayout}, ::Type{T}, axes) where {T} =
4848
similar(BlockArray{T}, axes)
4949

5050
@inline MemoryLayout(::Type{<:PseudoBlockArray{T,N,R}}) where {T,N,R} = MemoryLayout(R)
@@ -63,7 +63,7 @@ sublayout(BL::BlockLayout{MLAY,BLAY}, ::Type{<:Tuple{Sl,<:BlockSlice{BlockRange{
6363
BlockLayout{typeof(sublayout(MLAY(),Tuple{Sl,II})), BLAY}()
6464
sublayout(BL::BlockLayout{MLAY,BLAY}, ::Type{<:Tuple{<:BlockSlice{BlockRange{1,Tuple{II}}},Sl}}) where {MLAY,BLAY,Sl<:Slice,II} =
6565
BlockLayout{typeof(sublayout(MLAY(),Tuple{II,Sl})), BLAY}()
66-
sublayout(BL::BlockLayout{MLAY,BLAY}, ::Type{<:Tuple{Sl1,Sl2}}) where {MLAY,BLAY,Sl1<:Slice,Sl2<:Slice,II} =
66+
sublayout(BL::BlockLayout{MLAY,BLAY}, ::Type{<:Tuple{Sl1,Sl2}}) where {MLAY,BLAY,Sl1<:Slice,Sl2<:Slice} =
6767
BlockLayout{typeof(sublayout(MLAY(),Tuple{Sl1,Sl2})), BLAY}()
6868

6969
# materialize views, used for `getindex`

src/pseudo_blockarray.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ end
243243
_pseudo_reshape(block_array, axes) = PseudoBlockArray(reshape(block_array.blocks,map(length,axes)),axes)
244244
Base.reshape(block_array::PseudoBlockArray, axes::NTuple{N,AbstractUnitRange{Int}}) where N =
245245
_pseudo_reshape(block_array, axes)
246-
Base.reshape(parent::PseudoBlockArray, shp::Tuple{Union{Integer,Base.OneTo}, Vararg{Union{Integer,Base.OneTo}}}) where N =
246+
Base.reshape(parent::PseudoBlockArray, shp::Tuple{Union{Integer,Base.OneTo}, Vararg{Union{Integer,Base.OneTo}}}) =
247247
reshape(parent, Base.to_shape(shp))
248248
Base.reshape(parent::PseudoBlockArray, dims::Tuple{Int,Vararg{Int}}) =
249249
Base._reshape(parent, dims)

src/views.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ to_index(::BlockRange) = throw(ArgumentError("BlockRange must be converted by to
2323
(unblock(A, inds, I), to_indices(A, _maybetail(inds), tail(I))...)
2424
@inline to_indices(A, inds, I::Tuple{BlockRange{1,R}, Vararg{Any}}) where R =
2525
(unblock(A, inds, I), to_indices(A, _maybetail(inds), tail(I))...)
26-
@inline to_indices(A, inds, I::Tuple{BlockIndex{1}, Vararg{Any}}) where R =
26+
@inline to_indices(A, inds, I::Tuple{BlockIndex{1}, Vararg{Any}}) =
2727
(inds[1][I[1]], to_indices(A, _maybetail(inds), tail(I))...)
2828
@inline to_indices(A, inds, I::Tuple{BlockIndexRange{1,R}, Vararg{Any}}) where R =
2929
(unblock(A, inds, I), to_indices(A, _maybetail(inds), tail(I))...)

0 commit comments

Comments
 (0)