diff --git a/ext/LinearOperatorFFTWExt/DCTOp.jl b/ext/LinearOperatorFFTWExt/DCTOp.jl index c415ddc..f8bf727 100644 --- a/ext/LinearOperatorFFTWExt/DCTOp.jl +++ b/ext/LinearOperatorFFTWExt/DCTOp.jl @@ -32,9 +32,9 @@ returns a `DCTOpImpl <: AbstractLinearOperator` which performs a DCT on a given * `shape::Tuple` - size of the array to transform * `dcttype` - type of DCT (currently `2` and `4` are supported) """ -function LinearOperatorCollection.DCTOp(T::Type; shape::Tuple, dcttype=2) +function LinearOperatorCollection.DCTOp(T::Type; shape::Tuple, S = Array{T}, dcttype=2) - tmp=Array{T}(undef, shape) + tmp=similar(S(undef, 0), shape...) if dcttype == 2 plan = plan_dct!(tmp) iplan = plan_idct!(tmp) diff --git a/ext/LinearOperatorFFTWExt/DSTOp.jl b/ext/LinearOperatorFFTWExt/DSTOp.jl index f9c1955..b4b108e 100644 --- a/ext/LinearOperatorFFTWExt/DSTOp.jl +++ b/ext/LinearOperatorFFTWExt/DSTOp.jl @@ -31,8 +31,8 @@ returns a `LinearOperator` which performs a DST on a given input array. * `T::Type` - type of the array to transform * `shape::Tuple` - size of the array to transform """ -function LinearOperatorCollection.DSTOp(T::Type; shape::Tuple) - tmp=Array{T}(undef, shape) +function LinearOperatorCollection.DSTOp(T::Type; shape::Tuple, S = Array{T}) + tmp=similar(S(undef, 0), shape...) plan = FFTW.plan_r2r!(tmp,FFTW.RODFT10) iplan = FFTW.plan_r2r!(tmp,FFTW.RODFT01)