changeset 1150:58cb7cb02d9a refactor/sbpoperators/inflation

Merge default
author Jonatan Werpers <jonatan@werpers.com>
date Fri, 21 Oct 2022 22:11:04 +0200
parents 5ddf5ae48391 (current diff) dd7325f91aa3 (diff)
children 56bc2c6a17fd
files
diffstat 2 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/LazyTensors/lazy_array.jl	Tue Oct 18 20:27:31 2022 +0200
+++ b/src/LazyTensors/lazy_array.jl	Fri Oct 21 22:11:04 2022 +0200
@@ -28,7 +28,7 @@
 export LazyFunctionArray
 
 function LazyFunctionArray(f::F, size::NTuple{D,Int}) where {F<:Function,D}
-    T = typeof(f(ones(D)...))
+    T = typeof(f(ones(Int, D)...))
     return LazyFunctionArray{F,T,D}(f,size)
 end
 
--- a/test/LazyTensors/lazy_array_test.jl	Tue Oct 18 20:27:31 2022 +0200
+++ b/test/LazyTensors/lazy_array_test.jl	Fri Oct 21 22:11:04 2022 +0200
@@ -102,4 +102,7 @@
     @test_throws BoundsError LazyFunctionArray((i,j)->i*j, (3,2))[4,2]
     @test_throws BoundsError LazyFunctionArray((i,j)->i*j, (3,2))[2,3]
 
+    # Test that the constructor works with a restrictive function
+    f(x::Vararg{Int}) = sum(x)
+    @test LazyFunctionArray(f,(3,4)) isa LazyFunctionArray
 end