Skip to content

Commit 68b4ace

Browse files
committed
Use ImmutableArrays test helper
1 parent 6feca41 commit 68b4ace

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

test/symmetric.jl

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1207,16 +1207,7 @@ end
12071207
end
12081208

12091209
@testset "triu/tril with immutable arrays" begin
1210-
struct ImmutableMatrix{T,A<:AbstractMatrix{T}} <: AbstractMatrix{T}
1211-
a :: A
1212-
end
1213-
Base.size(A::ImmutableMatrix) = size(A.a)
1214-
Base.getindex(A::ImmutableMatrix, i::Int, j::Int) = getindex(A.a, i, j)
1215-
Base.copy(A::ImmutableMatrix) = A
1216-
LinearAlgebra.adjoint(A::ImmutableMatrix) = ImmutableMatrix(adjoint(A.a))
1217-
LinearAlgebra.transpose(A::ImmutableMatrix) = ImmutableMatrix(transpose(A.a))
1218-
1219-
A = ImmutableMatrix([1 2; 3 4])
1210+
A = ImmutableArray([1 2; 3 4])
12201211
for T in (Symmetric, Hermitian), uplo in (:U, :L)
12211212
H = T(A, uplo)
12221213
MH = Matrix(H)

test/testhelpers/ImmutableArrays.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,7 @@ AbstractArray{T,N}(A::ImmutableArray{S,N}) where {S,T,N} = ImmutableArray(Abstra
2828
Base.copy(A::ImmutableArray) = ImmutableArray(copy(A.data))
2929
Base.zero(A::ImmutableArray) = ImmutableArray(zero(A.data))
3030

31+
Base.adjoint(A::ImmutableArray) = ImmutableArray(adjoint(A.data))
32+
Base.transpose(A::ImmutableArray) = ImmutableArray(transpose(A.data))
33+
3134
end

0 commit comments

Comments
 (0)