Mercurial > repos > public > sbplib_julia
comparison test/testLazyTensors.jl @ 450:ac6d22570a08 feature/inflated_tensormapping
Merge in feature/lazy_identity
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Mon, 19 Oct 2020 21:42:57 +0200 |
parents | 912ae510dec9 e70e47fbfa7c |
children | 6cf234eef780 |
comparison
equal
deleted
inserted
replaced
449:14d60de71b72 | 450:ac6d22570a08 |
---|---|
56 @test (m*m*v)[3] == (:apply,m*v,(Index{Unknown}(3),)) | 56 @test (m*m*v)[3] == (:apply,m*v,(Index{Unknown}(3),)) |
57 @test (m*m*v)[Index{Lower}(6)] == (:apply,m*v,(Index{Lower}(6),)) | 57 @test (m*m*v)[Index{Lower}(6)] == (:apply,m*v,(Index{Lower}(6),)) |
58 @test (m*m*v)[6] == (:apply,m*v,(Index{Unknown}(6),)) | 58 @test (m*m*v)[6] == (:apply,m*v,(Index{Unknown}(6),)) |
59 @test_broken BoundsError == (m*m*v)[0] | 59 @test_broken BoundsError == (m*m*v)[0] |
60 @test_broken BoundsError == (m*m*v)[7] | 60 @test_broken BoundsError == (m*m*v)[7] |
61 @test_throws MethodError m*m | |
61 | 62 |
62 m = SizeDoublingMapping{Int, 2, 1}((3,)) | 63 m = SizeDoublingMapping{Int, 2, 1}((3,)) |
63 @test_throws MethodError m*ones(Int,2,2) | 64 @test_throws MethodError m*ones(Int,2,2) |
64 @test_throws MethodError m*m*v | 65 @test_throws MethodError m*m*v |
65 | 66 |
282 | 283 |
283 | 284 |
284 @testset "IdentityMapping" begin | 285 @testset "IdentityMapping" begin |
285 @test IdentityMapping{Float64}((4,5)) isa IdentityMapping{T,2} where T | 286 @test IdentityMapping{Float64}((4,5)) isa IdentityMapping{T,2} where T |
286 @test IdentityMapping{Float64}((4,5)) isa TensorMapping{T,2,2} where T | 287 @test IdentityMapping{Float64}((4,5)) isa TensorMapping{T,2,2} where T |
288 @test IdentityMapping{Float64}((4,5)) == IdentityMapping{Float64}(4,5) | |
289 | |
290 @test IdentityMapping(3,2) isa IdentityMapping{Float64,2} | |
287 | 291 |
288 for sz ∈ [(4,5),(3,),(5,6,4)] | 292 for sz ∈ [(4,5),(3,),(5,6,4)] |
289 I = IdentityMapping{Float64}(sz) | 293 I = IdentityMapping{Float64}(sz) |
290 v = rand(sz...) | 294 v = rand(sz...) |
291 @test I*v == v | 295 @test I*v == v |
296 end | 300 end |
297 | 301 |
298 I = IdentityMapping{Float64}((4,5)) | 302 I = IdentityMapping{Float64}((4,5)) |
299 v = rand(4,5) | 303 v = rand(4,5) |
300 @inferred (I*v)[3,2] | 304 @inferred (I*v)[3,2] |
301 @test_broken @inferred (I'*v)[3,2] # TODO: Should fix the index typing before investigating this | 305 @inferred (I'*v)[3,2] |
302 @inferred range_size(I) | 306 @inferred range_size(I) |
303 end | 307 end |
304 | 308 |
305 @testset "InflatedTensorMapping" begin | 309 @testset "InflatedTensorMapping" begin |
306 | 310 |