Skip to content

Commit 454011b

Browse files
committed
minor improvements
1 parent ddb518a commit 454011b

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/blockmap.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ BlockMap{T}(maps::As, rows::Rs) where {T, As<:LinearMapTuple, Rs} =
2525
MulStyle(A::BlockMap) = MulStyle(A.maps...)
2626

2727
@inline function _getranges(maps, dim, inds::NTuple{N,Int}=ntuple(identity, Val(length(maps)))) where {N}
28-
sizes = ntuple(i -> (@inbounds size(maps[inds[i]], dim)), Val(length(inds)))
28+
sizes = ntuple(i -> (@inbounds size(maps[inds[i]], dim)), Val(N))
2929
ends = cumsum(sizes)
3030
starts = (1, (1 .+ Base.front(ends))...)
3131
return UnitRange.(starts, ends)
@@ -49,9 +49,9 @@ function rowcolranges(maps, rows)
4949
# introduce "line breaks"
5050
colranges = ntuple(Val(length(maps))) do i
5151
# for each map find the index of the respective row-wise first map
52-
firstmapind = firstmapinds[something(findlast(<=(i), firstmapinds), 1)]
52+
@inbounds firstmapind = firstmapinds[something(findlast(<=(i), firstmapinds), 1)]
5353
# shift ranges by the first col-index of the row-wise first map
54-
return temp[i] .- first(temp[firstmapind]) .+ 1
54+
return @inbounds temp[i] .- first(temp[firstmapind]) .+ 1
5555
end
5656
return rowranges, colranges
5757
end
@@ -88,7 +88,7 @@ function Base.hcat(As::Union{LinearMap, UniformScaling, AbstractVecOrMat}...)
8888
j = findfirst(x -> !isa(x, UniformScaling), As)
8989
# this should not happen, function should only be called with at least one LinearMap
9090
@assert !isnothing(j)
91-
nrows = size(As[j], 1)
91+
@inbounds nrows = size(As[j], 1)
9292

9393
return BlockMap{T}(promote_to_lmaps(ntuple(_ -> nrows, Val(nbc)), 1, 1, As...), (nbc,))
9494
end
@@ -126,9 +126,9 @@ function Base.vcat(As::Union{LinearMap,UniformScaling,AbstractVecOrMat}...)
126126
j = findfirst(x -> !isa(x, UniformScaling), As)
127127
# this should not happen, function should only be called with at least one LinearMap
128128
@assert !isnothing(j)
129-
ncols = size(As[j], 2)
129+
@inbounds ncols = size(As[j], 2)
130130

131-
rows = ntuple(i->1, Val(nbr))
131+
rows = ntuple(_ -> 1, Val(nbr))
132132
return BlockMap{T}(promote_to_lmaps(ntuple(_ -> ncols, Val(nbr)), 1, 2, As...), rows)
133133
end
134134

0 commit comments

Comments
 (0)