本文整理汇总了Python中cysparse.sparse.ll_mat.LLSparseMatrix.find方法的典型用法代码示例。如果您正苦于以下问题:Python LLSparseMatrix.find方法的具体用法?Python LLSparseMatrix.find怎么用?Python LLSparseMatrix.find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cysparse.sparse.ll_mat.LLSparseMatrix
的用法示例。
在下文中一共展示了LLSparseMatrix.find方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: LLMatFindBenchmark
# 需要导入模块: from cysparse.sparse.ll_mat import LLSparseMatrix [as 别名]
# 或者: from cysparse.sparse.ll_mat.LLSparseMatrix import find [as 别名]
class LLMatFindBenchmark(benchmark.Benchmark):
label = "Simple find with 100 elements, size = 1,000"
each = 100
def setUp(self):
self.nbr_elements = 100
self.size = 1000
self.A_c = LLSparseMatrix(size=self.size, size_hint=self.nbr_elements, dtype=FLOAT64_T)
construct_sparse_matrix(self.A_c, self.size, self.nbr_elements)
self.A_p = spmatrix.ll_mat(self.size, self.size, self.nbr_elements)
construct_sparse_matrix(self.A_p, self.size, self.nbr_elements)
#def tearDown(self):
# assert self.A_c.nnz == self.A_p.nnz
# # reconstruct initial matrices
# self.A_c_bis = LLSparseMatrix(size=self.size, size_hint=self.nbr_elements, dtype=FLOAT64_T)
# self.A_c_bis.put_triplet(self.A_c_rows, self.A_c_cols, self.A_c_vals)
# self.A_p_bis = spmatrix.ll_mat(self.size, self.size, self.nbr_elements)
# self.A_p_bis.put(self.A_p_vals, self.A_p_rows, self.A_p_cols)
# for i in xrange(self.size):
# for j in xrange(self.size):
# assert self.A_c_bis[i, j] == self.A_p_bis[i, j]
def test_pysparse(self):
self.A_p_vals, self.A_p_rows, self.A_p_cols = self.A_p.find()
return
def test_cysparse(self):
self.A_c_rows, self.A_c_cols, self.A_c_vals = self.A_c.find()
return