|
483 | 483 | "$t of "*sprint((io, t) -> show(io, MIME"text/plain"(), t), parent(Fop))
|
484 | 484 | end
|
485 | 485 |
|
| 486 | +@testset "strided transposes" begin |
| 487 | + for t in (Adjoint, Transpose) |
| 488 | + @test strides(t(rand(3))) == (3, 1) |
| 489 | + @test strides(t(rand(3,2))) == (3, 1) |
| 490 | + @test strides(t(view(rand(3, 2), :))) == (6, 1) |
| 491 | + @test strides(t(view(rand(3, 2), :, 1:2))) == (3, 1) |
| 492 | + |
| 493 | + A = rand(3) |
| 494 | + @test pointer(t(A)) === pointer(A) |
| 495 | + B = rand(3,1) |
| 496 | + @test pointer(t(B)) === pointer(B) |
| 497 | + end |
| 498 | + @test_throws MethodError strides(Adjoint(rand(3) .+ rand(3).*im)) |
| 499 | + @test_throws MethodError strides(Adjoint(rand(3, 2) .+ rand(3, 2).*im)) |
| 500 | + @test strides(Transpose(rand(3) .+ rand(3).*im)) == (3, 1) |
| 501 | + @test strides(Transpose(rand(3, 2) .+ rand(3, 2).*im)) == (3, 1) |
| 502 | + |
| 503 | + C = rand(3) .+ rand(3).*im |
| 504 | + @test_throws ErrorException pointer(Adjoint(C)) |
| 505 | + @test pointer(Transpose(C)) === pointer(C) |
| 506 | + D = rand(3,2) .+ rand(3,2).*im |
| 507 | + @test_throws ErrorException pointer(Adjoint(D)) |
| 508 | + @test pointer(Transpose(D)) === pointer(D) |
| 509 | +end |
| 510 | + |
486 | 511 | const BASE_TEST_PATH = joinpath(Sys.BINDIR, "..", "share", "julia", "test")
|
487 | 512 | isdefined(Main, :OffsetArrays) || @eval Main include(joinpath($(BASE_TEST_PATH), "testhelpers", "OffsetArrays.jl"))
|
488 | 513 | using .Main.OffsetArrays
|
|
0 commit comments