Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Matrix sharps, matrix flats, subdivision, and link #59

Merged
merged 30 commits into from
Feb 27, 2024
Merged

Conversation

lukem12345
Copy link
Member

@lukem12345 lukem12345 commented Jul 1, 2023

This PR implements subdivision as a data migration, matrix versions of the sharp and flat operators, an alternative weighting scheme for the sharp operator, and the star, closed star, and link operators from S68 of Munkres' Elementary Algebraic Topology.

Some of these changes may need to get shifted to a different branch. In particular, subdivision cannot yet automatically compute barycenters of simplices until the attrMigr branch of Catlab is merged. Relatedly, refactoring the DualComplex schemas as a data migration that "remembers" e.g. which triangle a supporting dual triangle came from also depends on this functionality.

The star, closed star, and link operators were implemented as higher-level helper functions which will become more useful as 3D operators are becoming supported. This (not-Hodge) star essentially recursively computes cofaces, which is a common pattern in this codebase. e.g. grabbing all tetrahedra around a vertex v is simply star(v).

While developing the matrix version of the sharp operator, it was noted that the sharp of an EForm generated by a constant form would generate a primal vector field with the correct direction, but of incorrect magnitude. In particular, vectors with few neighbors would be too small, and those with many neighbors would be too large. By replacing the weighting denominator in Eq. 5.8.1 from Hirani with | star v | instead of | sigma n |, we successfully recover the original field (up to floating point error). This alternate discrete sharp operator can be selected via dispatching with AltPPSharp. Further, a sharp operator from Desbrun can be selected via DesbrunSharp.

As implemented at time of writing, the matrix-flat multiplied by a vector X of SVectors will return a vector of length 1 SArrays. When X is wrapped in DualVectorField(), this result is automatically reinterpreted to a vector of floats. This fix is a little unusual, but I am not sure how to structure the flat matrix to avoid this.

PPS
PPS_ALT

@lukem12345 lukem12345 marked this pull request as ready for review August 7, 2023 18:52
@lukem12345
Copy link
Member Author

Due to scheduling, this PR consists of a few disparate features:

  • Subdivision of non-embedded 1D delta sets w/o point attributes
  • Star, Closed Star, and Link operators from Munkres. a.k.a. "topological helper functions"
  • Matrix version of sharp
  • Matrix version of flat
  • Alternate weighting scheme for flat

All these features have tests.

When considering which features to merge, we should note:

  • Only 1D subdivision-as-data-migration is supported. Due to outstanding Catlab PR #823, barycentric and other automatic weighting of the point attribute is blocked. Although the current subdivide functions pass tests, perhaps this feature should live on a different branch for the time being.
  • Star, Closed Star, and Link are implemented for vertex input only. I believe that the current implementation is helpful as-is, however.
  • See my previous comment for the return type of the matrix version of flat
  • The Desbrun weighting scheme is rather poor, and I don't imagine it would be used in practice. However, it may still be nice to offer this for completeness' sake.
  • Likewise, I believe that the Hirani weighting scheme is inferior to the "Alternate" weighting scheme due to behavior mentioned in my previous comment. It may be best to change the default weighting scheme to "Alternate."

@lukem12345 lukem12345 self-assigned this Aug 10, 2023
@lukem12345
Copy link
Member Author

Todo:

  • [] Use QR decomposition in the new sharp operator

@jpfairbanks
Copy link
Member

I think you are probably better off with GMRES or PCG because the QR decomp will be dense.

@lukem12345
Copy link
Member Author

lukem12345 commented Feb 17, 2024 via email

Copy link
Member

@olynch olynch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've left some comments. The comments with 🟢 should be addressed in a future PR, the comments with 🔴 should be addressed in this PR.

src/FastDEC.jl Show resolved Hide resolved
src/Meshes.jl Show resolved Hide resolved
src/Meshes.jl Outdated Show resolved Hide resolved
src/Meshes.jl Outdated Show resolved Hide resolved
src/SimplicialSets.jl Show resolved Hide resolved
@lukem12345 lukem12345 merged commit ce8c47a into main Feb 27, 2024
9 checks passed
@epatters epatters deleted the llm/3d-dec branch February 27, 2024 22:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants