1+ using ArrayLayouts: LayoutMatrix
12using LinearAlgebra: LinearAlgebra, qr
23using .. TensorAlgebra:
34 TensorAlgebra,
@@ -8,6 +9,8 @@ using ..TensorAlgebra:
89 fusedims,
910 splitdims
1011
12+ # TODO : Define as `tensor_qr`.
13+ # TODO : This look generic but doesn't work for `BlockSparseArrays`.
1114function _qr (a:: AbstractArray , biperm:: BlockedPermutation{2} )
1215 a_matricized = fusedims (a, biperm)
1316
@@ -38,6 +41,12 @@ function LinearAlgebra.qr(a::AbstractMatrix, biperm::BlockedPermutation{2})
3841 return _qr (a, biperm)
3942end
4043
44+ # Fix ambiguity error with `ArrayLayouts`.
45+ function LinearAlgebra. qr (a:: LayoutMatrix , biperm:: BlockedPermutation{2} )
46+ return _qr (a, biperm)
47+ end
48+
49+ # TODO : Define in terms of an inner function `_qr` or `tensor_qr`.
4150function LinearAlgebra. qr (
4251 a:: AbstractArray , labels_a:: Tuple , labels_q:: Tuple , labels_r:: Tuple
4352)
@@ -50,3 +59,10 @@ function LinearAlgebra.qr(
5059)
5160 return qr (a, blockedperm_indexin (labels_a, labels_q, labels_r))
5261end
62+
63+ # Fix ambiguity error with `ArrayLayouts`.
64+ function LinearAlgebra. qr (
65+ a:: LayoutMatrix , labels_a:: Tuple , labels_q:: Tuple , labels_r:: Tuple
66+ )
67+ return qr (a, blockedperm_indexin (labels_a, labels_q, labels_r))
68+ end
0 commit comments