Skip to content

Commit 268af6f

Browse files
remove Union type for A_prev and make it parametric
1 parent b2ed091 commit 268af6f

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

src/shiftedCompositeNormL2.jl

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,14 @@ mutable struct ShiftedCompositeNormL2{
3030
F0 <: Function,
3131
F1 <: Function,
3232
M <: AbstractMatrix{T},
33+
N <: Union{Nothing, M},
3334
V <: AbstractVector{T},
3435
} <: ShiftedCompositeProximableFunction
3536
h::NormL2{T}
3637
c!::F0
3738
J!::F1
3839
A::M
39-
A_prev::Union{Nothing, M} # (Optional) can be used to store the previous Jacobian, useful for quasi-Newton approximations
40+
A_prev::N # (Optional) can be used to store the previous Jacobian, useful for quasi-Newton approximations
4041
shifted_spmat::qrm_shifted_spmat{T}
4142
spfct::qrm_spfct{T}
4243
b::V
@@ -71,7 +72,7 @@ mutable struct ShiftedCompositeNormL2{
7172
shifted_spmat = qrm_shift_spmat(spmat)
7273
spfct = qrm_spfct_init(spmat)
7374

74-
new{T, typeof(c!), typeof(J!), typeof(A), typeof(b)}(
75+
new{T, typeof(c!), typeof(J!), typeof(A), typeof(A_prev), typeof(b)}(
7576
NormL2(λ),
7677
c!,
7778
J!,
@@ -113,13 +114,13 @@ fun_params(ψ::ShiftedCompositeNormL2) = "c(xk) = $(ψ.b)\n" * " "^14 * "J(xk) =
113114

114115
function prox!(
115116
y::AbstractVector{T},
116-
ψ::ShiftedCompositeNormL2{T, F0, F1, M, V},
117+
ψ::ShiftedCompositeNormL2{T, F0, F1, M, N, V},
117118
q::AbstractVector{T},
118119
ν::T;
119120
max_iter = 10,
120121
atol = eps(T)^0.3,
121122
max_time = 180.0,
122-
) where {T <: Real, F0 <: Function, F1 <: Function, M <: AbstractMatrix{T}, V <: AbstractVector{T}}
123+
) where {T <: Real, F0 <: Function, F1 <: Function, M <: AbstractMatrix{T}, N <: Union{Nothing, M}, V <: AbstractVector{T}}
123124
@assert ν > zero(T)
124125
start_time = time()
125126
θ = T(0.8)

0 commit comments

Comments
 (0)