Implementing p-adic numbers in Macaulay2 using its foreign function interface and FLINT
arXiv:2604.16799
The paper presents a Macaulay2 package that implements p-adic numbers by interfacing with the FLINT library through Macaulay2's ForeignFunctions package, and discusses related implementation details such as memory management and design choices.
Abstract
Macaulay2 is a computer algebra platform widely used by researchers in algebraic geometry and commutative algebra. Using the ForeignFunctions package, it is possible to make calls from Macaulay2 to dynamic libraries such as FLINT. We demonstrate this by introducing a new Macaulay2 package implementing p-adic numbers using FLINT via this interface. We discuss implementation details such as memory allocation, interaction with Macaulay2's garbage collector, and object-oriented design decisions that mirror the existing implementations of the real and complex number fields in Macaulay2.
8 pages