Add two_sum in matrix_cmr_sparse.pyx#9
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.
This "marker" terminology coming from CMR is terrible. Can we find a better name for these arguments?
There was a problem hiding this comment.
How about using col_index, row_index?
There was a problem hiding this comment.
Check how methods such as submatrix and matrix_from_rows_and_columns call their arguments
There was a problem hiding this comment.
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.
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.
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.
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