Skip to content

Commit 85d5e63

Browse files
committed
Fix pad with colon
1 parent 2414cbf commit 85d5e63

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ FillArrays = "1.0"
2626
InfiniteArrays = "0.15"
2727
InfiniteRandomArrays = "0.2"
2828
Infinities = "0.1"
29-
LazyArrays = "2.6"
29+
LazyArrays = "2.7"
3030
LazyBandedMatrices = "0.11"
3131
LinearAlgebra = "1"
3232
MatrixFactorizations = "3.0"

src/InfiniteLinearAlgebra.jl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import Base: *, +, -, /, \, ^, AbstractArray, AbstractMatrix, AbstractVector, Ar
88
axes, copy, copymutable, copyto!, getindex, getproperty, inv,
99
length, map, oneto, promote_op, require_one_based_indexing, show,
1010
similar, size, transpose, adjoint, copymutable, transpose,
11-
adjoint, copymutable, transpose
11+
adjoint, copymutable, transpose, tail
1212

1313
import Base.Broadcast: BroadcastStyle, Broadcasted, broadcasted
1414

@@ -115,7 +115,11 @@ function chop(A::AbstractMatrix{T}, tol::Real=zero(real(T))) where T
115115
end
116116

117117
pad(c::AbstractVector{T}, ax::Union{OneTo,OneToInf}) where T = [c; Zeros{T}(length(ax)-length(c))]
118-
pad(c, ax...) = PaddedArray(c, ax)
118+
119+
_colon2axes(::Tuple{}, bx::Tuple{}) = ()
120+
_colon2axes(ax::Tuple, bx::Tuple{Colon, Vararg{Any}}) = (first(ax), _colon2axes(tail(ax), tail(bx))...)
121+
_colon2axes(ax::Tuple, bx::Tuple) = (first(bx), _colon2axes(tail(ax), tail(bx))...)
122+
pad(c, ax...) = PaddedArray(c, _colon2axes(axes(c), ax))
119123

120124
pad(c::Transpose, ax, bx) = transpose(pad(parent(c), bx, ax))
121125
pad(c::Adjoint, ax, bx) = adjoint(pad(parent(c), bx, ax))

0 commit comments

Comments
 (0)