code: def testSparseAdd(self):
      x = BCOO.fromdense(jnp.arange(5))
      y = BCOO.fromdense(2 * jnp.arange(5))
  
      # Distinct indices
      out = self.sparsify(operator.add)(x, y)
      self.assertEqual(out.nse, 8)  # uses concatenation.
      self.assertArraysEqual(out.todense(), 3 * jnp.arange(5))
  
      # Shared indices – requires lower level call
      spenv = SparsifyEnv([x.indices, x.data, y.data])
      spvalues = [
          spenv.sparse(x.shape, data_ref=1, indices_ref=0),
          spenv.sparse(y.shape, data_ref=2, indices_ref=0),
      ]
  
      result = sparsify_raw(operator.add)(spenv, *spvalues)
      args_out, _ = result
      (out,) = spvalues_to_arrays(spenv, args_out)
  
      self.assertAllClose(out.todense(), x.todense() + y.todense())
  
      # Sparse + dense: supported
      x = BCOO.fromdense(jnp.arange(6.0)).reshape(2, 3)
      y = jnp.ones((2, 3))
  
      out = self.sparsify(operator.add)(x, y)
      self.assertAllClose(out, x.todense() + y)
  
      out = self.sparsify(operator.add)(y, x)
      self.assertAllClose(out, x.todense() + y)
  
      # Sparse + dense: unsupported
      msg = "Addition between a sparse array X and a dense array Y is not implemented"
      with self.assertRaisesRegex(NotImplementedError, msg):
          self.sparsify(operator.add)(x, 1.0)
  
imports: from functools import partial
  import math
  import operator
  from absl.testing import absltest
  from absl.testing import parameterized
  import numpy
  import jax
  from jax import config, jit, lax
  import jax.numpy
  import jax._src.test_util
  from jax.experimental.sparse import BCOO, BCSR, sparsify, todense, SparseTracer
  from jax.experimental.sparse.transform import arrays_to_spvalues, spvalues_to_arrays, sparsify_raw, SparsifyValue, SparsifyEnv
  from jax.experimental.sparse.util import CuSparseEfficiencyWarning
  from jax.experimental.sparse import test_util
label_desc: Use image node_id 11 for calling the SparsifyTest obj's underlying member method code with example usage: obj.testSparseAdd() without return types