diff --git a/Project.toml b/Project.toml index 56fe5228..6e062118 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "Ripserer" uuid = "aa79e827-bd0b-42a8-9f10-2b302677a641" authors = ["mtsch "] -version = "0.6.3" +version = "0.6.4" [deps] Compat = "34da2185-b29b-5c13-b0c7-acf172513d20" diff --git a/src/cubical.jl b/src/cubical.jl index d5968d32..65906bdb 100644 --- a/src/cubical.jl +++ b/src/cubical.jl @@ -83,7 +83,11 @@ Base.LinearIndices(cf::Cubical) = LinearIndices(cf.data) function diam(cf::Cubical{T}, vertices) where {T} res = typemin(T) for v in vertices - res = max(res, get(cf.data, v, missing)) + if isnothing(get(cf.data, v, nothing)) + return missing + else + res = max(res, cf.data[v]) + end end return res end @@ -148,7 +152,7 @@ function Base.iterate(cc::CubeletCoboundary{A, N, C}, (dim, dir)=(1, 1)) where { break end - diff = CartesianIndex(ntuple(i -> i == dim ? dir : 0, N)) + diff = CartesianIndex{N}(ntuple(isequal(dim), N) .* dir) new_vertices = cc.vertices .+ Ref(diff) diameter = max(diam(cc.cubelet), diam(cc.filtration, new_vertices))