Skip to content

Commit 23dc3d4

Browse files
authored
FillArrays v1 (#128)
* FillArrays v1 * zero out matrix if dimensions mismatch in l/rmul!
1 parent 8c3994f commit 23dc3d4

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

Project.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
name = "ArrayLayouts"
22
uuid = "4c555306-a7a7-4459-81d9-ec55ddd5c99a"
33
authors = ["Sheehan Olver <solver@mac.com>"]
4-
version = "0.8.18"
4+
version = "0.8.19"
55

66
[deps]
77
FillArrays = "1a297f60-69ca-5386-bcde-b61e274b549b"
88
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
99
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
1010

1111
[compat]
12-
FillArrays = "0.13.2"
12+
FillArrays = "0.13.2, 1"
1313
julia = "1.6"
1414

1515
[extras]

src/lmul.jl

+12-2
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,18 @@ rmul!(A, B; kwds...) = materialize!(Rmul(A, B); kwds...)
4949

5050
materialize(L::Lmul) = copy(instantiate(L))
5151

52-
copy(M::Lmul) = lmul!(M.A, copyto!(similar(M), M.B))
53-
copy(M::Rmul) = rmul!(copyto!(similar(M), M.A), M.B)
52+
# needed since in orthogonal case dimensions might mismatch and
53+
# so need to make sure extra entries are zero
54+
function _zero_copyto!(dest, A)
55+
if axes(dest) == axes(A)
56+
copyto!(dest, A)
57+
else
58+
copyto!(zero!(dest), A)
59+
end
60+
end
61+
62+
copy(M::Lmul) = lmul!(M.A, _zero_copyto!(similar(M), M.B))
63+
copy(M::Rmul) = rmul!(_zero_copyto!(similar(M), M.A), M.B)
5464

5565
@inline function _lmul_copyto!(dest, M)
5666
M.B dest || copyto!(dest, M.B)

0 commit comments

Comments
 (0)