Skip to content

Commit c1e7a69

Browse files
committed
more comm_matrix tests
1 parent 3abe92e commit c1e7a69

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

test/unit_tests/matrix_helpers.jl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@ m = 5
1313
@test reshape(A[transpose_linear_indices(n, m)], m, n) == A'
1414
# commutation matrix multiplication
1515
K = CommutationMatrix(n)
16+
# test K array interface methods
17+
@test size(K) == (n^2, n^2)
18+
@test size(K, 1) == n^2
19+
@test length(K) == n^4
20+
nn_linind = LinearIndices((n, n))
21+
@test K[nn_linind[3, 2], nn_linind[2, 3]] == 1
22+
@test K[nn_linind[3, 2], nn_linind[3, 2]] == 0
23+
1624
B = rand(n, n)
1725
@test_throws DimensionMismatch K * rand(n, m)
1826
@test K * vec(B) == vec(B')

0 commit comments

Comments
 (0)