Skip to content

Commit cfbef56

Browse files
authored
Diagonal(::LayoutVector) \ UpperTriangular (#176)
* Diagonal(::LayoutVector) \ UpperTriangular * add tests * Update test_muladd.jl
1 parent ff760fa commit cfbef56

File tree

5 files changed

+9
-6
lines changed

5 files changed

+9
-6
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "ArrayLayouts"
22
uuid = "4c555306-a7a7-4459-81d9-ec55ddd5c99a"
33
authors = ["Sheehan Olver <[email protected]>"]
4-
version = "1.4.1"
4+
version = "1.4.2"
55

66
[deps]
77
FillArrays = "1a297f60-69ca-5386-bcde-b61e274b549b"

src/ArrayLayouts.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,6 @@ end
248248
\(A::Diagonal{<:Any,<:LayoutVector}, B::Diagonal{<:Any,<:LayoutVector}) = ldiv(A, B)
249249
\(A::Diagonal{<:Any,<:LayoutVector}, B::AbstractMatrix) = ldiv(A, B)
250250
\(A::AbstractMatrix, B::Diagonal{<:Any,<:LayoutVector}) = ldiv(A, B)
251-
\(A::Diagonal{<:Any,<:LayoutVector}, B::LayoutMatrix) = ldiv(A, B)
252-
\(A::LayoutMatrix, B::Diagonal{<:Any,<:LayoutVector}) = ldiv(A, B)
253251
\(A::Diagonal{<:Any,<:LayoutVector}, B::Diagonal) = ldiv(A, B)
254252
\(A::Diagonal, B::Diagonal{<:Any,<:LayoutVector}) = ldiv(A, B)
255253

src/ldiv.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,8 @@ macro _layoutldiv(Typ)
197197
ret = quote
198198
$ret
199199
(\)(A::$Typ, x::LayoutVector; kwds...) = ArrayLayouts.ldiv(A,x; kwds...)
200+
(\)(x::Diagonal{<:Any,<:LayoutVector}, A::$Typ; kwds...) = ArrayLayouts.ldiv(x,A; kwds...)
201+
\(A::$Typ, B::Diagonal{<:Any,<:LayoutVector}; kwds...) = ArrayLayouts.ldiv(A, B; kwds...)
200202
end
201203
end
202204
if Typ :LayoutMatrix

test/test_layoutarray.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,9 @@ MemoryLayout(::Type{MyVector}) = DenseColumnMajor()
245245
@test transpose(x) / A isa Transpose
246246
@test x' / A isa Adjoint
247247
end
248+
249+
@test D \ UpperTriangular(A) D \ UpperTriangular(A.A)
250+
@test UpperTriangular(A) \ D UpperTriangular(A.A) \ D
248251
end
249252

250253
@testset "dot" begin

test/test_muladd.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ Random.seed!(0)
615615
Q = qr(randn(5,5)).Q
616616
b = randn(5)
617617
B = randn(5,5)
618-
@test Q*1.0 == ArrayLayouts.lmul!(Q, Matrix{Float64}(I, 5, 5))
618+
@test Q*1.0 ArrayLayouts.lmul!(Q, Matrix{Float64}(I, 5, 5))
619619
@test Q*b == ArrayLayouts.lmul!(Q, copy(b)) == mul(Q,b)
620620
@test Q*B == ArrayLayouts.lmul!(Q, copy(B)) == mul(Q,B)
621621
@test B*Q == ArrayLayouts.rmul!(copy(B), Q) == mul(B,Q)
@@ -634,7 +634,7 @@ Random.seed!(0)
634634
Q = qr(randn(7,5)).Q
635635
b = randn(5)
636636
B = randn(5,5)
637-
@test Q*1.0 == ArrayLayouts.lmul!(Q, Matrix{Float64}(I, 7, 7))
637+
@test Q*1.0 ArrayLayouts.lmul!(Q, Matrix{Float64}(I, 7, 7))
638638
@test Q*b == mul(Q,b)
639639
@test Q*B == mul(Q,B)
640640
@test 1.0*Q ArrayLayouts.rmul!(Matrix{Float64}(I, 7, 7), Q)
@@ -681,7 +681,7 @@ Random.seed!(0)
681681
c = randn(5) + im*randn(5)
682682
d = randn(5) + im*randn(5)
683683

684-
@test ArrayLayouts.dot(a,b) == ArrayLayouts.dotu(a,b) == mul(a',b)
684+
@test ArrayLayouts.dot(a,b) ArrayLayouts.dotu(a,b) mul(a',b)
685685
@test ArrayLayouts.dot(a,b) dot(a,b)
686686
@test eltype(Dot(a,1:5)) == Float64
687687

0 commit comments

Comments
 (0)