@@ -440,6 +440,89 @@ 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
+
470
+ """
471
+ cholesky_instance(A, pivot = LinearAlgebra.RowMaximum()) -> cholesky_factorization_instance
472
+
473
+ Returns an instance of the Cholesky factorization object with the correct type
474
+ cheaply.
475
+ """
476
+ function cholesky_instance (A:: Matrix{T} , pivot = LinearAlgebra. RowMaximum ()) where {T}
477
+ return cholesky (similar (A, 0 , 0 ), pivot, check = false )
478
+ end
479
+ function cholesky_instance (A:: SparseMatrixCSC )
480
+ cholesky (sparse (similar (A, 1 , 1 )), check = false )
481
+ end
482
+
483
+ """
484
+ cholesky_instance(a::Number, pivot = LinearAlgebra.RowMaximum()) -> a
485
+
486
+ Returns the number.
487
+ """
488
+ cholesky_instance (a:: Number , pivot = LinearAlgebra. RowMaximum ()) = a
489
+
490
+ """
491
+ cholesky_instance(a::Any, pivot = LinearAlgebra.RowMaximum()) -> cholesky(a, check=false)
492
+
493
+ Slow fallback which gets the instance via factorization. Should get
494
+ specialized for new matrix types.
495
+ """
496
+ cholesky_instance (a:: Any , pivot = LinearAlgebra. RowMaximum ()) = cholesky (a, pivot, check = false )
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
+
443
526
"""
444
527
lu_instance(A) -> lu_factorization_instance
445
528
@@ -478,7 +561,8 @@ lu_instance(a::Number) = a
478
561
"""
479
562
lu_instance(a::Any) -> lu(a, check=false)
480
563
481
- Returns the number.
564
+ Slow fallback which gets the instance via factorization. Should get
565
+ specialized for new matrix types.
482
566
"""
483
567
lu_instance (a:: Any ) = lu (a, check = false )
484
568
@@ -507,7 +591,8 @@ qr_instance(a::Number) = a
507
591
"""
508
592
qr_instance(a::Any) -> qr(a)
509
593
510
- Returns the number.
594
+ Slow fallback which gets the instance via factorization. Should get
595
+ specialized for new matrix types.
511
596
"""
512
597
qr_instance (a:: Any ) = qr (a)# check = false)
513
598
@@ -531,7 +616,8 @@ svd_instance(a::Number) = a
531
616
"""
532
617
svd_instance(a::Any) -> svd(a)
533
618
534
- Returns the number.
619
+ Slow fallback which gets the instance via factorization. Should get
620
+ specialized for new matrix types.
535
621
"""
536
622
svd_instance (a:: Any ) = svd (a) # check = false)
537
623
0 commit comments