Mercurial > repos > public > sbplib_julia
comparison test/testLazyTensors.jl @ 476:1b9af062ba2c feature/outer_product
Merge in default
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Mon, 02 Nov 2020 21:34:33 +0100 |
parents | 0c3decc04649 3f3001d1020f |
children | 79a88269d7d0 |
comparison
equal
deleted
inserted
replaced
475:2c0e76d5832d | 476:1b9af062ba2c |
---|---|
342 @test domain_size(InflatedTensorMapping(I(3), C, I(2,3))) == (3,2,3,2,3) | 342 @test domain_size(InflatedTensorMapping(I(3), C, I(2,3))) == (3,2,3,2,3) |
343 | 343 |
344 @inferred range_size(InflatedTensorMapping(I(3,2), A, I(4))) == (3,2,4,4) | 344 @inferred range_size(InflatedTensorMapping(I(3,2), A, I(4))) == (3,2,4,4) |
345 @inferred domain_size(InflatedTensorMapping(I(3,2), A, I(4))) == (3,2,2,4) | 345 @inferred domain_size(InflatedTensorMapping(I(3,2), A, I(4))) == (3,2,2,4) |
346 | 346 |
347 # Test InflatedTensorMapping mapping w. before and after | |
347 tm = InflatedTensorMapping(I(3,2), A, I(4)) | 348 tm = InflatedTensorMapping(I(3,2), A, I(4)) |
348 v = rand(domain_size(tm)...) | 349 v = rand(domain_size(tm)...) |
349 | |
350 @tullio IAIv[a,b,c,d] := Ã[c,i]*v[a,b,i,d] | 350 @tullio IAIv[a,b,c,d] := Ã[c,i]*v[a,b,i,d] |
351 @test tm*v ≈ IAIv rtol=1e-14 | 351 @test tm*v ≈ IAIv rtol=1e-14 |
352 | |
353 @inferred LazyTensors.split_index(tm,1,1,1,1) | 352 @inferred LazyTensors.split_index(tm,1,1,1,1) |
353 | |
354 # Test InflatedTensorMapping mapping w. before | |
355 tm = InflatedTensorMapping(I(3,2), A) | |
356 v = rand(domain_size(tm)...) | |
357 @tullio IAIv[a,b,c] := Ã[c,i]*v[a,b,i] | |
358 @test tm*v ≈ IAIv rtol=1e-14 | |
359 @inferred LazyTensors.split_index(tm,1,1,1) | |
360 | |
361 # Test InflatedTensorMapping mapping w. after | |
362 tm = InflatedTensorMapping(A,I(4)) | |
363 v = rand(domain_size(tm)...) | |
364 @tullio IAIv[c,d] := Ã[c,i]*v[i,d] | |
365 @test tm*v ≈ IAIv rtol=1e-14 | |
366 @inferred LazyTensors.split_index(tm,1,1) | |
354 | 367 |
355 struct ScalingOperator{T,D} <: TensorMapping{T,D,D} | 368 struct ScalingOperator{T,D} <: TensorMapping{T,D,D} |
356 λ::T | 369 λ::T |
357 size::NTuple{D,Int} | 370 size::NTuple{D,Int} |
358 end | 371 end |