Repository navigation
Conversation
eriknw
force-pushed
the
45-ss-flatten-vector-size
branch
from
October 19, 2026 07:55
648f2d5 to
ddfa762
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 18-ss-namespace-refcycle #637 +/- ##
============================================================
+ Coverage 98.64% 98.65% +0.01%
============================================================
Files 105 105
Lines 29204 29217 +13
Branches 3438 3439 +1
============================================================
+ Hits 28807 28823 +16
+ Misses 260 258 -2
+ Partials 137 136 -1 🚀 New features to boost your workflow:
|
eriknw
force-pushed
the
45-ss-flatten-vector-size
branch
from
October 20, 2026 22:28
ddfa762 to
55e8685
Compare
eriknw
force-pushed
the
45-ss-flatten-vector-size
branch
2 times, most recently
from
October 21, 2026 08:38
a2553e5 to
49ae61c
Compare
eriknw
force-pushed
the
45-ss-flatten-vector-size
branch
from
October 28, 2026 04:29
49ae61c to
2192ea8
Compare
eriknw
force-pushed
the
45-ss-flatten-vector-size
branch
from
October 28, 2026 13:21
2192ea8 to
0713988
Compare
Matrix.ss.flatten reshapes a copy to n x 1 and casts the GrB_Matrix to a
GrB_Vector in place (_as_vector). SuiteSparse holds a GrB_Vector as a
one-column matrix by column, but GxB_Matrix_reshapeDup keeps the input's
orientation, so flattening a Matrix held by row (python-graphblas's
default) gave a Vector that SuiteSparse sees as size 1:
v = Matrix.from_coo([0, 1], [1, 2], [1.0, 2.0]).ss.flatten()
v.shape # (6,)
v.size # 1
v.get(5) # InvalidIndex
isequal and to_coo read the Python-side size and looked right, which is
why test_ss_flatten passed. Reproduced on 03cf0bc with SuiteSparse
10.5.1 as well as on this stack with 10.5.0.
_as_vector now sets the matrix's format to by_col when it is held by
row, so the cast is valid for every caller; flatten is the only one
today. The new test flattens a 2 x 3 Matrix imported in each of the
eight formats, in both orders, and checks size, every element through
get, and dup; the four by-row formats failed with "assert 1 == 6".
eriknw
force-pushed
the
45-ss-flatten-vector-size
branch
from
October 29, 2026 02:01
0713988 to
e6030c0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Matrix.ss.flattenreshapes a copy to n x 1 and casts it to a GrB_Vector inplace (
_as_vector). SuiteSparse holds a Vector by column, butGxB_Matrix_reshapeDupkeeps the input's orientation, so a Matrix held by row(the default) was flattened into a Vector that SuiteSparse sees as size 1:
test_ss_flattenpassed becauseisequalandto_cooread the Python-sidesize.
_as_vectornow sets the format to by_col first (on the copy; thecaller's Matrix is untouched). The new test covers all eight import formats in
both orders, checking size, every element and
dup. No measurable cost.