Mercurial > repos > public > sbplib_julia
comparison test/LazyTensors/lazy_tensor_operations_test.jl @ 1641:fddd3a906535 bugfix/warnings
Change name of dummy mapping to avoid conflict
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Wed, 26 Jun 2024 09:45:36 +0200 |
parents | 4c0bc52e170f |
children | 471a948cd2b2 |
comparison
equal
deleted
inserted
replaced
1640:8e28cadfefb3 | 1641:fddd3a906535 |
---|---|
2 using Sbplib.LazyTensors | 2 using Sbplib.LazyTensors |
3 using Sbplib.RegionIndices | 3 using Sbplib.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 |