本文整理汇总了Python中cysparse.sparse.ll_mat.LLSparseMatrix.norm方法的典型用法代码示例。如果您正苦于以下问题:Python LLSparseMatrix.norm方法的具体用法?Python LLSparseMatrix.norm怎么用?Python LLSparseMatrix.norm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cysparse.sparse.ll_mat.LLSparseMatrix
的用法示例。
在下文中一共展示了LLSparseMatrix.norm方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: LLMatInfiniteNormBenchmark
# 需要导入模块: from cysparse.sparse.ll_mat import LLSparseMatrix [as 别名]
# 或者: from cysparse.sparse.ll_mat.LLSparseMatrix import norm [as 别名]
class LLMatInfiniteNormBenchmark(benchmark.Benchmark):
label = "Infinite norm with 100 elements and 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.p_norm_inf == self.c_norm_inf
#assert self.w_c[i] == self.w_s[i]
def test_pysparse(self):
self.p_norm_inf = self.A_p.norm('inf')
return
def test_cysparse(self):
self.c_norm_inf = self.A_c.norm('inf')
return
示例2: LLMatFrobeniusNormBenchmark
# 需要导入模块: from cysparse.sparse.ll_mat import LLSparseMatrix [as 别名]
# 或者: from cysparse.sparse.ll_mat.LLSparseMatrix import norm [as 别名]
class LLMatFrobeniusNormBenchmark(benchmark.Benchmark):
label = "Frobenius norm with 100 elements and size = 1,000 for a symmetrical matrix"
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, store_symmetric=True)
construct_sym_sparse_matrix(self.A_c, self.size, self.nbr_elements)
self.A_p = spmatrix.ll_mat_sym(self.size, self.size, self.nbr_elements)
construct_sym_sparse_matrix(self.A_p, self.size, self.nbr_elements)
def tearDown(self):
assert self.p_norm == self.c_norm
#assert self.w_c[i] == self.w_s[i]
def test_pysparse(self):
self.p_norm = self.A_p.norm('fro')
return
def test_cysparse(self):
self.c_norm = self.A_c.norm('frob')
return