@@ -12,13 +12,8 @@ import LinearAlgebra: cholesky, cholesky!, norm, diag, eigvals!, eigvals, eigen!
1212 checknonsingular, ipiv2perm, copytri!, issuccess, RealHermSymComplexHerm,
1313 cholcopy, checkpositivedefinite, char_uplo, copymutable_oftype
1414
15- if VERSION ≥ v " 1.10-"
16- using LinearAlgebra: TransposeFactorization, AdjointFactorization
17- else
18- const TransposeFactorization = Transpose
19- const AdjointFactorization = Adjoint
2015
21- end
16+ using LinearAlgebra : TransposeFactorization, AdjointFactorization
2217
2318import Base: getindex, setindex!, * , + , - , == , < , <= , > ,
2419 >= , / , ^ , \ , transpose, showerror, reindex, checkbounds, @propagate_inbounds
@@ -53,6 +48,8 @@ const TransposeFact = isdefined(LinearAlgebra, :TransposeFactorization) ? Linear
5348# objects are flexible in size when multiplied from the left, or its adjoint
5449# from the right.
5550abstract type LayoutQ{T} <: AbstractQ{T} end
51+
52+
5653@_layoutlmul LayoutQ
5754@_layoutlmul AdjointQtype{<: Any ,<: LayoutQ }
5855@_layoutrmul LayoutQ
109106* (A:: AbstractTriangular , B:: LayoutQ ) = mul (A, B)
110107* (A:: AbstractTriangular , B:: AdjointQtype{<:Any,<:LayoutQ} ) = mul (A, B)
111108
112- if VERSION < v " 1.10-"
113- (* )(Q:: LayoutQ , b:: StridedVector ) = _mul (Q, b)
114- (* )(Q:: LayoutQ , B:: StridedMatrix ) = _mul (Q, B)
115- (* )(Q:: LayoutQ , B:: Adjoint{<:Any,<:StridedVecOrMat} ) = _mul (Q, B)
116- (* )(A:: StridedMatrix , adjQ:: AdjointQtype{<:Any,<:LayoutQ} ) = _mul (A, adjQ)
117- (* )(A:: Adjoint{<:Any,<:StridedMatrix} , adjQ:: AdjointQtype{<:Any,<:LayoutQ} ) = _mul (A, adjQ)
118-
119- Base. @propagate_inbounds getindex (Q:: LayoutQ , i:: Int , j:: Int ) = Q[:, j][i]
120- function getindex (Q:: LayoutQ , :: Colon , j:: Int )
121- y = zeros (eltype (Q), size (Q, 2 ))
122- y[j] = 1
123- lmul! (Q, y)
124- end
125- Base. @propagate_inbounds layout_getindex (A:: LayoutQ , I:: CartesianIndex ) = A[to_indices (A, (I,))... ]
126- Base. @propagate_inbounds layout_getindex (A:: LayoutQ , I:: Int... ) =
127- Base. invoke (Base. getindex, Tuple{AbstractQ, typeof .(I)... }, A, I... )
128- Base. @propagate_inbounds layout_getindex (A:: LayoutQ , I:: AbstractVector{Int} , J:: AbstractVector{Int} ) =
129- hcat ((A[:, j][I] for j in J). .. )
130-
131- (* )(Q:: LayoutQ , adjQ:: Adjoint{<:Any,<:LayoutQ} ) = mul (Q, adjQ)
132- (* )(adjQ:: Adjoint{<:Any,<:LayoutQ} , Q:: LayoutQ ) = mul (adjQ, Q)
133- (* )(adjQ:: Adjoint{<:Any,<:LayoutQ} , adjP:: Adjoint{<:Any,<:LayoutQ} ) = mul (adjQ, adjP)
134- end
135-
136109axes (Q:: LayoutQ , dim:: Integer ) = axes (getfield (Q, :factors ), dim == 2 ? 1 : dim)
137110axes (Q:: LayoutQ ) = axes (Q, 1 ), axes (Q, 2 )
138111copy (Q:: LayoutQ ) = Q
0 commit comments