hameerabbasi: Hello, the correct way to fix this would be to modify `__rmul__` to return `scalar * COO`. Fixing it this way causes the broadcasting path to be taken which will be much, much slower and will fail for scalar `COO` objects, returning 1-D instead of scalar.
fujiisoup: Hi, @hameerabbasi 
Thanks for the quick response.

> the correct way to fix this would be to modify __rmul__ to return scalar * COO

`np.number` has `__mul__` method and thus `COO.__rmul__` will not be called.
Instead, `np.number.__mul__` calls `COO.__array_ufunc__`.

Another option would be to have a special treatment for the `func is operator.mul` case in `__array_ufunc__`, but the code would be more complicated.
hameerabbasi: Hey! I came up with a long-term solution to this, hope it will be of use.

```
@staticmethod
    def _elemwise(func, *args, **kwargs):
        assert len(args) >= 1
        self = args[0]
        if isinstance(self, scipy.sparse.spmatrix):
            self = COO.from_numpy(self)
        elif np.isscalar(self):
            func = partial(func, self)
            other = args[1]
            if isinstance(other, scipy.sparse.spmatrix):
                other = COO.from_scipy_sparse(other)

            return other._elemwise_unary(func, *args[2:], **kwargs)

        if len(args) == 1:
            return self._elemwise_unary(func, *args[1:], **kwargs)
        else:
            other = args[1]
            if isinstance(other, scipy.sparse.spmatrix):
                other = COO.from_scipy_sparse(other)

            if isinstance(other, COO):
                return self._elemwise_binary(func, *args[1:], **kwargs)
            else:
                return self._elemwise_unary(func, *args[1:], **kwargs)
```

If you check this in, maybe @mrocklin can review it.
hameerabbasi: @fujiisoup I've edited the elemwise to account for the unit test failure.
fujiisoup: Cool!!

I added more tests for left-side operations.
Additionally, I added a support also for 0-dimensional `np.ndarray`.
hameerabbasi: Would you be kind enough to rebase this on `master`? Your other PR caused conflicts with this one.
hameerabbasi: Just waiting on either of @nils-werner or @mrocklin to review these changes... Since I was involved in adding code, I shouldn't be the one to review it. :-)
diff --git a/sparse/core.py b/sparse/core.py
index e455a9d..9a28145 100644
--- a/sparse/core.py
+++ b/sparse/core.py
@@ -1,7 +1,7 @@
 from __future__ import absolute_import, division, print_function
 
 from collections import Iterable, defaultdict, deque
-from functools import reduce
+from functools import reduce, partial
 import numbers
 import operator
 
@@ -728,6 +728,13 @@ class COO(object):
         self = args[0]
         if isinstance(self, scipy.sparse.spmatrix):
             self = COO.from_numpy(self)
+        elif np.isscalar(self) or (isinstance(self, np.ndarray)
+                                   and self.ndim == 0):
+            func = partial(func, self)
+            other = args[1]
+            if isinstance(other, scipy.sparse.spmatrix):
+                other = COO.from_numpy(other)
+            return other._elemwise_unary(func, *args[2:], **kwargs)
 
         if len(args) == 1:
             return self._elemwise_unary(func, *args[1:], **kwargs)

left-side np.scalar multiplication
Hi,

I noticed multiplication with `np.scalar` such as `np.float32` fails,

```python
In [1]: import numpy as np
   ...: import sparse
   ...: x = sparse.random((2, 3, 4), density=0.5)
   ...: x * np.float32(2.0)  # This succeeds
   ...: 
Out[1]: <COO: shape=(2, 3, 4), dtype=float64, nnz=12, sorted=False, duplicates=True>

In [2]: np.float32(2.0) * x  # fails
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-2-e1d24f7d85b3> in <module>()
----> 1 np.float32(2.0) * x  # fails

~/Dropbox/projects/sparse/sparse/core.py in __array_ufunc__(self, ufunc, method, *inputs, **kwargs)
    491     def __array_ufunc__(self, ufunc, method, *inputs, **kwargs):
    492         if method == '__call__':
--> 493             return COO._elemwise(ufunc, *inputs, **kwargs)
    494         elif method == 'reduce':
    495             return COO._reduce(ufunc, *inputs, **kwargs)

~/Dropbox/projects/sparse/sparse/core.py in _elemwise(func, *args, **kwargs)
    735             other = args[1]
    736             if isinstance(other, COO):
--> 737                 return self._elemwise_binary(func, *args[1:], **kwargs)
    738             elif isinstance(other, scipy.sparse.spmatrix):
    739                 other = COO.from_scipy_sparse(other)

AttributeError: 'numpy.float32' object has no attribute '_elemwise_binary'
```
diff --git a/sparse/tests/test_core.py b/sparse/tests/test_core.py
index 394abe7..2858e02 100644
--- a/sparse/tests/test_core.py
+++ b/sparse/tests/test_core.py
@@ -265,8 +265,11 @@ def test_op_scipy_sparse():
     (operator.le, -3),
     (operator.eq, 1)
 ])
-def test_elemwise_scalar(func, scalar):
+@pytest.mark.parametrize('convert_to_np_number', [True, False])
+def test_elemwise_scalar(func, scalar, convert_to_np_number):
     xs = sparse.random((2, 3, 4), density=0.5)
+    if convert_to_np_number:
+        scalar = np.float32(scalar)
     y = scalar
 
     x = xs.todense()
@@ -278,6 +281,33 @@ def test_elemwise_scalar(func, scalar):
     assert_eq(fs, func(x, y))
 
 
+@pytest.mark.parametrize('func, scalar', [
+    (operator.mul, 5),
+    (operator.add, 0),
+    (operator.sub, 0),
+    (operator.gt, -5),
+    (operator.lt, 5),
+    (operator.ne, 0),
+    (operator.ge, -5),
+    (operator.le, 3),
+    (operator.eq, 1)
+])
+@pytest.mark.parametrize('convert_to_np_number', [True, False])
+def test_leftside_elemwise_scalar(func, scalar, convert_to_np_number):
+    xs = sparse.random((2, 3, 4), density=0.5)
+    if convert_to_np_number:
+        scalar = np.float32(scalar)
+    y = scalar
+
+    x = xs.todense()
+    fs = func(y, xs)
+
+    assert isinstance(fs, COO)
+    assert xs.nnz >= fs.nnz
+
+    assert_eq(fs, func(y, x))
+
+
 @pytest.mark.parametrize('func, scalar', [
     (operator.add, 5),
     (operator.sub, -5),
@@ -601,15 +631,19 @@ def test_broadcast_to(shape1, shape2):
     assert_eq(np.broadcast_to(x, shape2), a.broadcast_to(shape2))
 
 
-def test_scalar_multiplication():
+@pytest.mark.parametrize('scalar', [2, 2.5, np.float32(2.0), np.int8(3)])
+def test_scalar_multiplication(scalar):
     a = sparse.random((2, 3, 4), density=0.5)
     x = a.todense()
 
-    assert_eq(x * 2, a * 2)
-    assert_eq(2 * x, 2 * a)
-    assert_eq(x / 2, a / 2)
-    assert_eq(x / 2.5, a / 2.5)
-    assert_eq(x // 2.5, a // 2.5)
+    assert_eq(x * scalar, a * scalar)
+    assert (a * scalar).nnz == a.nnz
+    assert_eq(scalar * x, scalar * a)
+    assert (scalar * a).nnz == a.nnz
+    assert_eq(x / scalar, a / scalar)
+    assert (a / scalar).nnz == a.nnz
+    assert_eq(x // scalar, a // scalar)
+    # division may reduce nnz.
 
 
 @pytest.mark.filterwarnings('ignore:divide by zero')

pip install -e .[tests]
parse_log_pytest
requirements.txt
pytest pytest-cov pytest-flake8
apt-get update apt-get install -y gcc
3.6
requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
attrs==22.2.0
certifi==2021.5.30
coverage==6.2
flake8==5.0.4
importlib-metadata==4.2.0
iniconfig==1.1.1
mccabe==0.7.0
numpy==1.19.5
packaging==21.3
pluggy==1.0.0
py==1.11.0
pycodestyle==2.9.1
pyflakes==2.5.0
pyparsing==3.1.4
pytest==7.0.1
pytest-cov==4.0.0
pytest-flake8==1.1.1
scipy==1.5.4
-e git+https://github.com/mrocklin/sparse.git@9be8058708127553d543a61001843e7064f885b9#egg=sparse
tomli==1.2.3
typing_extensions==4.1.1
zipp==3.6.0

name: sparse
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2021.5.30=py36h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.3=he6710b0_2
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - pip=21.2.2=py36h06a4308_0
  - python=3.6.13=h12debd9_1
  - readline=8.2=h5eee18b_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - attrs==22.2.0
      - coverage==6.2
      - flake8==5.0.4
      - importlib-metadata==4.2.0
      - iniconfig==1.1.1
      - mccabe==0.7.0
      - numpy==1.19.5
      - packaging==21.3
      - pluggy==1.0.0
      - py==1.11.0
      - pycodestyle==2.9.1
      - pyflakes==2.5.0
      - pyparsing==3.1.4
      - pytest==7.0.1
      - pytest-cov==4.0.0
      - pytest-flake8==1.1.1
      - scipy==1.5.4
      - tomli==1.2.3
      - typing-extensions==4.1.1
      - zipp==3.6.0
prefix: /opt/conda/envs/sparse

sparse/tests/test_core.py::test_leftside_elemwise_scalar[True-mul-5] sparse/tests/test_core.py::test_leftside_elemwise_scalar[True-add-0] sparse/tests/test_core.py::test_leftside_elemwise_scalar[True-sub-0] sparse/tests/test_core.py::test_leftside_elemwise_scalar[True-gt--5] sparse/tests/test_core.py::test_leftside_elemwise_scalar[True-lt-5] sparse/tests/test_core.py::test_leftside_elemwise_scalar[True-ge--5] sparse/tests/test_core.py::test_leftside_elemwise_scalar[True-le-3] sparse/tests/test_core.py::test_scalar_multiplication[scalar2] sparse/tests/test_core.py::test_scalar_multiplication[scalar3]
sparse/__init__.py::flake-8::FLAKE8 sparse/core.py::flake-8::FLAKE8 sparse/core.py::sparse.core.COO sparse/slicing.py::flake-8::FLAKE8 sparse/utils.py::flake-8::FLAKE8 sparse/tests/test_core.py::flake-8::FLAKE8
sparse/core.py::sparse.core.random sparse/slicing.py::sparse.slicing.check_index sparse/slicing.py::sparse.slicing.normalize_index sparse/slicing.py::sparse.slicing.normalize_slice sparse/slicing.py::sparse.slicing.posify_index sparse/slicing.py::sparse.slicing.replace_ellipsis sparse/slicing.py::sparse.slicing.sanitize_index sparse/tests/test_core.py::test_reductions[True-None-max-kwargs0-eqkwargs0] sparse/tests/test_core.py::test_reductions[True-None-sum-kwargs1-eqkwargs1] sparse/tests/test_core.py::test_reductions[True-None-sum-kwargs2-eqkwargs2] sparse/tests/test_core.py::test_reductions[True-None-prod-kwargs3-eqkwargs3] sparse/tests/test_core.py::test_reductions[True-None-min-kwargs4-eqkwargs4] sparse/tests/test_core.py::test_reductions[True-0-max-kwargs0-eqkwargs0] sparse/tests/test_core.py::test_reductions[True-0-sum-kwargs1-eqkwargs1] sparse/tests/test_core.py::test_reductions[True-0-sum-kwargs2-eqkwargs2] sparse/tests/test_core.py::test_reductions[True-0-prod-kwargs3-eqkwargs3] sparse/tests/test_core.py::test_reductions[True-0-min-kwargs4-eqkwargs4] sparse/tests/test_core.py::test_reductions[True-1-max-kwargs0-eqkwargs0] sparse/tests/test_core.py::test_reductions[True-1-sum-kwargs1-eqkwargs1] sparse/tests/test_core.py::test_reductions[True-1-sum-kwargs2-eqkwargs2] sparse/tests/test_core.py::test_reductions[True-1-prod-kwargs3-eqkwargs3] sparse/tests/test_core.py::test_reductions[True-1-min-kwargs4-eqkwargs4] sparse/tests/test_core.py::test_reductions[True-2-max-kwargs0-eqkwargs0] sparse/tests/test_core.py::test_reductions[True-2-sum-kwargs1-eqkwargs1] sparse/tests/test_core.py::test_reductions[True-2-sum-kwargs2-eqkwargs2] sparse/tests/test_core.py::test_reductions[True-2-prod-kwargs3-eqkwargs3] sparse/tests/test_core.py::test_reductions[True-2-min-kwargs4-eqkwargs4] sparse/tests/test_core.py::test_reductions[True-axis4-max-kwargs0-eqkwargs0] sparse/tests/test_core.py::test_reductions[True-axis4-sum-kwargs1-eqkwargs1] sparse/tests/test_core.py::test_reductions[True-axis4-sum-kwargs2-eqkwargs2] sparse/tests/test_core.py::test_reductions[True-axis4-prod-kwargs3-eqkwargs3] sparse/tests/test_core.py::test_reductions[True-axis4-min-kwargs4-eqkwargs4] sparse/tests/test_core.py::test_reductions[False-None-max-kwargs0-eqkwargs0] sparse/tests/test_core.py::test_reductions[False-None-sum-kwargs1-eqkwargs1] sparse/tests/test_core.py::test_reductions[False-None-sum-kwargs2-eqkwargs2] sparse/tests/test_core.py::test_reductions[False-None-prod-kwargs3-eqkwargs3] sparse/tests/test_core.py::test_reductions[False-None-min-kwargs4-eqkwargs4] sparse/tests/test_core.py::test_reductions[False-0-max-kwargs0-eqkwargs0] sparse/tests/test_core.py::test_reductions[False-0-sum-kwargs1-eqkwargs1] sparse/tests/test_core.py::test_reductions[False-0-sum-kwargs2-eqkwargs2] sparse/tests/test_core.py::test_reductions[False-0-prod-kwargs3-eqkwargs3] sparse/tests/test_core.py::test_reductions[False-0-min-kwargs4-eqkwargs4] sparse/tests/test_core.py::test_reductions[False-1-max-kwargs0-eqkwargs0] sparse/tests/test_core.py::test_reductions[False-1-sum-kwargs1-eqkwargs1] sparse/tests/test_core.py::test_reductions[False-1-sum-kwargs2-eqkwargs2] sparse/tests/test_core.py::test_reductions[False-1-prod-kwargs3-eqkwargs3] sparse/tests/test_core.py::test_reductions[False-1-min-kwargs4-eqkwargs4] sparse/tests/test_core.py::test_reductions[False-2-max-kwargs0-eqkwargs0] sparse/tests/test_core.py::test_reductions[False-2-sum-kwargs1-eqkwargs1] sparse/tests/test_core.py::test_reductions[False-2-sum-kwargs2-eqkwargs2] sparse/tests/test_core.py::test_reductions[False-2-prod-kwargs3-eqkwargs3] sparse/tests/test_core.py::test_reductions[False-2-min-kwargs4-eqkwargs4] sparse/tests/test_core.py::test_reductions[False-axis4-max-kwargs0-eqkwargs0] sparse/tests/test_core.py::test_reductions[False-axis4-sum-kwargs1-eqkwargs1] sparse/tests/test_core.py::test_reductions[False-axis4-sum-kwargs2-eqkwargs2] sparse/tests/test_core.py::test_reductions[False-axis4-prod-kwargs3-eqkwargs3] sparse/tests/test_core.py::test_reductions[False-axis4-min-kwargs4-eqkwargs4] sparse/tests/test_core.py::test_ufunc_reductions[True-None-amax-kwargs0-eqkwargs0] sparse/tests/test_core.py::test_ufunc_reductions[True-None-sum-kwargs1-eqkwargs1] sparse/tests/test_core.py::test_ufunc_reductions[True-None-sum-kwargs2-eqkwargs2] sparse/tests/test_core.py::test_ufunc_reductions[True-None-prod-kwargs3-eqkwargs3] sparse/tests/test_core.py::test_ufunc_reductions[True-None-amin-kwargs4-eqkwargs4] sparse/tests/test_core.py::test_ufunc_reductions[True-0-amax-kwargs0-eqkwargs0] sparse/tests/test_core.py::test_ufunc_reductions[True-0-sum-kwargs1-eqkwargs1] sparse/tests/test_core.py::test_ufunc_reductions[True-0-sum-kwargs2-eqkwargs2] sparse/tests/test_core.py::test_ufunc_reductions[True-0-prod-kwargs3-eqkwargs3] sparse/tests/test_core.py::test_ufunc_reductions[True-0-amin-kwargs4-eqkwargs4] sparse/tests/test_core.py::test_ufunc_reductions[True-1-amax-kwargs0-eqkwargs0] sparse/tests/test_core.py::test_ufunc_reductions[True-1-sum-kwargs1-eqkwargs1] sparse/tests/test_core.py::test_ufunc_reductions[True-1-sum-kwargs2-eqkwargs2] sparse/tests/test_core.py::test_ufunc_reductions[True-1-prod-kwargs3-eqkwargs3] sparse/tests/test_core.py::test_ufunc_reductions[True-1-amin-kwargs4-eqkwargs4] sparse/tests/test_core.py::test_ufunc_reductions[True-2-amax-kwargs0-eqkwargs0] sparse/tests/test_core.py::test_ufunc_reductions[True-2-sum-kwargs1-eqkwargs1] sparse/tests/test_core.py::test_ufunc_reductions[True-2-sum-kwargs2-eqkwargs2] sparse/tests/test_core.py::test_ufunc_reductions[True-2-prod-kwargs3-eqkwargs3] sparse/tests/test_core.py::test_ufunc_reductions[True-2-amin-kwargs4-eqkwargs4] sparse/tests/test_core.py::test_ufunc_reductions[True-axis4-amax-kwargs0-eqkwargs0] sparse/tests/test_core.py::test_ufunc_reductions[True-axis4-sum-kwargs1-eqkwargs1] sparse/tests/test_core.py::test_ufunc_reductions[True-axis4-sum-kwargs2-eqkwargs2] sparse/tests/test_core.py::test_ufunc_reductions[True-axis4-prod-kwargs3-eqkwargs3] sparse/tests/test_core.py::test_ufunc_reductions[True-axis4-amin-kwargs4-eqkwargs4] sparse/tests/test_core.py::test_ufunc_reductions[False-None-amax-kwargs0-eqkwargs0] sparse/tests/test_core.py::test_ufunc_reductions[False-None-sum-kwargs1-eqkwargs1] sparse/tests/test_core.py::test_ufunc_reductions[False-None-sum-kwargs2-eqkwargs2] sparse/tests/test_core.py::test_ufunc_reductions[False-None-prod-kwargs3-eqkwargs3] sparse/tests/test_core.py::test_ufunc_reductions[False-None-amin-kwargs4-eqkwargs4] sparse/tests/test_core.py::test_ufunc_reductions[False-0-amax-kwargs0-eqkwargs0] sparse/tests/test_core.py::test_ufunc_reductions[False-0-sum-kwargs1-eqkwargs1] sparse/tests/test_core.py::test_ufunc_reductions[False-0-sum-kwargs2-eqkwargs2] sparse/tests/test_core.py::test_ufunc_reductions[False-0-prod-kwargs3-eqkwargs3] sparse/tests/test_core.py::test_ufunc_reductions[False-0-amin-kwargs4-eqkwargs4] sparse/tests/test_core.py::test_ufunc_reductions[False-1-amax-kwargs0-eqkwargs0] sparse/tests/test_core.py::test_ufunc_reductions[False-1-sum-kwargs1-eqkwargs1] sparse/tests/test_core.py::test_ufunc_reductions[False-1-sum-kwargs2-eqkwargs2] sparse/tests/test_core.py::test_ufunc_reductions[False-1-prod-kwargs3-eqkwargs3] sparse/tests/test_core.py::test_ufunc_reductions[False-1-amin-kwargs4-eqkwargs4] sparse/tests/test_core.py::test_ufunc_reductions[False-2-amax-kwargs0-eqkwargs0] sparse/tests/test_core.py::test_ufunc_reductions[False-2-sum-kwargs1-eqkwargs1] sparse/tests/test_core.py::test_ufunc_reductions[False-2-sum-kwargs2-eqkwargs2] sparse/tests/test_core.py::test_ufunc_reductions[False-2-prod-kwargs3-eqkwargs3] sparse/tests/test_core.py::test_ufunc_reductions[False-2-amin-kwargs4-eqkwargs4] sparse/tests/test_core.py::test_ufunc_reductions[False-axis4-amax-kwargs0-eqkwargs0] sparse/tests/test_core.py::test_ufunc_reductions[False-axis4-sum-kwargs1-eqkwargs1] sparse/tests/test_core.py::test_ufunc_reductions[False-axis4-sum-kwargs2-eqkwargs2] sparse/tests/test_core.py::test_ufunc_reductions[False-axis4-prod-kwargs3-eqkwargs3] sparse/tests/test_core.py::test_ufunc_reductions[False-axis4-amin-kwargs4-eqkwargs4] sparse/tests/test_core.py::test_transpose[None] sparse/tests/test_core.py::test_transpose[axis1] sparse/tests/test_core.py::test_transpose[axis2] sparse/tests/test_core.py::test_transpose[axis3] sparse/tests/test_core.py::test_transpose[axis4] sparse/tests/test_core.py::test_transpose[axis5] sparse/tests/test_core.py::test_transpose[axis6] sparse/tests/test_core.py::test_transpose_error[axis0] sparse/tests/test_core.py::test_transpose_error[axis1] sparse/tests/test_core.py::test_transpose_error[axis2] sparse/tests/test_core.py::test_transpose_error[axis3] sparse/tests/test_core.py::test_transpose_error[axis4] sparse/tests/test_core.py::test_transpose_error[axis5] sparse/tests/test_core.py::test_reshape[a0-b0] sparse/tests/test_core.py::test_reshape[a1-b1] sparse/tests/test_core.py::test_reshape[a2-b2] sparse/tests/test_core.py::test_reshape[a3-b3] sparse/tests/test_core.py::test_reshape[a4-b4] sparse/tests/test_core.py::test_reshape[a5-b5] sparse/tests/test_core.py::test_reshape[a6-b6] sparse/tests/test_core.py::test_reshape[a7-b7] sparse/tests/test_core.py::test_reshape[a8-b8] sparse/tests/test_core.py::test_reshape[a9-b9] sparse/tests/test_core.py::test_large_reshape sparse/tests/test_core.py::test_reshape_same sparse/tests/test_core.py::test_to_scipy_sparse sparse/tests/test_core.py::test_tensordot[a_shape0-b_shape0-axes0] sparse/tests/test_core.py::test_tensordot[a_shape1-b_shape1-axes1] sparse/tests/test_core.py::test_tensordot[a_shape2-b_shape2-axes2] sparse/tests/test_core.py::test_tensordot[a_shape3-b_shape3-axes3] sparse/tests/test_core.py::test_tensordot[a_shape4-b_shape4-axes4] sparse/tests/test_core.py::test_tensordot[a_shape5-b_shape5-axes5] sparse/tests/test_core.py::test_tensordot[a_shape6-b_shape6-axes6] sparse/tests/test_core.py::test_tensordot[a_shape7-b_shape7-axes7] sparse/tests/test_core.py::test_tensordot[a_shape8-b_shape8-axes8] sparse/tests/test_core.py::test_tensordot[a_shape9-b_shape9-0] sparse/tests/test_core.py::test_dot sparse/tests/test_core.py::test_elemwise[expm1] sparse/tests/test_core.py::test_elemwise[log1p] sparse/tests/test_core.py::test_elemwise[sin] sparse/tests/test_core.py::test_elemwise[tan] sparse/tests/test_core.py::test_elemwise[sinh] sparse/tests/test_core.py::test_elemwise[tanh] sparse/tests/test_core.py::test_elemwise[floor] sparse/tests/test_core.py::test_elemwise[ceil] sparse/tests/test_core.py::test_elemwise[sqrt] sparse/tests/test_core.py::test_elemwise[conjugate0] sparse/tests/test_core.py::test_elemwise[round_] sparse/tests/test_core.py::test_elemwise[rint] sparse/tests/test_core.py::test_elemwise[<lambda>0] sparse/tests/test_core.py::test_elemwise[conjugate1] sparse/tests/test_core.py::test_elemwise[conjugate2] sparse/tests/test_core.py::test_elemwise[<lambda>1] sparse/tests/test_core.py::test_elemwise[abs] sparse/tests/test_core.py::test_elemwise_binary[shape0-mul] sparse/tests/test_core.py::test_elemwise_binary[shape0-add] sparse/tests/test_core.py::test_elemwise_binary[shape0-sub] sparse/tests/test_core.py::test_elemwise_binary[shape0-gt] sparse/tests/test_core.py::test_elemwise_binary[shape0-lt] sparse/tests/test_core.py::test_elemwise_binary[shape0-ne] sparse/tests/test_core.py::test_elemwise_binary[shape1-mul] sparse/tests/test_core.py::test_elemwise_binary[shape1-add] sparse/tests/test_core.py::test_elemwise_binary[shape1-sub] sparse/tests/test_core.py::test_elemwise_binary[shape1-gt] sparse/tests/test_core.py::test_elemwise_binary[shape1-lt] sparse/tests/test_core.py::test_elemwise_binary[shape1-ne] sparse/tests/test_core.py::test_elemwise_binary[shape2-mul] sparse/tests/test_core.py::test_elemwise_binary[shape2-add] sparse/tests/test_core.py::test_elemwise_binary[shape2-sub] sparse/tests/test_core.py::test_elemwise_binary[shape2-gt] sparse/tests/test_core.py::test_elemwise_binary[shape2-lt] sparse/tests/test_core.py::test_elemwise_binary[shape2-ne] sparse/tests/test_core.py::test_elemwise_binary[shape3-mul] sparse/tests/test_core.py::test_elemwise_binary[shape3-add] sparse/tests/test_core.py::test_elemwise_binary[shape3-sub] sparse/tests/test_core.py::test_elemwise_binary[shape3-gt] sparse/tests/test_core.py::test_elemwise_binary[shape3-lt] sparse/tests/test_core.py::test_elemwise_binary[shape3-ne] sparse/tests/test_core.py::test_auto_densification_fails[pow] sparse/tests/test_core.py::test_auto_densification_fails[truediv] sparse/tests/test_core.py::test_auto_densification_fails[floordiv] sparse/tests/test_core.py::test_auto_densification_fails[ge] sparse/tests/test_core.py::test_auto_densification_fails[le] sparse/tests/test_core.py::test_auto_densification_fails[eq] sparse/tests/test_core.py::test_op_scipy_sparse sparse/tests/test_core.py::test_elemwise_scalar[True-mul-5] sparse/tests/test_core.py::test_elemwise_scalar[True-add-0] sparse/tests/test_core.py::test_elemwise_scalar[True-sub-0] sparse/tests/test_core.py::test_elemwise_scalar[True-pow-5] sparse/tests/test_core.py::test_elemwise_scalar[True-truediv-3] sparse/tests/test_core.py::test_elemwise_scalar[True-floordiv-4] sparse/tests/test_core.py::test_elemwise_scalar[True-gt-5] sparse/tests/test_core.py::test_elemwise_scalar[True-lt--5] sparse/tests/test_core.py::test_elemwise_scalar[True-ne-0] sparse/tests/test_core.py::test_elemwise_scalar[True-ge-5] sparse/tests/test_core.py::test_elemwise_scalar[True-le--3] sparse/tests/test_core.py::test_elemwise_scalar[True-eq-1] sparse/tests/test_core.py::test_elemwise_scalar[False-mul-5] sparse/tests/test_core.py::test_elemwise_scalar[False-add-0] sparse/tests/test_core.py::test_elemwise_scalar[False-sub-0] sparse/tests/test_core.py::test_elemwise_scalar[False-pow-5] sparse/tests/test_core.py::test_elemwise_scalar[False-truediv-3] sparse/tests/test_core.py::test_elemwise_scalar[False-floordiv-4] sparse/tests/test_core.py::test_elemwise_scalar[False-gt-5] sparse/tests/test_core.py::test_elemwise_scalar[False-lt--5] sparse/tests/test_core.py::test_elemwise_scalar[False-ne-0] sparse/tests/test_core.py::test_elemwise_scalar[False-ge-5] sparse/tests/test_core.py::test_elemwise_scalar[False-le--3] sparse/tests/test_core.py::test_elemwise_scalar[False-eq-1] sparse/tests/test_core.py::test_leftside_elemwise_scalar[True-ne-0] sparse/tests/test_core.py::test_leftside_elemwise_scalar[True-eq-1] sparse/tests/test_core.py::test_leftside_elemwise_scalar[False-mul-5] sparse/tests/test_core.py::test_leftside_elemwise_scalar[False-add-0] sparse/tests/test_core.py::test_leftside_elemwise_scalar[False-sub-0] sparse/tests/test_core.py::test_leftside_elemwise_scalar[False-gt--5] sparse/tests/test_core.py::test_leftside_elemwise_scalar[False-lt-5] sparse/tests/test_core.py::test_leftside_elemwise_scalar[False-ne-0] sparse/tests/test_core.py::test_leftside_elemwise_scalar[False-ge--5] sparse/tests/test_core.py::test_leftside_elemwise_scalar[False-le-3] sparse/tests/test_core.py::test_leftside_elemwise_scalar[False-eq-1] sparse/tests/test_core.py::test_scalar_densification_fails[add-5] sparse/tests/test_core.py::test_scalar_densification_fails[sub--5] sparse/tests/test_core.py::test_scalar_densification_fails[pow--3] sparse/tests/test_core.py::test_scalar_densification_fails[truediv-0] sparse/tests/test_core.py::test_scalar_densification_fails[floordiv-0] sparse/tests/test_core.py::test_scalar_densification_fails[gt--5] sparse/tests/test_core.py::test_scalar_densification_fails[lt-5] sparse/tests/test_core.py::test_scalar_densification_fails[ne-1] sparse/tests/test_core.py::test_scalar_densification_fails[ge--3] sparse/tests/test_core.py::test_scalar_densification_fails[le-3] sparse/tests/test_core.py::test_scalar_densification_fails[eq-0] sparse/tests/test_core.py::test_bitwise_binary[shape0-and_] sparse/tests/test_core.py::test_bitwise_binary[shape0-or_] sparse/tests/test_core.py::test_bitwise_binary[shape0-xor] sparse/tests/test_core.py::test_bitwise_binary[shape1-and_] sparse/tests/test_core.py::test_bitwise_binary[shape1-or_] sparse/tests/test_core.py::test_bitwise_binary[shape1-xor] sparse/tests/test_core.py::test_bitwise_binary[shape2-and_] sparse/tests/test_core.py::test_bitwise_binary[shape2-or_] sparse/tests/test_core.py::test_bitwise_binary[shape2-xor] sparse/tests/test_core.py::test_bitwise_binary[shape3-and_] sparse/tests/test_core.py::test_bitwise_binary[shape3-or_] sparse/tests/test_core.py::test_bitwise_binary[shape3-xor] sparse/tests/test_core.py::test_bitwise_binary_bool[shape0-and_] sparse/tests/test_core.py::test_bitwise_binary_bool[shape0-or_] sparse/tests/test_core.py::test_bitwise_binary_bool[shape0-xor] sparse/tests/test_core.py::test_bitwise_binary_bool[shape1-and_] sparse/tests/test_core.py::test_bitwise_binary_bool[shape1-or_] sparse/tests/test_core.py::test_bitwise_binary_bool[shape1-xor] sparse/tests/test_core.py::test_bitwise_binary_bool[shape2-and_] sparse/tests/test_core.py::test_bitwise_binary_bool[shape2-or_] sparse/tests/test_core.py::test_bitwise_binary_bool[shape2-xor] sparse/tests/test_core.py::test_bitwise_binary_bool[shape3-and_] sparse/tests/test_core.py::test_bitwise_binary_bool[shape3-or_] sparse/tests/test_core.py::test_bitwise_binary_bool[shape3-xor] sparse/tests/test_core.py::test_elemwise_binary_empty sparse/tests/test_core.py::test_gt sparse/tests/test_core.py::test_slicing[0] sparse/tests/test_core.py::test_slicing[1] sparse/tests/test_core.py::test_slicing[-1] sparse/tests/test_core.py::test_slicing[index3] sparse/tests/test_core.py::test_slicing[index4] sparse/tests/test_core.py::test_slicing[index5] sparse/tests/test_core.py::test_slicing[index6] sparse/tests/test_core.py::test_slicing[index7] sparse/tests/test_core.py::test_slicing[index8] sparse/tests/test_core.py::test_slicing[index9] sparse/tests/test_core.py::test_slicing[index10] sparse/tests/test_core.py::test_slicing[index11] sparse/tests/test_core.py::test_slicing[index12] sparse/tests/test_core.py::test_slicing[index13] sparse/tests/test_core.py::test_slicing[index14] sparse/tests/test_core.py::test_slicing[index15] sparse/tests/test_core.py::test_slicing[index16] sparse/tests/test_core.py::test_slicing[index17] sparse/tests/test_core.py::test_slicing[index18] sparse/tests/test_core.py::test_slicing[index19] sparse/tests/test_core.py::test_slicing[index20] sparse/tests/test_core.py::test_slicing[index21] sparse/tests/test_core.py::test_slicing[index22] sparse/tests/test_core.py::test_slicing[index23] sparse/tests/test_core.py::test_slicing[index24] sparse/tests/test_core.py::test_slicing[index25] sparse/tests/test_core.py::test_slicing[index26] sparse/tests/test_core.py::test_slicing[index27] sparse/tests/test_core.py::test_slicing[index28] sparse/tests/test_core.py::test_slicing[index29] sparse/tests/test_core.py::test_slicing[index30] sparse/tests/test_core.py::test_slicing[index31] sparse/tests/test_core.py::test_slicing[index32] sparse/tests/test_core.py::test_slicing[index33] sparse/tests/test_core.py::test_slicing[index34] sparse/tests/test_core.py::test_slicing[index35] sparse/tests/test_core.py::test_slicing[index36] sparse/tests/test_core.py::test_slicing[index37] sparse/tests/test_core.py::test_slicing[index38] sparse/tests/test_core.py::test_slicing[index39] sparse/tests/test_core.py::test_slicing[index40] sparse/tests/test_core.py::test_slicing[index41] sparse/tests/test_core.py::test_slicing[index42] sparse/tests/test_core.py::test_slicing[index43] sparse/tests/test_core.py::test_slicing[index44] sparse/tests/test_core.py::test_custom_dtype_slicing sparse/tests/test_core.py::test_slicing_errors[index0] sparse/tests/test_core.py::test_slicing_errors[index1] sparse/tests/test_core.py::test_slicing_errors[index2] sparse/tests/test_core.py::test_slicing_errors[5] sparse/tests/test_core.py::test_slicing_errors[-5] sparse/tests/test_core.py::test_slicing_errors[foo] sparse/tests/test_core.py::test_slicing_errors[index6] sparse/tests/test_core.py::test_canonical sparse/tests/test_core.py::test_concatenate sparse/tests/test_core.py::test_concatenate_mixed[stack-0] sparse/tests/test_core.py::test_concatenate_mixed[stack-1] sparse/tests/test_core.py::test_concatenate_mixed[concatenate-0] sparse/tests/test_core.py::test_concatenate_mixed[concatenate-1] sparse/tests/test_core.py::test_stack[0-shape0] sparse/tests/test_core.py::test_stack[0-shape1] sparse/tests/test_core.py::test_stack[0-shape2] sparse/tests/test_core.py::test_stack[1-shape0] sparse/tests/test_core.py::test_stack[1-shape1] sparse/tests/test_core.py::test_stack[1-shape2] sparse/tests/test_core.py::test_stack[-1-shape0] sparse/tests/test_core.py::test_stack[-1-shape1] sparse/tests/test_core.py::test_stack[-1-shape2] sparse/tests/test_core.py::test_large_concat_stack sparse/tests/test_core.py::test_coord_dtype sparse/tests/test_core.py::test_addition sparse/tests/test_core.py::test_addition_not_ok_when_large_and_sparse sparse/tests/test_core.py::test_broadcasting[shape10-shape20-add] sparse/tests/test_core.py::test_broadcasting[shape10-shape20-mul] sparse/tests/test_core.py::test_broadcasting[shape11-shape21-add] sparse/tests/test_core.py::test_broadcasting[shape11-shape21-mul] sparse/tests/test_core.py::test_broadcasting[shape12-shape22-add] sparse/tests/test_core.py::test_broadcasting[shape12-shape22-mul] sparse/tests/test_core.py::test_broadcasting[shape13-shape23-add] sparse/tests/test_core.py::test_broadcasting[shape13-shape23-mul] sparse/tests/test_core.py::test_broadcasting[shape14-shape24-add] sparse/tests/test_core.py::test_broadcasting[shape14-shape24-mul] sparse/tests/test_core.py::test_broadcasting[shape15-shape25-add] sparse/tests/test_core.py::test_broadcasting[shape15-shape25-mul] sparse/tests/test_core.py::test_broadcast_to[shape10-shape20] sparse/tests/test_core.py::test_broadcast_to[shape11-shape21] sparse/tests/test_core.py::test_broadcast_to[shape12-shape22] sparse/tests/test_core.py::test_scalar_multiplication[2] sparse/tests/test_core.py::test_scalar_multiplication[2.5] sparse/tests/test_core.py::test_scalar_exponentiation sparse/tests/test_core.py::test_create_with_lists_of_tuples sparse/tests/test_core.py::test_sizeof sparse/tests/test_core.py::test_scipy_sparse_interface sparse/tests/test_core.py::test_cache_csr sparse/tests/test_core.py::test_empty_shape sparse/tests/test_core.py::test_single_dimension sparse/tests/test_core.py::test_raise_dense sparse/tests/test_core.py::test_large_sum sparse/tests/test_core.py::test_add_many_sparse_arrays sparse/tests/test_core.py::test_caching sparse/tests/test_core.py::test_scalar_slicing sparse/tests/test_core.py::test_triul[shape0-0] sparse/tests/test_core.py::test_triul[shape1-1] sparse/tests/test_core.py::test_triul[shape2--1] sparse/tests/test_core.py::test_triul[shape3--2] sparse/tests/test_core.py::test_triul[shape4-1000] sparse/tests/test_core.py::test_empty_reduction sparse/tests/test_core.py::test_random_shape[0.1-shape0] sparse/tests/test_core.py::test_random_shape[0.1-shape1] sparse/tests/test_core.py::test_random_shape[0.1-shape2] sparse/tests/test_core.py::test_random_shape[0.3-shape0] sparse/tests/test_core.py::test_random_shape[0.3-shape1] sparse/tests/test_core.py::test_random_shape[0.3-shape2] sparse/tests/test_core.py::test_random_shape[0.5-shape0] sparse/tests/test_core.py::test_random_shape[0.5-shape1] sparse/tests/test_core.py::test_random_shape[0.5-shape2] sparse/tests/test_core.py::test_random_shape[0.7-shape0] sparse/tests/test_core.py::test_random_shape[0.7-shape1] sparse/tests/test_core.py::test_random_shape[0.7-shape2] sparse/tests/test_core.py::test_two_random_unequal sparse/tests/test_core.py::test_two_random_same_seed sparse/tests/test_core.py::test_random_sorted sparse/tests/test_core.py::test_random_rvs[0.0-shape0-None-float64] sparse/tests/test_core.py::test_random_rvs[0.0-shape0-rvs-int] sparse/tests/test_core.py::test_random_rvs[0.0-shape0-<lambda>-bool] sparse/tests/test_core.py::test_random_rvs[0.0-shape1-None-float64] sparse/tests/test_core.py::test_random_rvs[0.0-shape1-rvs-int] sparse/tests/test_core.py::test_random_rvs[0.0-shape1-<lambda>-bool] sparse/tests/test_core.py::test_random_rvs[0.01-shape0-None-float64] sparse/tests/test_core.py::test_random_rvs[0.01-shape0-rvs-int] sparse/tests/test_core.py::test_random_rvs[0.01-shape0-<lambda>-bool] sparse/tests/test_core.py::test_random_rvs[0.01-shape1-None-float64] sparse/tests/test_core.py::test_random_rvs[0.01-shape1-rvs-int] sparse/tests/test_core.py::test_random_rvs[0.01-shape1-<lambda>-bool] sparse/tests/test_core.py::test_random_rvs[0.1-shape0-None-float64] sparse/tests/test_core.py::test_random_rvs[0.1-shape0-rvs-int] sparse/tests/test_core.py::test_random_rvs[0.1-shape0-<lambda>-bool] sparse/tests/test_core.py::test_random_rvs[0.1-shape1-None-float64] sparse/tests/test_core.py::test_random_rvs[0.1-shape1-rvs-int] sparse/tests/test_core.py::test_random_rvs[0.1-shape1-<lambda>-bool] sparse/tests/test_core.py::test_random_rvs[0.2-shape0-None-float64] sparse/tests/test_core.py::test_random_rvs[0.2-shape0-rvs-int] sparse/tests/test_core.py::test_random_rvs[0.2-shape0-<lambda>-bool] sparse/tests/test_core.py::test_random_rvs[0.2-shape1-None-float64] sparse/tests/test_core.py::test_random_rvs[0.2-shape1-rvs-int] sparse/tests/test_core.py::test_random_rvs[0.2-shape1-<lambda>-bool] sparse/tests/test_core.py::test_scalar_shape_construction
sparse/core.py
sparse/core.py