Skip to content

Commit 7a41bb0

Browse files
committed
Tests for copyto and triangular mats
1 parent f4a54a6 commit 7a41bb0

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

src/testsuite/linalg.jl

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,21 @@ function test_linalg(AT)
44
@test compare(adjoint, AT, rand(Float32, 32, 32))
55
@test compare(transpose, AT, rand(Float32, 32, 32))
66
@test compare(transpose!, AT, Array{Float32}(undef, 32, 32), rand(Float32, 32, 32))
7+
@test compare(transpose!, AT, Array{Float32}(undef, 128, 32), rand(Float32, 32, 128))
8+
end
9+
10+
@testset "copyto! for triangular" begin
11+
ga = Array{Float32}(undef, 128, 128)
12+
gb = AT{Float32}(undef, 128, 128)
13+
rand!(gb)
14+
copyto!(ga, UpperTriangular(gb))
15+
@test ga == Array(collect(UpperTriangular(gb)))
16+
ga = Array{Float32}(undef, 128, 128)
17+
gb = AT{Float32}(undef, 128, 128)
18+
rand!(gb)
19+
copyto!(ga, LowerTriangular(gb))
20+
@test ga == Array(collect(LowerTriangular(gb)))
721
end
8-
922
@testset "permutedims" begin
1023
@test compare(x -> permutedims(x, (2, 1)), AT, rand(Float32, 2, 3))
1124
@test compare(x -> permutedims(x, (2, 1, 3)), AT, rand(Float32, 4, 5, 6))
@@ -26,13 +39,5 @@ function test_linalg(AT)
2639
@test ishermitian(aherm)
2740
end
2841
end
29-
@testset "transpose fallback" begin
30-
m = 64
31-
n = 128
32-
a = randn(m,n)
33-
b = zeros(n,m)
34-
transpose!(b, a)
35-
@test b == transpose(a)
36-
end
3742
end
3843
end

0 commit comments

Comments
 (0)