AlgebraicJulia / DiagrammaticEquations.jl

MIT License
12 stars 1 forks source link

Higher level incident call #60

Open GeorgeR227 opened 3 months ago

GeorgeR227 commented 3 months ago

This PR adds a higher level collected_incident function that is meant to serve as a replacement to the many reduce-vcats we tend to use when trying to call incident on multiple things at once. Since results from this function are always combined into a single vector of unique results, as opposed to incident which may return a vector of vector of results, care must be taken when calling this function into different tables or when calling with multiple inputs.

This function is meant to be generic to work well with the idea that DiagrammaticEquations should have abstracted algorithms but I've also added specific helper functions for Decapodes that may be useful.

lukem12345 commented 3 months ago

Some calls may be better off as @generated functions. We should talk about what it would take for this to be in ACSets main at Wednesday's Catlab Developer's meeting.

GeorgeR227 commented 3 months ago

I'd rather not be writing @generated calls since we've seen that they don't have their intended effects in ACSets anyway and that'd severely complicate the code.

Having this in ACSets main sounds fine but it leads me to wonder what exactly is supposed to be the difference between ACSets and DiagrammaticEquations.

lukem12345 commented 3 months ago

To ACSets.jl belong data structures and algorithms over generic (not only compute-graph like) schemas. Partitioning the code as of the most recent commit, src/query.jl and test/query.jl are ACSets.jl-like.

The "query" related code is quite similar to the chained-subparts code, which Sean contributed to ACSets.jl, in that case using CompTime. A recent draft PR demonstrates how using @generated to replace that feature allows the Julia compiler to e.g. eliminate intermediate allocations from certain loops.

Sean's PR provides syntactic sugar for nested calls to incident. This current PR for adjacent. The code written for the current PR can only be improved by consulting with those sister ones.

codecov[bot] commented 3 months ago

Codecov Report

Attention: Patch coverage is 80.00000% with 6 lines in your changes missing coverage. Please review.

Project coverage is 86.55%. Comparing base (55d2972) to head (e54b692).

Files Patch % Lines
src/deca/deca_query.jl 40.00% 6 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #60 +/- ## ========================================== - Coverage 86.80% 86.55% -0.25% ========================================== Files 13 15 +2 Lines 894 922 +28 ========================================== + Hits 776 798 +22 - Misses 118 124 +6 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.