Ejemplo n.º 1
0
 def accept_p_domain(self) :
     with self.assertRaises(ValueError) as context :
         opnorm(self.K, p=0.5, q=2)
     self.assertEqual('Domain error (1 < p < infinity required)',
                      str(context.exception))
Ejemplo n.º 2
0
 def accept_q_domain(self) :
     with self.assertRaises(ValueError) as context :
         opnorm(self.K, p=2, q=0.5)
     self.assertEqual('Domain error (1 <= q required)',
                      str(context.exception))
Ejemplo n.º 3
0
 def accept_pq_required(self) :
     with self.assertRaises(ValueError) as context :
         opnorm(self.K)
     self.assertEqual('error parsing arguments', str(context.exception))
Ejemplo n.º 4
0
 def accept_fifomax(self) :
     with self.assertRaises(RuntimeError) as context :
         opnorm(self.K, 4, 4, eps=1e-10, fifomax=10)
     self.assertEqual('User specifed FIFO max-length exceeded',
                      str(context.exception))
Ejemplo n.º 5
0
 def accept_has_stats(self) :
     (M, vmax, stats) = opnorm(self.K, 4, 4, eps=1e-10, fifomax=0)
     keys = ['neval', 'nfifo', 'fifomax', 'nthread']
     self.assertItemsEqual(stats.keys(), keys,
                           "Drury stats keys : {0!s}".format(repr(stats.keys())))
Ejemplo n.º 6
0
 def accept_norm(self) :
     M0 = 0.99999943874177
     for eps in (1e-10, 1e-8, 1e-6, 1e-4) :
         (M, vmax, stats) = opnorm(self.K, 4, 4, eps=eps)
         self.assertTrue(abs(M - M0) < eps * M,
                         "Drury K norm : {0!s}".format(repr(M)))