From bcc52c459e12c498a57966a21db1cbf33ade7b5f Mon Sep 17 00:00:00 2001 From: Niklas Hackelberg Date: Wed, 11 Feb 2026 09:33:59 +0100 Subject: [PATCH] Add S keyword to DCT and DST operators (currently don't seem to be supported by CUDA) --- ext/LinearOperatorFFTWExt/DCTOp.jl | 4 ++-- ext/LinearOperatorFFTWExt/DSTOp.jl | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) 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)