Skip to content

Commit

Permalink
Merge pull request #868 from AlgebraicJulia/fixSetFunctionCallable
Browse files Browse the repository at this point in the history
Make sure you can add SetFunctionCallables to BipartiteDiagrams during limit computation
  • Loading branch information
epatters committed Dec 5, 2023
2 parents 795b05a + 17ef10b commit c4c28af
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 605 deletions.
13 changes: 6 additions & 7 deletions src/categorical_algebra/FinSets.jl
Original file line number Diff line number Diff line change
Expand Up @@ -850,12 +850,11 @@ function limit(d::BipartiteFreeDiagram{<:SetOb,<:FinDomFunction{Int}})
# incoming morphisms.
@assert !any(isempty(incident(d, v, :tgt)) for v in vertices₂(d))
d_original = d

# For uniformity, e.g. when pairing below, ensure that all objects in layer 2
# are type sets.
if !all(x isa TypeSet for x in ob₂(d))
d = map(d, ob₁=identity, ob₂=ensure_type_set, hom=ensure_type_set_codom)
end
d′ = BipartiteFreeDiagram{SetOb,FinDomFunction{Int}}()
add_vertices₁!(d′, nv₁(d), ob₁=ob₁(d))
add_vertices₂!(d′, nv₂(d), ob₂=ensure_type_set.(ob₂(d)))
add_edges!(d′,src(d,edges(d)),tgt(d,edges(d)),hom=ensure_type_set_codom.(hom(d)))
d = d′

# It is generally optimal to compute all equalizers (self joins) first, so as
# to reduce the sizes of later pullbacks (joins) and products (cross joins).
Expand Down Expand Up @@ -925,7 +924,7 @@ end
ensure_type_set(s::FinSet) = TypeSet(eltype(s))
ensure_type_set(s::TypeSet) = s
ensure_type_set_codom(f::FinFunction) =
FinDomFunction([f(i) for i in dom(f)], dom(f), TypeSet(eltype(codom(f))))
FinDomFunction(collect(f),dom(f), TypeSet(eltype(codom(f))))
ensure_type_set_codom(f::IndexedFinFunctionVector) =
IndexedFinDomFunctionVector(f.func, index=f.index)
ensure_type_set_codom(f::FinDomFunction) = f
Expand Down
Loading

0 comments on commit c4c28af

Please sign in to comment.