-
Notifications
You must be signed in to change notification settings - Fork 2
Add two_sum in matrix_cmr_sparse.pyx #9
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
Conversation
def two_sum(self, other, *args): | ||
raise NotImplementedError | ||
def two_sum(first_mat, second_mat, first_marker, second_marker): | ||
r""" |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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)) |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
Documentation preview for this PR is ready! 🎉 |
📚 Description
Add two_sum and examples. @jsantillan3📝 Checklist
⌛ Dependencies