本文整理汇总了Python中cysparse.sparse.ll_mat.LLSparseMatrix.to_csc方法的典型用法代码示例。如果您正苦于以下问题:Python LLSparseMatrix.to_csc方法的具体用法?Python LLSparseMatrix.to_csc怎么用?Python LLSparseMatrix.to_csc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cysparse.sparse.ll_mat.LLSparseMatrix
的用法示例。
在下文中一共展示了LLSparseMatrix.to_csc方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: LLMatMatVecBenchmark_3
# 需要导入模块: from cysparse.sparse.ll_mat import LLSparseMatrix [as 别名]
# 或者: from cysparse.sparse.ll_mat.LLSparseMatrix import to_csc [as 别名]
class LLMatMatVecBenchmark_3(LLMatMatVecBenchmark):
label = "matvec with 100,000 elements and size = 1,000,000"
each = 100
def setUp(self):
self.nbr_elements = 100000
self.size = 1000000
self.A_c = LLSparseMatrix(size=self.size, size_hint=self.nbr_elements, itype=INT32_T, dtype=FLOAT64_T)
self.A_s = lil_matrix((self.size, self.size), dtype=np.float64)
self.list_of_matrices = []
self.list_of_matrices.append(self.A_c)
self.list_of_matrices.append(self.A_s)
construct_random_matrices(self.list_of_matrices, self.size, self.nbr_elements)
self.CSC_c = self.A_c.to_csc()
self.CSC_s = self.A_s.tocsc()
self.v = np.arange(0, self.size, dtype=np.float64)
示例2: LLMatMatVecBenchmark
# 需要导入模块: from cysparse.sparse.ll_mat import LLSparseMatrix [as 别名]
# 或者: from cysparse.sparse.ll_mat.LLSparseMatrix import to_csc [as 别名]
class LLMatMatVecBenchmark(benchmark.Benchmark):
label = "CSR * CSC * v with 1000 elements and size = 10,000"
each = 100
def setUp(self):
self.nbr_elements = 1000
self.size = 10000
self.A_c = LLSparseMatrix(size=self.size, size_hint=self.nbr_elements, itype=INT32_T, dtype=FLOAT64_T)
self.A_s = lil_matrix((self.size, self.size), dtype=np.float64)
self.list_of_matrices = []
self.list_of_matrices.append(self.A_c)
self.list_of_matrices.append(self.A_s)
construct_random_matrices(self.list_of_matrices, self.size, self.nbr_elements)
self.CSR_c = self.A_c.to_csr()
self.CSR_s = self.A_s.tocsr()
self.B_c = LLSparseMatrix(size=self.size, size_hint=self.nbr_elements, itype=INT32_T, dtype=FLOAT64_T)
self.B_s = lil_matrix((self.size, self.size), dtype=np.float64)
self.list_of_matrices = []
self.list_of_matrices.append(self.B_c)
self.list_of_matrices.append(self.B_s)
construct_random_matrices(self.list_of_matrices, self.size, self.nbr_elements)
self.CSC_c = self.B_c.to_csc()
self.CSC_s = self.B_s.tocsc()
self.v = np.arange(0, self.size, dtype=np.float64)
#def tearDown(self):
# for i in xrange(self.size):
# assert self.w_c[i] == self.w_p[i]
# assert self.w_c[i] == self.w_s[i]
def test_cysparse(self):
self.w_c = self.CSR_c * self.CSC_c * self.v
return
def test_scipy_sparse(self):
self.w_s = self.CSR_s * self.CSC_s * self.v
return