diff --git a/NDTensors/src/lib/UnallocatedArrays/src/unallocatedfill.jl b/NDTensors/src/lib/UnallocatedArrays/src/unallocatedfill.jl index b9dbade6b5..c84d2e0d7e 100644 --- a/NDTensors/src/lib/UnallocatedArrays/src/unallocatedfill.jl +++ b/NDTensors/src/lib/UnallocatedArrays/src/unallocatedfill.jl @@ -7,7 +7,7 @@ struct UnallocatedFill{ElT,N,Axes,Alloc} <: AbstractFill{ElT,N,Axes} end function UnallocatedFill{ElT,N,Axes}(f::Fill, alloc::Type) where {ElT,N,Axes} - return new{ElT,N,Axes,Type{alloc}}(f, alloc) + return UnallocatedFill{ElT,N,Axes,Type{alloc}}(f, alloc) end function UnallocatedFill{ElT,N}(f::Fill, alloc) where {ElT,N} diff --git a/NDTensors/src/lib/UnallocatedArrays/src/unallocatedzeros.jl b/NDTensors/src/lib/UnallocatedArrays/src/unallocatedzeros.jl index 46918c0a47..39752e206e 100644 --- a/NDTensors/src/lib/UnallocatedArrays/src/unallocatedzeros.jl +++ b/NDTensors/src/lib/UnallocatedArrays/src/unallocatedzeros.jl @@ -17,7 +17,7 @@ struct UnallocatedZeros{ElT,N,Axes,Alloc} <: AbstractZeros{ElT,N,Axes} end function UnallocatedZeros{ElT,N,Axes}(z::Zeros, alloc::Type) where {ElT,N,Axes} - return new{ElT,N,Axes,Type{alloc}}(z, alloc) + return UnallocatedZeros{ElT,N,Axes,Type{alloc}}(z, alloc) end function UnallocatedZeros{ElT,N}(z::Zeros, alloc) where {ElT,N} diff --git a/NDTensors/src/lib/UnallocatedArrays/test/runtests.jl b/NDTensors/src/lib/UnallocatedArrays/test/runtests.jl index b2026bd636..b7b7fe2839 100644 --- a/NDTensors/src/lib/UnallocatedArrays/test/runtests.jl +++ b/NDTensors/src/lib/UnallocatedArrays/test/runtests.jl @@ -22,6 +22,8 @@ using .NDTensorsTestUtils: devices_list @test iszero(norm(Z)) @test iszero(Z[2, 3]) @test allocate(Z) isa dev(Matrix{elt}) + Zp = UnallocatedZeros{elt}(Zeros(2, 3), dev(Matrix{elt})) + @test Zp == Z Zp = set_alloctype(z, dev(Matrix{elt})) @test Zp == Z Zc = copy(Z) @@ -44,6 +46,7 @@ using .NDTensorsTestUtils: devices_list # UnallocatedFill f = Fill{elt}(3, (2, 3, 4)) F = UnallocatedFill(f, Array{elt,ndims(f)}) + @test F isa AbstractFill @test size(F) == (2, 3, 4) @test length(F) == 24 @@ -51,6 +54,8 @@ using .NDTensorsTestUtils: devices_list @test norm(F) ≈ sqrt(elt(3)^2 * 24) @test F[2, 3, 1] == elt(3) @test allocate(F) isa Array{elt,3} + Fp = UnallocatedFill{elt}(Fill(3, (2, 3, 4)), Array{elt,ndims(f)}) + @test Fp == F Fp = allocate(F) @test norm(Fp) ≈ norm(F) Fs = similar(F)