Mercurial > repos > public > sbplib_julia
comparison 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 |
comparison
equal
deleted
inserted
replaced
988:83046af6143a | 1022:bbbc31953367 |
---|---|
525 I2 = IdentityMapping(4) | 525 I2 = IdentityMapping(4) |
526 @test I1⊗Ã⊗I2 == InflatedTensorMapping(I1, Ã, I2) | 526 @test I1⊗Ã⊗I2 == InflatedTensorMapping(I1, Ã, I2) |
527 end | 527 end |
528 | 528 |
529 end | 529 end |
530 | |
531 @testset "inflate" begin | |
532 struct ScalingOperator{T,D} <: TensorMapping{T,D,D} | |
533 λ::T | |
534 size::NTuple{D,Int} | |
535 end | |
536 | |
537 LazyTensors.apply(m::ScalingOperator{T,D}, v, I::Vararg{Any,D}) where {T,D} = m.λ*v[I...] | |
538 LazyTensors.range_size(m::ScalingOperator) = m.size | |
539 LazyTensors.domain_size(m::ScalingOperator) = m.size | |
540 | |
541 | |
542 I = LazyTensors.inflate(IdentityMapping(),(3,4,5,6), 2) | |
543 @test I isa TensorMapping{Float64, 3,3} | |
544 @test range_size(I) == (3,5,6) | |
545 @test domain_size(I) == (3,5,6) | |
546 | |
547 # TODO: More tests | |
548 | |
549 # Check that the dir is inbounds | |
550 | |
551 # tm = ScalingOperator(2., (4,)) | |
552 end |