parameters: (self, other)
return_statement: return np.multiply(self.todense(), other)
docstring: Point-wise multiplication by another matrix, vector, or
          scalar.
docstring_summary: Point-wise multiplication by another matrix, vector, or
          scalar.
docstring_tokens: Point - wise multiplication by another matrix vector or scalar .
function: def multiply(self, other):
          """Point-wise multiplication by another matrix, vector, or
          scalar.
          """
          # Scalar multiplication.
          if isscalarlike(other):
              return self._mul_scalar(other)
          # Sparse matrix or vector.
          if isspmatrix(other):
              if self.shape == other.shape:
                  other = self.__class__(other)
                  return self._binopt(other, '_elmul_')
              # Single element.
              elif other.shape == (1,1):
                  return self._mul_scalar(other.toarray()[0, 0])
              elif self.shape == (1,1):
                  return other._mul_scalar(self.toarray()[0, 0])
              # A row times a column.
              elif self.shape[1] == other.shape[0] and self.shape[1] == 1:
                  return self._mul_sparse_matrix(other.tocsc())
              elif self.shape[0] == other.shape[1] and self.shape[0] == 1:
                  return other._mul_sparse_matrix(self.tocsc())
              # Row vector times matrix. other is a row.
              elif other.shape[0] == 1 and self.shape[1] == other.shape[1]:
                  other = dia_matrix((other.toarray().ravel(), [0]),
                                      shape=(other.shape[1], other.shape[1]))
                  return self._mul_sparse_matrix(other)
              # self is a row.
              elif self.shape[0] == 1 and self.shape[1] == other.shape[1]:
                  copy = dia_matrix((self.toarray().ravel(), [0]),
                                      shape=(self.shape[1], self.shape[1]))
                  return other._mul_sparse_matrix(copy)
              # Column vector times matrix. other is a column.
              elif other.shape[1] == 1 and self.shape[0] == other.shape[0]:
                  other = dia_matrix((other.toarray().ravel(), [0]),
                                      shape=(other.shape[0], other.shape[0]))
                  return other._mul_sparse_matrix(self)
              # self is a column.
              elif self.shape[1] == 1 and self.shape[0] == other.shape[0]:
                  copy = dia_matrix((self.toarray().ravel(), [0]),
                                      shape=(self.shape[0], self.shape[0]))
                  return copy._mul_sparse_matrix(other)
              else:
                  raise ValueError("inconsistent shapes")
          # Dense matrix.
          if isdense(other):
              if self.shape == other.shape:
                  ret = self.tocoo()
                  ret.data = np.multiply(ret.data, other[ret.row, ret.col]
                                         ).view(np.ndarray).ravel()
                  return ret
              # Single element.
              elif other.size == 1:
                  return self._mul_scalar(other.flat[0])
          # Anything else.
          return np.multiply(self.todense(), other)
function_tokens: def multiply ( self , other ) : # Scalar multiplication. if isscalarlike ( other ) : return self . _mul_scalar ( other ) # Sparse matrix or vector. if isspmatrix ( other ) : if self . shape == other . shape : other = self . __class__ ( other ) return self . _binopt ( other , '_elmul_' ) # Single element. elif other . shape == ( 1 , 1 ) : return self . _mul_scalar ( other . toarray ( ) [ 0 , 0 ] ) elif self . shape == ( 1 , 1 ) : return other . _mul_scalar ( self . toarray ( ) [ 0 , 0 ] ) # A row times a column. elif self . shape [ 1 ] == other . shape [ 0 ] and self . shape [ 1 ] == 1 : return self . _mul_sparse_matrix ( other . tocsc ( ) ) elif self . shape [ 0 ] == other . shape [ 1 ] and self . shape [ 0 ] == 1 : return other . _mul_sparse_matrix ( self . tocsc ( ) ) # Row vector times matrix. other is a row. elif other . shape [ 0 ] == 1 and self . shape [ 1 ] == other . shape [ 1 ] : other = dia_matrix ( ( other . toarray ( ) . ravel ( ) , [ 0 ] ) , shape = ( other . shape [ 1 ] , other . shape [ 1 ] ) ) return self . _mul_sparse_matrix ( other ) # self is a row. elif self . shape [ 0 ] == 1 and self . shape [ 1 ] == other . shape [ 1 ] : copy = dia_matrix ( ( self . toarray ( ) . ravel ( ) , [ 0 ] ) , shape = ( self . shape [ 1 ] , self . shape [ 1 ] ) ) return other . _mul_sparse_matrix ( copy ) # Column vector times matrix. other is a column. elif other . shape [ 1 ] == 1 and self . shape [ 0 ] == other . shape [ 0 ] : other = dia_matrix ( ( other . toarray ( ) . ravel ( ) , [ 0 ] ) , shape = ( other . shape [ 0 ] , other . shape [ 0 ] ) ) return other . _mul_sparse_matrix ( self ) # self is a column. elif self . shape [ 1 ] == 1 and self . shape [ 0 ] == other . shape [ 0 ] : copy = dia_matrix ( ( self . toarray ( ) . ravel ( ) , [ 0 ] ) , shape = ( self . shape [ 0 ] , self . shape [ 0 ] ) ) return copy . _mul_sparse_matrix ( other ) else : raise ValueError ( "inconsistent shapes" ) # Dense matrix. if isdense ( other ) : if self . shape == other . shape : ret = self . tocoo ( ) ret . data = np . multiply ( ret . data , other [ ret . row , ret . col ] ) . view ( np . ndarray ) . ravel ( ) return ret # Single element. elif other . size == 1 : return self . _mul_scalar ( other . flat [ 0 ] ) # Anything else. return np . multiply ( self . todense ( ) , other )