Skip to content
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

BUG: sparse: fix bugs in dia_matrix.setdiag #3272

Merged
merged 1 commit into from
Feb 25, 2014
Merged

Conversation

pv
Copy link
Member

@pv pv commented Feb 2, 2014

Some bugs in dia_matrix.setdiag slipped through. This PR fixes:

  • hide details of the internal dia_matrix data representation in
    setdiag(), so that setdiag() behavior is same for all spmatrix types
  • fix bugs in resizing self.data, which doesn't always have
    self.shape[1]==N
  • add scalar broadcasting behavior to setdiag() for all matrix types
  • add comprehensive tests

(Milestone added --- we don't want to have setdiag with known bugs there...)

@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling 018181d on pv:fix-setdiag into 28f9d10 on scipy:master.

@pv
Copy link
Member Author

pv commented Feb 14, 2014

Will merge soon-ish if no comments, so it makes 0.14.0

- hide details of the internal dia_matrix data representation in
  setdiag(), so that behavior matches the other spmatrix types

- fix bugs in resizing self.data, which doesn't always have
  self.shape[1]==N

- add scalar broadcasting behavior to setdiag() for all matrix types
@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling 4cd67a6 on pv:fix-setdiag into 96c85a5 on scipy:master.

@rgommers
Copy link
Member

This increases the number of errors on 32-bit:

======================================================================
ERROR: test_base.TestLIL.test_setdiag
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/rgommers/.local/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
    self.test(*self.arg)
  File "/home/rgommers/Code/scipy/scipy/sparse/tests/test_base.py", line 646, in test_setdiag
    check_setdiag(a, b, k)
  File "/home/rgommers/Code/scipy/scipy/sparse/tests/test_base.py", line 624, in check_setdiag
    b.setdiag(v, k)
  File "/home/rgommers/Code/scipy/scipy/sparse/base.py", line 770, in setdiag
    self[i, i + k] = values
  File "/home/rgommers/Code/scipy/scipy/sparse/lil.py", line 286, in __setitem__
    i, j, x)
  File "_csparsetools.pyx", line 112, in scipy.sparse._csparsetools.__pyx_fused_cpdef (../scipy/sparse/_csparsetools.c:3578)
TypeError: No matching signature found

Probably they'll be fixed when fixed the existing errors, but let's hold off on this one just to be sure.

@pv
Copy link
Member Author

pv commented Feb 25, 2014

The alternatives are to merge this before 0.14.0, or to revert eef58eb

@rgommers
Copy link
Member

Yes, I left the 0.14.0 milestone on this PR on purpose. We should fix those 32-bit issues anyway and then merge this.

@rgommers
Copy link
Member

Since this in itself is OK, let's merge it.

rgommers added a commit that referenced this pull request Feb 25, 2014
BUG: sparse: fix bugs in dia_matrix.setdiag
@rgommers rgommers merged commit c43260b into scipy:master Feb 25, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defect A clear bug or issue that prevents SciPy from being installed or used as expected scipy.sparse
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants