Did I find the right examples for you? yes no

All Samples(54)  |  Call(37)  |  Derive(0)  |  Import(17)

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 _mul_vector(self, other):
        # matrix * vector
        result = np.zeros(self.shape[0], dtype=upcast(self.dtype,other.dtype))
        for (i,j),v in iteritems(self):
            result[i] += v * other[j]
    def _mul_multivector(self, other):
        # matrix * multivector
        M,N = self.shape
        n_vecs = other.shape[1]  # number of column vectors
        result = np.zeros((M,n_vecs), dtype=upcast(self.dtype,other.dtype))

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 _mul_vector(self, other):
        M,N = self.shape
 
        #output array
        result = np.zeros( self.shape[0], dtype=upcast(self.dtype,other.dtype) )
    def _mul_multivector(self, other):
        M,N = self.shape
        n_vecs = other.shape[1] #number of column vectors
 
        result = np.zeros( (M,n_vecs), dtype=upcast(self.dtype,other.dtype) )
        nnz = indptr[-1]
        indices = np.empty(nnz, dtype=np.intc)
        data    = np.empty(nnz, dtype=upcast(self.dtype,other.dtype))
 
        fn = getattr(sparsetools, self.format + '_matmat_pass2')
        #TODO support k-th diagonal
        fn = getattr(sparsetools, self.format + "_diagonal")
        y = np.empty( min(self.shape), dtype=upcast(self.dtype) )
        fn(self.shape[0], self.shape[1], self.indptr, self.indices, self.data, y)
        return y

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 _mul_vector(self, other):
        #matrix * vector
        result = np.zeros( self.shape[0], dtype=upcast(self.dtype,other.dtype) )
        for (i,j),v in self.iteritems():
            result[i] += v * other[j]
    def _mul_multivector(self, other):
        #matrix * multivector
        M,N = self.shape
        n_vecs = other.shape[1] #number of column vectors
        result = np.zeros( (M,n_vecs), dtype=upcast(self.dtype,other.dtype) )

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
 
        nnz = indptr[-1]
        indices = np.empty(nnz, dtype=np.intc)
        data = np.empty(nnz, dtype=upcast(self.dtype,other.dtype))
 
        fn = getattr(sparsetools, self.format + '_matmat_pass2')
        # TODO support k-th diagonal
        fn = getattr(sparsetools, self.format + "_diagonal")
        y = np.empty(min(self.shape), dtype=upcast(self.dtype))
        fn(self.shape[0], self.shape[1], self.indptr, self.indices, self.data, y)
        return y
            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],

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
 
        nnz = indptr[-1]
        indices = np.empty(nnz, dtype=np.intc)
        data    = np.empty(nnz, dtype=upcast(self.dtype,other.dtype))
 
        fn = getattr(sparsetools, self.format + '_matmat_pass2')
        #TODO support k-th diagonal
        fn = getattr(sparsetools, self.format + "_diagonal")
        y = np.empty( min(self.shape), dtype=upcast(self.dtype) )
        fn(self.shape[0], self.shape[1], self.indptr, self.indices, self.data, y)
        return y
        indptr  = np.empty_like(self.indptr)
        indices = np.empty(maxnnz, dtype=np.intc)
        data    = np.empty(maxnnz, dtype=upcast(self.dtype,other.dtype))
 
        fn(self.shape[0], self.shape[1], \

src/s/c/scipy-0.13.3/scipy/sparse/bsr.py   scipy(Download)
from .compressed import _cs_matrix
from .base import isspmatrix, _formats
from .sputils import isshape, getdtype, to_native, upcast
from . import sparsetools
from .sparsetools import bsr_matvec, bsr_matvecs, csr_matmat_pass1, \
        M,N = self.shape
        R,C = self.blocksize
        y = np.empty(min(M,N), dtype=upcast(self.dtype))
        sparsetools.bsr_diagonal(M//R, N//C, R, C,
                self.indptr, self.indices, np.ravel(self.data), y)
    def _mul_vector(self, other):
        M,N = self.shape
        R,C = self.blocksize
 
        result = np.zeros(self.shape[0], dtype=upcast(self.dtype, other.dtype))
        n_vecs = other.shape[1]  # number of column vectors
 
        result = np.zeros((M,n_vecs), dtype=upcast(self.dtype,other.dtype))
 
        bsr_matvecs(M//R, N//C, n_vecs, R, C,
        bnnz = indptr[-1]
        indices = np.empty(bnnz, dtype=np.intc)
        data = np.empty(R*C*bnnz, dtype=upcast(self.dtype,other.dtype))
 
        bsr_matmat_pass2(M//R, N//C, R, C, n,

src/s/c/scipy-HEAD/scipy/sparse/bsr.py   scipy(Download)
from compressed import _cs_matrix
from base import isspmatrix, _formats
from sputils import isshape, getdtype, to_native, upcast
import sparsetools
from sparsetools import bsr_matvec, bsr_matvecs, csr_matmat_pass1, \
        M,N = self.shape
        R,C = self.blocksize
        y = np.empty(min(M,N), dtype=upcast(self.dtype))
        sparsetools.bsr_diagonal(M//R, N//C, R, C, \
                self.indptr, self.indices, np.ravel(self.data), y)
    def _mul_vector(self, other):
        M,N = self.shape
        R,C = self.blocksize
 
        result = np.zeros(self.shape[0], dtype=upcast(self.dtype, other.dtype))
        n_vecs = other.shape[1] #number of column vectors
 
        result = np.zeros((M,n_vecs), dtype=upcast(self.dtype,other.dtype))
 
        bsr_matvecs(M//R, N//C, n_vecs, R, C, \
        bnnz = indptr[-1]
        indices = np.empty(bnnz, dtype=np.intc)
        data    = np.empty(R*C*bnnz, dtype=upcast(self.dtype,other.dtype))
 
        bsr_matmat_pass2( M//R, N//C, R, C, n, \

src/s/c/scipy-0.13.3/scipy/sparse/construct.py   scipy(Download)
import numpy as np
 
from .sputils import upcast
 
from .csr import csr_matrix
        raise ValueError('B is not square')
 
    dtype = upcast(A.dtype, B.dtype)
 
    L = kron(eye(B.shape[0],dtype=dtype), A, format=format)
    nnz = sum([A.nnz for A in blocks[block_mask]])
    if dtype is None:
        dtype = upcast(*tuple([A.dtype for A in blocks[block_mask]]))
 
    row_offsets = np.concatenate(([0], np.cumsum(brow_lengths)))

src/s/c/scipy-HEAD/scipy/sparse/construct.py   scipy(Download)
import numpy as np
 
from sputils import upcast
 
from csr import csr_matrix
        raise ValueError('B is not square')
 
    dtype = upcast(A.dtype, B.dtype)
 
    L = kron(eye(B.shape[0],dtype=dtype), A, format=format)
    nnz = sum([ A.nnz for A in blocks[block_mask] ])
    if dtype is None:
        dtype = upcast( *tuple([A.dtype for A in blocks[block_mask]]) )
 
    row_offsets = np.concatenate(([0], np.cumsum(brow_lengths)))

src/s/c/scipy-0.13.3/scipy/sparse/csc.py   scipy(Download)
from .sparsetools import csc_tocsr
from . import sparsetools
from .sputils import upcast, isintlike, IndexMixin
 
from .compressed import _cs_matrix
    def tocsr(self):
        M,N = self.shape
        indptr = np.empty(M + 1, dtype=np.intc)
        indices = np.empty(self.nnz, dtype=np.intc)
        data = np.empty(self.nnz, dtype=upcast(self.dtype))

  1 | 2  Next