Mercurial > repos > public > sbplib_julia
diff test/LazyTensors/lazy_tensor_operations_test.jl @ 1022:bbbc31953367 refactor/sbpoperators/inflation
Introduce an inflate function in lazy tensors and use it in volume_operator and boundary_operator
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Fri, 18 Mar 2022 16:57:00 +0100 |
parents | 043d13ef8898 |
children | 52f07c77299d |
line wrap: on
line diff
--- a/test/LazyTensors/lazy_tensor_operations_test.jl Wed Mar 16 18:39:00 2022 +0100 +++ b/test/LazyTensors/lazy_tensor_operations_test.jl Fri Mar 18 16:57:00 2022 +0100 @@ -527,3 +527,26 @@ end end + +@testset "inflate" begin + struct ScalingOperator{T,D} <: TensorMapping{T,D,D} + λ::T + size::NTuple{D,Int} + end + + LazyTensors.apply(m::ScalingOperator{T,D}, v, I::Vararg{Any,D}) where {T,D} = m.λ*v[I...] + LazyTensors.range_size(m::ScalingOperator) = m.size + LazyTensors.domain_size(m::ScalingOperator) = m.size + + + I = LazyTensors.inflate(IdentityMapping(),(3,4,5,6), 2) + @test I isa TensorMapping{Float64, 3,3} + @test range_size(I) == (3,5,6) + @test domain_size(I) == (3,5,6) + + # TODO: More tests + + # Check that the dir is inbounds + + # tm = ScalingOperator(2., (4,)) +end