@@ -6,6 +6,7 @@ import LinearAlgebra.BLAS: gemv, gemv!
66import LinearAlgebra: BlasFloat, normalize!, norm, rmul!, lmul!
77using SparseArrays
88using Random
9+ using InteractiveUtils
910
1011using Reexport
1112@reexport using Reexport
@@ -26,7 +27,7 @@ function wrapProd(prod::Function)
2627 return λ
2728end
2829
29- export linearOperatorList, constructLinearOperator
30+ export linearOperatorList, createLinearOperator
3031export AbstractLinearOperatorFromCollection, WaveletOp, FFTOp, DCTOp, DSTOp, NFFTOp,
3132 SamplingOp, NormalOp, WeightingOp, GradientOp
3233
@@ -41,9 +42,6 @@ abstract type NormalOp{T} <: AbstractLinearOperatorFromCollection{T} end
4142abstract type WeightingOp{T} <: AbstractLinearOperatorFromCollection{T} end
4243abstract type GradientOp{T} <: AbstractLinearOperatorFromCollection{T} end
4344
44- function constructLinearOperator (:: Type{<:AbstractLinearOperatorFromCollection} , args... ; kargs... )
45- error (" Operator can't be constructed. You need to load another package!" )
46- end
4745
4846"""
4947 returns a list of currently implemented `LinearOperator`s
@@ -52,6 +50,16 @@ function linearOperatorList()
5250 return subtypes (AbstractLinearOperatorFromCollection)
5351end
5452
53+ # Next we create the factory methods. We probably want to given
54+ # a better error message if the extension module is not loaded
55+ for op in linearOperatorList ()
56+ @eval begin
57+ function createLinearOperator (:: Type{ Op } ; kargs... ) where Op <: $op{T} where T <: Number
58+ return $ op (T; kargs... )
59+ end
60+ end
61+ end
62+
5563include (" GradientOp.jl" )
5664include (" SamplingOp.jl" )
5765include (" WeightingOp.jl" )
0 commit comments