@@ -440,17 +440,32 @@ 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 Bunch-Kaufman 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 )
443
+ @static if VERSION > v " 1.9-"
444
+ """
445
+ bunchkaufman_instance(A, pivot = LinearAlgebra.RowMaximum()) -> bunchkaufman_factorization_instance
446
+
447
+ Returns an instance of the Bunch-Kaufman factorization object with the correct type
448
+ cheaply.
449
+ """
450
+ function bunchkaufman_instance (A:: Matrix{T} ) where T
451
+ return bunchkaufman (similar (A, 0 , 0 ), check = false )
452
+ end
453
+ function bunchkaufman_instance (A:: SparseMatrixCSC )
454
+ bunchkaufman (sparse (similar (A, 1 , 1 )), check = false )
455
+ end
456
+ else
457
+ """
458
+ bunchkaufman_instance(A, pivot = LinearAlgebra.RowMaximum()) -> bunchkaufman_factorization_instance
459
+
460
+ Returns an instance of the Bunch-Kaufman factorization object with the correct type
461
+ cheaply.
462
+ """
463
+ function bunchkaufman_instance (A:: Matrix{T} ) where T
464
+ return bunchkaufman (similar (A, 0 , 0 ))
465
+ end
466
+ function bunchkaufman_instance (A:: SparseMatrixCSC )
467
+ bunchkaufman (sparse (similar (A, 1 , 1 )))
468
+ end
454
469
end
455
470
456
471
"""
@@ -473,18 +488,34 @@ else
473
488
const DEFAULT_CHOLESKY_PIVOT = LinearAlgebra. NoPivot ()
474
489
end
475
490
476
- """
477
- cholesky_instance(A, pivot = LinearAlgebra.RowMaximum()) -> cholesky_factorization_instance
491
+ @static if VERSION > v " 1.9-"
492
+ """
493
+ cholesky_instance(A, pivot = LinearAlgebra.RowMaximum()) -> cholesky_factorization_instance
478
494
479
- Returns an instance of the Cholesky factorization object with the correct type
480
- cheaply.
481
- """
482
- function cholesky_instance (A:: Matrix{T} , pivot = DEFAULT_CHOLESKY_PIVOT) where {T}
483
- return cholesky (similar (A, 0 , 0 ), pivot, check = false )
484
- end
495
+ Returns an instance of the Cholesky factorization object with the correct type
496
+ cheaply.
497
+ """
498
+ function cholesky_instance (A:: Matrix{T} , pivot = DEFAULT_CHOLESKY_PIVOT) where {T}
499
+ return cholesky (similar (A, 0 , 0 ), pivot, check = false )
500
+ end
501
+
502
+ function cholesky_instance (A:: Union{SparseMatrixCSC,Symmetric{<:Number,<:SparseMatrixCSC}} , pivot = DEFAULT_CHOLESKY_PIVOT)
503
+ cholesky (sparse (similar (A, 1 , 1 )), check = false )
504
+ end
505
+ else
506
+ """
507
+ cholesky_instance(A, pivot = LinearAlgebra.RowMaximum()) -> cholesky_factorization_instance
508
+
509
+ Returns an instance of the Cholesky factorization object with the correct type
510
+ cheaply.
511
+ """
512
+ function cholesky_instance (A:: Matrix{T} , pivot = DEFAULT_CHOLESKY_PIVOT) where {T}
513
+ return cholesky (similar (A, 0 , 0 ), pivot)
514
+ end
485
515
486
- function cholesky_instance (A:: Union{SparseMatrixCSC,Symmetric{<:Number,<:SparseMatrixCSC}} , pivot = DEFAULT_CHOLESKY_PIVOT)
487
- cholesky (sparse (similar (A, 1 , 1 )), check = false )
516
+ function cholesky_instance (A:: Union{SparseMatrixCSC,Symmetric{<:Number,<:SparseMatrixCSC}} , pivot = DEFAULT_CHOLESKY_PIVOT)
517
+ cholesky (sparse (similar (A, 1 , 1 )))
518
+ end
488
519
end
489
520
490
521
"""
@@ -494,13 +525,23 @@ Returns the number.
494
525
"""
495
526
cholesky_instance (a:: Number , pivot = DEFAULT_CHOLESKY_PIVOT) = a
496
527
497
- """
498
- cholesky_instance(a::Any, pivot = LinearAlgebra.RowMaximum()) -> cholesky(a, check=false)
499
-
500
- Slow fallback which gets the instance via factorization. Should get
501
- specialized for new matrix types.
502
- """
503
- cholesky_instance (a:: Any , pivot = DEFAULT_CHOLESKY_PIVOT) = cholesky (a, pivot, check = false )
528
+ @static if VERSION > v " 1.9-"
529
+ """
530
+ cholesky_instance(a::Any, pivot = LinearAlgebra.RowMaximum()) -> cholesky(a, check=false)
531
+
532
+ Slow fallback which gets the instance via factorization. Should get
533
+ specialized for new matrix types.
534
+ """
535
+ cholesky_instance (a:: Any , pivot = DEFAULT_CHOLESKY_PIVOT) = cholesky (a, pivot, check = false )
536
+ else
537
+ """
538
+ cholesky_instance(a::Any, pivot = LinearAlgebra.RowMaximum()) -> cholesky(a, check=false)
539
+
540
+ Slow fallback which gets the instance via factorization. Should get
541
+ specialized for new matrix types.
542
+ """
543
+ cholesky_instance (a:: Any , pivot = DEFAULT_CHOLESKY_PIVOT) = cholesky (a, pivot)
544
+ end
504
545
505
546
"""
506
547
ldlt_instance(A) -> ldlt_factorization_instance
@@ -511,8 +552,15 @@ cheaply.
511
552
function ldlt_instance (A:: Matrix{T} ) where {T}
512
553
return ldlt (SymTridiagonal (similar (A, 0 , 0 )))
513
554
end
514
- function ldlt_instance (A:: SparseMatrixCSC )
515
- ldlt (sparse (similar (A, 1 , 1 )), check= false )
555
+
556
+ @static if VERSION > v " 1.9-"
557
+ function ldlt_instance (A:: SparseMatrixCSC )
558
+ ldlt (sparse (similar (A, 1 , 1 )), check= false )
559
+ end
560
+ else
561
+ function ldlt_instance (A:: SparseMatrixCSC )
562
+ ldlt (sparse (similar (A, 1 , 1 )))
563
+ end
516
564
end
517
565
518
566
"""
@@ -565,13 +613,23 @@ Returns the number.
565
613
"""
566
614
lu_instance (a:: Number ) = a
567
615
568
- """
616
+ @static if VERSION > v " 1.9-"
617
+ """
618
+ lu_instance(a::Any) -> lu(a, check=false)
619
+
620
+ Slow fallback which gets the instance via factorization. Should get
621
+ specialized for new matrix types.
622
+ """
623
+ lu_instance (a:: Any ) = lu (a, check = false )
624
+ else
625
+ """
569
626
lu_instance(a::Any) -> lu(a, check=false)
570
627
571
- Slow fallback which gets the instance via factorization. Should get
572
- specialized for new matrix types.
573
- """
574
- lu_instance (a:: Any ) = lu (a, check = false )
628
+ Slow fallback which gets the instance via factorization. Should get
629
+ specialized for new matrix types.
630
+ """
631
+ lu_instance (a:: Any ) = lu (a)
632
+ end
575
633
576
634
"""
577
635
qr_instance(A) -> qr_factorization_instance
0 commit comments