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

Updated Hodge Star for 1-Forms #35

Merged
merged 12 commits into from
Sep 10, 2021
Merged

Updated Hodge Star for 1-Forms #35

merged 12 commits into from
Sep 10, 2021

Conversation

bosonbaas
Copy link
Member

This PR provides an implementation of the hodge star on primal 1-forms presented in Ayoub et al 2021.

@bosonbaas bosonbaas added the enhancement New feature or request label Jul 22, 2021
@bosonbaas bosonbaas self-assigned this Jul 22, 2021
@bosonbaas
Copy link
Member Author

bosonbaas commented Jul 22, 2021

There are still a few things that need to be decided before merging this PR, specifically:

  • How do we want to facilitate the user choosing between the diagonal hodge star (if using just circumcentric sub) and this one?
  • Since this does not have a hodge_diag function, the δ function will need to be updated to support this implementation. (related to the first question)
  • Tests need to be added to show consistency between the diagonal and new hodge star for circumcentric subdivision.

@epatters
Copy link
Member

epatters commented Aug 9, 2021

Thanks for implementing this improved Hodge star. Re: your first question, I think we should use the dispatch-on-algorithm design pattern, used elsewhere in this package to select to the subdivision method. We should make this new Hodge star the default, but keep the diagonal Hodge star around for benchmarking and debugging purposes.

Copy link
Member

@jpfairbanks jpfairbanks left a comment

Choose a reason for hiding this comment

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

I noticed some performance issues that I think we can easily clean up.

src/DiscreteExteriorCalculus.jl Outdated Show resolved Hide resolved
src/DiscreteExteriorCalculus.jl Outdated Show resolved Hide resolved
e = reverse(triangle_edges(s, t))
ev = point(s, tgt(s, e)) .- point(s, src(s,e))

dv = fill(dual_point(s, triangle_center(s, t)),3) .- dual_point(s, edge_center(s, e))
Copy link
Member

Choose a reason for hiding this comment

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

I think that you can avoid this fill because of the semantics of broadcasting .- either you can avoid it or pull it outside the subtraction.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, it'd be nice to remove that fill, but I'm not sure how to get it to broadcast the first argument (which is a 3-element vector) over the second argument (which is a 3-element vector of 3-element vectors). In this last commit I've changed it out with a map call, but I'd be interested in learning about other solutions to this.

src/DiscreteExteriorCalculus.jl Outdated Show resolved Hide resolved
@bosonbaas
Copy link
Member Author

I've tested the new hodge on some physical systems, and it seems to be performing as expected! I've included tests which should evaluate both the diagonal and geometric hodge stars, and added a keyword system for specifying hodge star and matrix type from any of the methods that depend on these.

I'll just be adding some tests for codecov, but the body of the code is ready for another review!

@bosonbaas
Copy link
Member Author

100% coverage now!

@bosonbaas bosonbaas requested a review from epatters August 23, 2021 14:56
Copy link
Member

@epatters epatters left a comment

Choose a reason for hiding this comment

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

Thanks Andrew, this will be great to have.

@@ -6,6 +6,7 @@ using SparseArrays, StaticArrays

using Catlab.CategoricalAlgebra.CSets
using CombinatorialSpaces
using CombinatorialSpaces.DiscreteExteriorCalculus: inv_hodge_star
Copy link
Member

Choose a reason for hiding this comment

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

I guess we should go ahead and export this function.

Copy link
Member Author

Choose a reason for hiding this comment

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

Would it make sense to also include a function for ⋆ that accepts a DualForm and calls inv_hodge_star?

Copy link
Member

Choose a reason for hiding this comment

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

I'd prefer to introduce a new operator ⋆⁻¹ as in the exterior calculus GAT.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, yeah, that makes sense.

Copy link
Member

Choose a reason for hiding this comment

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

Created issue #43 for this.

test/DiscreteExteriorCalculus.jl Show resolved Hide resolved
src/DiscreteExteriorCalculus.jl Outdated Show resolved Hide resolved
src/DiscreteExteriorCalculus.jl Outdated Show resolved Hide resolved
src/DiscreteExteriorCalculus.jl Outdated Show resolved Hide resolved
src/DiscreteExteriorCalculus.jl Outdated Show resolved Hide resolved
@bosonbaas bosonbaas requested a review from epatters September 3, 2021 15:12
@epatters
Copy link
Member

Thanks Andrew! I will go ahead and merge this now.

@epatters epatters merged commit 6fa9f51 into main Sep 10, 2021
@epatters epatters deleted the hodge_dev branch September 10, 2021 03:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants