Skip to content

Commit

Permalink
small unit test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
alyst committed Apr 23, 2024
1 parent 2984203 commit b6db6b1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions test/unit_tests/matrix_helpers.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ m = 5
# commutation matrix multiplication
K = CommutationMatrix(n)
B = rand(n, n)
@test_throws DimensionMismatch K * rand(n, m)
@test K * vec(B) == vec(B')
C = sprand(n, n, 0.5)
@test K * vec(C) == vec(C')
Expand All @@ -27,10 +28,12 @@ end
@testset "Duplication / elimination matrix" begin
A = rand(m, m)
A = A * A'

# dupication
D = duplication_matrix(m)
@test D * A[tril(trues(size(A)))] == vec(A)

# elimination
D = elimination_matrix(m)
@test D * vec(A) == A[tril(trues(size(A)))]
E = elimination_matrix(m)
@test E * vec(A) == A[tril(trues(size(A)))]
end

0 comments on commit b6db6b1

Please sign in to comment.