@@ -11,10 +11,14 @@ function defaultalg(A,b)
11
11
# whether MKL or OpenBLAS is being used
12
12
if (A === nothing && ! isgpu (b)) || A isa Matrix
13
13
if (A === nothing || eltype (A) <: Union{Float32,Float64,ComplexF32,ComplexF64} ) &&
14
- ArrayInterface. can_setindex (b) && (length (b) <= 100 ||
15
- (isopenblas () && length (b) <= 500 )
16
- )
17
- alg = RFLUFactorization ()
14
+ ArrayInterface. can_setindex (b)
15
+ if length (b) <= 10
16
+ alg = GenericLUFactorization ()
17
+ elseif (length (b) <= 100 || (isopenblas () && length (b) <= 500 ))
18
+ alg = RFLUFactorization ()
19
+ else
20
+ alg = LUFactorization ()
21
+ end
18
22
else
19
23
alg = LUFactorization ()
20
24
end
@@ -58,12 +62,19 @@ function SciMLBase.solve(cache::LinearCache, alg::Nothing,
58
62
# it makes sense according to the benchmarks, which is dependent on
59
63
# whether MKL or OpenBLAS is being used
60
64
if A isa Matrix
61
- if eltype (A) <: Union{Float32,Float64,ComplexF32,ComplexF64} &&
62
- ArrayInterface. can_setindex (cache. b) && (size (A,1 ) <= 100 ||
63
- (isopenblas () && size (A,1 ) <= 500 )
64
- )
65
- alg = RFLUFactorization ()
66
- SciMLBase. solve (cache, alg, args... ; kwargs... )
65
+ b = cache. b
66
+ if (A === nothing || eltype (A) <: Union{Float32,Float64,ComplexF32,ComplexF64} ) &&
67
+ ArrayInterface. can_setindex (b)
68
+ if length (b) <= 10
69
+ alg = GenericLUFactorization ()
70
+ SciMLBase. solve (cache, alg, args... ; kwargs... )
71
+ elseif (length (b) <= 100 || (isopenblas () && length (b) <= 500 ))
72
+ alg = RFLUFactorization ()
73
+ SciMLBase. solve (cache, alg, args... ; kwargs... )
74
+ else
75
+ alg = LUFactorization ()
76
+ SciMLBase. solve (cache, alg, args... ; kwargs... )
77
+ end
67
78
else
68
79
alg = LUFactorization ()
69
80
SciMLBase. solve (cache, alg, args... ; kwargs... )
@@ -110,12 +121,18 @@ function init_cacheval(alg::Nothing, A, b, u, Pl, Pr, maxiters, abstol, reltol,
110
121
# it makes sense according to the benchmarks, which is dependent on
111
122
# whether MKL or OpenBLAS is being used
112
123
if A isa Matrix
113
- if eltype (A) <: Union{Float32,Float64,ComplexF32,ComplexF64} &&
114
- ArrayInterface. can_setindex (b) && (size (A,1 ) <= 100 ||
115
- (isopenblas () && size (A,1 ) <= 500 )
116
- )
117
- alg = RFLUFactorization ()
118
- init_cacheval (alg, A, b, u, Pl, Pr, maxiters, abstol, reltol, verbose)
124
+ if (A === nothing || eltype (A) <: Union{Float32,Float64,ComplexF32,ComplexF64} ) &&
125
+ ArrayInterface. can_setindex (b)
126
+ if length (b) <= 10
127
+ alg = GenericLUFactorization ()
128
+ init_cacheval (alg, A, b, u, Pl, Pr, maxiters, abstol, reltol, verbose)
129
+ elseif (length (b) <= 100 || (isopenblas () && length (b) <= 500 ))
130
+ alg = RFLUFactorization ()
131
+ init_cacheval (alg, A, b, u, Pl, Pr, maxiters, abstol, reltol, verbose)
132
+ else
133
+ alg = LUFactorization ()
134
+ init_cacheval (alg, A, b, u, Pl, Pr, maxiters, abstol, reltol, verbose)
135
+ end
119
136
else
120
137
alg = LUFactorization ()
121
138
init_cacheval (alg, A, b, u, Pl, Pr, maxiters, abstol, reltol, verbose)
0 commit comments