class_docstr: Dictionary Of Keys based sparse matrix.
  
  This is an efficient structure for constructing sparse
  matrices incrementally.
  
  This can be instantiated in several ways:
      dok_matrix(D)
          with a dense matrix, D
  
      dok_matrix(S)
          with a sparse matrix, S
  
      dok_matrix((M,N), [dtype])
          create the matrix with initial shape (M,N)
          dtype is optional, defaulting to dtype='d'
  
  Attributes
  ----------
  dtype : dtype
      Data type of the matrix
  shape : 2-tuple
      Shape of the matrix
  ndim : int
      Number of dimensions (this is always 2)
  nnz
      Number of nonzero elements
  
  Notes
  -----
  
  Sparse matrices can be used in arithmetic operations: they support
  addition, subtraction, multiplication, division, and matrix power.
  
  Allows for efficient O(1) access of individual elements.
  Duplicates are not allowed.
  Can be efficiently converted to a coo_matrix once constructed.
  
  Examples
  --------
  >>> import numpy as np
  >>> from scipy.sparse import dok_matrix
  >>> S = dok_matrix((5, 5), dtype=np.float32)
  >>> for i in range(5):
  ...     for j in range(5):
  ...         S[i, j] = i + j    # Update element
class_docstr_tok: ["Dictionary","Of","Keys","based","sparse","matrix",".","This","is","an","efficient","structure","for","constructing","sparse","matrices","incrementally",".","This","can","be","instantiated","in","several","ways",":","dok_matrix","(","D",")","with","a","dense","matrix",",","D","dok_matrix","(","S",")","with","a","sparse","matrix",",","S","dok_matrix","(","(","M",",","N",")",",","[","dtype","]",")","create","the","matrix","with","initial","shape","(","M",",","N",")","dtype","is","optional",",","defaulting","to","dtype='d'","Attributes","--","--","--","--","--","dtype",":","dtype","Data","type","of","the","matrix","shape",":","2-tuple","Shape","of","the","matrix","ndim",":","int","Number","of","dimensions","(","this","is","always","2",")","nnz","Number","of","nonzero","elements","Notes","--","--","-","Sparse","matrices","can","be","used","in","arithmetic","operations",":","they","support","addition",",","subtraction",",","multiplication",",","division",",","and","matrix","power",".","Allows","for","efficient","O","(","1",")","access","of","individual","elements",".","Duplicates","are","not","allowed",".","Can","be","efficiently","converted","to","a","coo_matrix","once","constructed",".","Examples","--","--","--","--",">",">",">","import","numpy","as","np",">",">",">","from","scipy.sparse","import","dok_matrix",">",">",">","S","=","dok_matrix","(","(","5",",","5",")",",","dtype=np.float32",")",">",">",">","for","i","in","range","(","5",")",":","...","for","j","in","range","(","5",")",":","...","S","[","i",",","j","]","=","i","+","j","#","Update","element"]
code: def _getitem_ranges(self, i_indices, j_indices, shape):
      # performance golf: we don't want Numpy scalars here, they are slow
      i_start, i_stop, i_stride = map(int, i_indices)
      j_start, j_stop, j_stride = map(int, j_indices)
  
      newdok = dok_matrix(shape, dtype=self.dtype)
  
      for ii, jj in iterkeys(self):
          # ditto for numpy scalars
          ii = int(ii)
          jj = int(jj)
          a, ra = divmod(ii - i_start, i_stride)
          if a < 0 or a >= shape[0] or ra != 0:
              continue
          b, rb = divmod(jj - j_start, j_stride)
          if b < 0 or b >= shape[1] or rb != 0:
              continue
          dict.__setitem__(
              newdok, (a, b), dict.__getitem__(self, (ii, jj))
          )
      return newdok
  
imports: from __future__ import division, print_function, absolute_import
  import functools
  import operator
  import itertools
  import numpy
  from scipy._lib.six import zip, xrange, iteritems, iterkeys, itervalues
  from .base import spmatrix, isspmatrix
  from .sputils import isdense, getdtype, isshape, isintlike, isscalarlike, upcast, upcast_scalar, IndexMixin, get_index_dtype, check_shape
label_desc: Use image node_id 10 for calling the dok_matrix obj's underlying member method code with example usage: obj._getitem_ranges(i_indices, j_indices, shape) and returns: newdok