Pewarta Proxy

📋 Server Request & Proxy Logs

Loading active proxy settings...
Developed by Khairul Adha (adhexa.id)
Mengambil log server...

⚙️ Pengaturan Proxy Target

Skip to content

Hold a Matrix by column before casting it to a Vector - #637

Open
eriknw wants to merge 1 commit into
18-ss-namespace-refcyclefrom
45-ss-flatten-vector-size
Open

eriknw wants to merge 1 commit into
18-ss-namespace-refcyclefrom
45-ss-flatten-vector-size

Conversation

@eriknw

@eriknw eriknw commented Oct 19, 2026

Copy link
Copy Markdown
Member

Matrix.ss.flatten reshapes a copy to n x 1 and casts it to a GrB_Vector in
place (_as_vector). SuiteSparse holds a Vector by column, but
GxB_Matrix_reshapeDup keeps the input's orientation, so a Matrix held by row
(the default) was flattened into a Vector that SuiteSparse sees as size 1:

v = Matrix.from_coo([0, 1], [1, 2], [1.0, 2.0]).ss.flatten()
v.shape, v.size   # (6,), 1
v.get(5)          # InvalidIndex

test_ss_flatten passed because isequal and to_coo read the Python-side
size. _as_vector now sets the format to by_col first (on the copy; the
caller's Matrix is untouched). The new test covers all eight import formats in
both orders, checking size, every element and dup. No measurable cost.

@eriknw
eriknw added this pull request to stack #650 October 19, 2026 07:50
@eriknw
eriknw force-pushed the 45-ss-flatten-vector-size branch from 648f2d5 to ddfa762 Compare October 19, 2026 07:55
@codecov

codecov Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.65%. Comparing base (accb051) to head (e6030c0).

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:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@eriknw
eriknw force-pushed the 45-ss-flatten-vector-size branch from ddfa762 to 55e8685 Compare October 20, 2026 22:28
@eriknw
eriknw force-pushed the 45-ss-flatten-vector-size branch 2 times, most recently from a2553e5 to 49ae61c Compare October 21, 2026 08:38
@eriknw
eriknw removed this pull request from stack #650 October 28, 2026 04:29
@eriknw
eriknw force-pushed the 45-ss-flatten-vector-size branch from 49ae61c to 2192ea8 Compare October 28, 2026 04:29
@eriknw
eriknw added this pull request to stack #653 October 28, 2026 04:30
@eriknw
eriknw removed this pull request from stack #653 October 28, 2026 04:31
@eriknw
eriknw added this pull request to stack #655 October 28, 2026 04:32
@eriknw
eriknw removed this pull request from stack #655 October 28, 2026 04:33
@eriknw
eriknw added this pull request to stack #657 October 28, 2026 04:33
@eriknw
eriknw force-pushed the 45-ss-flatten-vector-size branch from 2192ea8 to 0713988 Compare October 28, 2026 13:21
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
eriknw force-pushed the 45-ss-flatten-vector-size branch from 0713988 to e6030c0 Compare October 29, 2026 02:01
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.

1 participant