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

[Persistence matrix] Better additions in U for RU matrices in Z2 #1143

Merged
merged 4 commits into from
Oct 24, 2024

Conversation

hschreiber
Copy link
Collaborator

Small optimization for the reduction of U in the RU decomposition. It does not make a big difference for small complexes, but divides by two the reduction time for big complexes.
The difference is mostly at line 851 of RU_matrix.h.

Copy link
Member

@mglisse mglisse left a comment

Choose a reason for hiding this comment

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

Since the new function has a precondition, some GUDHI_CHECK checking that the argument is indeed larger than the current pivot could make sense at some point.

*
* @param entry Entry to push back.
*/
void push_back(const Entry& entry);
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 I would have preferred a name like insert_pivot or insert_max_entry, but this is ok for now.

@@ -615,7 +615,7 @@ inline void Base_matrix<Master_matrix>::print()
if constexpr (Master_matrix::Option_list::has_row_access) {
std::cout << "Row Matrix:\n";
for (Index i = 0; i < nextInsertIndex_; ++i) {
const auto& row = RA_opt::rows_[i];
const auto& row = (*RA_opt::rows_)[i];
Copy link
Member

Choose a reason for hiding this comment

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

Just to confirm: this is a bugfix independent of the main goal of the PR, right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, I stumbled over it while testing the new strategy.

Comment on lines +652 to +653
static_assert(!Master_matrix::Option_list::is_z2,
"Multiplication with something else than the identity is not allowed with Z2 coefficients.");
Copy link
Member

Choose a reason for hiding this comment

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

How do you know that the argument is not the identity?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't know, I just wanted to say that for Z2 add_to should be used in all cases, as multiplying by 0 the column is likely an error and a bit costly to implement as U is transposed.

@VincentRouvreau VincentRouvreau merged commit 1cf5a3d into GUDHI:master Oct 24, 2024
5 of 7 checks passed
@VincentRouvreau VincentRouvreau added the 3.11.0 GUDHI version 3.11.0 label Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.11.0 GUDHI version 3.11.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants