Skip to content

Scipy sparse inplace fails after __array_ufunc__ merge #9019

Closed
@charris

Description

@charris

The following works before merge of #8247.

In [1]: import scipy.sparse as sp

In [2]: a = np.array((2,3))

In [3]: a += sp.lil_matrix(a)

After merge

In [1]: import scipy.sparse as sp

In [2]: a = np.array((2,3))

In [3]: a += sp.lil_matrix(a)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-3-4472ce1a04df> in <module>()
----> 1 a += sp.lil_matrix(a)

TypeError: ufunc 'add' output (typecode 'O') could not be coerced to provided output parameter (typecode 'l') according to the casting rule ''same_kind''

The sparse matrices depend on the fact that they are cast to objects, so this is a function of how object arrays are handled,

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions