Did I find the right examples for you? yes no

All Samples(73)  |  Call(60)  |  Derive(0)  |  Import(13)

src/s/c/scipy-0.13.3/scipy/sparse/compressed.py   scipy(Download)
from .dia import dia_matrix
from . import sparsetools
from .sputils import upcast, upcast_char, to_native, isdense, isshape, \
     getdtype, isscalarlike, isintlike, IndexMixin
 
    def __eq__(self, other):
        # Scalar other.
        if isscalarlike(other):
            other_arr = self.copy()
            other_arr.data[:] = other
    def __ne__(self, other):
        # Scalar other.
        if isscalarlike(other):
            if other != 0:
                warn("Comparing a sparse matrix with a nonzero scalar using !="
    def __lt__(self, other):
        # Scalar other.
        if isscalarlike(other):
            if 0 < other:
                warn("Comparing a sparse matrix with a scalar greater than "
    def __gt__(self, other):
        # Scalar other.
        if isscalarlike(other):
            if 0 > other:
                warn("Comparing a sparse matrix with a scalar less than zero "

src/c/o/cobrapy-HEAD/cobra/oven/danielhyduke/jython/scipy/sparse/compressed.py   cobrapy(Download)
from data import _data_matrix
import sparsetools
from sputils import upcast, to_native, isdense, isshape, getdtype, \
        isscalarlike, isintlike
 
    def __add__(self,other):
        # First check if argument is a scalar
        if isscalarlike(other):
            # Now we would add this scalar to every element.
            raise NotImplementedError, 'adding a scalar to a CSC or CSR ' \
    def __sub__(self,other):
        # First check if argument is a scalar
        if isscalarlike(other):
            # Now we would add this scalar to every element.
            raise NotImplementedError, 'adding a scalar to a sparse ' \
    def __rsub__(self,other):  # other - self
        #note: this can't be replaced by other + (-self) for unsigned types
        if isscalarlike(other):
            # Now we would add this scalar to every element.
            raise NotImplementedError, 'adding a scalar to a sparse ' \
    def __truediv__(self,other):
        if isscalarlike(other):
            return self * (1./other)
 
        elif isspmatrix(other):

src/s/c/scipy-HEAD/scipy/sparse/compressed.py   scipy(Download)
from data import _data_matrix
import sparsetools
from sputils import upcast, upcast_char, to_native, isdense, isshape, \
     getdtype, isscalarlike, isintlike
 
    def __add__(self,other):
        # First check if argument is a scalar
        if isscalarlike(other):
            if other == 0:
                return self.copy()
    def __sub__(self,other):
        # First check if argument is a scalar
        if isscalarlike(other):
            if other == 0:
                return self.copy()
    def __rsub__(self,other):  # other - self
        #note: this can't be replaced by other + (-self) for unsigned types
        if isscalarlike(other):
            if other == 0:
                return -self.copy()
    def __truediv__(self,other):
        if isscalarlike(other):
            return self * (1./other)
 
        elif isspmatrix(other):

src/s/c/scipy-0.13.3/scipy/sparse/dok.py   scipy(Download)
 
from .base import spmatrix, isspmatrix
from .sputils import (isdense, getdtype, isshape, isintlike, isscalarlike,
                      upcast, upcast_scalar)
 
    def __add__(self, other):
        # First check if argument is a scalar
        if isscalarlike(other):
            new = dok_matrix(self.shape, dtype=self.dtype)
            # Add this scalar to every element.
    def __radd__(self, other):
        # First check if argument is a scalar
        if isscalarlike(other):
            new = dok_matrix(self.shape, dtype=self.dtype)
            # Add this scalar to every element.
    def __imul__(self, other):
        if isscalarlike(other):
            # Multiply this scalar by every element.
            for (key, val) in iteritems(self):
                self[key] = val * other
    def __truediv__(self, other):
        if isscalarlike(other):
            new = dok_matrix(self.shape, dtype=self.dtype)
            # Multiply this scalar by every element.
            for (key, val) in iteritems(self):

src/s/c/scipy-HEAD/scipy/sparse/dok.py   scipy(Download)
 
from base import spmatrix, isspmatrix
from sputils import isdense, getdtype, isshape, isintlike, isscalarlike, upcast
 
try:
    def __add__(self, other):
        # First check if argument is a scalar
        if isscalarlike(other):
            new = dok_matrix(self.shape, dtype=self.dtype)
            # Add this scalar to every element.
    def __radd__(self, other):
        # First check if argument is a scalar
        if isscalarlike(other):
            new = dok_matrix(self.shape, dtype=self.dtype)
            # Add this scalar to every element.
    def __imul__(self, other):
        if isscalarlike(other):
            # Multiply this scalar by every element.
            for (key, val) in self.iteritems():
                self[key] = val * other
    def __truediv__(self, other):
        if isscalarlike(other):
            new = dok_matrix(self.shape, dtype=self.dtype)
            # Multiply this scalar by every element.
            for (key, val) in self.iteritems():

src/s/c/scipy-0.13.3/scipy/sparse/lil.py   scipy(Download)
 
from .base import spmatrix, isspmatrix
from .sputils import getdtype, isshape, issequence, isscalarlike, ismatrix, \
    IndexMixin, upcast_scalar
 
    def __imul__(self,other):
        if isscalarlike(other):
            self[:,:] = self * other
            return self
        else:
            raise NotImplementedError
 
    def __itruediv__(self,other):
        if isscalarlike(other):
        i, j = self._unpack_index(index)
 
        if isscalarlike(i) and isscalarlike(j):
            return self._get1(int(i), int(j))
 

src/c/o/cobrapy-HEAD/cobra/oven/danielhyduke/jython/scipy/sparse/base.py   cobrapy(Download)
import numjy as np
 
from sputils import isdense, isscalarlike, isintlike
 
 
        M,N = self.shape
 
        if isscalarlike(other):
            # scalar value
            return self._mul_scalar(other)
    def __rmul__(self, other): # other * self
        if isscalarlike(other):
            return self.__mul__(other)
        else:
            # Don't use asarray unless we have to
    def __truediv__(self, other):
        if isscalarlike(other):
            return self * (1./other)
        else:
            return self.tocsr().__truediv__(other)
                    result = result*self
                return result
        elif isscalarlike(other):
            raise ValueError('exponent must be an integer')
        elif isspmatrix(other):

src/c/o/cobrapy-HEAD/cobra/oven/danielhyduke/jython/scipy/sparse/lil.py   cobrapy(Download)
 
from base import spmatrix, isspmatrix
from sputils import getdtype, isshape, issequence, isscalarlike
 
class lil_matrix(spmatrix):
    def __imul__(self,other):
        if isscalarlike(other):
            self[:,:] = self * other
            return self
        else:
            raise NotImplementedError
 
    def __itruediv__(self,other):
        if isscalarlike(other):
    def __truediv__(self, other):           # self / other
        if isscalarlike(other):
            new = self.copy()
            # Divide every element by this scalar
            new.data = np.array([[val/other for val in rowvals] for

src/s/c/scipy-0.13.3/scipy/sparse/base.py   scipy(Download)
 
from scipy.lib.six.moves import xrange
from .sputils import isdense, isscalarlike, isintlike
 
 
                return self._mul_multivector(other)
 
        if isscalarlike(other):
            # scalar value
            return self._mul_scalar(other)
    def __rmul__(self, other):  # other * self
        if isscalarlike(other):
            return self.__mul__(other)
        else:
            # Don't use asarray unless we have to
    def __truediv__(self, other):
        if isscalarlike(other):
            return self * (1./other)
        else:
            return self.tocsr().__truediv__(other)
                else:
                    return tmp * tmp
        elif isscalarlike(other):
            raise ValueError('exponent must be an integer')
        else:

src/s/c/scipy-HEAD/scipy/sparse/base.py   scipy(Download)
import numpy as np
 
from sputils import isdense, isscalarlike, isintlike
 
 
                return self._mul_multivector(other)
 
        if isscalarlike(other):
            # scalar value
            return self._mul_scalar(other)
    def __rmul__(self, other): # other * self
        if isscalarlike(other):
            return self.__mul__(other)
        else:
            # Don't use asarray unless we have to
    def __truediv__(self, other):
        if isscalarlike(other):
            return self * (1./other)
        else:
            return self.tocsr().__truediv__(other)
                    result = result*self
                return result
        elif isscalarlike(other):
            raise ValueError('exponent must be an integer')
        else:

  1 | 2  Next