Skip to content

Commit 5854ef0

Browse files
author
Will Kimmerer
committed
fix 1.7 additions
1 parent 62ccf33 commit 5854ef0

File tree

1 file changed

+31
-13
lines changed

1 file changed

+31
-13
lines changed

src/factorization.jl

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -395,33 +395,51 @@ function FastQRFactorization()
395395
# but QRFactorization uses 16.
396396
end
397397

398-
function init_cacheval(alg::FastQRFactorization{NoPivot}, A, b, u, Pl, Pr,
399-
maxiters, abstol, reltol, verbose)
400-
ws = QRWYWs(A; blocksize = alg.blocksize)
401-
return WorkspaceAndFactors(ws, LinearAlgebra.QRCompactWY(LAPACK.geqrt!(ws, A)...))
402-
end
398+
@static if VERSION < v"1.7beta"
399+
function init_cacheval(alg::FastQRFactorization{Val{false}}, A, b, u, Pl, Pr,
400+
maxiters, abstol, reltol, verbose)
401+
ws = QRWYWs(A; blocksize = alg.blocksize)
402+
return WorkspaceAndFactors(ws, LinearAlgebra.QRCompactWY(LAPACK.geqrt!(ws, A)...))
403+
end
403404

404-
function init_cacheval(::FastQRFactorization{LinearAlgebra.ColumnNorm}, A, b, u, Pl, Pr,
405-
maxiters, abstol, reltol, verbose)
406-
ws = QRpWs(A)
407-
return WorkspaceAndFactors(ws, LinearAlgebra.QRPivoted(LAPACK.geqp3!(ws, A)...))
405+
function init_cacheval(::FastQRFactorization{Val{true}}, A, b, u, Pl, Pr,
406+
maxiters, abstol, reltol, verbose)
407+
ws = QRpWs(A)
408+
return WorkspaceAndFactors(ws, LinearAlgebra.QRPivoted(LAPACK.geqp3!(ws, A)...))
409+
end
410+
else
411+
function init_cacheval(alg::FastQRFactorization{NoPivot}, A, b, u, Pl, Pr,
412+
maxiters, abstol, reltol, verbose)
413+
ws = QRWYWs(A; blocksize = alg.blocksize)
414+
return WorkspaceAndFactors(ws, LinearAlgebra.QRCompactWY(LAPACK.geqrt!(ws, A)...))
415+
end
416+
function init_cacheval(::FastQRFactorization{ColumnNorm}, A, b, u, Pl, Pr,
417+
maxiters, abstol, reltol, verbose)
418+
ws = QRpWs(A)
419+
return WorkspaceAndFactors(ws, LinearAlgebra.QRPivoted(LAPACK.geqp3!(ws, A)...))
420+
end
408421
end
409422

423+
424+
410425
function SciMLBase.solve(cache::LinearCache, alg::FastQRFactorization{P}) where {P}
411426
A = cache.A
412427
A = convert(AbstractMatrix, A)
413428
ws_and_fact = cache.cacheval
414429
if cache.isfresh
415430
# we will fail here if A is a different *size* than in a previous version of the same cache.
416431
# it may instead be desirable to resize the workspace.
417-
if P === NoPivot
432+
nopivot = @static if VERSION < v"1.7beta"
433+
Val{false}
434+
else
435+
NoPivot
436+
end
437+
if P === nopivot
418438
@set! ws_and_fact.factors = LinearAlgebra.QRCompactWY(LAPACK.geqrt!(ws_and_fact.workspace,
419439
A)...)
420-
elseif P === LinearAlgebra.ColumnNorm
440+
else
421441
@set! ws_and_fact.factors = LinearAlgebra.QRPivoted(LAPACK.geqp3!(ws_and_fact.workspace,
422442
A)...)
423-
else
424-
error("No FastLAPACK Factorization defined for $P")
425443
end
426444
cache = set_cacheval(cache, ws_and_fact)
427445
end

0 commit comments

Comments
 (0)