Skip to content

Commit 7dd11ab

Browse files
committed
check dim in lmul_dim_begin and friends
1 parent 41cdc3c commit 7dd11ab

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/chebyshevtransform.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,15 @@ for op in (:ldiv, :lmul)
6969
@eval begin
7070
function $op_dim_begin!(α, d::Number, y::AbstractArray)
7171
# scale just the d-th dimension by permuting it to the first
72+
d 1:ndims(y) || throw(ArgumentError("dimension $d must lie between 1 and $(ndims(y))"))
7273
Rpre = CartesianIndices(axes(y)[1:d-1])
7374
Rpost = CartesianIndices(axes(y)[d+1:end])
7475
applydim!(v -> $op!(α, v), y, Rpre, Rpost, 1)
7576
end
7677

7778
function $op_dim_end!(α, d::Number, y::AbstractArray)
7879
# scale just the d-th dimension by permuting it to the first
80+
d 1:ndims(y) || throw(ArgumentError("dimension $d must lie between 1 and $(ndims(y))"))
7981
Rpre = CartesianIndices(axes(y)[1:d-1])
8082
Rpost = CartesianIndices(axes(y)[d+1:end])
8183
applydim!(v -> $op!(α, v), y, Rpre, Rpost, size(y, d))

0 commit comments

Comments
 (0)