@@ -46,6 +46,7 @@ function shear!(arr::TA, Δ, shear_dir_dim=1, shear_dim=2; fix_nyquist=false, as
4646
4747 # stores the maximum amount of shift
4848 TR = real_arr_type (TA)
49+ # shift = similar(arr, real(eltype(arr)), select_sizes(arr, shear_dir_dim))
4950 # shift = TR(reshape(fftfreq(size(arr, shear_dir_dim)), NDTools.select_sizes(arr, shear_dir_dim)))
5051 shift = TR (reorient (fftfreq (size (arr, shear_dir_dim)),shear_dir_dim, Val (N)))
5152
@@ -65,12 +66,13 @@ function shear!(arr::TA, Δ, shear_dir_dim=1, shear_dim=2; fix_nyquist=false, as
6566
6667 # stores the maximum amount of shift
6768 TR = real_arr_type (TA)
69+ # shift = similar(arr, real(eltype(arr_ft)), select_sizes(arr_ft, shear_dir_dim))
6870 # shift = TR(reshape(rfftfreq(size(arr, shear_dir_dim)), NDTools.select_sizes(arr_ft, shear_dir_dim)))
6971 shift = TR (reorient (rfftfreq (size (arr, shear_dir_dim)),shear_dir_dim, Val (N)))
7072
7173 apply_shift_strength! (arr_ft, arr, shift, shear_dir_dim, shear_dim, Δ, fix_nyquist)
7274 # go back to real space
73-
75+
7476 # overwrites arr in-place
7577 ldiv! (arr, p, arr_ft)
7678 if assign_wrap
110112
111113function apply_shift_strength! (arr:: TA , arr_orig, shift, shear_dir_dim, shear_dim, Δ, fix_nyquist= false ) where {T, N, TA<: AbstractArray{T, N} }
112114 # applies the strength to each slice
113- # shift_strength = reshape(fftpos(1, size(arr, shear_dim), CenterFT), NDTools.select_sizes(arr, shear_dim))
114- # TR = real_arr_type(typeof(collect (arr[1:1]))) # There is a problem with circshifted arrays and this way of finding the type.
115- shift_strength = reorient (fftpos (1 , size (arr, shear_dim), CenterFT), shear_dim, Val (N))
115+ # The TR trick does not seem to work for the code below due to a call with a PaddedArray.
116+ shift_strength = similar (arr, real ( eltype (arr)), select_sizes (arr, shear_dim))
117+ shift_strength . = ( real ( eltype (TA))) . ( reorient (fftpos (1 , size (arr, shear_dim), CenterFT), shear_dim, Val (N) ))
116118
117119 # do the exp multiplication in place
118120 e = cispi .(2 .* Δ .* shift .* shift_strength)
0 commit comments