Skip to content

Commit

Permalink
Merge pull request #1742 from albinahlback/more_pretty_tests
Browse files Browse the repository at this point in the history
Remove unused functions and do more pretty tests
  • Loading branch information
albinahlback authored Jan 24, 2024
2 parents 0f04336 + 9595344 commit f9fcca0
Show file tree
Hide file tree
Showing 65 changed files with 444 additions and 1,556 deletions.
24 changes: 0 additions & 24 deletions doc/source/aprcl.rst
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,6 @@ Comparison
Returns nonzero if `f = g` reduced by the `p^{exp}`-th cyclotomic
polynomial.

Output
................................................................................

.. function:: void unity_zp_print(const unity_zp f)

Prints the contents of the `f`.

Coefficient management
................................................................................

Expand Down Expand Up @@ -209,11 +202,6 @@ Coefficient management
Scalar multiplication
................................................................................

.. function:: void unity_zp_mul_scalar_fmpz(unity_zp f, const unity_zp g, const fmpz_t s)

Sets `f` to `s \cdot g`. `f` and `g` must be initialized with
same `p`, `exp` and `n`.

.. function:: void unity_zp_mul_scalar_ui(unity_zp f, const unity_zp g, ulong s)

Sets `f` to `s \cdot g`. `f` and `g` must be initialized with
Expand Down Expand Up @@ -362,18 +350,6 @@ Extended rings

Returns nonzero if `f = g`.

.. function:: slong unity_zpq_p_unity(const unity_zpq f)

If `f = \zeta_p^x` returns `x \in [0, p - 1]`; otherwise returns `p`.

.. function:: int unity_zpq_is_p_unity(const unity_zpq f)

Returns nonzero if `f = \zeta_p^x`.

.. function:: int unity_zpq_is_p_unity_generator(const unity_zpq f)

Returns nonzero if `f` is a generator of the cyclic group `\langle\zeta_p\rangle`.

.. function:: void unity_zpq_coeff_set_fmpz(unity_zpq f, slong i, slong j, const fmpz_t x)

Sets the coefficient of `\zeta_q^i \zeta_p^j` to `x`.
Expand Down
36 changes: 0 additions & 36 deletions doc/source/d_mat.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,6 @@ Basic assignment and manipulation

Sets all entries of ``mat`` to 0.

.. function:: void d_mat_one(d_mat_t mat)

Sets ``mat`` to the unit matrix, having ones on the main diagonal
and zeroes elsewhere. If ``mat`` is nonsquare, it is set to the
truncation of a unit matrix.


Random matrix generation
--------------------------------------------------------------------------------
Expand Down Expand Up @@ -93,12 +87,6 @@ Comparison
the same dimensions and entries within ``eps`` of each other,
and zero otherwise.

.. function:: int d_mat_is_empty(const d_mat_t mat)

Returns a non-zero value if the number of rows or the number of
columns in ``mat`` is zero, and otherwise returns
zero.

.. function:: int d_mat_is_square(const d_mat_t mat)

Returns a non-zero value if the number of rows is equal to the
Expand All @@ -124,27 +112,3 @@ Matrix multiplication
Sets ``C`` to the matrix product `C = A B`. The matrices must have
compatible dimensions for matrix multiplication (an exception is raised
otherwise). Aliasing is allowed.


Gram-Schmidt Orthogonalisation and QR Decomposition
--------------------------------------------------------------------------------


.. function:: void d_mat_gso(d_mat_t B, const d_mat_t A)

Takes a subset of `R^m` `S = {a_1, a_2, \ldots, a_n}` (as the columns of
a `m \times n` matrix ``A``) and generates an orthonormal set
`S' = {b_1, b_2, \ldots, b_n}` (as the columns of the `m \times n` matrix
``B``) that spans the same subspace of `R^m` as `S`.

This uses an algorithm of Schwarz-Rutishauser. See pp. 9 of
https://people.inf.ethz.ch/gander/papers/qrneu.pdf

.. function:: void d_mat_qr(d_mat_t Q, d_mat_t R, const d_mat_t A)

Computes the `QR` decomposition of a matrix ``A`` using the Gram-Schmidt
process. (Sets ``Q`` and ``R`` such that `A = QR` where ``R`` is
an upper triangular matrix and ``Q`` is an orthogonal matrix.)

This uses an algorithm of Schwarz-Rutishauser. See pp. 9 of
https://people.inf.ethz.ch/gander/papers/qrneu.pdf
10 changes: 0 additions & 10 deletions src/acb_dirichlet.h
Original file line number Diff line number Diff line change
Expand Up @@ -310,16 +310,6 @@ slong acb_dirichlet_platt_hardy_z_zeros(
void acb_dirichlet_dft_index(acb_ptr w, acb_srcptr v, const dirichlet_group_t G, slong prec);
void acb_dirichlet_dft(acb_ptr w, acb_srcptr v, const dirichlet_group_t G, slong prec);

/* utils */

FLINT_FORCE_INLINE void
acb_vec_printd(acb_srcptr vec, slong len, slong digits)
{
slong i;
for (i = 0; i < len; i++)
acb_printd(vec + i, digits), flint_printf("\n");
}

#ifdef __cplusplus
}
#endif
Expand Down
4 changes: 2 additions & 2 deletions src/acb_dirichlet/test/t-dft.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ check_vec_eq_prec(acb_srcptr w1, acb_srcptr w2, slong len, slong prec, slong dig
flint_printf("q = %wu, size = %wd\n", q, len);
flint_printf("\nDFT differ from index %wd / %wd \n", i, len);
flint_printf("\n%s =\n", f1);
acb_vec_printd(w1, len, digits);
_acb_vec_printd(w1, len, digits);
flint_printf("\n%s =\n", f2);
acb_vec_printd(w2, len, digits);
_acb_vec_printd(w2, len, digits);
flint_printf("\n\n");
flint_abort();
}
Expand Down
2 changes: 1 addition & 1 deletion src/acb_dirichlet/test/t-l_vec_hurwitz.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ TEST_FUNCTION_START(acb_dirichlet_l_vec_hurwitz, state)
flint_printf("\nL(1/2, %wu) multi = ", chi->n);
acb_printd(v + i, 20);
flint_printf("\n\n");
acb_vec_printd(v, G->phi_q, 10);
_acb_vec_printd(v, G->phi_q, 10);
flint_printf("\n\n");
flint_abort();
}
Expand Down
17 changes: 1 addition & 16 deletions src/aprcl.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,7 @@ slong _aprcl_is_prime_jacobi_check_2k(const unity_zp j, const unity_zp j2_1, con

int _aprcl_is_prime_jacobi_additional_test(const fmpz_t n, ulong p);

/* Final division functions */
int aprcl_is_prime_divisors_in_residue(const fmpz_t n, const fmpz_t s, ulong r);

/* Final division function */
int aprcl_is_prime_final_division(const fmpz_t n, const fmpz_t s, ulong r);

/* Z[unity_root]/(n) operations **********************************************/
Expand All @@ -131,9 +129,6 @@ slong unity_zp_is_unity(unity_zp f);

int unity_zp_equal(unity_zp f, unity_zp g);

/* I/O */
void unity_zp_print(const unity_zp f);

/* Coefficient management */
void unity_zp_coeff_set_fmpz(unity_zp f, ulong ind, const fmpz_t x);
void unity_zp_coeff_set_ui(unity_zp f, ulong ind, ulong x);
Expand All @@ -145,7 +140,6 @@ void unity_zp_coeff_inc(unity_zp f, ulong ind);
void unity_zp_coeff_dec(unity_zp f, ulong ind);

/* Scalar multiplication */
void unity_zp_mul_scalar_fmpz(unity_zp f, const unity_zp g, const fmpz_t s);
void unity_zp_mul_scalar_ui(unity_zp f, const unity_zp g, ulong s);

/* Addition */
Expand Down Expand Up @@ -228,22 +222,13 @@ void unity_zpq_swap(unity_zpq f, unity_zpq g);
/* Comparison */
int unity_zpq_equal(const unity_zpq f, const unity_zpq g);

slong unity_zpq_p_unity(const unity_zpq f);

int unity_zpq_is_p_unity(const unity_zpq f);

int unity_zpq_is_p_unity_generator(const unity_zpq f);

/* Coefficient management */
void unity_zpq_coeff_set_fmpz(unity_zpq f, slong i, slong j, const fmpz_t x);
void unity_zpq_coeff_set_ui(unity_zpq f, slong i, slong j, ulong x);

void unity_zpq_coeff_add(unity_zpq f, slong i, slong j, const fmpz_t x);
void unity_zpq_coeff_add_ui(unity_zpq f, slong i, slong j, ulong x);

/* Scalar multiplication */
void unity_zpq_scalar_mul_ui(unity_zpq f, const unity_zpq g, ulong s);

/* Addition and multiplication */
void unity_zpq_add(unity_zpq f, const unity_zpq g, const unity_zpq h);

Expand Down
46 changes: 0 additions & 46 deletions src/aprcl/is_prime_divisors_in_residue.c

This file was deleted.

9 changes: 0 additions & 9 deletions src/aprcl/unity_zp_mul.c
Original file line number Diff line number Diff line change
Expand Up @@ -872,15 +872,6 @@ unity_zp_mul7(unity_zp f, const unity_zp g, const unity_zp h, fmpz_t * t)
unity_zp_coeff_set_fmpz(f, 5, t[0]); /* z5 = a0 mod n */
}

void
unity_zp_mul_scalar_fmpz(unity_zp f, const unity_zp g, const fmpz_t s)
{
FLINT_ASSERT(fmpz_equal(fmpz_mod_ctx_modulus(f->ctx),
fmpz_mod_ctx_modulus(g->ctx)));

fmpz_mod_poly_scalar_mul_fmpz(f->poly, g->poly, s, f->ctx);
}

void
unity_zp_mul_scalar_ui(unity_zp f, const unity_zp g, ulong s)
{
Expand Down
21 changes: 0 additions & 21 deletions src/aprcl/unity_zp_print.c

This file was deleted.

55 changes: 0 additions & 55 deletions src/aprcl/unity_zpq_is_p_unity.c

This file was deleted.

42 changes: 0 additions & 42 deletions src/aprcl/unity_zpq_scalar.c

This file was deleted.

Loading

0 comments on commit f9fcca0

Please sign in to comment.