Skip to content

Commit 4c390cc

Browse files
committed
Merge branch 'main' of github.com:JuliaImageRecon/LinearOperatorCollection.jl
2 parents be12a8d + 20eea66 commit 4c390cc

File tree

2 files changed

+38
-43
lines changed

2 files changed

+38
-43
lines changed

Project.toml

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
11
name = "LinearOperatorCollection"
22
uuid = "a4a2c56f-fead-462a-a3ab-85921a5f2575"
33
authors = ["Tobias Knopp <[email protected]> and contributors"]
4-
version = "1.1.1"
4+
version = "1.1.3-DEV"
55

66
[deps]
7+
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
78
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
8-
LinearOperators = "5c8ed15e-5a4c-59e4-a42b-c7e8811fb125"
9+
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
910
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
11+
LinearOperators = "5c8ed15e-5a4c-59e4-a42b-c7e8811fb125"
1012
Reexport = "189a3867-3050-52da-a836-e630ba90ab69"
11-
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
12-
InteractiveUtils = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
1313

14-
[weakdeps]
15-
Wavelets = "29a6e085-ba6d-5f35-a997-948ac2efa89a"
16-
FFTW = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341"
17-
NFFT = "efe261a4-0d2b-5849-be55-fc731d526b0d"
18-
19-
[extensions]
20-
LinearOperatorWaveletExt = "Wavelets"
21-
LinearOperatorFFTWExt = "FFTW"
22-
LinearOperatorNFFTExt = ["NFFT", "FFTW"]
14+
[extras]
15+
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
2316

2417
[compat]
2518
julia = "1.9"
26-
FFTW = "1.0"
19+
NFFT = "0.13"
2720
LinearOperators = "2.3.3"
28-
Reexport = "1.0"
2921
Wavelets = "0.9, 0.10"
30-
NFFT = "0.13"
22+
Reexport = "1.0"
23+
FFTW = "1.0"
3124

32-
[extras]
33-
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
25+
[weakdeps]
26+
NFFT = "efe261a4-0d2b-5849-be55-fc731d526b0d"
27+
Wavelets = "29a6e085-ba6d-5f35-a997-948ac2efa89a"
28+
FFTW = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341"
3429

3530
[targets]
3631
test = ["Test", "FFTW", "Wavelets", "NFFT"]
32+
33+
[extensions]
34+
LinearOperatorNFFTExt = ["NFFT", "FFTW"]
35+
LinearOperatorFFTWExt = "FFTW"
36+
LinearOperatorWaveletExt = "Wavelets"

src/GradientOp.jl

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,33 @@
1-
function LinearOperatorCollection.GradientOp(::Type{T};
2-
shape::Tuple, dims=nothing) where T <: Number
3-
if dims == nothing
4-
return GradientOpImpl(T, shape)
5-
else
6-
return GradientOpImpl(T, shape, dims)
7-
end
8-
end
9-
101
"""
11-
GradOp(T::Type, shape::NTuple{N,Int64})
2+
GradientOp(T::Type; shape::Tuple, dims=1:length(shape))
123
13-
Nd gradient operator for an array of size `shape`
14-
"""
15-
function GradientOpImpl(T::Type, shape)
16-
shape = typeof(shape) <: Number ? (shape,) : shape # convert Number to Tuple
17-
return vcat([GradientOpImpl(T, shape, i) for i eachindex(shape)]...)
18-
end
4+
directional gradient operator along the dimensions `dims` for an array of size `shape`.
195
20-
"""
21-
GradOp(T::Type, shape::NTuple{N,Int64}, dims)
6+
# Required Argument
7+
* `T` - type of elements, .e.g. `Float64` for `ComplexF32`
8+
9+
# Required Keyword argument
10+
* `shape::NTuple{N,Int}` - shape of the array (e.g., image)
2211
23-
directional gradient operator along the dimensions `dims`
24-
for an array of size `shape`
12+
# Optional Keyword argument
13+
* `dims` - dimension(s) along which the gradient is applied; default is `1:length(shape)`
2514
"""
26-
function GradientOpImpl(T::Type, shape::NTuple{N,Int64}, dims) where N
15+
function GradientOp(::Type{T}; shape::NTuple{N,Int}, dims=1:length(shape)) where {T <: Number, N}
16+
return GradientOpImpl(T, shape, dims)
17+
end
18+
19+
function GradientOpImpl(T::Type, shape::NTuple{N,Int}, dims) where N
2720
return vcat([GradientOpImpl(T, shape, dim) for dim dims]...)
2821
end
29-
function GradientOpImpl(T::Type, shape::NTuple{N,Int64}, dim::Integer) where N
22+
23+
function GradientOpImpl(T::Type, shape::NTuple{N,Int}, dim::Int) where N
3024
nrow = div( (shape[dim]-1)*prod(shape), shape[dim] )
3125
ncol = prod(shape)
3226
return LinearOperator{T}(nrow, ncol, false, false,
33-
(res,x) -> (grad!(res,x,shape,dim) ),
34-
(res,x) -> (grad_t!(res,x,shape,dim) ),
35-
nothing )
27+
(res,x) -> (grad!(res,x,shape,dim)),
28+
(res,x) -> (grad_t!(res,x,shape,dim)),
29+
(res,x) -> (grad_t!(res,x,shape,dim))
30+
)
3631
end
3732

3833
# directional gradients

0 commit comments

Comments
 (0)