What is the fastest method to shift matrix?

try if this is faster

Spshiftl(A,1) .+ B == hcat(A[:,2:end] .+ B[:1,1:end-1], B[:,end])
1 Like

Thanks for your explanation. It is clear now.
Actually, the case is A .= spshiftl(A,1).+B

try if this is faster

Spshiftl(A,1) .+ B = hcat(A[:,2:end] .+ B[:1,1:end-1], B[:,end])

I tried but Spshiftl(A,1) is faster than hcat(A[:,2:end] .+ B[:,1:end-1], B[:,end])