Skip to content

Commit 1c728c4

Browse files
committed
small changes
1 parent a956b1a commit 1c728c4

File tree

2 files changed

+23
-5
lines changed

2 files changed

+23
-5
lines changed

src/common.jl

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,11 @@ function SciMLBase.init(
4242
kwargs...,
4343
)
4444
@unpack A, b, u0, p = prob
45+
46+
if u0 == nothing
47+
u0 = zero(b)
48+
end
49+
4550
if alg isa LUFactorization
4651
fact = lu_instance(A)
4752
Tfact = typeof(fact)
@@ -52,13 +57,11 @@ function SciMLBase.init(
5257
Pr = LinearAlgebra.I
5358
Pl = LinearAlgebra.I
5459

60+
# @show (A, b, u0, p) |> typeof
61+
5562
A = alias_A ? A : copy(A)
5663
b = alias_b ? b : copy(b)
5764

58-
if u0 == nothing
59-
u0 = zero(b)
60-
end
61-
6265
cache = LinearCache{
6366
typeof(A),
6467
typeof(b),

src/krylov.jl

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1+
## Krylov.jl
2+
3+
# place Krylov.CGsolver in LinearCache.cacheval, and resule
4+
15
struct KrylovJL{A,K} <: SciMLLinearSolveAlgorithm
26
solver::Function
37
args::A
48
kwargs::K
59
end
610

7-
function KrylovJL(args...; solver = gmres, kwargs...)
11+
function KrylovJL(args...; solver = Krylov.gmres, kwargs...)
812
return KrylovJL(solver, args, kwargs)
913
end
1014

@@ -15,3 +19,14 @@ function SciMLBase.solve(cache::LinearCache, alg::KrylovJL,args...;kwargs...)
1519
retcode = stats.solved ? :Success : :Failure
1620
return u #SciMLBase.build_solution(prob, alg, x, resid; retcode = retcode)
1721
end
22+
23+
## IterativeSolvers.jl
24+
25+
struct IterativeSolversJL{A,K} <: SciMLLinearSolveAlgorithm
26+
solver::Function
27+
args::A
28+
kwargs::K
29+
end
30+
31+
## KrylovKit.jl
32+

0 commit comments

Comments
 (0)