Skip to content

Commit

Permalink
constructor fix and test
Browse files Browse the repository at this point in the history
  • Loading branch information
kmp5VT committed May 20, 2024
1 parent dc4d3db commit f20a818
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion NDTensors/src/lib/UnallocatedArrays/src/unallocatedfill.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
3 changes: 3 additions & 0 deletions NDTensors/src/lib/UnallocatedArrays/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ using .NDTensorsTestUtils: devices_list
@testset "Basic funcitonality" begin
z = Zeros{elt}((2, 3))
Z = UnallocatedZeros(z, dev(Matrix{elt}))
Z = UnallocatedZeros{elt}(z, dev(Matrix{elt}))

@test Z isa AbstractFill
@test size(Z) == (2, 3)
Expand Down Expand Up @@ -44,6 +45,8 @@ using .NDTensorsTestUtils: devices_list
# UnallocatedFill
f = Fill{elt}(3, (2, 3, 4))
F = UnallocatedFill(f, Array{elt,ndims(f)})
F = UnallocatedFill{elt}(f, Array{elt,ndims(f)})

@test F isa AbstractFill
@test size(F) == (2, 3, 4)
@test length(F) == 24
Expand Down

0 comments on commit f20a818

Please sign in to comment.