File tree Expand file tree Collapse file tree 3 files changed +19
-2
lines changed Expand file tree Collapse file tree 3 files changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -10,8 +10,8 @@ QuadGK = "1fd47b50-473d-5c70-9696-f719f8f3bcdc"
10
10
11
11
[compat ]
12
12
EllipsisNotation = " 1"
13
- julia = " 1.6"
14
13
QuadGK = " 2.9"
14
+ julia = " 1.6"
15
15
16
16
[extras ]
17
17
Aqua = " 4c88cf16-eb10-579e-8560-4a9242c79595"
Original file line number Diff line number Diff line change @@ -136,7 +136,8 @@ function _optimizerrlu!(
136
136
k = lu. npivot + 1
137
137
newpivot = submatrixargmax (abs2, A, k)
138
138
lu. error = abs (A[newpivot... ])
139
- if abs (lu. error) < reltol * maxerror || abs (lu. error) < abstol
139
+ # Add at least 1 pivot to get a well-defined L * U
140
+ if (abs (lu. error) < reltol * maxerror || abs (lu. error) < abstol) && lu. npivot > 0
140
141
break
141
142
end
142
143
maxerror = max (maxerror, lu. error)
Original file line number Diff line number Diff line change @@ -192,4 +192,20 @@ using LinearAlgebra
192
192
lu3 = TCI. rrlu (A, abstol= 0.0 )
193
193
@test TCI. lastpivoterror (lu3) == 0.0
194
194
end
195
+
196
+ @testset " LU for matrices with very small absolute values" begin
197
+ A = 1e-13 * [
198
+ 0.585383 0.124568 0.352426 0.573507
199
+ 0.865875 0.600153 0.727443 0.902388
200
+ 0.913477 0.954081 0.116965 0.817
201
+ 0.985918 0.516114 0.600366 0.0200085
202
+ ]
203
+
204
+ lu = TCI. rrlu (A, abstol= 1e-3 )
205
+ @test TCI. npivots (lu) == 1
206
+ @test length (TCI. pivoterrors (lu)) > 0
207
+ @test TCI. lastpivoterror (lu) > 0
208
+ @test size (lu) == size (A)
209
+ @test maximum (abs .(TCI. left (lu) * TCI. right (lu) .- A)) < 1e-3
210
+ end
195
211
end
You can’t perform that action at this time.
0 commit comments