@@ -1026,108 +1026,6 @@ function SciMLBase.solve!(cache::LinearCache, alg::DiagonalFactorization;
10261026 SciMLBase. build_linear_solution (alg, cache. u, nothing , cache)
10271027end
10281028
1029- # # FastLAPACKFactorizations
1030-
1031- struct WorkspaceAndFactors{W, F}
1032- workspace:: W
1033- factors:: F
1034- end
1035-
1036- # There's no options like pivot here.
1037- # But I'm not sure it makes sense as a GenericFactorization
1038- # since it just uses `LAPACK.getrf!`.
1039- """
1040- `FastLUFactorization()`
1041-
1042- The FastLapackInterface.jl version of the LU factorization. Notably,
1043- this version does not allow for choice of pivoting method.
1044- """
1045- struct FastLUFactorization <: AbstractDenseFactorization end
1046-
1047- function init_cacheval (:: FastLUFactorization , A, b, u, Pl, Pr,
1048- maxiters:: Int , abstol, reltol, verbose:: Bool ,
1049- assumptions:: OperatorAssumptions )
1050- ws = LUWs (A)
1051- return WorkspaceAndFactors (ws, ArrayInterface. lu_instance (convert (AbstractMatrix, A)))
1052- end
1053-
1054- function SciMLBase. solve! (cache:: LinearCache , alg:: FastLUFactorization ; kwargs... )
1055- A = cache. A
1056- A = convert (AbstractMatrix, A)
1057- ws_and_fact = @get_cacheval (cache, :FastLUFactorization )
1058- if cache. isfresh
1059- # we will fail here if A is a different *size* than in a previous version of the same cache.
1060- # it may instead be desirable to resize the workspace.
1061- @set! ws_and_fact. factors = LinearAlgebra. LU (LAPACK. getrf! (ws_and_fact. workspace,
1062- A)... )
1063- cache. cacheval = ws_and_fact
1064- cache. isfresh = false
1065- end
1066- y = ldiv! (cache. u, cache. cacheval. factors, cache. b)
1067- SciMLBase. build_linear_solution (alg, y, nothing , cache)
1068- end
1069-
1070- """
1071- `FastQRFactorization()`
1072-
1073- The FastLapackInterface.jl version of the QR factorization.
1074- """
1075- struct FastQRFactorization{P} <: AbstractDenseFactorization
1076- pivot:: P
1077- blocksize:: Int
1078- end
1079-
1080- # is 36 or 16 better here? LinearAlgebra and FastLapackInterface use 36,
1081- # but QRFactorization uses 16.
1082- FastQRFactorization () = FastQRFactorization (NoPivot (), 36 )
1083-
1084- function init_cacheval (alg:: FastQRFactorization{NoPivot} , A:: AbstractMatrix , b, u, Pl, Pr,
1085- maxiters:: Int , abstol, reltol, verbose:: Bool ,
1086- assumptions:: OperatorAssumptions )
1087- ws = QRWYWs (A; blocksize = alg. blocksize)
1088- return WorkspaceAndFactors (ws,
1089- ArrayInterface. qr_instance (convert (AbstractMatrix, A)))
1090- end
1091- function init_cacheval (:: FastQRFactorization{ColumnNorm} , A:: AbstractMatrix , b, u, Pl, Pr,
1092- maxiters:: Int , abstol, reltol, verbose:: Bool ,
1093- assumptions:: OperatorAssumptions )
1094- ws = QRpWs (A)
1095- return WorkspaceAndFactors (ws,
1096- ArrayInterface. qr_instance (convert (AbstractMatrix, A)))
1097- end
1098-
1099- function init_cacheval (alg:: FastQRFactorization , A, b, u, Pl, Pr,
1100- maxiters:: Int , abstol, reltol, verbose:: Bool ,
1101- assumptions:: OperatorAssumptions )
1102- return init_cacheval (alg, convert (AbstractMatrix, A), b, u, Pl, Pr,
1103- maxiters:: Int , abstol, reltol, verbose:: Bool ,
1104- assumptions:: OperatorAssumptions )
1105- end
1106-
1107- function SciMLBase. solve! (cache:: LinearCache , alg:: FastQRFactorization{P} ;
1108- kwargs... ) where {P}
1109- A = cache. A
1110- A = convert (AbstractMatrix, A)
1111- ws_and_fact = @get_cacheval (cache, :FastQRFactorization )
1112- if cache. isfresh
1113- # we will fail here if A is a different *size* than in a previous version of the same cache.
1114- # it may instead be desirable to resize the workspace.
1115- if P === NoPivot
1116- @set! ws_and_fact. factors = LinearAlgebra. QRCompactWY (LAPACK. geqrt! (
1117- ws_and_fact. workspace,
1118- A)... )
1119- else
1120- @set! ws_and_fact. factors = LinearAlgebra. QRPivoted (LAPACK. geqp3! (
1121- ws_and_fact. workspace,
1122- A)... )
1123- end
1124- cache. cacheval = ws_and_fact
1125- cache. isfresh = false
1126- end
1127- y = ldiv! (cache. u, cache. cacheval. factors, cache. b)
1128- SciMLBase. build_linear_solution (alg, y, nothing , cache)
1129- end
1130-
11311029# # SparspakFactorization is here since it's MIT licensed, not GPL
11321030
11331031"""
0 commit comments