Mercurial > repos > public > sbplib_julia
comparison test/testLazyTensors.jl @ 451:6cf234eef780 feature/inflated_tensormapping
Add tests for constructors and size calculations
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Mon, 19 Oct 2020 22:03:59 +0200 |
parents | ac6d22570a08 |
children | aeda2698166d |
comparison
equal
deleted
inserted
replaced
450:ac6d22570a08 | 451:6cf234eef780 |
---|---|
305 @inferred (I'*v)[3,2] | 305 @inferred (I'*v)[3,2] |
306 @inferred range_size(I) | 306 @inferred range_size(I) |
307 end | 307 end |
308 | 308 |
309 @testset "InflatedTensorMapping" begin | 309 @testset "InflatedTensorMapping" begin |
310 | 310 I(sz...) = IdentityMapping(sz...) |
311 end | 311 A = LazyLinearMap(rand(4,2),(1,),(2,)) |
312 | 312 B = LazyLinearMap(rand(4,2,3),(1,2),(3,)) |
313 end | 313 C = LazyLinearMap(rand(4,2,3),(1,),(2,3)) |
314 | |
315 @test InflatedTensorMapping(I(3,2), A, I(4)) isa TensorMapping{Float64, 4, 4} | |
316 @test InflatedTensorMapping(I(3,2), B, I(4)) isa TensorMapping{Float64, 5, 4} | |
317 @test InflatedTensorMapping(I(3), C, I(2,3)) isa TensorMapping{Float64, 4, 5} | |
318 | |
319 @test range_size(InflatedTensorMapping(I(3,2), A, I(4))) == (3,2,4,4) | |
320 @test domain_size(InflatedTensorMapping(I(3,2), A, I(4))) == (3,2,2,4) | |
321 | |
322 @test range_size(InflatedTensorMapping(I(3,2), B, I(4))) == (3,2,4,2,4) | |
323 @test domain_size(InflatedTensorMapping(I(3,2), B, I(4))) == (3,2,3,4) | |
324 | |
325 @test range_size(InflatedTensorMapping(I(3), C, I(2,3))) == (3,4,2,3) | |
326 @test domain_size(InflatedTensorMapping(I(3), C, I(2,3))) == (3,2,3,2,3) | |
327 | |
328 @inferred range_size(InflatedTensorMapping(I(3,2), A, I(4))) == (3,2,4,4) | |
329 @inferred domain_size(InflatedTensorMapping(I(3,2), A, I(4))) == (3,2,2,4) | |
330 | |
331 | |
332 end | |
333 | |
334 end |