gmpy2_mpz_misc.h
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 * gmpy2_mpz_misc.h * 3 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 4 * Python interface to the GMP or MPIR, MPFR, and MPC multiple precision * 5 * libraries. * 6 * * 7 * Copyright 2000 - 2009 Alex Martelli * 8 * * 9 * Copyright 2008 - 2021 Case Van Horsen * 10 * * 11 * This file is part of GMPY2. * 12 * * 13 * GMPY2 is free software: you can redistribute it and/or modify it under * 14 * the terms of the GNU Lesser General Public License as published by the * 15 * Free Software Foundation, either version 3 of the License, or (at your * 16 * option) any later version. * 17 * * 18 * GMPY2 is distributed in the hope that it will be useful, but WITHOUT * 19 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * 20 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * 21 * License for more details. * 22 * * 23 * You should have received a copy of the GNU Lesser General Public * 24 * License along with GMPY2; if not, see <http://www.gnu.org/licenses/> * 25 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 26 27 #ifndef GMPY_MPZ_MISC_H 28 #define GMPY_MPZ_MISC_H 29 30 #ifdef __cplusplus 31 extern "C" { 32 #endif 33 34 35 static int GMPy_MPZ_NonZero_Slot(MPZ_Object *self); 36 37 static PyObject * GMPy_MPZ_Attrib_GetNumer(MPZ_Object *self, void *closure); 38 static PyObject * GMPy_MPZ_Attrib_GetDenom(MPZ_Object *self, void *closure); 39 static PyObject * GMPy_MPZ_Attrib_GetReal(MPZ_Object *self, void *closure); 40 static PyObject * GMPy_MPZ_Attrib_GetImag(MPZ_Object *self, void *closure); 41 42 static PyObject * GMPy_MPZ_Method_Ceil(PyObject *self, PyObject *other); 43 static PyObject * GMPy_MPZ_Method_Floor(PyObject *self, PyObject *other); 44 static PyObject * GMPy_MPZ_Method_Trunc(PyObject *self, PyObject *other); 45 static PyObject * GMPy_MPZ_Method_Round(PyObject *self, PyObject *other); 46 static PyObject * GMPy_MPZ_Method_NumDigits(PyObject *self, PyObject *args); 47 static Py_ssize_t GMPy_MPZ_Method_Length(MPZ_Object *self); 48 static PyObject * GMPy_MPZ_Method_SubScript(MPZ_Object *self, PyObject *item); 49 static PyObject * GMPy_MPZ_Method_IsSquare(PyObject *self, PyObject *other); 50 static PyObject * GMPy_MPZ_Method_IsDivisible(PyObject *self, PyObject *other); 51 static PyObject * GMPy_MPZ_Method_IsCongruent(PyObject *self, PyObject *args); 52 static PyObject * GMPy_MPZ_Method_IsPower(PyObject *self, PyObject *other); 53 static PyObject * GMPy_MPZ_Method_IsPrime(PyObject *self, PyObject *args); 54 static PyObject * GMPy_MPZ_Method_IsEven(PyObject *self, PyObject *other); 55 static PyObject * GMPy_MPZ_Method_IsOdd(PyObject *self, PyObject *other); 56 static PyObject * GMPy_MP_Method_Conjugate(PyObject *self, PyObject *args); 57 58 static PyObject * GMPy_MPZ_Function_NumDigits(PyObject *self, PyObject *args); 59 static PyObject * GMPy_MPZ_Function_Iroot(PyObject *self, PyObject *args); 60 static PyObject * GMPy_MPZ_Function_IrootRem(PyObject *self, PyObject *args); 61 static PyObject * GMPy_MPZ_Function_Bincoef(PyObject *self, PyObject *args); 62 static PyObject * GMPy_MPZ_Function_GCD(PyObject *self, PyObject *args); 63 static PyObject * GMPy_MPZ_Function_LCM(PyObject *self, PyObject *args); 64 static PyObject * GMPy_MPZ_Function_GCDext(PyObject *self, PyObject *args); 65 static PyObject * GMPy_MPZ_Function_Divm(PyObject *self, PyObject *args); 66 static PyObject * GMPy_MPZ_Function_Fac(PyObject *self, PyObject *other); 67 static PyObject * GMPy_MPZ_Function_Primorial(PyObject *self, PyObject *other); 68 static PyObject * GMPy_MPZ_Function_DoubleFac(PyObject *self, PyObject *other); 69 static PyObject * GMPy_MPZ_Function_MultiFac(PyObject *self, PyObject *args); 70 static PyObject * GMPy_MPZ_Function_Fib(PyObject *self, PyObject *other); 71 static PyObject * GMPy_MPZ_Function_Fib2(PyObject *self, PyObject *other); 72 static PyObject * GMPy_MPZ_Function_Lucas(PyObject *self, PyObject *other); 73 static PyObject * GMPy_MPZ_Function_Lucas2(PyObject *self, PyObject *other); 74 static PyObject * GMPy_MPZ_Function_Isqrt(PyObject *self, PyObject *other); 75 static PyObject * GMPy_MPZ_Function_IsqrtRem(PyObject *self, PyObject *other); 76 static PyObject * GMPy_MPZ_Function_Remove(PyObject *self, PyObject *args); 77 static PyObject * GMPy_MPZ_Function_Invert(PyObject *self, PyObject *args); 78 static PyObject * GMPy_MPZ_Function_Divexact(PyObject *self, PyObject *args); 79 static PyObject * GMPy_MPZ_Function_IsSquare(PyObject *self, PyObject *other); 80 static PyObject * GMPy_MPZ_Function_IsDivisible(PyObject *self, PyObject *args); 81 static PyObject * GMPy_MPZ_Function_IsCongruent(PyObject *self, PyObject *args); 82 static PyObject * GMPy_MPZ_Function_IsPower(PyObject *self, PyObject *other); 83 static PyObject * GMPy_MPZ_Function_IsPrime(PyObject *self, PyObject *args); 84 static PyObject * GMPy_MPZ_Function_NextPrime(PyObject *self, PyObject *other); 85 static PyObject * GMPy_MPZ_Function_Jacobi(PyObject *self, PyObject *args); 86 static PyObject * GMPy_MPZ_Function_Legendre(PyObject *self, PyObject *args); 87 static PyObject * GMPy_MPZ_Function_Kronecker(PyObject *self, PyObject *args); 88 static PyObject * GMPy_MPZ_Function_IsEven(PyObject *self, PyObject *other); 89 static PyObject * GMPy_MPZ_Function_IsOdd(PyObject *self, PyObject *other); 90 91 92 #if PY_MAJOR_VERSION < 3 93 static PyObject * GMPy_MPZ_Oct_Slot(MPZ_Object *self); 94 static PyObject * GMPy_MPZ_Hex_Slot(MPZ_Object *self); 95 #endif 96 97 #ifdef __cplusplus 98 } 99 #endif 100 #endif