Mercurial > repos > public > sbplib_julia
comparison test/LazyTensors/lazy_tensor_operations_test.jl @ 1829:871f3f1decea refactor/grids/iterable_boundary_indices
Merge default
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Sun, 20 Oct 2024 21:38:09 +0200 |
parents | 471a948cd2b2 |
children | 368999a2e243 |
comparison
equal
deleted
inserted
replaced
1828:8adecef380b4 | 1829:871f3f1decea |
---|---|
1 using Test | 1 using Test |
2 using Sbplib.LazyTensors | 2 using Diffinitive.LazyTensors |
3 using Sbplib.RegionIndices | 3 using Diffinitive.RegionIndices |
4 | 4 |
5 using Tullio | 5 using Tullio |
6 | 6 |
7 struct DummyMapping{T,R,D} <: LazyTensor{T,R,D} end | 7 struct TransposableDummyMapping{T,R,D} <: LazyTensor{T,R,D} end |
8 | 8 |
9 LazyTensors.apply(m::DummyMapping{T,R}, v, I::Vararg{Any,R}) where {T,R} = :apply | 9 LazyTensors.apply(m::TransposableDummyMapping{T,R}, v, I::Vararg{Any,R}) where {T,R} = :apply |
10 LazyTensors.apply_transpose(m::DummyMapping{T,R,D}, v, I::Vararg{Any,D}) where {T,R,D} = :apply_transpose | 10 LazyTensors.apply_transpose(m::TransposableDummyMapping{T,R,D}, v, I::Vararg{Any,D}) where {T,R,D} = :apply_transpose |
11 | 11 |
12 LazyTensors.range_size(m::DummyMapping) = :range_size | 12 LazyTensors.range_size(m::TransposableDummyMapping) = :range_size |
13 LazyTensors.domain_size(m::DummyMapping) = :domain_size | 13 LazyTensors.domain_size(m::TransposableDummyMapping) = :domain_size |
14 | 14 |
15 | 15 |
16 struct SizeDoublingMapping{T,R,D} <: LazyTensor{T,R,D} | 16 struct SizeDoublingMapping{T,R,D} <: LazyTensor{T,R,D} |
17 domain_size::NTuple{D,Int} | 17 domain_size::NTuple{D,Int} |
18 end | 18 end |
22 LazyTensors.domain_size(m::SizeDoublingMapping) = m.domain_size | 22 LazyTensors.domain_size(m::SizeDoublingMapping) = m.domain_size |
23 | 23 |
24 | 24 |
25 | 25 |
26 @testset "Mapping transpose" begin | 26 @testset "Mapping transpose" begin |
27 m = DummyMapping{Float64,2,3}() | 27 m = TransposableDummyMapping{Float64,2,3}() |
28 @test m' isa LazyTensor{Float64, 3,2} | 28 @test m' isa LazyTensor{Float64, 3,2} |
29 @test m'' == m | 29 @test m'' == m |
30 @test apply(m',zeros(Float64,(0,0)), 0, 0, 0) == :apply_transpose | 30 @test apply(m',zeros(Float64,(0,0)), 0, 0, 0) == :apply_transpose |
31 @test apply(m'',zeros(Float64,(0,0,0)), 0, 0) == :apply | 31 @test apply(m'',zeros(Float64,(0,0,0)), 0, 0) == :apply |
32 @test apply_transpose(m', zeros(Float64,(0,0,0)), 0, 0) == :apply | 32 @test apply_transpose(m', zeros(Float64,(0,0,0)), 0, 0) == :apply |