Skip to content

Conversation

@corybrunson
Copy link
Member

This PR introduces the return_class parameter to vietoris_rips() and cubical(). It defaults to "PHom" and can be set to "persistence" instead; for the latter option, {phutil} becomes a dependency. The PHom (and default) output should be unchanged, while the persistence output provides some metadata that the class understands.

The plan is to change the default to "persistence" in the next major release and eventually deprecate the "PHom" class and its option.

@corybrunson corybrunson requested a review from astamm August 21, 2025 10:53
@corybrunson corybrunson added the enhancement New feature or request label Aug 23, 2025
Copy link

Choose a reason for hiding this comment

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

Why not starting the deprecation right now?

Copy link
Member Author

Choose a reason for hiding this comment

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

My thinking was that users would get a soft notice (introduction of options), then a soft warning (change of default), then a hard warning (deprecation). But i concede that i err toward being too gradual.

R/cubical.R Outdated
#' @rdname cubical
#' @export cubical
#' @return `PHom` object
#' @return `"PHom"` or `"persistence"` object
Copy link

Choose a reason for hiding this comment

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

We could have the documentation here link to the documentation of as_persistence() and as_PHom().

#' @rdname vietoris_rips
#' @export vietoris_rips
#' @return `PHom` object
#' @return `"PHom"` or `"persistence"` object
Copy link

Choose a reason for hiding this comment

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

Same comment here.

Copy link
Member Author

Choose a reason for hiding this comment

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

On this and the above comment, i lean toward non-duplication of hyperlinks, and i believe (or at least intended) that the persistence class is linked in the Details. But i would not object to this change.

Copy link
Member Author

Choose a reason for hiding this comment

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

On reflection, i'm with you.

#' <doi:10.1527/tjsai.D-G72>. Persistent homology of the resulting matrix is
#' then calculated.
#'
#' @importFrom phutil as_persistence
Copy link

Choose a reason for hiding this comment

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

Better to call phutil::as_persistence() than to actually import the function from {phutil}.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good call. Feel free to make that change!

Copy link
Member Author

Choose a reason for hiding this comment

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

Never mind, i'm on it.

@corybrunson
Copy link
Member Author

@astamm could you review again?

In particular, wrapping the soft-deprecation call in a helper function undermined its environment-sensitive design, so i dropped it into every place "PHom" is invoked. Please confirm that it works as expected. : )

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