@@ -622,21 +622,25 @@ else
622
622
end
623
623
624
624
"""
625
- qr_instance(A) -> qr_factorization_instance
625
+ qr_instance(A, pivot = NoPivot() ) -> qr_factorization_instance
626
626
627
627
Returns an instance of the QR factorization object with the correct type
628
628
cheaply.
629
629
"""
630
- function qr_instance (A:: Matrix{T} ) where {T}
631
- LinearAlgebra. QRCompactWY (zeros (T,0 ,0 ),zeros (T,0 ,0 ))
630
+ function qr_instance (A:: Matrix{T} ,pivot = DEFAULT_CHOLESKY_PIVOT) where {T}
631
+ if pivot === DEFAULT_CHOLESKY_PIVOT
632
+ LinearAlgebra. QRCompactWY (zeros (T,0 ,0 ),zeros (T,0 ,0 ))
633
+ else
634
+ LinearAlgebra. QRPivoted (zeros (T,0 ,0 ),zeros (T,0 ),zeros (Int,0 ))
635
+ end
632
636
end
633
637
634
- function qr_instance (A:: Matrix{BigFloat} )
638
+ function qr_instance (A:: Matrix{BigFloat} ,pivot = DEFAULT_CHOLESKY_PIVOT )
635
639
LinearAlgebra. QR (zeros (BigFloat,0 ,0 ),zeros (BigFloat,0 ))
636
640
end
637
641
638
642
# Could be optimized but this should work for any real case.
639
- function qr_instance (jac_prototype:: SparseMatrixCSC )
643
+ function qr_instance (jac_prototype:: SparseMatrixCSC , pivot = DEFAULT_CHOLESKY_PIVOT )
640
644
qr (sparse (rand (1 ,1 )))
641
645
end
642
646
@@ -645,15 +649,15 @@ end
645
649
646
650
Returns the number.
647
651
"""
648
- qr_instance (a:: Number ) = a
652
+ qr_instance (a:: Number , pivot = DEFAULT_CHOLESKY_PIVOT ) = a
649
653
650
654
"""
651
655
qr_instance(a::Any) -> qr(a)
652
656
653
657
Slow fallback which gets the instance via factorization. Should get
654
658
specialized for new matrix types.
655
659
"""
656
- qr_instance (a:: Any ) = qr (a)# check = false)
660
+ qr_instance (a:: Any , pivot = DEFAULT_CHOLESKY_PIVOT ) = qr (a)# check = false)
657
661
658
662
"""
659
663
svd_instance(A) -> qr_factorization_instance
0 commit comments