changeset 441:552189707fbe feature/lazy_identity

Add convenience constructor
author Jonatan Werpers <jonatan@werpers.com>
date Mon, 19 Oct 2020 21:23:12 +0200
parents a57b71343aeb
children e70e47fbfa7c
files src/LazyTensors/lazy_tensor_operations.jl test/testLazyTensors.jl
diffstat 2 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/LazyTensors/lazy_tensor_operations.jl	Mon Oct 19 21:12:15 2020 +0200
+++ b/src/LazyTensors/lazy_tensor_operations.jl	Mon Oct 19 21:23:12 2020 +0200
@@ -161,6 +161,7 @@
 export IdentityMapping
 
 IdentityMapping{T}(size::NTuple{D,Int}) where {T,D} = IdentityMapping{T,D}(size)
+IdentityMapping{T}(size::Vararg{Int,D}) where {T,D} = IdentityMapping{T,D}(size)
 
 range_size(tmi::IdentityMapping) = tmi.size
 domain_size(tmi::IdentityMapping) = tmi.size
--- a/test/testLazyTensors.jl	Mon Oct 19 21:12:15 2020 +0200
+++ b/test/testLazyTensors.jl	Mon Oct 19 21:23:12 2020 +0200
@@ -285,6 +285,7 @@
 @testset "IdentityMapping" begin
     @test IdentityMapping{Float64}((4,5)) isa IdentityMapping{T,2} where T
     @test IdentityMapping{Float64}((4,5)) isa TensorMapping{T,2,2} where T
+    @test IdentityMapping{Float64}((4,5)) == IdentityMapping{Float64}(4,5)
 
     for sz ∈ [(4,5),(3,),(5,6,4)]
         I = IdentityMapping{Float64}(sz)