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
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
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
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