Skip to content

Commit fd17a17

Browse files
committed
Use ImmutableArrays test helper
1 parent cd2aa88 commit fd17a17

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
@@ -1351,16 +1351,7 @@ end
13511351
end
13521352

13531353
@testset "triu/tril with immutable arrays" begin
1354-
struct ImmutableMatrix{T,A<:AbstractMatrix{T}} <: AbstractMatrix{T}
1355-
a :: A
1356-
end
1357-
Base.size(A::ImmutableMatrix) = size(A.a)
1358-
Base.getindex(A::ImmutableMatrix, i::Int, j::Int) = getindex(A.a, i, j)
1359-
Base.copy(A::ImmutableMatrix) = A
1360-
LinearAlgebra.adjoint(A::ImmutableMatrix) = ImmutableMatrix(adjoint(A.a))
1361-
LinearAlgebra.transpose(A::ImmutableMatrix) = ImmutableMatrix(transpose(A.a))
1362-
1363-
A = ImmutableMatrix([1 2; 3 4])
1354+
A = ImmutableArray([1 2; 3 4])
13641355
for T in (Symmetric, Hermitian), uplo in (:U, :L)
13651356
H = T(A, uplo)
13661357
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)