Skip to content

Conversation

xuluze
Copy link

@xuluze xuluze commented Jul 26, 2023

📚 Description

Add two_sum and examples. @jsantillan3

📝 Checklist

  • The title is concise, informative, and self-explanatory.
  • The description explains in detail what this PR is about.
  • I have linked a relevant issue or discussion.
  • I have created tests covering the changes.
  • I have updated the documentation accordingly.

⌛ Dependencies

def two_sum(self, other, *args):
raise NotImplementedError
def two_sum(first_mat, second_mat, first_marker, second_marker):
r"""
Copy link
Owner

Choose a reason for hiding this comment

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

This "marker" terminology coming from CMR is terrible. Can we find a better name for these arguments?

Copy link
Author

Choose a reason for hiding this comment

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

How about using col_index, row_index?

Copy link
Owner

Choose a reason for hiding this comment

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

Check how methods such as submatrix and matrix_from_rows_and_columns call their arguments

Copy link
Author

Choose a reason for hiding this comment

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

I change it to column and row following the arguments in submatrix

row_subdivision.append(second._mat.numRows)
column_subdivision.append(first._mat.numColumns)
column_subdivision.append(second._mat.numColumns)
CMR_CALL(CMRtwoSum(cmr, first._mat, second._mat, first_marker+1, -(second_marker+1), &sum_mat))
Copy link
Owner

Choose a reason for hiding this comment

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

This encoding of row and column indices is an implementation detail.

Better to use these functions:

    CMR_ELEMENT CMRrowToElement(size_t row)
    CMR_ELEMENT CMRcolumnToElement(size_t column)

Copy link
Author

Choose a reason for hiding this comment

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

Got it. I will change it. By the way, what does the sum.subdivide() do? I don't understand its function and just copy it from the one_sum function

Copy link
Owner

Choose a reason for hiding this comment

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

this is what creates the horizontal and vertical lines in the print representation of the matrix

@github-actions
Copy link

Documentation preview for this PR is ready! 🎉
Built with commit: 7145b68

@mkoeppe mkoeppe merged commit 3d5d01a into mkoeppe:cmr Jul 27, 2023
mkoeppe pushed a commit that referenced this pull request Oct 8, 2023
mkoeppe pushed a commit that referenced this pull request Dec 11, 2023
mkoeppe pushed a commit that referenced this pull request Feb 5, 2024
mkoeppe pushed a commit that referenced this pull request Feb 16, 2024
mkoeppe pushed a commit that referenced this pull request May 14, 2024
mkoeppe pushed a commit that referenced this pull request Jun 2, 2024
mkoeppe pushed a commit that referenced this pull request Oct 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants