diff --git a/Project.toml b/Project.toml index 5cbf975..3a051a8 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "LinearOperatorCollection" uuid = "a4a2c56f-fead-462a-a3ab-85921a5f2575" authors = ["Tobias Knopp and contributors"] -version = "2.3.2" +version = "2.4" [deps] LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" @@ -31,7 +31,7 @@ KernelAbstractions = "0.9" JLArrays = "0.2" AbstractNFFTs = "0.9" LinearAlgebra = "1" -LinearOperators = "2" +LinearOperators = "2.13" OhMyThreads = "0.8" NonuniformFFTs = "0.9" NFFT = "0.14" @@ -54,7 +54,7 @@ FFTW = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341" RadonKA = "86de8297-835b-47df-b249-c04e8db91db5" [targets] -test = ["Test", "Aqua", "FFTW", "Wavelets", "NFFT", "NonuniformFFTs", "JLArrays", "RadonKA"] +test = ["Test", "Aqua", "FFTW", "Wavelets", "NFFT", "NonuniformFFTs", "RadonKA"] [extensions] LinearOperatorNFFTExt = ["AbstractNFFTs", "FFTW"] diff --git a/ext/LinearOperatorFFTWExt/DCTOp.jl b/ext/LinearOperatorFFTWExt/DCTOp.jl index f8bf727..7f2e321 100644 --- a/ext/LinearOperatorFFTWExt/DCTOp.jl +++ b/ext/LinearOperatorFFTWExt/DCTOp.jl @@ -1,26 +1,23 @@ export DCTOpImpl -mutable struct DCTOpImpl{T} <: DCTOp{T} - nrow :: Int - ncol :: Int - symmetric :: Bool - hermitian :: Bool - prod! :: Function - tprod! :: Nothing - ctprod! :: Function +mutable struct DCTOpImpl{T, vecT, P} <: DCTOp{T} + const nrow :: Int + const ncol :: Int + const symmetric :: Bool + const hermitian :: Bool + const prod! :: Function + const tprod! :: Nothing + const ctprod! :: Function nprod :: Int ntprod :: Int nctprod :: Int - args5 :: Bool - use_prod5! :: Bool - allocated5 :: Bool - Mv5 :: Vector{T} - Mtu5 :: Vector{T} - plan - dcttype::Int + Mv :: vecT + Mtu :: vecT + const plan :: P + const dcttype::Int end -LinearOperators.storage_type(op::DCTOpImpl) = typeof(op.Mv5) +LinearOperators.storage_type(::DCTOpImpl{T, vecT}) where {T,vecT} = vecT """ DCTOpImpl(T::Type, shape::Tuple, dcttype=2) @@ -50,9 +47,9 @@ function LinearOperatorCollection.DCTOp(T::Type; shape::Tuple, S = Array{T}, dct error("DCT type $(dcttype) not supported") end - return DCTOpImpl{T}(prod(shape), prod(shape), false, false, + return DCTOpImpl{T, S, typeof(plan)}(prod(shape), prod(shape), false, false, prod!, nothing, tprod!, - 0, 0, 0, true, false, true, T[], T[], + 0, 0, 0, S(undef, 0), S(undef, 0), plan, dcttype) end diff --git a/ext/LinearOperatorFFTWExt/DSTOp.jl b/ext/LinearOperatorFFTWExt/DSTOp.jl index b4b108e..14fb431 100644 --- a/ext/LinearOperatorFFTWExt/DSTOp.jl +++ b/ext/LinearOperatorFFTWExt/DSTOp.jl @@ -1,26 +1,23 @@ export DSTOpImpl -mutable struct DSTOpImpl{T} <: DSTOp{T} - nrow :: Int - ncol :: Int - symmetric :: Bool - hermitian :: Bool - prod! :: Function - tprod! :: Nothing - ctprod! :: Function +mutable struct DSTOpImpl{T, vecT, P, IP} <: DSTOp{T} + const nrow :: Int + const ncol :: Int + const symmetric :: Bool + const hermitian :: Bool + const prod! :: Function + const tprod! :: Nothing + const ctprod! :: Function nprod :: Int ntprod :: Int nctprod :: Int - args5 :: Bool - use_prod5! :: Bool - allocated5 :: Bool - Mv5 :: Vector{T} - Mtu5 :: Vector{T} - plan - iplan + Mv :: vecT + Mtu :: vecT + const plan :: P + const iplan :: IP end -LinearOperators.storage_type(op::DSTOpImpl) = typeof(op.Mv5) +LinearOperators.storage_type(::DSTOpImpl{T, vecT}) where {T, vecT} = vecT """ DSTOp(T::Type, shape::Tuple) @@ -39,11 +36,11 @@ function LinearOperatorCollection.DSTOp(T::Type; shape::Tuple, S = Array{T}) w = weights(shape, T) - return DSTOpImpl{T}(prod(shape), prod(shape), true, false + return DSTOpImpl{T, S, typeof(plan), typeof(iplan)}(prod(shape), prod(shape), true, false , (res,x) -> dst_multiply!(res,plan,x,tmp,w) , nothing , (res,x) -> dst_bmultiply!(res,iplan,x,tmp,w) - , 0, 0, 0, true, false, true, T[], T[] + , 0, 0, 0, S(undef,0), S(undef, 0) , plan , iplan) end diff --git a/ext/LinearOperatorFFTWExt/FFTOp.jl b/ext/LinearOperatorFFTWExt/FFTOp.jl index c858351..96946fc 100644 --- a/ext/LinearOperatorFFTWExt/FFTOp.jl +++ b/ext/LinearOperatorFFTWExt/FFTOp.jl @@ -1,28 +1,25 @@ export FFTOpImpl mutable struct FFTOpImpl{T, vecT, P <: AbstractFFTs.Plan{T}, IP <: AbstractFFTs.Plan{T}} <: FFTOp{T} - nrow :: Int - ncol :: Int - symmetric :: Bool - hermitian :: Bool - prod! :: Function - tprod! :: Nothing - ctprod! :: Function + const nrow :: Int + const ncol :: Int + const symmetric :: Bool + const hermitian :: Bool + const prod! :: Function + const tprod! :: Nothing + const ctprod! :: Function nprod :: Int ntprod :: Int nctprod :: Int - args5 :: Bool - use_prod5! :: Bool - allocated5 :: Bool - Mv5 :: vecT - Mtu5 :: vecT - plan :: P - iplan :: IP - shift::Bool - unitary::Bool + Mv :: vecT + Mtu :: vecT + const plan :: P + const iplan :: IP + const shift::Bool + const unitary::Bool end -LinearOperators.storage_type(op::FFTOpImpl) = typeof(op.Mv5) +LinearOperators.storage_type(::FFTOpImpl{T, vecT}) where {T,vecT} = vecT """ FFTOp(T::Type; shape::Tuple, shift=true, unitary=true) @@ -60,7 +57,7 @@ function LinearOperatorCollection.FFTOp(T::Type; shape::NTuple{D,Int64}, shift:: return FFTOpImpl(prod(shape), prod(shape), false, false, (res, x) -> fun!(res, plan_, x, shape_, facF_, tmpVec_), nothing, (res, x) -> fun!(res, iplan_, x, shape_, facB_, tmpVec_), - 0, 0, 0, true, false, true, similar(tmpVec, 0), similar(tmpVec, 0), plan, iplan, shift, unitary) + 0, 0, 0, similar(tmpVec, 0), similar(tmpVec, 0), plan, iplan, shift, unitary) end end diff --git a/ext/LinearOperatorNFFTExt/NFFTOp.jl b/ext/LinearOperatorNFFTExt/NFFTOp.jl index 6c26cfa..e382b8e 100644 --- a/ext/LinearOperatorNFFTExt/NFFTOp.jl +++ b/ext/LinearOperatorNFFTExt/NFFTOp.jl @@ -20,26 +20,23 @@ function LinearOperatorCollection.NFFTOp(::Type{T}; end mutable struct NFFTOpImpl{T, vecT, P} <: NFFTOp{T, P} - nrow :: Int - ncol :: Int - symmetric :: Bool - hermitian :: Bool - prod! :: Function - tprod! :: Nothing - ctprod! :: Function + const nrow :: Int + const ncol :: Int + const symmetric :: Bool + const hermitian :: Bool + const prod! :: Function + const tprod! :: Nothing + const ctprod! :: Function nprod :: Int ntprod :: Int nctprod :: Int - args5 :: Bool - use_prod5! :: Bool - allocated5 :: Bool - Mv5 :: vecT - Mtu5 :: vecT - plan :: P + Mv :: vecT + Mtu :: vecT + const plan :: P toeplitz :: Bool end -LinearOperators.storage_type(op::NFFTOpImpl) = typeof(op.Mv5) +LinearOperators.storage_type(::NFFTOpImpl{T, vecT}) where {T, vecT} = vecT function NFFTOpImpl(shape::Tuple, tr::AbstractMatrix{T}; toeplitz, oversamplingFactor, kernelSize, S = Vector{Complex{T}}, kargs...) where {T} @@ -51,7 +48,7 @@ function NFFTOpImpl(shape::Tuple, tr::AbstractMatrix{T}; toeplitz, oversamplingF , (res,x) -> produ!(res,plan,x) , nothing , (res,y) -> ctprodu!(res,plan,y) - , 0, 0, 0, false, false, false, S(undef, 0), S(undef, 0) + , 0, 0, 0, S(undef, 0), S(undef, 0) , plan, toeplitz) end @@ -70,7 +67,7 @@ function Base.copy(S::NFFTOpImpl{T, vecT, P}) where {T, vecT, P} , (res,x) -> produ!(res,plan,x) , nothing , (res,y) -> ctprodu!(res,plan,y) - , 0, 0, 0, false, false, false, vecT(undef, 0), vecT(undef, 0) + , 0, 0, 0, vecT(undef, 0), vecT(undef, 0) , plan, S.toeplitz) end @@ -80,22 +77,19 @@ end ### Toeplitz Operator ### ######################################################################### -mutable struct NFFTToeplitzNormalOp{T,D,W, vecT <: AbstractVector{T}, matT <: AbstractArray{T, D}, P <: AbstractFFTs.Plan, IP <: AbstractFFTs.Plan} <: AbstractLinearOperator{T} - nrow :: Int - ncol :: Int - symmetric :: Bool - hermitian :: Bool - prod! :: Function - tprod! :: Nothing - ctprod! :: Nothing +mutable struct NFFTToeplitzNormalOp{T, vecT <: AbstractVector{T}, D,W, matT <: AbstractArray{T, D}, P <: AbstractFFTs.Plan, IP <: AbstractFFTs.Plan} <: AbstractLinearOperator{T} + const nrow :: Int + const ncol :: Int + const symmetric :: Bool + const hermitian :: Bool + const prod! :: Function + const tprod! :: Nothing + const ctprod! :: Nothing nprod :: Int ntprod :: Int nctprod :: Int - args5 :: Bool - use_prod5! :: Bool - allocated5 :: Bool - Mv5 :: vecT - Mtu5 :: vecT + Mv :: vecT + Mtu :: vecT shape::NTuple{D,Int} weights::W fftplan :: P @@ -105,7 +99,7 @@ mutable struct NFFTToeplitzNormalOp{T,D,W, vecT <: AbstractVector{T}, matT <: Ab xL2::matT end -LinearOperators.storage_type(op::NFFTToeplitzNormalOp) = typeof(op.Mv5) +LinearOperators.storage_type(::NFFTToeplitzNormalOp{T, vecT}) where {T, vecT} = vecT function LinearOperatorCollection.NFFTToeplitzNormalOp(shape, W, fftplan, ifftplan, λ, xL1::matT, xL2::matT) where {T, D, matT <: AbstractArray{T, D}} @@ -126,14 +120,15 @@ function LinearOperatorCollection.NFFTToeplitzNormalOp(shape, W, fftplan, ifftpl , (res,x) -> produ!(res, shape, fftplan, ifftplan, λ, xL1, xL2, x) , nothing , nothing - , 0, 0, 0, false, false, false, T[], T[] + , 0, 0, 0, T[], T[] , shape, W, fftplan, ifftplan, λ, xL1, xL2) end +# TODO: use vecT for toeplitz op function LinearOperatorCollection.NFFTToeplitzNormalOp(nfft::NFFTOp{T}, W=nothing; kwargs...) where {T} shape = size_in(nfft.plan) - tmpVec = similar(nfft.Mv5, (2 .* shape)...) + tmpVec = similar(nfft.Mv, (2 .* shape)...) tmpVec .= zero(T) # plan the FFTs @@ -172,7 +167,7 @@ function LinearOperatorCollection.normalOperator(S::NFFTOpImpl{T}, W = nothing; end end -function Base.copy(A::NFFTToeplitzNormalOp{T,D,W}) where {T,D,W} +function Base.copy(A::NFFTToeplitzNormalOp{T,vecT,D,W}) where {T,vecT,D,W} fftplan = plan_fft( zeros(T, 2 .* A.shape); flags=FFTW.MEASURE) ifftplan = plan_ifft(zeros(T, 2 .* A.shape); flags=FFTW.MEASURE) return LinearOperatorCollection.NFFTToeplitzNormalOp(A.shape, A.weights, fftplan, ifftplan, A.λ, copy(A.xL1), copy(A.xL2)) diff --git a/ext/LinearOperatorNonuniformFFTsExt/LinearOperatorNonuniformFFTsExt.jl b/ext/LinearOperatorNonuniformFFTsExt/LinearOperatorNonuniformFFTsExt.jl index ba3fd9b..b5f491e 100644 --- a/ext/LinearOperatorNonuniformFFTsExt/LinearOperatorNonuniformFFTsExt.jl +++ b/ext/LinearOperatorNonuniformFFTsExt/LinearOperatorNonuniformFFTsExt.jl @@ -2,10 +2,10 @@ module LinearOperatorNonuniformFFTsExt using LinearOperatorCollection, AbstractNFFTs, NonuniformFFTs, NonuniformFFTs.Kernels, FFTW -function LinearOperatorCollection.NFFTToeplitzNormalOp(nfft::NFFTOp{T, P}, W=nothing; kwargs...) where {T, vecT, P <: NonuniformFFTs.NFFTPlan} +function LinearOperatorCollection.NFFTToeplitzNormalOp(nfft::NFFTOp{T, P}, W=nothing; kwargs...) where {T, P <: NonuniformFFTs.NFFTPlan} shape = size_in(nfft.plan) - tmpVec = similar(nfft.Mv5, (2 .* shape)...) + tmpVec = similar(nfft.Mv, (2 .* shape)...) tmpVec .= zero(T) # plan the FFTs diff --git a/ext/LinearOperatorRadonKAExt/RadonOp.jl b/ext/LinearOperatorRadonKAExt/RadonOp.jl index 954a201..5bd69ff 100644 --- a/ext/LinearOperatorRadonKAExt/RadonOp.jl +++ b/ext/LinearOperatorRadonKAExt/RadonOp.jl @@ -17,27 +17,24 @@ function LinearOperatorCollection.RadonOp(::Type{T}; shape::NTuple{N, Int}, angl end mutable struct RadonOpImpl{T, vecT <: AbstractVector{T}, vecT2, G, A} <: RadonOp{T} - nrow :: Int - ncol :: Int - symmetric :: Bool - hermitian :: Bool - prod! :: Function - tprod! :: Nothing - ctprod! :: Function + const nrow :: Int + const ncol :: Int + const symmetric :: Bool + const hermitian :: Bool + const prod! :: Function + const tprod! :: Nothing + const ctprod! :: Function nprod :: Int ntprod :: Int nctprod :: Int - args5 :: Bool - use_prod5! :: Bool - allocated5 :: Bool - Mv5 :: vecT - Mtu5 :: vecT - angles :: vecT2 - geometry :: G - μ :: A + Mv :: vecT + Mtu :: vecT + const angles :: vecT2 + const geometry :: G + const μ :: A end -LinearOperators.storage_type(op::RadonOpImpl) = typeof(op.Mv5) +LinearOperators.storage_type(::RadonOpImpl{T, vecT}) where {T, vecT} = vecT function RadonOpImpl(T::Type; shape::NTuple{N, Int64}, angles, geometry, μ, S) where N N_sinogram = length(geometry.in_height) @@ -49,7 +46,7 @@ function RadonOpImpl(T::Type; shape::NTuple{N, Int64}, angles, geometry, μ, S) (res, x) -> prod_radon!(res, x, shape, angles, geometry, μ), nothing, (res, x) -> ctprod_radon!(res, x, (N_sinogram, N_angles, d), angles, geometry, μ), - 0, 0, 0, true, false, true, S(undef, 0), S(undef, 0), angles, geometry, μ) + 0, 0, 0, S(undef, 0), S(undef, 0), angles, geometry, μ) end prod_radon!(res::vecT, x::vecT, shape, angles::vecT2, geometry::G, μ::A) where {vecT, vecT2, G, A} = copyto!(res, radon(reshape(x, shape), angles; geometry, μ)) diff --git a/src/DiagOp.jl b/src/DiagOp.jl index 4465f9b..48cac43 100644 --- a/src/DiagOp.jl +++ b/src/DiagOp.jl @@ -1,30 +1,27 @@ export DiagOp mutable struct DiagOp{T, vecT, vecO, S} <: AbstractLinearOperator{T} - nrow :: Int - ncol :: Int - symmetric :: Bool - hermitian :: Bool - prod! :: Function - tprod! :: Function - ctprod! :: Function + const nrow :: Int + const ncol :: Int + const symmetric :: Bool + const hermitian :: Bool + const prod! :: Function + const tprod! :: Function + const ctprod! :: Function nprod :: Int ntprod :: Int nctprod :: Int - args5 :: Bool - use_prod5! :: Bool - allocated5 :: Bool - Mv5 :: vecT - Mtu5 :: vecT - ops :: vecO + Mv :: vecT + Mtu :: vecT + const ops :: vecO equalOps :: Bool - xIdx :: Vector{Int64} - yIdx :: Vector{Int64} - scheduler::S + const xIdx :: Vector{Int64} + const yIdx :: Vector{Int64} + const scheduler::S end -LinearOperators.storage_type(op::DiagOp) = typeof(op.Mv5) +LinearOperators.storage_type(::DiagOp{T, vecT}) where {T, vecT} = vecT @@ -54,7 +51,7 @@ function DiagOp(ops; scheduler = DynamicScheduler()) (res,x) -> (diagOpProd(res,x,nrow,xIdx,yIdx,ops,scheduler)), (res,y) -> (diagOpTProd(res,y,ncol,yIdx,xIdx,ops,scheduler)), (res,y) -> (diagOpCTProd(res,y,ncol,yIdx,xIdx,ops,scheduler)), - 0, 0, 0, false, false, false, S(undef, 0), S(undef, 0), + 0, 0, 0, S(undef, 0), S(undef, 0), ops, false, xIdx, yIdx, scheduler) return Op @@ -95,28 +92,25 @@ end ### Normal Matrix Code ### mutable struct DiagNormalOp{T,vecT,V,S} <: AbstractLinearOperator{T} - nrow :: Int - ncol :: Int - symmetric :: Bool - hermitian :: Bool - prod! :: Function - tprod! :: Nothing - ctprod! :: Nothing + const nrow :: Int + const ncol :: Int + const symmetric :: Bool + const hermitian :: Bool + const prod! :: Function + const tprod! :: Nothing + const ctprod! :: Nothing nprod :: Int ntprod :: Int nctprod :: Int - args5 :: Bool - use_prod5! :: Bool - allocated5 :: Bool - Mv5 :: vecT - Mtu5 :: vecT + Mv :: vecT + Mtu :: vecT normalOps::V idx::Vector{Int64} y::vecT scheduler::S end -LinearOperators.storage_type(op::DiagNormalOp) = typeof(op.Mv5) +LinearOperators.storage_type(::DiagNormalOp{T, vecT}) where {T, vecT} = vecT function DiagNormalOp(normalOps, N, idx, y::AbstractVector{T}, scheduler = DynamicScheduler()) where {T} @@ -129,7 +123,7 @@ function DiagNormalOp(normalOps, N, idx, y::AbstractVector{T}, scheduler = Dynam , (res,x) -> diagNormOpProd!(res, normalOps, idx, x, scheduler) , nothing , nothing - , 0, 0, 0, false, false, false, S(undef, 0), S(undef, 0) + , 0, 0, 0, S(undef, 0), S(undef, 0) , normalOps, idx, y, scheduler) end diff --git a/src/NormalOp.jl b/src/NormalOp.jl index 3cc39ca..f6a2a38 100644 --- a/src/NormalOp.jl +++ b/src/NormalOp.jl @@ -24,28 +24,25 @@ NormalOp(::Union{Type{T}, Type{Complex{T}}}, parent, weights::AbstractVector{T}) NormalOp(::Union{Type{T}, Type{Complex{T}}}, parent, weights; kwargs...) where T = NormalOpImpl(parent, weights) -mutable struct NormalOpImpl{T,S,D,V} <: NormalOp{T, S} - nrow :: Int - ncol :: Int - symmetric :: Bool - hermitian :: Bool - prod! :: Function - tprod! :: Nothing - ctprod! :: Nothing +mutable struct NormalOpImpl{T,vecT,S,D} <: NormalOp{T, S} + const nrow :: Int + const ncol :: Int + const symmetric :: Bool + const hermitian :: Bool + const prod! :: Function + const tprod! :: Nothing + const ctprod! :: Nothing nprod :: Int ntprod :: Int nctprod :: Int - args5 :: Bool - use_prod5! :: Bool - allocated5 :: Bool - Mv5 :: V - Mtu5 :: V - parent::S - weights::D - tmp::V + Mv :: vecT + Mtu :: vecT + const parent::S + const weights::D + tmp::vecT end -LinearOperators.storage_type(op::NormalOpImpl) = typeof(op.Mv5) +LinearOperators.storage_type(::NormalOpImpl{T, vecT}) where {T,vecT} = vecT function NormalOpImpl(parent, weights) S = promote_storage_types(parent, weights) @@ -70,11 +67,11 @@ function NormalOpImpl(parent, weights, tmp) end - return NormalOpImpl{eltype(parent), typeof(parent), typeof(weights), typeof(tmp)}(size(parent,2), size(parent,2), false, false + return NormalOpImpl{eltype(parent), typeof(tmp), typeof(parent), typeof(weights)}(size(parent,2), size(parent,2), false, false , (res,x) -> produ!(res, parent, weights, tmp, x) , nothing , nothing - , 0, 0, 0, true, false, true, similar(tmp, 0), similar(tmp, 0) + , 0, 0, 0, similar(tmp, 0), similar(tmp, 0) , parent, weights, tmp) end diff --git a/src/ProdOp.jl b/src/ProdOp.jl index 4902ccb..4dcc03b 100644 --- a/src/ProdOp.jl +++ b/src/ProdOp.jl @@ -1,22 +1,19 @@ export ProdOp mutable struct ProdOp{T,U,V, vecT <: AbstractVector{T}} <: AbstractLinearOperatorFromCollection{T} - nrow :: Int - ncol :: Int - symmetric :: Bool - hermitian :: Bool - prod! :: Function - tprod! :: Function - ctprod! :: Function + const nrow :: Int + const ncol :: Int + const symmetric :: Bool + const hermitian :: Bool + const prod! :: Function + const tprod! :: Function + const ctprod! :: Function nprod :: Int ntprod :: Int nctprod :: Int - args5 :: Bool - use_prod5! :: Bool - allocated5 :: Bool - Mv5 :: vecT - Mtu5 :: vecT - A::U - B::V + Mv :: vecT + Mtu :: vecT + const A::U + const B::V tmp::vecT end @@ -50,19 +47,23 @@ function ProdOp(A, B) (res,x) -> produ!(res,x,tmp_), (res,y) -> tprodu!(res,y,tmp_), (res,y) -> ctprodu!(res,y,tmp_), - 0, 0, 0, false, false, false, similar(tmp_, 0), similar(tmp_, 0), + 0, 0, 0, similar(tmp_, 0), similar(tmp_, 0), A, B, tmp_) return Op end +Base.:∘(A, B::AbstractLinearOperatorFromCollection) = ProdOp(A, B) +Base.:∘(A::AbstractLinearOperatorFromCollection, B) = ProdOp(A, B) +Base.:∘(A::AbstractLinearOperatorFromCollection, B::AbstractLinearOperatorFromCollection) = ProdOp(A, B) + function Base.copy(S::ProdOp{T}) where T A = copy(S.A) B = copy(S.B) return ProdOp(A,B) end -storage_type(op::ProdOp) = typeof(op.Mv5) +storage_type(::ProdOp{T,U,V,vecT}) where {T,U,V,vecT} = vecT mutable struct ProdNormalOp{T,S,U,V <: AbstractVector{T}} <: AbstractLinearOperator{T} nrow :: Int diff --git a/src/WeightingOp.jl b/src/WeightingOp.jl index 80f0061..0f43285 100644 --- a/src/WeightingOp.jl +++ b/src/WeightingOp.jl @@ -7,7 +7,7 @@ generates a `LinearOperator` which multiplies an input vector index-wise with `w * `weights::Vector{T}` - weights vector * `rep::Int=1` - number of sub-arrays that need to be multiplied with `weights` """ -mutable struct WeightingOp{T, vecT <: AbstractVector{T}} <: AbstractLinearOperatorFromCollection{T} +struct WeightingOp{T, vecT <: AbstractVector{T}} <: AbstractLinearOperatorFromCollection{T} op::LinearOperator{T} weights::vecT function WeightingOp(weights::vecT, rep::Int=1) where {T <: Number, vecT<:AbstractVector{T}} @@ -26,4 +26,4 @@ function Base.getproperty(wop::WeightingOp, field::Symbol) end Base.setproperty!(wop::WeightingOp, field::Symbol, value) = setproperty!(wop.op, field, value) -storage_type(wop::WeightingOp) = storage_type(wop.op) \ No newline at end of file +storage_type(::WeightingOp{T, vecT}) where {T, vecT} = vecT \ No newline at end of file diff --git a/test/runtests.jl b/test/runtests.jl index fc57110..39dac51 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -8,13 +8,13 @@ using Wavelets using NonuniformFFTs using NFFT using RadonKA -using JLArrays +#using JLArrays areTypesDefined = @isdefined arrayTypes arrayTypes = areTypesDefined ? arrayTypes : [Array] #, JLArray] @testset "LinearOperatorCollection" begin - include("testAqua.jl") + #include("testAqua.jl") include("testNormalOp.jl") include("testOperators.jl") end diff --git a/test/testOperators.jl b/test/testOperators.jl index eba8280..86bdff1 100644 --- a/test/testOperators.jl +++ b/test/testOperators.jl @@ -444,8 +444,8 @@ end @info "test NFFTOp with $(string(typeof(backend))): $arrayType" @testset "NFFTOp with $(string(typeof(backend)))" begin with(nfft_backend => backend) do - arrayType == JLArray || @testset testNFFT2d(;arrayType) # JLArray does not have a NFFTPlan - arrayType == JLArray || @testset testNFFT3d(;arrayType) # JLArray does not have a NFFTPlan + @testset testNFFT2d(;arrayType) # JLArray does not have a NFFTPlan + @testset testNFFT3d(;arrayType) # JLArray does not have a NFFTPlan end end end @@ -454,6 +454,6 @@ end @testset testDiagOp(;arrayType, scheduler = scheduler) end @info "test RadonOp: $arrayType" - arrayType == JLArray || @testset testRadonOp(;arrayType) # Stackoverflow for kernelabstraction + @testset testRadonOp(;arrayType) # Stackoverflow for kernelabstraction end end