Skip to content

Commit 8b3d634

Browse files
author
mohamed82008
committed
Make CGStateVariables work for all arrays
1 parent 2c75164 commit 8b3d634

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/cg.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,16 +90,16 @@ end
9090

9191
# Utility functions
9292

93-
struct CGStateVariables{T}
94-
u::Vector{T}
95-
r::Vector{T}
96-
c::Vector{T}
93+
struct CGStateVariables{T,Tx<:AbstractArray{T}}
94+
u::Tx
95+
r::Tx
96+
c::Tx
9797
end
9898

9999
function cg_iterator!(x, A, b, Pl = Identity();
100100
tol = sqrt(eps(real(eltype(b)))),
101101
maxiter::Int = size(A, 2),
102-
statevars::CGStateVariables = CGStateVariables{eltype(x)}(zeros(x), similar(x), similar(x)),
102+
statevars::CGStateVariables = CGStateVariables{eltype(x),typeof(x)}(zeros(x), similar(x), similar(x)),
103103
initially_zero::Bool = false
104104
)
105105
u = statevars.u

0 commit comments

Comments
 (0)