Beispiel #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
Beispiel #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
Beispiel #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
Beispiel #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
Beispiel #5
0
Datei: dia.py Projekt: 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
Beispiel #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
Beispiel #7
0
 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
Beispiel #8
0
 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