@@ -177,3 +177,40 @@ for solver in solvers
177177 @test Pardiso. get_iparm (solver, i) == iparm[i][2 ]
178178 end
179179end
180+
181+ @testset " AbstractSparseMatrixCSC" begin
182+ struct MySparseMatrixCSC2{Tv, Ti} <: SparseArrays.AbstractSparseMatrixCSC{Tv, Ti}
183+ csc:: SparseMatrixCSC{Tv, Ti}
184+ end
185+
186+ Base. size (m:: MySparseMatrixCSC2 ) = size (m. csc)
187+ SparseArrays. getcolptr (m:: MySparseMatrixCSC2 ) = SparseArrays. getcolptr (m. csc)
188+ SparseArrays. rowvals (m:: MySparseMatrixCSC2 ) = SparseArrays. rowvals (m. csc)
189+ SparseArrays. nonzeros (m:: MySparseMatrixCSC2 ) = SparseArrays. nonzeros (m. csc)
190+
191+ for alg in algs
192+ N = 100
193+ u0 = ones (N)
194+ A0 = spdiagm (1 => - ones (N - 1 ), 0 => fill (10.0 , N), - 1 => - ones (N - 1 ))
195+ b0 = A0 * u0
196+ B0 = MySparseMatrixCSC2 (A0)
197+ A1 = spdiagm (1 => - ones (N - 1 ), 0 => fill (100.0 , N), - 1 => - ones (N - 1 ))
198+ b1= A1* u0
199+ B1= MySparseMatrixCSC2 (A1)
200+
201+
202+ pr = LinearProblem (B0, b0)
203+ # test default algorithn
204+ u= solve (pr,alg)
205+ @test norm (u - u0, Inf ) < 1.0e-13
206+
207+ # test factorization with reinit!
208+ pr = LinearProblem (B0, b0)
209+ cache= init (pr,alg)
210+ u= solve! (cache)
211+ @test norm (u - u0, Inf ) < 1.0e-13
212+ reinit! (cache; A= B1, b= b1)
213+ u= solve! (cache)
214+ @test norm (u - u0, Inf ) < 1.0e-13
215+ end
216+ end
0 commit comments