Mercurial > repos > public > sbplib_julia
comparison test/testLazyTensors.jl @ 493:df566372bb4f feature/avoid_nested_inflated_tensormappings
Implement constructors to avoid creating nested InflatedTensorMappings
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Thu, 05 Nov 2020 13:18:24 +0100 |
parents | 8082d43103c1 |
children | f906f207571c |
comparison
equal
deleted
inserted
replaced
490:7e698030c170 | 493:df566372bb4f |
---|---|
392 | 392 |
393 @inferred LazyTensors.split_index(tm,1,2,3,2,2,4) | 393 @inferred LazyTensors.split_index(tm,1,2,3,2,2,4) |
394 @inferred apply(tm,v,Index{Unknown}.((1,2,3,2,2,4))...) | 394 @inferred apply(tm,v,Index{Unknown}.((1,2,3,2,2,4))...) |
395 @inferred (tm*v)[1,2,3,2,2,4] | 395 @inferred (tm*v)[1,2,3,2,2,4] |
396 | 396 |
397 @testset "InflatedTensorMapping of InflatedTensorMapping" begin | |
398 A = ScalingOperator(2.0,(2,3)) | |
399 itm = InflatedTensorMapping(I(3,2), A, I(4)) | |
400 @test InflatedTensorMapping(I(4), itm, I(2)) == InflatedTensorMapping(I(4,3,2), A, I(4,2)) | |
401 @test InflatedTensorMapping(itm, I(2)) == InflatedTensorMapping(I(3,2), A, I(4,2)) | |
402 @test InflatedTensorMapping(I(4), itm) == InflatedTensorMapping(I(4,3,2), A, I(4)) | |
403 | |
404 @test InflatedTensorMapping(I(2), I(2), I(2)) isa InflatedTensorMapping # The constructor should always return its type. | |
405 end | |
406 | |
397 end | 407 end |
398 | 408 |
399 @testset "slice_tuple" begin | 409 @testset "slice_tuple" begin |
400 @test LazyTensors.slice_tuple((1,2,3),Val(1), Val(3)) == (1,2,3) | 410 @test LazyTensors.slice_tuple((1,2,3),Val(1), Val(3)) == (1,2,3) |
401 @test LazyTensors.slice_tuple((1,2,3,4,5,6),Val(2), Val(5)) == (2,3,4,5) | 411 @test LazyTensors.slice_tuple((1,2,3,4,5,6),Val(2), Val(5)) == (2,3,4,5) |