Skip to content

Commit 62552b5

Browse files
committed
Fix non-static zero entry
1 parent 28c087d commit 62552b5

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/system/entry.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ function Base.show(io::IO, mime::MIME{Symbol("text/plain")}, entry::Entry)
1919
end
2020

2121

22-
Base.zero(::Entry{ET}) where ET = Entry(zero(ET), false)
22+
function Base.zero(::Entry{ET}) where ET
23+
dims = [ET.parameters[1].parameters...]
24+
return Entry{ET.parameters[2]}(dims...)
25+
end
2326
Base.zero(::Type{Entry}) = Entry(nothing, false)
2427

2528
Base.:+(E1::Entry, E2::Entry) = Entry(E1.value + E2.value, false)

test/algebra.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ include("adjacency_matrix.jl")
66
for i=1:5
77
r1 = randn()
88
r2 = randn()
9-
system = System{Float64}(A, rand(0:3, size(A)[1]))
9+
system = System{Float64}(A, rand(0:20, size(A)[1]))
1010
initialize!(system)
1111

1212
F = full_matrix(system)

0 commit comments

Comments
 (0)