comparison test/LazyTensors/lazy_tensor_operations_test.jl @ 1221:b3b4d29b46c3 refactor/grids

Merge default
author Jonatan Werpers <jonatan@werpers.com>
date Fri, 10 Feb 2023 08:36:56 +0100
parents c94a12327737
children 4c0bc52e170f
comparison
equal deleted inserted replaced
1220:93bba649aea2 1221:b3b4d29b46c3
364 I1 = IdentityTensor(3,2) 364 I1 = IdentityTensor(3,2)
365 I2 = IdentityTensor(4) 365 I2 = IdentityTensor(4)
366 @test I1⊗Ã⊗I2 == InflatedTensor(I1, Ã, I2) 366 @test I1⊗Ã⊗I2 == InflatedTensor(I1, Ã, I2)
367 end 367 end
368 end 368 end
369
370 @testset "inflate" begin
371 I = LazyTensors.inflate(IdentityTensor(),(3,4,5,6), 2)
372 @test I isa LazyTensor{Float64, 3,3}
373 @test range_size(I) == (3,5,6)
374 @test domain_size(I) == (3,5,6)
375
376 @test LazyTensors.inflate(ScalingTensor(1., (4,)),(3,4,5,6), 1) == InflatedTensor(IdentityTensor{Float64}(),ScalingTensor(1., (4,)),IdentityTensor(4,5,6))
377 @test LazyTensors.inflate(ScalingTensor(2., (1,)),(3,4,5,6), 2) == InflatedTensor(IdentityTensor(3),ScalingTensor(2., (1,)),IdentityTensor(5,6))
378 @test LazyTensors.inflate(ScalingTensor(3., (6,)),(3,4,5,6), 4) == InflatedTensor(IdentityTensor(3,4,5),ScalingTensor(3., (6,)),IdentityTensor{Float64}())
379
380 @test_throws BoundsError LazyTensors.inflate(ScalingTensor(1., (4,)),(3,4,5,6), 0)
381 @test_throws BoundsError LazyTensors.inflate(ScalingTensor(1., (4,)),(3,4,5,6), 5)
382 end