Skip to content

Commit 1cd1e7e

Browse files
committed
Fix missing struct changes in ProdNormalOp, added missing tests
1 parent a6a84b6 commit 1cd1e7e

3 files changed

Lines changed: 23 additions & 20 deletions

File tree

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "LinearOperatorCollection"
22
uuid = "a4a2c56f-fead-462a-a3ab-85921a5f2575"
33
authors = ["Tobias Knopp <tobias.knopp@tuhh.de> and contributors"]
4-
version = "2.4"
4+
version = "2.4.1"
55

66
[deps]
77
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"

src/ProdOp.jl

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -65,28 +65,25 @@ end
6565

6666
storage_type(::ProdOp{T,U,V,vecT}) where {T,U,V,vecT} = vecT
6767

68-
mutable struct ProdNormalOp{T,S,U,V <: AbstractVector{T}} <: AbstractLinearOperator{T}
69-
nrow :: Int
70-
ncol :: Int
71-
symmetric :: Bool
72-
hermitian :: Bool
73-
prod! :: Function
74-
tprod! :: Nothing
75-
ctprod! :: Nothing
68+
mutable struct ProdNormalOp{T, vecT <: AbstractVector{T}, S, U} <: AbstractLinearOperator{T}
69+
const nrow :: Int
70+
const ncol :: Int
71+
const symmetric :: Bool
72+
const hermitian :: Bool
73+
const prod! :: Function
74+
const tprod! :: Nothing
75+
const ctprod! :: Nothing
7676
nprod :: Int
7777
ntprod :: Int
7878
nctprod :: Int
79-
args5 :: Bool
80-
use_prod5! :: Bool
81-
allocated5 :: Bool
82-
Mv5 :: V
83-
Mtu5 :: V
84-
opOuter::S
85-
normalOpInner::U
86-
tmp::V
79+
Mv :: vecT
80+
Mtu :: vecT
81+
const opOuter::S
82+
const normalOpInner::U
83+
tmp::vecT
8784
end
8885

89-
storage_type(op::ProdNormalOp) = typeof(op.Mv5)
86+
storage_type(::ProdNormalOp{T, vecT}) where {T, vecT} = vecT
9087

9188

9289
function ProdNormalOp(opOuter, normalOpInner, tmp)
@@ -101,7 +98,7 @@ function ProdNormalOp(opOuter, normalOpInner, tmp)
10198
, (res,x) -> produ!(res, opOuter, normalOpInner, tmp, x)
10299
, nothing
103100
, nothing
104-
, 0, 0, 0, false, false, false, similar(tmp, 0), similar(tmp, 0)
101+
, 0, 0, 0, similar(tmp, 0), similar(tmp, 0)
105102
, opOuter, normalOpInner, tmp)
106103
end
107104

@@ -112,7 +109,7 @@ end
112109
"""
113110
normalOperator(prod::ProdOp{T, <:WeightingOp, matT}; kwargs...)
114111
115-
Fuses weights of `ẀeightingOp` by computing `adjoint.(weights) .* weights`
112+
Fuses weights of `WeightingOp` by computing `adjoint.(weights) .* weights`
116113
"""
117114
normalOperator(S::ProdOp{T, <:WeightingOp, matT}; kwargs...) where {T, matT} = normalOperator(S.B, WeightingOp(adjoint.(S.A.weights) .* S.A.weights); kwargs...)
118115
function normalOperator(S::ProdOp, W=nothing; kwargs...)

test/testNormalOp.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@
2828
y = Array(normalOperator(A)*x)
2929

3030
@test norm(y1 - y) / norm(y) 0 atol=0.01
31+
32+
B = arrayType(rand(elType, N, N))
33+
AB = A * B
34+
WAB = diagm(W.weights)*A*B
35+
@test isapprox(normalOperator(ProdOp(A, B)) * x, adjoint(AB) * AB * x)
36+
@test isapprox(normalOperator(ProdOp(ProdOp(W, A), B)) * x, adjoint(WAB) * WAB * x)
3137
end
3238
end
3339
end

0 commit comments

Comments
 (0)