@@ -8,7 +8,7 @@ import Base: *, +, -, /, \, ^, AbstractArray, AbstractMatrix, AbstractVector, Ar
8
8
axes, copy, copymutable, copyto!, getindex, getproperty, inv,
9
9
length, map, oneto, promote_op, require_one_based_indexing, show,
10
10
similar, size, transpose, adjoint, copymutable, transpose,
11
- adjoint, copymutable, transpose
11
+ adjoint, copymutable, transpose, tail
12
12
13
13
import Base. Broadcast: BroadcastStyle, Broadcasted, broadcasted
14
14
@@ -114,8 +114,15 @@ function chop(A::AbstractMatrix{T}, tol::Real=zero(real(T))) where T
114
114
return A
115
115
end
116
116
117
- pad (c:: AbstractVector{T} , ax:: Union{OneTo,OneToInf} ) where T = [c; Zeros {T} (length (ax)- length (c))]
118
- pad (c, ax... ) = PaddedArray (c, ax)
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)))
119
+
120
+ _colon2axes (:: Tuple{} , bx:: Tuple{} ) = ()
121
+ _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))... )
123
+ _colon2axes (ax:: Tuple , bx:: Tuple ) = (first (bx), _colon2axes (tail (ax), tail (bx))... )
124
+ pad (c, ax... ) = PaddedArray (c, _colon2axes (axes (c), ax))
125
+ pad (c, ax:: Colon... ) = c
119
126
120
127
pad (c:: Transpose , ax, bx) = transpose (pad (parent (c), bx, ax))
121
128
pad (c:: Adjoint , ax, bx) = adjoint (pad (parent (c), bx, ax))
0 commit comments