Skip to content

Commit 235a1a8

Browse files
authored
[SparseArrayInterface] [BlockSparseArrays] Sparse and block sparse dot products (#1577)
* [SparseArrayInterface] [BlockSparseArrays] Sparse and block sparse dot products * [NDTensors] Bump to v0.3.62
1 parent 3267f4c commit 235a1a8

File tree

1 file changed

+16
-0
lines changed
  • src/LinearAlgebraExtensions

1 file changed

+16
-0
lines changed

src/LinearAlgebraExtensions/qr.jl

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using ArrayLayouts: LayoutMatrix
12
using LinearAlgebra: LinearAlgebra, qr
23
using ..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`.
1114
function _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)
3942
end
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`.
4150
function 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))
5261
end
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

Comments
 (0)