Skip to content

Commit cd66958

Browse files
committed
increase coverage
1 parent da0950c commit cd66958

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "InfiniteLinearAlgebra"
22
uuid = "cde9dba0-b1de-11e9-2c62-0bab9446c55c"
3-
version = "0.10"
3+
version = "0.10.1"
44

55
[deps]
66
ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a"

src/InfiniteLinearAlgebra.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,15 @@ function chop(A::AbstractMatrix{T}, tol::Real=zero(real(T))) where T
114114
return A
115115
end
116116

117-
pad(c::AbstractVector{T}, ax::Union{OneTo,OneToInf}) where T = [c; Zeros{T}(length(ax)-length(c))]
117+
pad(c::AbstractVector{T}, ax::Union{OneTo,OneToInf}) where T = Vcat(c, Zeros{T}(length(ax)-length(c)))
118+
pad(c::AbstractVector{T}, n::Int) where T = Vcat(c, Zeros{T}(n-length(c)))
118119

119120
_colon2axes(::Tuple{}, bx::Tuple{}) = ()
120121
_colon2axes(ax::Tuple, bx::Tuple{Colon, Vararg{Any}}) = (first(ax), _colon2axes(tail(ax), tail(bx))...)
122+
_colon2axes(ax::Tuple, bx::Tuple{Union{Integer,Infinity}, Vararg{Any}}) = (oneto(first(bx)), _colon2axes(tail(ax), tail(bx))...)
121123
_colon2axes(ax::Tuple, bx::Tuple) = (first(bx), _colon2axes(tail(ax), tail(bx))...)
122124
pad(c, ax...) = PaddedArray(c, _colon2axes(axes(c), ax))
125+
pad(c, ax::Colon...) = c
123126

124127
pad(c::Transpose, ax, bx) = transpose(pad(parent(c), bx, ax))
125128
pad(c::Adjoint, ax, bx) = adjoint(pad(parent(c), bx, ax))

test/runtests.jl

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,14 @@ end
3838

3939
@test pad(1:3, 5) == [1:3; 0; 0]
4040
@test pad(1:3, oneto(∞)) isa Vcat
41+
@test pad(1:3, :) 1:3
4142
X = Matrix(reshape(1:6, 3, 2))
42-
P = pad(X, oneto(3), oneto(∞))
43-
@test P isa PaddedArray
43+
# TODO: replace ≈ with ==
44+
@test pad(X, oneto(3), ∞) pad(X, oneto(3), oneto(∞)) pad(X, 3, oneto(∞)) pad(X, 3, ∞) pad(X, :, ∞)
45+
@test pad(X, oneto(3), oneto(∞)) isa PaddedArray
46+
@test pad(X, :, oneto(∞)) isa PaddedArray
47+
@test pad(X, :, :) isa Matrix
48+
@test pad(X, oneto(10), :) isa PaddedArray
4449
P = pad(BlockVec(X), blockedrange(Fill(3,∞)))
4550
@test P isa BlockVec
4651
@test MemoryLayout(P) isa PaddedColumns

0 commit comments

Comments
 (0)