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: apply the binary operation fn to two sparse matrices.
code: def _binopt(self, other, op):
      """apply the binary operation fn to two sparse matrices."""
      other = self.__class__(other)
  
      # e.g. csr_plus_csr, csr_minus_csr, etc.
      fn = getattr(_sparsetools, self.format + op + self.format)
  
      maxnnz = self.nnz + other.nnz
      idx_dtype = get_index_dtype(
          (self.indptr, self.indices, other.indptr, other.indices),
          maxval=maxnnz,
      )
      indptr = np.empty(self.indptr.shape, dtype=idx_dtype)
      indices = np.empty(maxnnz, dtype=idx_dtype)
  
      bool_ops = ["_ne_", "_lt_", "_gt_", "_le_", "_ge_"]
      if op in bool_ops:
          data = np.empty(maxnnz, dtype=np.bool_)
      else:
          data = np.empty(maxnnz, dtype=upcast(self.dtype, other.dtype))
  
      fn(
          self.shape[0],
          self.shape[1],
          np.asarray(self.indptr, dtype=idx_dtype),
          np.asarray(self.indices, dtype=idx_dtype),
          self.data,
          np.asarray(other.indptr, dtype=idx_dtype),
          np.asarray(other.indices, dtype=idx_dtype),
          other.data,
          indptr,
          indices,
          data,
      )
  
      A = self.__class__((data, indices, indptr), shape=self.shape)
      A.prune()
  
      return A
  
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 47 for calling the _cs_matrix obj's underlying member method code with example usage: obj._binopt(other, op) and returns: A