本文整理汇总了C++中FLINT_TEST_CLEANUP函数的典型用法代码示例。如果您正苦于以下问题:C++ FLINT_TEST_CLEANUP函数的具体用法?C++ FLINT_TEST_CLEANUP怎么用?C++ FLINT_TEST_CLEANUP使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FLINT_TEST_CLEANUP函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: main
int
main(void)
{
int iter;
FLINT_TEST_INIT(state);
flint_printf("inflate....");
fflush(stdout);
for (iter = 0; iter < 100 * flint_test_multiplier(); iter++)
{
nmod_poly_t poly1, poly2, poly3, xp;
mp_limb_t modulus;
ulong inflation;
modulus = n_randtest_prime(state, 0);
nmod_poly_init(poly1, modulus);
nmod_poly_init(poly2, modulus);
nmod_poly_init(poly3, modulus);
nmod_poly_init(xp, modulus);
nmod_poly_randtest(poly1, state, n_randint(state, 20));
inflation = n_randint(state, 10);
nmod_poly_inflate(poly2, poly1, inflation);
nmod_poly_set_coeff_ui(xp, inflation, 1);
nmod_poly_compose(poly3, poly1, xp);
if (!nmod_poly_equal(poly2, poly3))
{
flint_printf("FAIL: not equal to compose (inflation = %wu)\n", inflation);
flint_printf("poly1:\n"); nmod_poly_print(poly1); flint_printf("\n\n");
flint_printf("poly2:\n"); nmod_poly_print(poly2); flint_printf("\n\n");
flint_printf("poly3:\n"); nmod_poly_print(poly3); flint_printf("\n\n");
abort();
}
nmod_poly_inflate(poly1, poly1, inflation);
if (!nmod_poly_equal(poly1, poly2))
{
flint_printf("FAIL: aliasing (inflation = %wu)\n", inflation);
flint_printf("poly1:\n"); nmod_poly_print(poly1); flint_printf("\n\n");
flint_printf("poly2:\n"); nmod_poly_print(poly2); flint_printf("\n\n");
abort();
}
nmod_poly_clear(poly1);
nmod_poly_clear(poly2);
nmod_poly_clear(poly3);
nmod_poly_clear(xp);
}
FLINT_TEST_CLEANUP(state);
flint_printf("PASS\n");
return 0;
}
开发者ID:clear731,项目名称:lattice,代码行数:60,代码来源:t-inflate.c
示例2: main
int main(void)
{
mp_limb_t n;
int j;
FLINT_TEST_INIT(state);
flint_printf("factorial_mod2_preinv....");
fflush(stdout);
for (n = 0; n < 100 * flint_test_multiplier(); n++)
{
mp_limb_t p, pinv, x, y;
for (j = 0; j < 10; j++)
{
p = n_randtest_not_zero(state);
pinv = n_preinvert_limb(p);
x = n_factorial_mod2_preinv(n, p, pinv);
y = n_factorial_mod2_foolproof(n, p, pinv);
if (x != y)
{
flint_printf("FAIL:\n");
flint_printf("n = %wu\np = %wu\nx = %wu\ny = %wu\n", n, p, x, y);
abort();
}
}
}
FLINT_TEST_CLEANUP(state);
flint_printf("PASS\n");
return 0;
}
开发者ID:clear731,项目名称:lattice,代码行数:35,代码来源:t-factorial_mod2_preinv.c
示例3: main
int
main(void)
{
int i;
FLINT_TEST_INIT(state);
flint_printf("init/clear....");
fflush(stdout);
for (i = 0; i < 1000 * flint_test_multiplier(); i++)
{
fmpq_mat_t a;
slong j, k;
slong rows = n_randint(state, 100);
slong cols = n_randint(state, 100);
fmpq_mat_init(a, rows, cols);
for (j = 0; j < rows; j++)
for (k = 0; k < cols; k++)
fmpq_zero(fmpq_mat_entry(a, j, k));
fmpq_mat_clear(a);
}
FLINT_TEST_CLEANUP(state);
flint_printf("PASS\n");
return 0;
}
开发者ID:clear731,项目名称:lattice,代码行数:32,代码来源:t-init_clear.c
示例4: main
int
main(void)
{
int i;
FLINT_TEST_INIT(state);
flint_printf("is_square....");
fflush(stdout);
for (i = 0; i < 1000 * flint_test_multiplier(); i++)
{
fmpz_mat_t A;
slong rows = n_randint(state, 10);
slong cols = n_randint(state, 10);
fmpz_mat_init(A, rows, cols);
if (fmpz_mat_is_square(A) != (rows == cols))
{
flint_printf("FAIL!\n");
abort();
}
fmpz_mat_clear(A);
}
FLINT_TEST_CLEANUP(state);
flint_printf("PASS\n");
return 0;
}
开发者ID:clear731,项目名称:lattice,代码行数:32,代码来源:t-is_square.c
示例5: main
int main(void)
{
slong i;
FLINT_TEST_INIT(state);
flint_printf("pow....");
fflush(stdout);
for (i = 0; i < 100 * flint_test_multiplier(); i++)
{
fmpz_mat_t A, B, C;
slong i, n;
ulong e;
n = n_randint(state, 10);
e = n_randint(state, 20);
fmpz_mat_init(A, n, n);
fmpz_mat_init(B, n, n);
fmpz_mat_init(C, n, n);
fmpz_mat_randtest(A, state, n_randint(state, 200) + 1);
fmpz_mat_randtest(B, state, n_randint(state, 200) + 1);
/* Make sure noise in the output is ok */
fmpz_mat_randtest(B, state, n_randint(state, 200) + 1);
fmpz_mat_pow(B, A, e);
fmpz_mat_one(C);
for (i = 0; i < e; i++)
fmpz_mat_mul(C, C, A);
if (!fmpz_mat_equal(C, B))
{
flint_printf("FAIL: results not equal\n");
abort();
}
fmpz_mat_pow(A, A, e);
if (!fmpz_mat_equal(A, B))
{
flint_printf("FAIL: aliasing failed\n");
abort();
}
fmpz_mat_clear(A);
fmpz_mat_clear(B);
fmpz_mat_clear(C);
}
FLINT_TEST_CLEANUP(state);
flint_printf("PASS\n");
return 0;
}
开发者ID:clear731,项目名称:lattice,代码行数:59,代码来源:t-pow.c
示例6: main
int
main(void)
{
int i, result;
FLINT_TEST_INIT(state);
flint_printf("one....");
fflush(stdout);
/* 1 * A == A * 1 == A */
for (i = 0; i < 100 * flint_test_multiplier(); i++)
{
fmpq_mat_t A, B, C, I;
slong n, bits;
n = n_randint(state, 10);
bits = 1 + n_randint(state, 100);
fmpq_mat_init(A, n, n);
fmpq_mat_init(B, n, n);
fmpq_mat_init(C, n, n);
fmpq_mat_init(I, n, n);
fmpq_mat_randtest(A, state, bits);
fmpq_mat_one(I);
fmpq_mat_mul(B, I, A);
fmpq_mat_mul(C, A, I);
result = fmpq_mat_equal(A, B) && fmpq_mat_equal(A, C);
if (!result)
{
flint_printf("FAIL:\n");
flint_printf("A:\n");
fmpq_mat_print(A);
flint_printf("B:\n");
fmpq_mat_print(B);
flint_printf("C:\n");
fmpq_mat_print(C);
flint_printf("I:\n");
fmpq_mat_print(I);
abort();
}
fmpq_mat_clear(A);
fmpq_mat_clear(B);
fmpq_mat_clear(C);
fmpq_mat_clear(I);
}
FLINT_TEST_CLEANUP(state);
flint_printf("PASS\n");
return EXIT_SUCCESS;
}
开发者ID:clear731,项目名称:lattice,代码行数:59,代码来源:t-one.c
示例7: main
int
main(void)
{
int i, result;
FLINT_TEST_INIT(state);
flint_printf("mullow_classical... ");
fflush(stdout);
/* Compare with truncated product of a and b */
for (i = 0; i < 2000; i++)
{
TEMPLATE(T, ctx_t) ctx;
TEMPLATE(T, poly_t) a, b, c, d;
slong n;
TEMPLATE(T, ctx_randtest) (ctx, state);
TEMPLATE(T, poly_init) (a, ctx);
TEMPLATE(T, poly_init) (b, ctx);
TEMPLATE(T, poly_init) (c, ctx);
TEMPLATE(T, poly_init) (d, ctx);
TEMPLATE(T, poly_randtest) (a, state, n_randint(state, 50), ctx);
TEMPLATE(T, poly_randtest) (b, state, n_randint(state, 50), ctx);
n = n_randint(state, 50);
TEMPLATE(T, poly_mullow_classical) (c, a, b, n, ctx);
TEMPLATE(T, poly_mul) (d, a, b, ctx);
TEMPLATE(T, poly_truncate) (d, n, ctx);
result = (TEMPLATE(T, poly_equal) (c, d, ctx));
if (!result)
{
flint_printf("FAIL:\n\n");
flint_printf("a = "), TEMPLATE(T, poly_print_pretty) (a, "X", ctx),
flint_printf("\n");
flint_printf("b = "), TEMPLATE(T, poly_print_pretty) (b, "X", ctx),
flint_printf("\n");
flint_printf("c = "), TEMPLATE(T, poly_print_pretty) (c, "X", ctx),
flint_printf("\n");
flint_printf("d = "), TEMPLATE(T, poly_print_pretty) (d, "X", ctx),
flint_printf("\n");
abort();
}
TEMPLATE(T, poly_clear) (a, ctx);
TEMPLATE(T, poly_clear) (b, ctx);
TEMPLATE(T, poly_clear) (c, ctx);
TEMPLATE(T, poly_clear) (d, ctx);
TEMPLATE(T, ctx_clear) (ctx);
}
FLINT_TEST_CLEANUP(state);
flint_printf("PASS\n");
return EXIT_SUCCESS;
}
开发者ID:clear731,项目名称:lattice,代码行数:59,代码来源:t-mullow_classical.c
示例8: main
int main(void)
{
fmpz_mat_t A, B, C, D;
slong i;
FLINT_TEST_INIT(state);
flint_printf("mul....");
fflush(stdout);
for (i = 0; i < 100 * flint_test_multiplier(); i++)
{
slong m, n, k;
m = n_randint(state, 50);
n = n_randint(state, 50);
k = n_randint(state, 50);
fmpz_mat_init(A, m, n);
fmpz_mat_init(B, n, k);
fmpz_mat_init(C, m, k);
fmpz_mat_init(D, m, k);
fmpz_mat_randtest(A, state, n_randint(state, 200) + 1);
fmpz_mat_randtest(B, state, n_randint(state, 200) + 1);
/* Make sure noise in the output is ok */
fmpz_mat_randtest(C, state, n_randint(state, 200) + 1);
fmpz_mat_mul(C, A, B);
fmpz_mat_mul_classical_inline(D, A, B);
if (!fmpz_mat_equal(C, D))
{
flint_printf("FAIL: results not equal\n");
abort();
}
fmpz_mat_mul(A, A, B);
if (!fmpz_mat_equal(A, C))
{
flint_printf("FAIL: aliasing failed\n");
abort();
}
fmpz_mat_clear(A);
fmpz_mat_clear(B);
fmpz_mat_clear(C);
fmpz_mat_clear(D);
}
FLINT_TEST_CLEANUP(state);
flint_printf("PASS\n");
return 0;
}
开发者ID:clear731,项目名称:lattice,代码行数:58,代码来源:t-mul.c
示例9: main
int
main(void)
{
int i, result;
FLINT_TEST_INIT(state);
flint_printf("content....");
fflush(stdout);
/* Check that content(a f) = abs(a) content(f) */
for (i = 0; i < 1000 * flint_test_multiplier(); i++)
{
fmpq_poly_t f, g;
fmpq_t a, b, c;
fmpq_poly_init(f);
fmpq_poly_init(g);
fmpq_init(a);
fmpq_init(b);
fmpq_init(c);
fmpq_poly_randtest_not_zero(f, state, n_randint(state, 100) + 1, 100);
fmpq_randtest_not_zero(a, state, 100);
fmpq_poly_scalar_mul_fmpq(g, f, a);
fmpq_poly_content(b, g);
fmpq_poly_content(c, f);
fmpq_mul(c, a, c);
fmpq_abs(c, c);
result = (fmpq_equal(b, c));
if (!result)
{
flint_printf("FAIL:\n");
fmpq_poly_print(f), flint_printf("\n\n");
fmpq_poly_print(g), flint_printf("\n\n");
fmpq_print(a), flint_printf("\n\n");
fmpq_print(b), flint_printf("\n\n");
fmpq_print(c), flint_printf("\n\n");
abort();
}
fmpq_poly_clear(f);
fmpq_poly_clear(g);
fmpq_clear(a);
fmpq_clear(b);
fmpq_clear(c);
}
FLINT_TEST_CLEANUP(state);
flint_printf("PASS\n");
return 0;
}
开发者ID:clear731,项目名称:lattice,代码行数:57,代码来源:t-content.c
示例10: main
int
main(void)
{
int i, result = 1;
FLINT_TEST_INIT(state);
flint_printf("exp_series_monomial_ui....");
fflush(stdout);
for (i = 0; i < 1000 * flint_test_multiplier(); i++)
{
nmod_poly_t A, expA, res;
slong n;
mp_limb_t mod;
ulong power;
mp_limb_t coeff;
mod = n_randtest_prime(state, 0);
n = n_randtest(state) % 100;
n = FLINT_MIN(n, mod);
nmod_poly_init(A, mod);
nmod_poly_init(expA, mod);
nmod_poly_init(res, mod);
coeff = n_randlimb(state) % mod;
power = 1 + n_randint(state, 2*n + 1);
nmod_poly_set_coeff_ui(A, power, coeff);
nmod_poly_exp_series(expA, A, n);
nmod_poly_exp_series_monomial_ui(res, coeff, power, n);
result = nmod_poly_equal(expA, res);
if (!result)
{
flint_printf("FAIL:\n");
flint_printf("n = %wd, mod = %wu\n", n, mod);
flint_printf("power = %wu, coeff = %wu\n", power, coeff);
flint_printf("A: "); nmod_poly_print(A), flint_printf("\n\n");
flint_printf("exp(A): "); nmod_poly_print(expA), flint_printf("\n\n");
flint_printf("res: "); nmod_poly_print(res), flint_printf("\n\n");
abort();
}
nmod_poly_clear(A);
nmod_poly_clear(expA);
nmod_poly_clear(res);
}
FLINT_TEST_CLEANUP(state);
flint_printf("PASS\n");
return 0;
}
开发者ID:clear731,项目名称:lattice,代码行数:57,代码来源:t-exp_series_monomial_ui.c
示例11: main
int
main(void)
{
int i, result = 1;
FLINT_TEST_INIT(state);
flint_printf("interpolate_nmod_vec_fast....");
fflush(stdout);
for (i = 0; i < 1000 * flint_test_multiplier(); i++)
{
nmod_poly_t P, Q;
mp_ptr x, y;
mp_limb_t mod;
slong j, n, npoints;
mod = n_randtest_prime(state, 0);
npoints = n_randint(state, FLINT_MIN(100, mod));
n = n_randint(state, npoints + 1);
nmod_poly_init(P, mod);
nmod_poly_init(Q, mod);
x = _nmod_vec_init(npoints);
y = _nmod_vec_init(npoints);
nmod_poly_randtest(P, state, n);
for (j = 0; j < npoints; j++)
x[j] = j;
nmod_poly_evaluate_nmod_vec_fast(y, P, x, npoints);
nmod_poly_interpolate_nmod_vec_fast(Q, x, y, npoints);
result = nmod_poly_equal(P, Q);
if (!result)
{
flint_printf("FAIL:\n");
flint_printf("mod=%wu, n=%wd, npoints=%wd\n\n", mod, n, npoints);
nmod_poly_print(P), flint_printf("\n\n");
nmod_poly_print(Q), flint_printf("\n\n");
abort();
}
nmod_poly_clear(P);
nmod_poly_clear(Q);
_nmod_vec_clear(x);
_nmod_vec_clear(y);
}
FLINT_TEST_CLEANUP(state);
flint_printf("PASS\n");
return 0;
}
开发者ID:clear731,项目名称:lattice,代码行数:56,代码来源:t-interpolate_nmod_vec_fast.c
示例12: main
int
main(void)
{
int i, result;
FLINT_TEST_INIT(state);
flint_printf("scalar_submul_si_2exp....");
fflush(stdout);
/* Compare with alternative method of computation */
for (i = 0; i < 1000 * flint_test_multiplier(); i++)
{
fmpz *a, *b, *c, *d;
slong len = n_randint(state, 100), x;
mp_bitcnt_t exp;
a = _fmpz_vec_init(len);
b = _fmpz_vec_init(len);
c = _fmpz_vec_init(len);
d = _fmpz_vec_init(len);
_fmpz_vec_randtest(a, state, len, 200);
_fmpz_vec_randtest(b, state, len, 200);
_fmpz_vec_set(c, b, len);
x = z_randtest(state);
exp = n_randint(state, 200);
_fmpz_vec_scalar_submul_si_2exp(b, a, len, x, exp);
_fmpz_vec_scalar_mul_2exp(d, a, len, exp);
_fmpz_vec_scalar_submul_si(c, d, len, x);
result = (_fmpz_vec_equal(b, c, len));
if (!result)
{
flint_printf("FAIL:\n");
flint_printf("x = %wd, exp = %wu\n", x, exp);
_fmpz_vec_print(b, len), flint_printf("\n\n");
_fmpz_vec_print(c, len), flint_printf("\n\n");
abort();
}
_fmpz_vec_clear(a, len);
_fmpz_vec_clear(b, len);
_fmpz_vec_clear(c, len);
_fmpz_vec_clear(d, len);
}
FLINT_TEST_CLEANUP(state);
flint_printf("PASS\n");
return 0;
}
开发者ID:clear731,项目名称:lattice,代码行数:55,代码来源:t-scalar_submul_si_2exp.c
示例13: main
int
main(void)
{
int iter;
FLINT_TEST_INIT(state);
flint_printf("sgn_eval_at_half....");
fflush(stdout);
/* Check aliasing */
for (iter = 0; iter < 1000 * flint_test_multiplier(); iter++)
{
fmpz_t a;
fmpz_poly_t f, g;
long i, d;
int s1, s2;
fmpz_init(a);
fmpz_poly_init(f);
fmpz_poly_init(g);
fmpz_poly_randtest(f, state, n_randint(state, 100), 200);
s1 = fmpz_poly_sgn_eval_at_half(f);
fmpz_poly_set(g, f);
d = fmpz_poly_degree(g);
for (i = 0; i <= d; i++)
{
fmpz_mul_2exp(fmpz_poly_get_coeff_ptr(g, i),
fmpz_poly_get_coeff_ptr(g, i), d - i);
}
fmpz_one(a);
fmpz_poly_evaluate_fmpz(a, g, a);
s2 = fmpz_sgn(a);
if (s1 != s2)
{
flint_printf("FAIL:\n");
fmpz_poly_print(f); printf("\n\n");
printf("s1 = %d, s2 = %d\n\n", s1, s2);
abort();
}
fmpz_clear(a);
fmpz_poly_clear(f);
fmpz_poly_clear(g);
}
FLINT_TEST_CLEANUP(state);
flint_printf("PASS\n");
return 0;
}
开发者ID:elias-tsigaridas,项目名称:slv,代码行数:55,代码来源:t-sgn_eval_at_half.c
示例14: main
int main(void)
{
int i;
FLINT_TEST_INIT(state);
flint_printf("parity....");
fflush(stdout);
/* check inv(inv(a)) == a */
for (i = 0; i < 10000; i++)
{
slong n, *a, *b, *c;
int ap, bp, cp, ap2, bp2, cp2;
n = n_randint(state, 100);
a = _perm_init(n);
b = _perm_init(n);
c = _perm_init(n);
ap = _perm_randtest(a, n, state);
bp = _perm_randtest(b, n, state);
_perm_compose(c, a, b, n);
cp = ap ^ bp;
ap2 = _perm_parity(a, n);
bp2 = _perm_parity(b, n);
cp2 = _perm_parity(c, n);
if (ap != ap2 || bp != bp2 || cp != cp2)
{
flint_printf("FAIL:\n");
flint_printf("a: "); _perm_print(a, n); flint_printf("\n\n");
flint_printf("b: "); _perm_print(b, n); flint_printf("\n\n");
flint_printf("c: "); _perm_print(c, n); flint_printf("\n\n");
flint_printf("ap = %d\n", ap);
flint_printf("bp = %d\n", bp);
flint_printf("cp = %d\n", cp);
flint_printf("ap2 = %d\n", ap2);
flint_printf("bp2 = %d\n", bp2);
flint_printf("cp2 = %d\n", cp2);
abort();
}
_perm_clear(a);
_perm_clear(b);
_perm_clear(c);
}
FLINT_TEST_CLEANUP(state);
flint_printf("PASS\n");
return 0;
}
开发者ID:clear731,项目名称:lattice,代码行数:55,代码来源:t-parity.c
示例15: main
int main(void)
{
fmpz_t p;
fmpz * v;
slong i;
FLINT_TEST_INIT(state);
flint_printf("number_of_partitions....");
fflush(stdout);
fmpz_init(p);
v = _fmpz_vec_init(3000);
arith_number_of_partitions_vec(v, 3000);
for (i = 0; i < 3000; i++)
{
arith_number_of_partitions(p, i);
if (!fmpz_equal(p, v + i))
{
flint_printf("FAIL:\n");
flint_printf("p(%wd) does not agree with power series\n", i);
flint_printf("Computed p(%wd): ", i); fmpz_print(p); flint_printf("\n");
flint_printf("Expected: "); fmpz_print(v + i); flint_printf("\n");
abort();
}
}
_fmpz_vec_clear(v, 3000);
for (i = 0; testdata[i][0] != 0; i++)
{
arith_number_of_partitions(p, testdata[i][0]);
if (fmpz_fdiv_ui(p, 1000000000) != testdata[i][1])
{
flint_printf("FAIL:\n");
flint_printf("p(%wd) does not agree with known value mod 10^9\n",
testdata[i][0]);
flint_printf("Computed: %wu\n", fmpz_fdiv_ui(p, 1000000000));
flint_printf("Expected: %wu\n", testdata[i][1]);
abort();
}
}
fmpz_clear(p);
FLINT_TEST_CLEANUP(state);
flint_printf("PASS\n");
return 0;
}
开发者ID:clear731,项目名称:lattice,代码行数:54,代码来源:t-number_of_partitions.c
示例16: main
int
main(void)
{
int i;
FLINT_TEST_INIT(state);
flint_printf("cfrac_bound....");
fflush(stdout);
for (i = 0; i < 10000; i++)
{
fmpq_t x, r;
fmpz * c;
slong n, bound;
fmpq_init(x);
fmpq_init(r);
/* Test worst case (quotient of Fibonacci numbers) */
if (n_randint(state, 50) == 1)
{
slong v = 1 + n_randint(state, 1000);
fmpz_fib_ui(fmpq_numref(x), v + 1);
fmpz_fib_ui(fmpq_denref(x), v);
}
else
{
fmpq_randtest(x, state, 1 + n_randint(state, 1000));
}
bound = fmpq_cfrac_bound(x);
c = _fmpz_vec_init(bound + 10);
n = fmpq_get_cfrac(c, r, x, bound);
if (n > bound)
{
flint_printf("FAIL: length=%wd > bound=%wd\n", n, bound);
abort();
}
_fmpz_vec_clear(c, bound + 10);
fmpq_clear(x);
fmpq_clear(r);
}
FLINT_TEST_CLEANUP(state);
flint_printf("PASS\n");
return 0;
}
开发者ID:clear731,项目名称:lattice,代码行数:52,代码来源:t-cfrac_bound.c
示例17: main
int main()
{
fmpq_poly_t P, Q;
mpz_t t;
slong k, n;
FLINT_TEST_INIT(state);
flint_printf("bernoulli_polynomial....");
fflush(stdout);
for (n = 0; n <= 100; n++)
{
fmpq_poly_init(P);
fmpq_poly_init(Q);
mpz_init(t);
for (k = 0; k <= n; k++)
{
arith_bernoulli_polynomial(P, k);
flint_mpz_bin_uiui(t, n+1, k);
fmpq_poly_scalar_mul_mpz(P, P, t);
fmpq_poly_add(Q, Q, P);
}
fmpq_poly_scalar_div_ui(Q, Q, n+1);
mpz_clear(t);
fmpq_poly_zero(P);
fmpq_poly_set_coeff_ui(P, n, UWORD(1));
if (!fmpq_poly_equal(P, Q))
{
flint_printf("ERROR: sum up to n = %wd did not add to x^n\n", n);
flint_printf("Sum: ");
fmpq_poly_print_pretty(Q, "x");
flint_printf("\nExpected: ");
fmpq_poly_print_pretty(P, "x");
flint_printf("\n");
abort();
}
fmpq_poly_clear(P);
fmpq_poly_clear(Q);
}
FLINT_TEST_CLEANUP(state);
flint_printf("PASS\n");
return 0;
}
开发者ID:clear731,项目名称:lattice,代码行数:52,代码来源:t-bernoulli_polynomial.c
示例18: main
int
main(void)
{
int i;
FLINT_TEST_INIT(state);
flint_printf("set_si....");
fflush(stdout);
for (i = 0; i < 10000; i++)
{
fmpq_t x, y;
fmpz_t p, q;
slong P, Q;
fmpq_init(x);
fmpq_init(y);
fmpz_init(p);
fmpz_init(q);
P = z_randtest(state);
Q = n_randtest_not_zero(state);
fmpz_set_si(p, P);
fmpz_set_ui(q, Q);
fmpq_set_fmpz_frac(x, p, q);
fmpq_set_si(y, P, Q);
if (!fmpq_is_canonical(y) || !fmpq_equal(x, y))
{
flint_printf("FAIL");
flint_printf("p: "); fmpz_print(p); flint_printf("\n");
flint_printf("q: "); fmpz_print(q); flint_printf("\n");
flint_printf("x: "); fmpq_print(x); flint_printf("\n");
flint_printf("y: "); fmpq_print(y); flint_printf("\n");
abort();
}
fmpq_clear(x);
fmpq_clear(y);
fmpz_clear(p);
fmpz_clear(q);
}
FLINT_TEST_CLEANUP(state);
flint_printf("PASS\n");
return 0;
}
开发者ID:clear731,项目名称:lattice,代码行数:52,代码来源:t-set_si.c
示例19: main
int
main(void)
{
int i, result;
FLINT_TEST_INIT(state);
flint_printf("content....");
fflush(stdout);
/* Check that content(a f) = abs(a) content(f) */
for (i = 0; i < 1000 * flint_test_multiplier(); i++)
{
fmpz_t a, c, d;
fmpz *f;
slong len = n_randint(state, 100);
fmpz_init(a);
fmpz_init(c);
fmpz_init(d);
f = _fmpz_vec_init(len);
_fmpz_vec_randtest(f, state, len, 200);
fmpz_randtest(a, state, 100);
_fmpz_vec_content(c, f, len);
_fmpz_vec_scalar_mul_fmpz(f, f, len, a);
fmpz_abs(a, a);
fmpz_mul(c, a, c);
_fmpz_vec_content(d, f, len);
result = (fmpz_equal(c, d));
if (!result)
{
flint_printf("FAIL:\n");
fmpz_print(c), flint_printf("\n\n");
fmpz_print(d), flint_printf("\n\n");
abort();
}
fmpz_clear(a);
fmpz_clear(c);
fmpz_clear(d);
_fmpz_vec_clear(f, len);
}
FLINT_TEST_CLEANUP(state);
flint_printf("PASS\n");
return 0;
}
开发者ID:clear731,项目名称:lattice,代码行数:51,代码来源:t-content.c
示例20: main
int
main(void)
{
int i, result;
FLINT_TEST_INIT(state);
flint_printf("swap....");
fflush(stdout);
for (i = 0; i < 10000; i++)
{
fmpz_t p;
fmpz_mod_poly_t a, b, c;
fmpz_init(p);
fmpz_randtest_unsigned(p, state, 2 * FLINT_BITS);
fmpz_add_ui(p, p, 2);
fmpz_mod_poly_init(a, p);
fmpz_mod_poly_init(b, p);
fmpz_mod_poly_init(c, p);
fmpz_mod_poly_randtest(a, state, n_randint(state, 100));
fmpz_mod_poly_randtest(b, state, n_randint(state, 100));
fmpz_mod_poly_set(c, b);
fmpz_mod_poly_swap(a, b);
result = (fmpz_mod_poly_equal(a, c));
if (!result)
{
flint_printf("FAIL:\n");
fmpz_mod_poly_print(a), flint_printf("\n\n");
fmpz_mod_poly_print(b), flint_printf("\n\n");
fmpz_mod_poly_print(c), flint_printf("\n\n");
abort();
}
fmpz_mod_poly_clear(a);
fmpz_mod_poly_clear(b);
fmpz_mod_poly_clear(c);
fmpz_clear(p);
}
FLINT_TEST_CLEANUP(state);
flint_printf("PASS\n");
return 0;
}
开发者ID:clear731,项目名称:lattice,代码行数:50,代码来源:t-swap.c
注:本文中的FLINT_TEST_CLEANUP函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论