1
- struct LinearCache{TA, Tb, Tu, Tp, Talg, Tc, Tl, Tr, Ttol}
1
+ struct OperatorAssumptions{issquare} end
2
+ function OperatorAssumptions (issquare = nothing )
3
+ OperatorAssumptions {_unwrap_val(issquare)} ()
4
+ end
5
+ issquare (:: OperatorAssumptions{issq} ) where {issq} = issq
6
+
7
+ _unwrap_val (:: Val{B} ) where {B} = B
8
+ _unwrap_val (B:: Nothing ) = Nothing
9
+ _unwrap_val (B:: Bool ) = B
10
+
11
+ struct LinearCache{TA, Tb, Tu, Tp, Talg, Tc, Tl, Tr, Ttol, issquare}
2
12
A:: TA
3
13
b:: Tb
4
14
u:: Tu
@@ -12,6 +22,7 @@ struct LinearCache{TA, Tb, Tu, Tp, Talg, Tc, Tl, Tr, Ttol}
12
22
reltol:: Ttol
13
23
maxiters:: Int
14
24
verbose:: Bool
25
+ assumptions:: OperatorAssumptions{issquare}
15
26
end
16
27
17
28
"""
@@ -82,10 +93,11 @@ function SciMLBase.init(prob::LinearProblem, alg::Union{SciMLLinearSolveAlgorith
82
93
alias_A = false , alias_b = false ,
83
94
abstol = default_tol (eltype (prob. A)),
84
95
reltol = default_tol (eltype (prob. A)),
85
- maxiters = length (prob. b),
86
- verbose = false ,
96
+ maxiters:: Int = length (prob. b),
97
+ verbose:: Bool = false ,
87
98
Pl = Identity (),
88
99
Pr = Identity (),
100
+ assumptions = OperatorAssumptions (),
89
101
kwargs... )
90
102
@unpack A, b, u0, p = prob
91
103
@@ -96,7 +108,8 @@ function SciMLBase.init(prob::LinearProblem, alg::Union{SciMLLinearSolveAlgorith
96
108
fill! (u0, false )
97
109
end
98
110
99
- cacheval = init_cacheval (alg, A, b, u0, Pl, Pr, maxiters, abstol, reltol, verbose)
111
+ cacheval = init_cacheval (alg, A, b, u0, Pl, Pr, maxiters, abstol, reltol, verbose,
112
+ assumptions)
100
113
isfresh = true
101
114
Tc = typeof (cacheval)
102
115
@@ -112,7 +125,8 @@ function SciMLBase.init(prob::LinearProblem, alg::Union{SciMLLinearSolveAlgorith
112
125
Tc,
113
126
typeof (Pl),
114
127
typeof (Pr),
115
- typeof (reltol)
128
+ typeof (reltol),
129
+ issquare (assumptions)
116
130
}(A,
117
131
b,
118
132
u0,
@@ -125,7 +139,8 @@ function SciMLBase.init(prob::LinearProblem, alg::Union{SciMLLinearSolveAlgorith
125
139
abstol,
126
140
reltol,
127
141
maxiters,
128
- verbose)
142
+ verbose,
143
+ assumptions)
129
144
return cache
130
145
end
131
146
0 commit comments