comparison test/testLazyTensors.jl @ 492:cd509e57f898 feature/tensormapping_eltype

Implement method eltype for TensorMapping
author Jonatan Werpers <jonatan@werpers.com>
date Thu, 05 Nov 2020 12:51:26 +0100
parents 8082d43103c1
children f906f207571c
comparison
equal deleted inserted replaced
490:7e698030c170 492:cd509e57f898
10 struct DummyMapping{T,R,D} <: TensorMapping{T,R,D} end 10 struct DummyMapping{T,R,D} <: TensorMapping{T,R,D} end
11 LazyTensors.apply(m::DummyMapping{T,R,D}, v, i::NTuple{R,Index{<:Region}}) where {T,R,D} = :apply 11 LazyTensors.apply(m::DummyMapping{T,R,D}, v, i::NTuple{R,Index{<:Region}}) where {T,R,D} = :apply
12 @test range_dim(DummyMapping{Int,2,3}()) == 2 12 @test range_dim(DummyMapping{Int,2,3}()) == 2
13 @test domain_dim(DummyMapping{Int,2,3}()) == 3 13 @test domain_dim(DummyMapping{Int,2,3}()) == 3
14 @test apply(DummyMapping{Int,2,3}(), zeros(Int, (0,0,0)),(Index{Unknown}(0),Index{Unknown}(0))) == :apply 14 @test apply(DummyMapping{Int,2,3}(), zeros(Int, (0,0,0)),(Index{Unknown}(0),Index{Unknown}(0))) == :apply
15 @test eltype(DummyMapping{Int,2,3}()) == Int
16 @test eltype(DummyMapping{Float64,2,3}()) == Float64
15 end 17 end
16 18
17 @testset "Mapping transpose" begin 19 @testset "Mapping transpose" begin
18 struct DummyMapping{T,R,D} <: TensorMapping{T,R,D} end 20 struct DummyMapping{T,R,D} <: TensorMapping{T,R,D} end
19 21