Skip to content

Commit d72f42a

Browse files
committed
form and test
1 parent 5854ef0 commit d72f42a

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

src/factorization.jl

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -397,31 +397,29 @@ end
397397

398398
@static if VERSION < v"1.7beta"
399399
function init_cacheval(alg::FastQRFactorization{Val{false}}, A, b, u, Pl, Pr,
400-
maxiters, abstol, reltol, verbose)
400+
maxiters, abstol, reltol, verbose)
401401
ws = QRWYWs(A; blocksize = alg.blocksize)
402402
return WorkspaceAndFactors(ws, LinearAlgebra.QRCompactWY(LAPACK.geqrt!(ws, A)...))
403403
end
404404

405405
function init_cacheval(::FastQRFactorization{Val{true}}, A, b, u, Pl, Pr,
406-
maxiters, abstol, reltol, verbose)
406+
maxiters, abstol, reltol, verbose)
407407
ws = QRpWs(A)
408408
return WorkspaceAndFactors(ws, LinearAlgebra.QRPivoted(LAPACK.geqp3!(ws, A)...))
409409
end
410410
else
411411
function init_cacheval(alg::FastQRFactorization{NoPivot}, A, b, u, Pl, Pr,
412-
maxiters, abstol, reltol, verbose)
412+
maxiters, abstol, reltol, verbose)
413413
ws = QRWYWs(A; blocksize = alg.blocksize)
414414
return WorkspaceAndFactors(ws, LinearAlgebra.QRCompactWY(LAPACK.geqrt!(ws, A)...))
415415
end
416416
function init_cacheval(::FastQRFactorization{ColumnNorm}, A, b, u, Pl, Pr,
417-
maxiters, abstol, reltol, verbose)
417+
maxiters, abstol, reltol, verbose)
418418
ws = QRpWs(A)
419419
return WorkspaceAndFactors(ws, LinearAlgebra.QRPivoted(LAPACK.geqp3!(ws, A)...))
420420
end
421421
end
422422

423-
424-
425423
function SciMLBase.solve(cache::LinearCache, alg::FastQRFactorization{P}) where {P}
426424
A = cache.A
427425
A = convert(AbstractMatrix, A)

test/basictests.jl

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,24 @@ end
119119
@test_throws ArgumentError solve(cache)
120120
end
121121

122+
@testset "FastLAPACK Factorizations" begin
123+
A1 = A / 1
124+
b1 = rand(n)
125+
x1 = zero(b)
126+
A2 = A / 2
127+
b2 = rand(n)
128+
x2 = zero(b)
129+
130+
prob1 = LinearProblem(A1, b1; u0 = x1)
131+
prob2 = LinearProblem(A2, b2; u0 = x2)
132+
test_interface(LinearSolve.FastLUFactorization(), prob1, prob2)
133+
test_interface(LinearSolve.FastQRFactorization(), prob1, prob2)
134+
135+
# TODO: Resizing tests. Upstream doesn't currently support it.
136+
# Need to be absolutely certain we never segfault with incorrect
137+
# ws sizes.
138+
end
139+
122140
@testset "Concrete Factorizations" begin for alg in (LUFactorization(),
123141
QRFactorization(),
124142
SVDFactorization(),

0 commit comments

Comments
 (0)