@@ -402,15 +402,15 @@ function do_factorization(alg::GenericFactorization, A, b, u)
402
402
return fact
403
403
end
404
404
405
- function init_cacheval (alg:: GenericFactorization{typeof(lu)} , A, b, u, Pl, Pr,
405
+ function init_cacheval (alg:: GenericFactorization{typeof(lu)} , A:: AbstractMatrix , b, u, Pl, Pr,
406
406
maxiters:: Int ,
407
407
abstol, reltol, verbose:: Bool , assumptions:: OperatorAssumptions )
408
- ArrayInterface. lu_instance (convert (AbstractMatrix, A) )
408
+ ArrayInterface. lu_instance (A )
409
409
end
410
- function init_cacheval (alg:: GenericFactorization{typeof(lu!)} , A, b, u, Pl, Pr,
410
+ function init_cacheval (alg:: GenericFactorization{typeof(lu!)} , A:: AbstractMatrix , b, u, Pl, Pr,
411
411
maxiters:: Int ,
412
412
abstol, reltol, verbose:: Bool , assumptions:: OperatorAssumptions )
413
- ArrayInterface. lu_instance (convert (AbstractMatrix, A) )
413
+ ArrayInterface. lu_instance (A )
414
414
end
415
415
416
416
function init_cacheval (alg:: GenericFactorization{typeof(lu)} ,
@@ -445,16 +445,36 @@ function init_cacheval(alg::GenericFactorization{typeof(lu!)}, A::Tridiagonal, b
445
445
assumptions:: OperatorAssumptions )
446
446
ArrayInterface. lu_instance (A)
447
447
end
448
+ function init_cacheval (alg:: GenericFactorization{typeof(lu!)} , A:: SymTridiagonal{T, V} , b, u, Pl, Pr,
449
+ maxiters:: Int , abstol, reltol, verbose:: Bool ,
450
+ assumptions:: OperatorAssumptions ) where {T, V}
451
+ LinearAlgebra. LDLt {T, SymTridiagonal{T, V}} (A)
452
+ end
453
+ function init_cacheval (alg:: GenericFactorization{typeof(lu)} , A:: SymTridiagonal{T, V} , b, u, Pl, Pr,
454
+ maxiters:: Int , abstol, reltol, verbose:: Bool ,
455
+ assumptions:: OperatorAssumptions ) where {T, V}
456
+ LinearAlgebra. LDLt {T, SymTridiagonal{T, V}} (A)
457
+ end
448
458
449
- function init_cacheval (alg:: GenericFactorization{typeof(qr)} , A, b, u, Pl, Pr,
459
+ function init_cacheval (alg:: GenericFactorization{typeof(qr)} , A:: AbstractMatrix , b, u, Pl, Pr,
450
460
maxiters:: Int ,
451
461
abstol, reltol, verbose:: Bool , assumptions:: OperatorAssumptions )
452
- ArrayInterface. qr_instance (convert (AbstractMatrix, A) )
462
+ ArrayInterface. qr_instance (A )
453
463
end
454
- function init_cacheval (alg:: GenericFactorization{typeof(qr!)} , A, b, u, Pl, Pr,
464
+ function init_cacheval (alg:: GenericFactorization{typeof(qr!)} , A:: AbstractMatrix , b, u, Pl, Pr,
455
465
maxiters:: Int ,
456
466
abstol, reltol, verbose:: Bool , assumptions:: OperatorAssumptions )
457
- ArrayInterface. qr_instance (convert (AbstractMatrix, A))
467
+ ArrayInterface. qr_instance (A)
468
+ end
469
+ function init_cacheval (alg:: GenericFactorization{typeof(qr)} , A:: SymTridiagonal{T, V} , b, u, Pl, Pr,
470
+ maxiters:: Int , abstol, reltol, verbose:: Bool ,
471
+ assumptions:: OperatorAssumptions ) where {T, V}
472
+ LinearAlgebra. LDLt {T, SymTridiagonal{T, V}} (A)
473
+ end
474
+ function init_cacheval (alg:: GenericFactorization{typeof(qr!)} , A:: SymTridiagonal{T, V} , b, u, Pl, Pr,
475
+ maxiters:: Int , abstol, reltol, verbose:: Bool ,
476
+ assumptions:: OperatorAssumptions ) where {T, V}
477
+ LinearAlgebra. LDLt {T, SymTridiagonal{T, V}} (A)
458
478
end
459
479
460
480
function init_cacheval (alg:: GenericFactorization{typeof(qr)} ,
@@ -490,15 +510,15 @@ function init_cacheval(alg::GenericFactorization{typeof(qr!)}, A::Tridiagonal, b
490
510
ArrayInterface. qr_instance (A)
491
511
end
492
512
493
- function init_cacheval (alg:: GenericFactorization{typeof(svd)} , A, b, u, Pl, Pr,
513
+ function init_cacheval (alg:: GenericFactorization{typeof(svd)} , A:: AbstractMatrix , b, u, Pl, Pr,
494
514
maxiters:: Int ,
495
515
abstol, reltol, verbose:: Bool , assumptions:: OperatorAssumptions )
496
- ArrayInterface. svd_instance (convert (AbstractMatrix, A) )
516
+ ArrayInterface. svd_instance (A )
497
517
end
498
- function init_cacheval (alg:: GenericFactorization{typeof(svd!)} , A, b, u, Pl, Pr,
518
+ function init_cacheval (alg:: GenericFactorization{typeof(svd!)} , A:: AbstractMatrix , b, u, Pl, Pr,
499
519
maxiters:: Int ,
500
520
abstol, reltol, verbose:: Bool , assumptions:: OperatorAssumptions )
501
- ArrayInterface. svd_instance (convert (AbstractMatrix, A) )
521
+ ArrayInterface. svd_instance (A )
502
522
end
503
523
504
524
function init_cacheval (alg:: GenericFactorization{typeof(svd)} ,
@@ -534,6 +554,16 @@ function init_cacheval(alg::GenericFactorization{typeof(svd!)}, A::Tridiagonal,
534
554
assumptions:: OperatorAssumptions )
535
555
ArrayInterface. svd_instance (A)
536
556
end
557
+ function init_cacheval (alg:: GenericFactorization{typeof(svd!)} , A:: SymTridiagonal{T, V} , b, u, Pl, Pr,
558
+ maxiters:: Int , abstol, reltol, verbose:: Bool ,
559
+ assumptions:: OperatorAssumptions ) where {T, V}
560
+ LinearAlgebra. LDLt {T, SymTridiagonal{T, V}} (A)
561
+ end
562
+ function init_cacheval (alg:: GenericFactorization{typeof(svd)} , A:: SymTridiagonal{T, V} , b, u, Pl, Pr,
563
+ maxiters:: Int , abstol, reltol, verbose:: Bool ,
564
+ assumptions:: OperatorAssumptions ) where {T, V}
565
+ LinearAlgebra. LDLt {T, SymTridiagonal{T, V}} (A)
566
+ end
537
567
538
568
function init_cacheval (alg:: GenericFactorization , A:: Diagonal , b, u, Pl, Pr, maxiters:: Int ,
539
569
abstol, reltol, verbose:: Bool , assumptions:: OperatorAssumptions )
@@ -549,6 +579,18 @@ function init_cacheval(alg::GenericFactorization, A::SymTridiagonal{T, V}, b, u,
549
579
assumptions:: OperatorAssumptions ) where {T, V}
550
580
LinearAlgebra. LDLt {T, SymTridiagonal{T, V}} (A)
551
581
end
582
+ function init_cacheval (alg:: GenericFactorization , A, b, u, Pl, Pr,
583
+ maxiters:: Int ,
584
+ abstol, reltol, verbose:: Bool , assumptions:: OperatorAssumptions )
585
+ init_cacheval (alg, convert (AbstractMatrix, A), b, u, Pl, Pr,
586
+ maxiters:: Int , abstol, reltol, verbose:: Bool ,
587
+ assumptions:: OperatorAssumptions )
588
+ end
589
+ function init_cacheval (alg:: GenericFactorization , A:: AbstractMatrix , b, u, Pl, Pr,
590
+ maxiters:: Int ,
591
+ abstol, reltol, verbose:: Bool , assumptions:: OperatorAssumptions )
592
+ do_factorization (alg, A, b, u)
593
+ end
552
594
553
595
function init_cacheval (alg:: Union {GenericFactorization{typeof (bunchkaufman!)},
554
596
GenericFactorization{typeof (bunchkaufman)}},
@@ -573,15 +615,49 @@ end
573
615
# Try to never use it.
574
616
575
617
# Cholesky needs the posdef matrix, for GenericFactorization assume structure is needed
576
- function init_cacheval (alg:: Union {GenericFactorization{typeof (cholesky)},
577
- GenericFactorization{typeof (cholesky!)}}, A, b, u, Pl, Pr,
578
- maxiters:: Int , abstol, reltol, verbose:: Bool ,
618
+ function init_cacheval (alg:: GenericFactorization{typeof(cholesky)} , A:: AbstractMatrix , b, u, Pl, Pr,
619
+ maxiters:: Int , abstol, reltol, verbose:: Bool ,
620
+ assumptions:: OperatorAssumptions )
621
+ newA = copy (convert (AbstractMatrix, A))
622
+ do_factorization (alg, newA, b, u)
623
+ end
624
+ function init_cacheval (alg:: GenericFactorization{typeof(cholesky!)} , A:: AbstractMatrix , b, u, Pl, Pr,
625
+ maxiters:: Int , abstol, reltol, verbose:: Bool ,
579
626
assumptions:: OperatorAssumptions )
580
627
newA = copy (convert (AbstractMatrix, A))
581
628
do_factorization (alg, newA, b, u)
582
629
end
630
+ function init_cacheval (alg:: GenericFactorization{typeof(cholesky!)} , A:: Diagonal , b, u, Pl, Pr, maxiters:: Int ,
631
+ abstol, reltol, verbose:: Bool , assumptions:: OperatorAssumptions )
632
+ Diagonal (inv .(A. diag))
633
+ end
634
+ function init_cacheval (alg:: GenericFactorization{typeof(cholesky!)} , A:: Tridiagonal , b, u, Pl, Pr,
635
+ maxiters:: Int ,
636
+ abstol, reltol, verbose:: Bool , assumptions:: OperatorAssumptions )
637
+ ArrayInterface. lu_instance (A)
638
+ end
639
+ function init_cacheval (alg:: GenericFactorization{typeof(cholesky!)} , A:: SymTridiagonal{T, V} , b, u, Pl, Pr,
640
+ maxiters:: Int , abstol, reltol, verbose:: Bool ,
641
+ assumptions:: OperatorAssumptions ) where {T, V}
642
+ LinearAlgebra. LDLt {T, SymTridiagonal{T, V}} (A)
643
+ end
644
+ function init_cacheval (alg:: GenericFactorization{typeof(cholesky)} , A:: Diagonal , b, u, Pl, Pr, maxiters:: Int ,
645
+ abstol, reltol, verbose:: Bool , assumptions:: OperatorAssumptions )
646
+ Diagonal (inv .(A. diag))
647
+ end
648
+ function init_cacheval (alg:: GenericFactorization{typeof(cholesky)} , A:: Tridiagonal , b, u, Pl, Pr,
649
+ maxiters:: Int ,
650
+ abstol, reltol, verbose:: Bool , assumptions:: OperatorAssumptions )
651
+ ArrayInterface. lu_instance (A)
652
+ end
653
+ function init_cacheval (alg:: GenericFactorization{typeof(cholesky)} , A:: SymTridiagonal{T, V} , b, u, Pl, Pr,
654
+ maxiters:: Int , abstol, reltol, verbose:: Bool ,
655
+ assumptions:: OperatorAssumptions ) where {T, V}
656
+ LinearAlgebra. LDLt {T, SymTridiagonal{T, V}} (A)
657
+ end
658
+
583
659
584
- function init_cacheval (alg:: Union{ GenericFactorization} ,
660
+ function init_cacheval (alg:: GenericFactorization ,
585
661
A:: Union {Hermitian{T, <: SparseMatrixCSC },
586
662
Symmetric{T, <: SparseMatrixCSC }}, b, u, Pl, Pr,
587
663
maxiters:: Int , abstol, reltol, verbose:: Bool ,
@@ -1063,21 +1139,29 @@ end
1063
1139
# but QRFactorization uses 16.
1064
1140
FastQRFactorization () = FastQRFactorization (NoPivot (), 36 )
1065
1141
1066
- function init_cacheval (alg:: FastQRFactorization{NoPivot} , A, b, u, Pl, Pr,
1142
+ function init_cacheval (alg:: FastQRFactorization{NoPivot} , A:: AbstractMatrix , b, u, Pl, Pr,
1067
1143
maxiters:: Int , abstol, reltol, verbose:: Bool ,
1068
1144
assumptions:: OperatorAssumptions )
1069
1145
ws = QRWYWs (A; blocksize = alg. blocksize)
1070
1146
return WorkspaceAndFactors (ws,
1071
1147
ArrayInterface. qr_instance (convert (AbstractMatrix, A)))
1072
1148
end
1073
- function init_cacheval (:: FastQRFactorization{ColumnNorm} , A, b, u, Pl, Pr,
1149
+ function init_cacheval (:: FastQRFactorization{ColumnNorm} , A:: AbstractMatrix , b, u, Pl, Pr,
1074
1150
maxiters:: Int , abstol, reltol, verbose:: Bool ,
1075
1151
assumptions:: OperatorAssumptions )
1076
1152
ws = QRpWs (A)
1077
1153
return WorkspaceAndFactors (ws,
1078
1154
ArrayInterface. qr_instance (convert (AbstractMatrix, A)))
1079
1155
end
1080
1156
1157
+ function init_cacheval (alg:: FastQRFactorization , A, b, u, Pl, Pr,
1158
+ maxiters:: Int , abstol, reltol, verbose:: Bool ,
1159
+ assumptions:: OperatorAssumptions )
1160
+ return init_cacheval (alg, convert (AbstractMatrix, A), b, u, Pl, Pr,
1161
+ maxiters:: Int , abstol, reltol, verbose:: Bool ,
1162
+ assumptions:: OperatorAssumptions )
1163
+ end
1164
+
1081
1165
function SciMLBase. solve! (cache:: LinearCache , alg:: FastQRFactorization{P} ;
1082
1166
kwargs... ) where {P}
1083
1167
A = cache. A
@@ -1184,4 +1268,4 @@ for alg in InteractiveUtils.subtypes(AbstractFactorization)
1184
1268
maxiters:: Int , abstol, reltol, verbose:: Bool ,
1185
1269
assumptions:: OperatorAssumptions )
1186
1270
end
1187
- end
1271
+ end
0 commit comments