Did I find the right examples for you? yes no

All Samples(62)  |  Call(35)  |  Derive(0)  |  Import(27)

src/s/c/scipy-0.13.3/scipy/sparse/dok.py   scipy(Download)
                raise TypeError('expected rank <=2 dense array or matrix')
 
            from .coo import coo_matrix
            d = coo_matrix(arg1, dtype=dtype).todok()
            self.update(d)
    def tocoo(self):
        """ Return a copy of this matrix in COOrdinate format"""
        from .coo import coo_matrix
        if self.nnz == 0:
            return coo_matrix(self.shape, dtype=self.dtype)
        else:
            data = np.asarray(_list(self.values()), dtype=self.dtype)
            indices = np.asarray(_list(self.keys()), dtype=np.intc).T
            return coo_matrix((data,indices), shape=self.shape,

src/s/c/scipy-HEAD/scipy/sparse/dok.py   scipy(Download)
                raise TypeError('expected rank <=2 dense array or matrix')
 
            from coo import coo_matrix
            self.update( coo_matrix(arg1, dtype=dtype).todok() )
            self.shape = arg1.shape
    def tocoo(self):
        """ Return a copy of this matrix in COOrdinate format"""
        from coo import coo_matrix
        if self.nnz == 0:
            return coo_matrix(self.shape, dtype=self.dtype)
        else:
            data    = np.asarray(self.values(), dtype=self.dtype)
            indices = np.asarray(self.keys(), dtype=np.intc).T
            return coo_matrix((data,indices), shape=self.shape, dtype=self.dtype)

src/s/c/scipy-0.13.3/scipy/sparse/compressed.py   scipy(Download)
                if len(arg1) == 2:
                    # (data, ij) format
                    from .coo import coo_matrix
                    other = self.__class__(coo_matrix(arg1, shape=shape))
                    self._set_self(other)
                raise ValueError("unrecognized %s_matrix constructor usage" %
                        self.format)
            from .coo import coo_matrix
            self._set_self(self.__class__(coo_matrix(arg1, dtype=dtype)))
 
        row,col = self._swap((major_indices,minor_indices))
 
        from .coo import coo_matrix
        return coo_matrix((data,(row,col)), self.shape)
 

src/s/c/scipy-0.13.3/scipy/sparse/bsr.py   scipy(Download)
            elif len(arg1) == 2:
                # (data,(row,col)) format
                from .coo import coo_matrix
                self._set_self(coo_matrix(arg1, dtype=dtype).tobsr(blocksize=blocksize))
 
                raise ValueError("unrecognized form for"
                        " %s_matrix constructor" % self.format)
            from .coo import coo_matrix
            arg1 = coo_matrix(arg1, dtype=dtype).tobsr(blocksize=blocksize)
            self._set_self(arg1)
            data = data.copy()
 
        from .coo import coo_matrix
        return coo_matrix((data,(row,col)), shape=self.shape)
 

src/s/c/scipy-HEAD/scipy/sparse/bsr.py   scipy(Download)
            elif len(arg1) == 2:
                # (data,(row,col)) format
                from coo import coo_matrix
                self._set_self( coo_matrix(arg1, dtype=dtype).tobsr(blocksize=blocksize) )
 
                raise ValueError("unrecognized form for" \
                        " %s_matrix constructor" % self.format)
            from coo import coo_matrix
            arg1 = coo_matrix(arg1, dtype=dtype).tobsr(blocksize=blocksize)
            self._set_self( arg1 )
            data = data.copy()
 
        from coo import coo_matrix
        return coo_matrix((data,(row,col)), shape=self.shape)
 

src/s/c/scipy-0.13.3/scipy/sparse/dia.py   scipy(Download)
                raise ValueError("unrecognized form for"
                        " %s_matrix constructor" % self.format)
            from .coo import coo_matrix
            A = coo_matrix(arg1, dtype=dtype).todia()
            self.data = A.data
        row,col,data = row[mask],col[mask],data[mask]
 
        from .coo import coo_matrix
        return coo_matrix((data,(row,col)), shape=self.shape)
 

src/s/c/scipy-HEAD/scipy/sparse/dia.py   scipy(Download)
                raise ValueError("unrecognized form for" \
                        " %s_matrix constructor" % self.format)
            from coo import coo_matrix
            A = coo_matrix(arg1, dtype=dtype).todia()
            self.data    = A.data
        row,col,data = row[mask],col[mask],data[mask]
 
        from coo import coo_matrix
        return coo_matrix((data,(row,col)), shape=self.shape)
 

src/s/c/scipy-0.13.3/scipy/sparse/extract.py   scipy(Download)
 
 
from .coo import coo_matrix
 
 
 
    # convert to COOrdinate format where things are easy
    A = coo_matrix(A, copy=False)
 
    mask = A.row + k >= A.col
 
    # convert to COOrdinate format where things are easy
    A = coo_matrix(A, copy=False)
 
    mask = A.row + k <= A.col

src/s/c/scipy-HEAD/scipy/sparse/extract.py   scipy(Download)
 
 
from coo import coo_matrix
 
def find(A):
 
    # convert to COOrdinate format where things are easy
    A = coo_matrix(A, copy=False)
 
    mask = A.row + k >= A.col
 
    # convert to COOrdinate format where things are easy
    A = coo_matrix(A, copy=False)
 
    mask = A.row + k <= A.col

src/s/c/scipy-0.13.3/scipy/sparse/construct.py   scipy(Download)
from .csc import csc_matrix
from .bsr import bsr_matrix
from .coo import coo_matrix
from .lil import lil_matrix
from .dia import dia_matrix
            col = np.arange(n, dtype=np.intc)
            data = np.ones(n, dtype=dtype)
            return coo_matrix((data,(row,col)),(n,n))
 
    diags = np.ones((1, max(0, min(m + k, n))), dtype=dtype)
 
    """
    B = coo_matrix(B)
 
    if (format is None or format == "bsr") and 2*B.nnz >= B.shape[0] * B.shape[1]:
        if A.nnz == 0 or B.nnz == 0:
            # kronecker product is the zero matrix
            return coo_matrix(output_shape)
 
        B = B.toarray()
    else:
        # use COO
        A = coo_matrix(A)
        output_shape = (A.shape[0]*B.shape[0], A.shape[1]*B.shape[1])
 

  1 | 2  Next