コード例 #1
0
ファイル: csc.py プロジェクト: wangdayoux/OpenSignals
    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))

        csc_tocsr(M, N, self.indptr, self.indices, self.data, indptr, indices, data)

        from csr import csr_matrix

        A = csr_matrix((data, indices, indptr), shape=self.shape)
        A.has_sorted_indices = True
        return A
コード例 #2
0
ファイル: csc.py プロジェクト: sprevrha/scipy-refactor
    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))

        csc_tocsr(M, N, \
                 self.indptr, self.indices, self.data, \
                 indptr, indices, data)

        from csr import csr_matrix
        A = csr_matrix((data, indices, indptr), shape=self.shape)
        A.has_sorted_indices = True
        return A