@@ -306,21 +306,25 @@ function materialize!(M::Rmul{<:Any,<:AdjQRPackedQLayout})
306306end
307307
308308
309- __qr (layout, lengths, A; kwds... ) = invoke (qr, Tuple{AbstractMatrix{eltype (A)}}, A; kwds... )
310- _qr (layout, axes, A; kwds... ) = __qr (layout, map (length, axes), A; kwds... )
311- _qr (layout, axes, A, pivot:: P ; kwds... ) where P = invoke (qr, Tuple{AbstractMatrix{eltype (A)},P}, A, pivot; kwds... )
312- _qr! (layout, axes, A, args... ; kwds... ) = error (LazyString (" Overload _qr!(::" , typeof (layout), " , axes, A)" ))
313- _lu (layout, axes, A; kwds... ) = invoke (lu, Tuple{AbstractMatrix{eltype (A)}}, A; kwds... )
314- _lu (layout, axes, A, pivot:: P ; kwds... ) where P = invoke (lu, Tuple{AbstractMatrix{eltype (A)},P}, A, pivot; kwds... )
315- _lu! (layout, axes, A, args... ; kwds... ) = error (LazyString (" Overload _lu!(::" , typeof (layout), " , axes, A)" ))
316- _cholesky (layout, axes, A, :: CNoPivot = CNoPivot (); check:: Bool = true ) = cholesky! (cholcopy (A); check = check)
317- _cholesky (layout, axes, A, :: CRowMaximum ; tol = 0.0 , check:: Bool = true ) = cholesky! (cholcopy (A), CRowMaximum (); tol = tol, check = check)
318- _factorize (layout, axes, A) = qr (A) # Default to QR
319-
320-
321- _factorize (:: AbstractStridedLayout , axes, A) = lu (A)
309+
310+ _qr_layout (layout, lengths, A; kwds... ) = invoke (qr, Tuple{AbstractMatrix{eltype (A)}}, A; kwds... )
311+ qr_layout (layout, axes, A; kwds... ) = _qr_layout (layout, map (length, axes), A; kwds... )
312+ qr_layout (layout, axes, A, pivot:: P ; kwds... ) where P = invoke (qr, Tuple{AbstractMatrix{eltype (A)},P}, A, pivot; kwds... )
313+ qr!_layout (layout, axes, A, args... ; kwds... ) = error (LazyString (" Overload qr!_layout(::" , typeof (layout), " , axes, A)" ))
314+ lu_layout (layout, axes, A; kwds... ) = invoke (lu, Tuple{AbstractMatrix{eltype (A)}}, A; kwds... )
315+ lu_layout (layout, axes, A, pivot:: P ; kwds... ) where P = invoke (lu, Tuple{AbstractMatrix{eltype (A)},P}, A, pivot; kwds... )
316+ lu!_layout (layout, axes, A, args... ; kwds... ) = error (LazyString (" Overload lu!_layout(::" , typeof (layout), " , axes, A)" ))
317+ cholesky_layout (layout, axes, A, :: CNoPivot = CNoPivot (); check:: Bool = true ) = cholesky! (cholcopy (A); check = check)
318+ cholesky_layout (layout, axes, A, :: CRowMaximum ; tol = 0.0 , check:: Bool = true ) = cholesky! (cholcopy (A), CRowMaximum (); tol = tol, check = check)
319+
320+
321+
322+ factorize_layout (layout, axes, A) = qr (A) # Default to QR
323+
324+
325+ factorize_layout (:: AbstractStridedLayout , axes, A) = lu (A)
322326if VERSION < v " 1.8-"
323- function _lu! (:: AbstractColumnMajor , axes, A:: AbstractMatrix{T} , pivot:: Union{NoPivot, RowMaximum} = RowMaximum ();
327+ function lu!_layout (:: AbstractColumnMajor , axes, A:: AbstractMatrix{T} , pivot:: Union{NoPivot, RowMaximum} = RowMaximum ();
324328 check:: Bool = true ) where T<: BlasFloat
325329 if pivot === NoPivot ()
326330 return generic_lufact! (A, pivot; check = check)
@@ -330,7 +334,7 @@ if VERSION < v"1.8-"
330334 return LU {T,typeof(A)} (lpt[1 ], lpt[2 ], lpt[3 ])
331335 end
332336else
333- function _lu! (:: AbstractColumnMajor , axes, A:: AbstractMatrix{T} , pivot:: Union{NoPivot, RowMaximum} = RowMaximum ();
337+ function lu!_layout (:: AbstractColumnMajor , axes, A:: AbstractMatrix{T} , pivot:: Union{NoPivot, RowMaximum} = RowMaximum ();
334338 check:: Bool = true ) where T<: BlasFloat
335339 if pivot === NoPivot ()
336340 return generic_lufact! (A, pivot; check = check)
@@ -375,13 +379,13 @@ end
375379
376380_chol! (_, A, UL) = LinearAlgebra. _chol! (A, UL)
377381
378- function _cholesky! (layout, axes, A:: RealHermSymComplexHerm , :: CNoPivot ; check:: Bool = true )
382+ function cholesky!_layout (layout, axes, A:: RealHermSymComplexHerm , :: CNoPivot ; check:: Bool = true )
379383 C, info = _chol! (layout, A. data, A. uplo == ' U' ? UpperTriangular : LowerTriangular)
380384 check && LinearAlgebra. checkpositivedefinite (info)
381385 return Cholesky (C. data, A. uplo, info)
382386end
383387
384- function _cholesky! (:: SymmetricLayout{<:AbstractColumnMajor} , axes, A:: AbstractMatrix{<:BlasReal} ,
388+ function cholesky!_layout (:: SymmetricLayout{<:AbstractColumnMajor} , axes, A:: AbstractMatrix{<:BlasReal} ,
385389 :: CRowMaximum ; tol = 0.0 , check:: Bool = true )
386390 AA, piv, rank, info = LAPACK. pstrf! (A. uplo, A. data, tol)
387391 if VERSION < v " 1.8"
@@ -401,7 +405,7 @@ function _inv_eye(A, ::Type{T}, (rows,cols)) where T
401405 dest
402406end
403407
404- function _inv (layout, axes, A)
408+ function inv_layout (layout, axes, A)
405409 T = eltype (A)
406410 (rows,cols) = axes
407411 n = checksquare (A)
@@ -414,17 +418,17 @@ end
414418
415419macro _layoutfactorizations (Typ)
416420 esc (quote
417- LinearAlgebra. cholesky (A:: $Typ , v:: ArrayLayouts.CNoPivot = ArrayLayouts. CNoPivot (); kwds... ) = ArrayLayouts. _cholesky (ArrayLayouts. MemoryLayout (A), axes (A), A, v; kwds... )
418- LinearAlgebra. cholesky (A:: $Typ , v:: ArrayLayouts.CRowMaximum ; kwds... ) = ArrayLayouts. _cholesky (ArrayLayouts. MemoryLayout (A), axes (A), A, v; kwds... )
419- LinearAlgebra. cholesky! (A:: LinearAlgebra.RealHermSymComplexHerm{<:Real,<:$Typ} , v:: ArrayLayouts.CNoPivot = ArrayLayouts. CNoPivot (); check:: Bool = true ) = ArrayLayouts. _cholesky! (ArrayLayouts. MemoryLayout (A), axes (A), A, v; check= check)
420- LinearAlgebra. cholesky! (A:: LinearAlgebra.RealHermSymComplexHerm{<:Real,<:$Typ} , v:: ArrayLayouts.CRowMaximum ; check:: Bool = true , tol = 0.0 ) = ArrayLayouts. _cholesky! (ArrayLayouts. MemoryLayout (A), axes (A), A, v; check= check, tol= tol)
421- LinearAlgebra. qr (A:: $Typ , args... ; kwds... ) = ArrayLayouts. _qr (ArrayLayouts. MemoryLayout (A), axes (A), A, args... ; kwds... )
422- LinearAlgebra. qr! (A:: $Typ , args... ; kwds... ) = ArrayLayouts. _qr! (ArrayLayouts. MemoryLayout (A), axes (A), A, args... ; kwds... )
423- LinearAlgebra. lu (A:: $Typ , pivot:: Union{ArrayLayouts.NoPivot,ArrayLayouts.RowMaximum} ; kwds... ) = ArrayLayouts. _lu (ArrayLayouts. MemoryLayout (A), axes (A), A, pivot; kwds... )
424- LinearAlgebra. lu (A:: $Typ{T} ; kwds... ) where T = ArrayLayouts. _lu (ArrayLayouts. MemoryLayout (A), axes (A), A; kwds... )
425- LinearAlgebra. lu! (A:: $Typ , args... ; kwds... ) = ArrayLayouts. _lu! (ArrayLayouts. MemoryLayout (A), axes (A), A, args... ; kwds... )
426- LinearAlgebra. factorize (A:: $Typ ) = ArrayLayouts. _factorize (ArrayLayouts. MemoryLayout (A), axes (A), A)
427- Base. inv (A:: $Typ ) = ArrayLayouts. _inv (ArrayLayouts. MemoryLayout (A), axes (A), A)
421+ LinearAlgebra. cholesky (A:: $Typ , v:: ArrayLayouts.CNoPivot = ArrayLayouts. CNoPivot (); kwds... ) = ArrayLayouts. cholesky_layout (ArrayLayouts. MemoryLayout (A), axes (A), A, v; kwds... )
422+ LinearAlgebra. cholesky (A:: $Typ , v:: ArrayLayouts.CRowMaximum ; kwds... ) = ArrayLayouts. cholesky_layout (ArrayLayouts. MemoryLayout (A), axes (A), A, v; kwds... )
423+ LinearAlgebra. cholesky! (A:: LinearAlgebra.RealHermSymComplexHerm{<:Real,<:$Typ} , v:: ArrayLayouts.CNoPivot = ArrayLayouts. CNoPivot (); check:: Bool = true ) = ArrayLayouts. cholesky!_layout (ArrayLayouts. MemoryLayout (A), axes (A), A, v; check= check)
424+ LinearAlgebra. cholesky! (A:: LinearAlgebra.RealHermSymComplexHerm{<:Real,<:$Typ} , v:: ArrayLayouts.CRowMaximum ; check:: Bool = true , tol = 0.0 ) = ArrayLayouts. cholesky!_layout (ArrayLayouts. MemoryLayout (A), axes (A), A, v; check= check, tol= tol)
425+ LinearAlgebra. qr (A:: $Typ , args... ; kwds... ) = ArrayLayouts. qr_layout (ArrayLayouts. MemoryLayout (A), axes (A), A, args... ; kwds... )
426+ LinearAlgebra. qr! (A:: $Typ , args... ; kwds... ) = ArrayLayouts. qr!_layout (ArrayLayouts. MemoryLayout (A), axes (A), A, args... ; kwds... )
427+ LinearAlgebra. lu (A:: $Typ , pivot:: Union{ArrayLayouts.NoPivot,ArrayLayouts.RowMaximum} ; kwds... ) = ArrayLayouts. lu_layout (ArrayLayouts. MemoryLayout (A), axes (A), A, pivot; kwds... )
428+ LinearAlgebra. lu (A:: $Typ{T} ; kwds... ) where T = ArrayLayouts. lu_layout (ArrayLayouts. MemoryLayout (A), axes (A), A; kwds... )
429+ LinearAlgebra. lu! (A:: $Typ , args... ; kwds... ) = ArrayLayouts. lu!_layout (ArrayLayouts. MemoryLayout (A), axes (A), A, args... ; kwds... )
430+ LinearAlgebra. factorize (A:: $Typ ) = ArrayLayouts. factorize_layout (ArrayLayouts. MemoryLayout (A), axes (A), A)
431+ Base. inv (A:: $Typ ) = ArrayLayouts. inv_layout (ArrayLayouts. MemoryLayout (A), axes (A), A)
428432 LinearAlgebra. ldiv! (L:: LU{<:Any,<:$Typ} , B) = ArrayLayouts. ldiv! (L, B)
429433 LinearAlgebra. ldiv! (L:: LU{<:Any,<:$Typ} , B:: $Typ ) = ArrayLayouts. ldiv! (L, B)
430434 end )
@@ -434,11 +438,20 @@ macro layoutfactorizations(Typ)
434438 esc (quote
435439 ArrayLayouts. @_layoutfactorizations $ Typ
436440 ArrayLayouts. @_layoutfactorizations SubArray{<: Any ,2 ,<: $Typ }
437- ArrayLayouts. @_layoutfactorizations LinearAlgebra. RealHermSymComplexHerm{<: Real ,<: $Typ }
438- ArrayLayouts. @_layoutfactorizations LinearAlgebra. RealHermSymComplexHerm{<: Real ,<: SubArray{<:Real,2,<:$Typ} }
441+ ArrayLayouts. @_layoutfactorizations ArrayLayouts. RealHermSymComplexHerm{<: Real ,<: $Typ }
442+ ArrayLayouts. @_layoutfactorizations ArrayLayouts. RealHermSymComplexHerm{<: Real ,<: SubArray{<:Real,2,<:$Typ} }
443+ ArrayLayouts. @_layoutfactorizations ArrayLayouts. LowerTriangular{<: Any ,<: $Typ }
444+ ArrayLayouts. @_layoutfactorizations ArrayLayouts. LowerTriangular{<: Any ,<: SubArray{<:Any,2,<:$Typ} }
445+ ArrayLayouts. @_layoutfactorizations ArrayLayouts. UpperTriangular{<: Any ,<: $Typ }
446+ ArrayLayouts. @_layoutfactorizations ArrayLayouts. UpperTriangular{<: Any ,<: SubArray{<:Any,2,<:$Typ} }
447+ ArrayLayouts. @_layoutfactorizations ArrayLayouts. UnitLowerTriangular{<: Any ,<: $Typ }
448+ ArrayLayouts. @_layoutfactorizations ArrayLayouts. UnitLowerTriangular{<: Any ,<: SubArray{<:Any,2,<:$Typ} }
449+ ArrayLayouts. @_layoutfactorizations ArrayLayouts. UnitUpperTriangular{<: Any ,<: $Typ }
450+ ArrayLayouts. @_layoutfactorizations ArrayLayouts. UnitUpperTriangular{<: Any ,<: SubArray{<:Any,2,<:$Typ} }
439451 end )
440452end
441453
454+
442455function ldiv! (C:: Cholesky{<:Any,<:AbstractMatrix} , B:: LayoutArray )
443456 if C. uplo == ' L'
444457 return ldiv! (adjoint (LowerTriangular (C. factors)), ldiv! (LowerTriangular (C. factors), B))
449462
450463LinearAlgebra. ldiv! (L:: LU{<:Any,<:LayoutMatrix} , B:: LayoutVector ) = ArrayLayouts. ldiv! (L, B)
451464
465+
466+
467+ # for back compatibility, TODO : deprecate
468+ const _factorize = factorize_layout
469+ const __qr = _qr_layout
470+ const _qr = qr_layout
471+ const _qr! = qr!_layout
472+ const _lu = lu_layout
473+ const _cholesky = cholesky_layout
474+ const _cholesky! = cholesky!_layout
475+ const _lu! = lu!_layout
476+ const _inv = inv_layout
0 commit comments