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"]
code: def _inequality(self, other, op, op_name, bad_scalar_msg):
      # Scalar other.
      if isscalarlike(other):
          if 0 == other and op_name in ("_le_", "_ge_"):
              raise NotImplementedError(" >= and <= don't work with 0.")
          elif op(0, other):
              warn(bad_scalar_msg, SparseEfficiencyWarning)
              other_arr = np.empty(
                  self.shape, dtype=np.result_type(other)
              )
              other_arr.fill(other)
              other_arr = self.__class__(other_arr)
              return self._binopt(other_arr, op_name)
          else:
              return self._scalar_binopt(other, op)
      # Dense other.
      elif isdense(other):
          return op(self.todense(), other)
      # Sparse other.
      elif isspmatrix(other):
          # TODO sparse broadcasting
          if self.shape != other.shape:
              raise ValueError("inconsistent shapes")
          elif self.format != other.format:
              other = other.asformat(self.format)
          if op_name not in ("_ge_", "_le_"):
              return self._binopt(other, op_name)
  
          warn(
              "Comparing sparse matrices using >= and <= is inefficient, "
              "using <, >, or !=, instead.",
              SparseEfficiencyWarning,
          )
          all_true = self.__class__(np.ones(self.shape, dtype=np.bool_))
          res = self._binopt(
              other, "_gt_" if op_name == "_le_" else "_lt_"
          )
          return all_true - res
      else:
          raise ValueError("Operands could not be compared.")
  
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 8 for calling the _cs_matrix obj's underlying member method code with example usage: obj._inequality(other, op, op_name, bad_scalar_msg) and returns: op, self, self, unknown, self