def test_scalar_coefs_ops(self): """::Check to make sure the scalar coefficient ops are working """ _ = sp.ones_coefs(12, 8) _ = sp.random_coefs(10, 10) + 1j * sp.random_coefs(10, 10) _ = sp.zeros_coefs(21, 18) ss = 1j - 2 / (sp.zeros_coefs(5, 4) + .001) + \ 4 * sp.random_coefs(5, 4) / 6.0 ss += sp.ones_coefs(5, 4, coef_type=sp.scalar) _ = 1 + 2 * sp.ones_coefs(3, 3) / 4 * sp.ones_coefs(3, 3) - 2 ds1 = 1j + 4 * sp.ones_patt_uniform(5, 8) / 3 - \ sp.ones_patt_uniform(5, 8) - 1 + \ 10 * sp.random_patt_uniform(5, 8) ds1.single_val sp.array(ds1) _ = sp.zeros_coefs(10, 10) self.assertTrue(True)
def test_mult_constant_left_right(self): """::can mult a scalar to VectorCoefs from both sides""" z1 = sp.ones_coefs(11, 10, coef_type=sp.vector) a = z1 * 1j * 1.1 b = z1 * 1j * 1.1 c = a - b res = True if sp.L2_coef(c) / sp.L2_coef(b) > 1e-13: res = False a = 1j * 1.1 * z1 b = 1j * 1.1 * z1 c = a - b if sp.L2_coef(c) / sp.L2_coef(b) > 1e-13: res = False self.assertTrue(res)
def test_make_sure_mmax_not_greater_nmax_o(self): """::raise an error if I try to set mmax > nmax: ones""" with self.assertRaises(ValueError): _ = sp.ones_coefs(11, 13)
rs = scoef._reshape_n_vecs() #ps.pcolor_coefs(scoef) sp.plot_coefs(scoef) print scoef[:, 2] sp = sp.ispht(scoef, 6, 8) if T5: rr = sp.random_coefs(10, 10) + 1j * sp.random_coefs(10, 10) ss = 1j - 2 / (sp.zeros_coefs(5,4) + .001) + \ 4* sp.random_coefs(5,4) / 6.0 ss += sp.ones_coefs(5, 4, coef_type=sp.scalar) qq = 1 + 2 * sp.ones_coefs(3, 3) / 4 * sp.ones_coefs(3, 3) - 2 ds1 =1j + 4*sp.ones_patt_uniform(5,8)/3 - \ sp.ones_patt_uniform(5,8) -1 + \ 10*sp.random_patt_uniform(5,8) print ds1.single_val print sp.array(ds1) zc = sp.zeros_coefs(10, 10) zc[2, 1] = 1.0 zc[2, -2] = 3.0 zc[0, 0] = 1j * 5.0