flintlib / flint

FLINT (Fast Library for Number Theory)
http://www.flintlib.org
GNU Lesser General Public License v3.0
401 stars 235 forks source link

Global field accessor macros for matrices and polynomials #1985

Open albinahlback opened 1 month ago

albinahlback commented 1 month ago

If all matrix and polynomials of different types are on the same form, why not set global macros such as

#define flint_mat_entry(mat,i,j) ((mat)->rows[i] + (j))
#define flint_mat_nrows(mat) ((mat)->r)
#define flint_mat_ncols(mat) ((mat)->c)

#define flint_poly_coeffs(poly) ((poly)->coeffs)
#define flint_poly_length(poly) ((poly)->length)
#define flint_poly_alloc(poly) ((poly)->alloc)
#define flint_poly_degree(poly) ((poly)->length - 1)

Feels like it should yield very consistent internals.