@@ -440,6 +440,33 @@ matrix_colors(A::Bidiagonal) = _cycle(1:2, Base.size(A, 2))
440
440
matrix_colors (A:: Union{Tridiagonal, SymTridiagonal} ) = _cycle (1 : 3 , Base. size (A, 2 ))
441
441
_cycle (repetend, len) = repeat (repetend, div (len, length (repetend)) + 1 )[1 : len]
442
442
443
+ """
444
+ bunchkaufman_instance(A, pivot = LinearAlgebra.RowMaximum()) -> bunchkaufman_factorization_instance
445
+
446
+ Returns an instance of the Cholesky factorization object with the correct type
447
+ cheaply.
448
+ """
449
+ function bunchkaufman_instance (A:: Matrix{T} ) where T
450
+ return bunchkaufman (similar (A, 0 , 0 ), check = false )
451
+ end
452
+ function bunchkaufman_instance (A:: SparseMatrixCSC )
453
+ bunchkaufman (sparse (similar (A, 1 , 1 )), check = false )
454
+ end
455
+
456
+ """
457
+ bunchkaufman_instance(a::Number) -> a
458
+
459
+ Returns the number.
460
+ """
461
+ bunchkaufman_instance (a:: Number ) = a
462
+
463
+ """
464
+ bunchkaufman_instance(a::Any) -> cholesky(a, check=false)
465
+
466
+ Returns the number.
467
+ """
468
+ bunchkaufman_instance (a:: Any ) = bunchkaufman (a, check = false )
469
+
443
470
"""
444
471
cholesky_instance(A, pivot = LinearAlgebra.RowMaximum()) -> cholesky_factorization_instance
445
472
@@ -463,10 +490,39 @@ cholesky_instance(a::Number, pivot = LinearAlgebra.RowMaximum()) = a
463
490
"""
464
491
cholesky_instance(a::Any, pivot = LinearAlgebra.RowMaximum()) -> cholesky(a, check=false)
465
492
466
- Returns the number.
493
+ Slow fallback which gets the instance via factorization. Should get
494
+ specialized for new matrix types.
467
495
"""
468
496
cholesky_instance (a:: Any , pivot = LinearAlgebra. RowMaximum ()) = cholesky (a, pivot, check = false )
469
497
498
+ """
499
+ ldlt_instance(A) -> ldlt_factorization_instance
500
+
501
+ Returns an instance of the LDLT factorization object with the correct type
502
+ cheaply.
503
+ """
504
+ function ldlt_instance (A:: Matrix{T} ) where {T}
505
+ return ldlt (SymTridiagonal (similar (A, 0 , 0 )), check = false )
506
+ end
507
+ function ldlt_instance (A:: SparseMatrixCSC )
508
+ ldlt (sparse (similar (A, 1 , 1 )), check = false )
509
+ end
510
+
511
+ """
512
+ ldlt_instance(a::Number) -> a
513
+
514
+ Returns the number.
515
+ """
516
+ ldlt_instance (a:: Number ) = a
517
+
518
+ """
519
+ ldlt_instance(a::Any) -> ldlt(a, check=false)
520
+
521
+ Slow fallback which gets the instance via factorization. Should get
522
+ specialized for new matrix types.
523
+ """
524
+ ldlt_instance (a:: Any ) = ldlt (a)
525
+
470
526
"""
471
527
lu_instance(A) -> lu_factorization_instance
472
528
@@ -505,7 +561,8 @@ lu_instance(a::Number) = a
505
561
"""
506
562
lu_instance(a::Any) -> lu(a, check=false)
507
563
508
- Returns the number.
564
+ Slow fallback which gets the instance via factorization. Should get
565
+ specialized for new matrix types.
509
566
"""
510
567
lu_instance (a:: Any ) = lu (a, check = false )
511
568
@@ -534,7 +591,8 @@ qr_instance(a::Number) = a
534
591
"""
535
592
qr_instance(a::Any) -> qr(a)
536
593
537
- Returns the number.
594
+ Slow fallback which gets the instance via factorization. Should get
595
+ specialized for new matrix types.
538
596
"""
539
597
qr_instance (a:: Any ) = qr (a)# check = false)
540
598
@@ -558,7 +616,8 @@ svd_instance(a::Number) = a
558
616
"""
559
617
svd_instance(a::Any) -> svd(a)
560
618
561
- Returns the number.
619
+ Slow fallback which gets the instance via factorization. Should get
620
+ specialized for new matrix types.
562
621
"""
563
622
svd_instance (a:: Any ) = svd (a) # check = false)
564
623
0 commit comments