Mercurial > repos > public > sbplib_julia
changeset 471:3f3001d1020f feature/inflated_tensormapping
Add tests to InflatedTensorMapping where one of before and after are missing
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Mon, 02 Nov 2020 17:39:15 +0100 |
parents | 6458c929de4a |
children | aa7bd2b908f8 |
files | test/testLazyTensors.jl |
diffstat | 1 files changed, 15 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/test/testLazyTensors.jl Thu Oct 22 13:22:08 2020 +0200 +++ b/test/testLazyTensors.jl Mon Nov 02 17:39:15 2020 +0100 @@ -344,13 +344,26 @@ @inferred range_size(InflatedTensorMapping(I(3,2), A, I(4))) == (3,2,4,4) @inferred domain_size(InflatedTensorMapping(I(3,2), A, I(4))) == (3,2,2,4) + # Test InflatedTensorMapping mapping w. before and after tm = InflatedTensorMapping(I(3,2), A, I(4)) v = rand(domain_size(tm)...) - @tullio IAIv[a,b,c,d] := Ã[c,i]*v[a,b,i,d] @test tm*v ≈ IAIv rtol=1e-14 + @inferred LazyTensors.split_index(tm,1,1,1,1) - @inferred LazyTensors.split_index(tm,1,1,1,1) + # Test InflatedTensorMapping mapping w. before + tm = InflatedTensorMapping(I(3,2), A) + v = rand(domain_size(tm)...) + @tullio IAIv[a,b,c] := Ã[c,i]*v[a,b,i] + @test tm*v ≈ IAIv rtol=1e-14 + @inferred LazyTensors.split_index(tm,1,1,1) + + # Test InflatedTensorMapping mapping w. after + tm = InflatedTensorMapping(A,I(4)) + v = rand(domain_size(tm)...) + @tullio IAIv[c,d] := Ã[c,i]*v[i,d] + @test tm*v ≈ IAIv rtol=1e-14 + @inferred LazyTensors.split_index(tm,1,1) struct ScalingOperator{T,D} <: TensorMapping{T,D,D} λ::T