示例#1
0
    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_char(self.dtype.char, other.dtype.char))

        # csr_matvecs or csc_matvecs
        fn = getattr(sparsetools, self.format + "_matvecs")
        fn(M, N, n_vecs, self.indptr, self.indices, self.data, other.ravel(), result.ravel())

        return result
示例#2
0
    def _mul_vector(self, other):
        M, N = self.shape

        # output array
        result = np.zeros(M, dtype=upcast_char(self.dtype.char, other.dtype.char))

        # csr_matvec or csc_matvec
        fn = getattr(sparsetools, self.format + "_matvec")
        fn(M, N, self.indptr, self.indices, self.data, other, result)

        return result
示例#3
0
    def _mul_vector(self, other):
        M, N = self.shape

        # output array
        result = np.zeros(M,
                          dtype=upcast_char(self.dtype.char, other.dtype.char))

        # csr_matvec or csc_matvec
        fn = getattr(sparsetools, self.format + '_matvec')
        fn(M, N, self.indptr, self.indices, self.data, other, result)

        return result
示例#4
0
    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_char(self.dtype.char,
                                                        other.dtype.char))

        # csr_matvecs or csc_matvecs
        fn = getattr(sparsetools,self.format + '_matvecs')
        fn(M, N, n_vecs, self.indptr, self.indices, self.data, other.ravel(), result.ravel())

        return result
示例#5
0
文件: dia.py 项目: 87/scipy
    def _mul_vector(self, other):
        x = other

        y = np.zeros( self.shape[0], dtype=upcast_char(self.dtype.char,
                                                       x.dtype.char))

        L = self.data.shape[1]

        M,N = self.shape

        dia_matvec(M,N, len(self.offsets), L, self.offsets, self.data, x.ravel(), y.ravel())

        return y
示例#6
0
    def _mul_vector(self, other):
        x = other

        y = np.zeros(self.shape[0],
                     dtype=upcast_char(self.dtype.char, x.dtype.char))

        L = self.data.shape[1]

        M, N = self.shape

        dia_matvec(M, N, len(self.offsets), L, self.offsets, self.data,
                   x.ravel(), y.ravel())

        return y
示例#7
0
文件: coo.py 项目: afarahi/QFT
 def _mul_vector(self, other):
     #output array
     result = np.zeros(self.shape[0],
                       dtype=upcast_char(self.dtype.char, other.dtype.char))
     coo_matvec(self.nnz, self.row, self.col, self.data, other, result)
     return result
示例#8
0
文件: coo.py 项目: aidoom/scipy
 def _mul_vector(self, other):
     #output array
     result = np.zeros( self.shape[0], dtype=upcast_char(self.dtype.char,
                                                         other.dtype.char) )
     coo_matvec(self.nnz, self.row, self.col, self.data, other, result)
     return result