diff 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
line wrap: on
line diff
--- a/test/testLazyTensors.jl	Thu Nov 05 11:46:03 2020 +0100
+++ b/test/testLazyTensors.jl	Thu Nov 05 13:18:24 2020 +0100
@@ -394,6 +394,16 @@
     @inferred apply(tm,v,Index{Unknown}.((1,2,3,2,2,4))...)
     @inferred (tm*v)[1,2,3,2,2,4]
 
+    @testset "InflatedTensorMapping of InflatedTensorMapping" begin
+        A = ScalingOperator(2.0,(2,3))
+        itm = InflatedTensorMapping(I(3,2), A, I(4))
+        @test  InflatedTensorMapping(I(4), itm, I(2)) == InflatedTensorMapping(I(4,3,2), A, I(4,2))
+        @test  InflatedTensorMapping(itm, I(2)) == InflatedTensorMapping(I(3,2), A, I(4,2))
+        @test  InflatedTensorMapping(I(4), itm) == InflatedTensorMapping(I(4,3,2), A, I(4))
+
+        @test InflatedTensorMapping(I(2), I(2), I(2)) isa InflatedTensorMapping # The constructor should always return its type.
+    end
+
 end
 
 @testset "slice_tuple" begin