Skip to content

Fix param names manual#2601

Merged
fredrik-johansson merged 3 commits intoflintlib:mainfrom
edgarcosta:fix-param-names-manual
Mar 11, 2026
Merged

Fix param names manual#2601
fredrik-johansson merged 3 commits intoflintlib:mainfrom
edgarcosta:fix-param-names-manual

Conversation

@edgarcosta
Copy link
Member

@edgarcosta edgarcosta commented Mar 10, 2026

This is part of the effort started in #1895 to make parameter names consistent across headers, docs, and sources. I have since built a proper tool (dev/check_param_names.py, coming in a separate PR) that can automatically detect and fix ~2500 name mismatches. However, the cases below involve parameter count mismatches or type errors that the tool cannot auto-fix, so they need manual attention first.

This PR supersedes #1895.

Commit 1: Fix parameter count mismatches in docs and headers

These are cases where the doc signature had a different number of parameters than the actual code, or had the wrong type.

  • gr_mpoly_write_pretty / gr_mpoly_print_pretty (doc/source/gr_mpoly.rst): The docs listed a const char ** x parameter that doesn't exist in the header or source. The functions were changed to not take variable name strings, but the docs were never updated. Removed the stale parameter and description.

  • _gr_poly_get_str (doc/source/gr_poly.rst): The doc signature used const gr_poly_t f (a polynomial struct), but this is an underscore-prefixed internal function that takes raw arrays. Fixed to gr_srcptr f, slong len to match the actual header/source signature.

  • _nmod_poly_evaluate_geometric_nmod_vec_fast_precomp (doc/source/nmod_poly.rst): The doc signature was missing the final nmod_t mod parameter that exists in both the header and source.

  • fprint_memory_usage (src/profiler.h): The header declaration void fprint_memory_usage(FILE *) omitted the parameter name. Added fs to match the source definition.

  • qsieve_parse_relation (doc/source/qsieve.rst): The doc signature listed char * str as a parameter, but the function only takes qs_t qs_inf in both the header and source. The string is read internally, not passed as an argument. Removed the stale parameter.

Commit 2: Add missing parameter names in header declarations

These are header declarations where some or all parameter names were omitted. The names added match the source definitions exactly.

  • _fmpz_clear_readonly_mpz (src/fmpz.h): (mpz_t) -> (mpz_t z)
  • fq_nmod_ctx_init, _fq_nmod_ctx_init_conway, fq_nmod_ctx_init_conway (src/fq_nmod.h): all three had (fq_nmod_ctx_t, fmpz_t, slong, const char *) with no names; added ctx, p, d, var
  • fq_zech_ctx_init, _fq_zech_ctx_init_conway, fq_zech_ctx_init_conway, fq_zech_ctx_init_random (src/fq_zech.h): same pattern, added ctx, p, d, var
  • fq_zech_ctx_order (src/fq_zech.h): (fmpz_t, const fq_zech_ctx_t) -> (fmpz_t f, const fq_zech_ctx_t ctx)
  • flint_mpn_mul_toom22, flint_mpn_mul_toom32 (src/mpn_extras.h): all 6 parameters unnamed; added pp, ap, an, bp, bn, scratch
  • _flint_mpn_sqrhigh (src/mpn_extras.h): (mp_ptr, mp_srcptr, mp_size_t) -> (mp_ptr res, mp_srcptr u, mp_size_t n)
  • nmod_mat_randrank (src/nmod_mat.h): first parameter nmod_mat_t had no name while the rest did; added mat
  • acb_dft_convol_rad2_precomp (src/acb_dft.h): const acb_dft_rad2_t had no name while all other parameters did; added rad2
  • fmpq_mpoly_reduce_easy (src/fmpq_mpoly.h): const fmpq_mpoly_ctx_t had no name; added ctx

Commit 3

Commit 3 updates doc descriptions that became stale after the signature fixes:

  • Clarified gr_mpoly_write_pretty/print_pretty description to note that variable names come from the context.
  • Rewrote qsieve_parse_relation description to reflect that the function reads from the file associated with qs_inf, not from a string parameter.

Manual fixes for 5 functions where the doc signature had wrong
parameter counts compared to header+source:

- gr_mpoly_write_pretty/print_pretty: remove stale x parameter
- _gr_poly_get_str: add missing len parameter, fix type to gr_srcptr
- _nmod_poly_evaluate_geometric_nmod_vec_fast_precomp: add missing mod
- fprint_memory_usage: add missing param name fs in header
- qsieve_parse_relation: remove stale str parameter
Several function declarations in headers omitted parameter names,
making it harder to understand function signatures at a glance and
causing mismatches with their source definitions.

Headers fixed: fmpz.h, fq_nmod.h, fq_zech.h, mpn_extras.h,
nmod_mat.h, acb_dft.h, fmpq_mpoly.h
@edgarcosta edgarcosta marked this pull request as ready for review March 11, 2026 00:13
@edgarcosta edgarcosta mentioned this pull request Mar 11, 2026
1 task
@fredrik-johansson fredrik-johansson merged commit 95a02b7 into flintlib:main Mar 11, 2026
21 of 22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants