class_docstr: base matrix class for compressed row and column oriented matrices
class_docstr_tok: ["base","matrix","class","for","compressed","row","and","column","oriented","matrices"]
docstr: Inserts new nonzero at each (i, j) with value x
  
  Here (i,j) index major and minor respectively.
  i, j and x must be non-empty, 1d arrays.
  Inserts each major group (e.g. all entries per row) at a time.
  Maintains has_sorted_indices property.
  Modifies i, j, x in place.
code: def _insert_many(self, i, j, x):
      """Inserts new nonzero at each (i, j) with value x
  
      Here (i,j) index major and minor respectively.
      i, j and x must be non-empty, 1d arrays.
      Inserts each major group (e.g. all entries per row) at a time.
      Maintains has_sorted_indices property.
      Modifies i, j, x in place.
      """
      order = np.argsort(i, kind="mergesort")  # stable for duplicates
      i = i.take(order, mode="clip")
      j = j.take(order, mode="clip")
      x = x.take(order, mode="clip")
  
      do_sort = self.has_sorted_indices
  
      # Update index data type
      idx_dtype = get_index_dtype(
          (self.indices, self.indptr), maxval=(self.indptr[-1] + x.size)
      )
      self.indptr = np.asarray(self.indptr, dtype=idx_dtype)
      self.indices = np.asarray(self.indices, dtype=idx_dtype)
      i = np.asarray(i, dtype=idx_dtype)
      j = np.asarray(j, dtype=idx_dtype)
  
      # Collate old and new in chunks by major index
      indices_parts = []
      data_parts = []
      ui, ui_indptr = np.unique(i, return_index=True)
      ui_indptr = np.append(ui_indptr, len(j))
      new_nnzs = np.diff(ui_indptr)
      prev = 0
      for c, (ii, js, je) in enumerate(
          izip(ui, ui_indptr, ui_indptr[1:])
      ):
          # old entries
          start = self.indptr[prev]
          stop = self.indptr[ii]
          indices_parts.append(self.indices[start:stop])
          data_parts.append(self.data[start:stop])
  
          # handle duplicate j: keep last setting
          uj, uj_indptr = np.unique(j[js:je][::-1], return_index=True)
          if len(uj) == je - js:
              indices_parts.append(j[js:je])
              data_parts.append(x[js:je])
          else:
              indices_parts.append(j[js:je][::-1][uj_indptr])
              data_parts.append(x[js:je][::-1][uj_indptr])
              new_nnzs[c] = len(uj)
  
          prev = ii
  
      # remaining old entries
      start = self.indptr[ii]
      indices_parts.append(self.indices[start:])
      data_parts.append(self.data[start:])
  
      # update attributes
      self.indices = np.concatenate(indices_parts)
      self.data = np.concatenate(data_parts)
      nnzs = np.empty(self.indptr.shape, dtype=idx_dtype)
      nnzs[0] = idx_dtype(0)
      indptr_diff = np.diff(self.indptr)
      indptr_diff[ui] += new_nnzs
      nnzs[1:] = indptr_diff
      self.indptr = np.cumsum(nnzs, out=nnzs)
  
      if do_sort:
          # TODO: only sort where necessary
          self.has_sorted_indices = False
          self.sort_indices()
  
      self.check_format(full_check=False)
  
imports: from __future__ import division, print_function, absolute_import
  from warnings import warn
  import operator
  import numpy
  from scipy._lib.six import zip
  from scipy._lib._util import _prune_array
  from .base import spmatrix, isspmatrix, SparseEfficiencyWarning
  from .data import _data_matrix, _minmax_mixin
  from .dia import dia_matrix
  from .None import _sparsetools
  from .sputils import upcast, upcast_char, to_native, isdense, isshape, getdtype, isscalarlike, IndexMixin, get_index_dtype, downcast_intp_index, get_sum_dtype, check_shape, matrix, asmatrix
label_desc: Use image node_id 31 for calling the _cs_matrix obj's underlying member method code with example usage: obj._insert_many(i, j, x) without return types