Skip to content

Commit

Permalink
Merge pull request #1239 from cbm755/only_flat
Browse files Browse the repository at this point in the history
Port helpers from list-of-lists to flat+shape
  • Loading branch information
cbm755 authored Oct 14, 2022
2 parents f16deb3 + fd79620 commit 4f6b65b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions inst/@sym/private/mat_rclist_access.m
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@

cmd = {'(A, rr, cc) = _ins'
'AA = A.tolist() if isinstance(A, (MatrixBase, NDimArray)) else [[A]]'
'MM = [[AA[i][j]] for i, j in zip(rr, cc)]'
'M = make_2d_sym(MM)'
'return M,'};
'M = [AA[i][j] for i, j in zip(rr, cc)]'
'return _make_2d_sym(M, shape=(len(rr), 1)),'
};

rr = num2cell(int32(r-1));
cc = num2cell(int32(c-1));
Expand Down
2 changes: 1 addition & 1 deletion inst/@sym/private/mat_rclist_asgn.m
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
% Easy trick to copy A into larger matrix AA:
% AA = sp.Matrix.zeros(n, m)
% AA[0, 0] = A
% Also usefil: .copyin_matrix
% Also useful: .copyin_matrix

cmd = {'(A, rr, cc, b) = _ins'
'assert A == [] or not isinstance(A, list), "unexpectedly non-empty list: report bug!"'
Expand Down

0 comments on commit 4f6b65b

Please sign in to comment.