Flint2 0.1.0.1 → 0.1.0.2
raw patch · 101 files changed
+12332/−5086 lines, 101 filesdep +containersdep ~QuickCheckdep ~groupsPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependencies added: containers
Dependency ranges changed: QuickCheck, groups
API changes (from Hackage documentation)
- Data.Number.Flint.Arb: ArbStrOption :: CULong -> ArbStrOption
- Data.Number.Flint.Arb: [_ArbStrOption] :: ArbStrOption -> CULong
- Data.Number.Flint.Arb: newtype ArbStrOption
- Data.Number.Flint.Arb.Types: ArbStrOption :: CULong -> ArbStrOption
- Data.Number.Flint.Arb.Types: [_ArbStrOption] :: ArbStrOption -> CULong
- Data.Number.Flint.Arb.Types: newtype ArbStrOption
- Data.Number.Flint.Fmpz.Poly: fmpz_poly_get_coeff_ptr :: Ptr CFmpzPoly -> CLong -> IO (Ptr CFmpz)
- Data.Number.Flint.Fmpz.Poly: fmpz_poly_is_zero :: Ptr CFmpzPoly -> IO CInt
- Data.Number.Flint.Fmpz.Poly: fmpz_poly_lead :: Ptr CFmpzPoly -> IO (Ptr CFmpz)
+ Data.Number.Flint.Acb: acb_imagref :: Ptr CAcb -> Ptr CArb
+ Data.Number.Flint.Acb: acb_realref :: Ptr CAcb -> Ptr CArb
+ Data.Number.Flint.Acb.Calc: AcbCalcIntegrateOpt :: {-# UNPACK #-} !ForeignPtr CAcbCalcIntegrateOpt -> AcbCalcIntegrateOpt
+ Data.Number.Flint.Acb.Calc: CAcbCalcIntegrateOpt :: CLong -> CLong -> CLong -> CInt -> CInt -> CAcbCalcIntegrateOpt
+ Data.Number.Flint.Acb.Calc: newAcbCalcIntegrateOpt_ :: CLong -> CLong -> CLong -> CInt -> CInt -> IO AcbCalcIntegrateOpt
+ Data.Number.Flint.Acb.Calc: withNewAcbCalcIntegrateOpt :: (Ptr CAcbCalcIntegrateOpt -> IO a) -> IO (AcbCalcIntegrateOpt, a)
+ Data.Number.Flint.Acb.Calc: withNewAcbCalcIntegrateOpt_ :: CLong -> CLong -> CLong -> CInt -> CInt -> (Ptr CAcbCalcIntegrateOpt -> IO a) -> IO (AcbCalcIntegrateOpt, a)
+ Data.Number.Flint.Acb.Instances: instance GHC.Show.Show Data.Number.Flint.Acb.Types.FFI.Acb
+ Data.Number.Flint.Acb.Mat.Instances: instance GHC.Show.Show Data.Number.Flint.Acb.Mat.FFI.AcbMat
+ Data.Number.Flint.Acb.Modular.Instances: instance Data.Group.Group Data.Number.Flint.Acb.Modular.FFI.PSL2Z
+ Data.Number.Flint.Acb.Modular.Instances: instance GHC.Base.Monoid Data.Number.Flint.Acb.Modular.FFI.PSL2Z
+ Data.Number.Flint.Acb.Modular.Instances: instance GHC.Base.Semigroup Data.Number.Flint.Acb.Modular.FFI.PSL2Z
+ Data.Number.Flint.Acb.Modular.Instances: instance GHC.Classes.Eq Data.Number.Flint.Acb.Modular.FFI.PSL2Z
+ Data.Number.Flint.Acb.Modular.Instances: instance GHC.Show.Show Data.Number.Flint.Acb.Modular.FFI.PSL2Z
+ Data.Number.Flint.Acb.Modular.Instances: instance GHC.Show.Show Data.Number.Flint.Acb.Modular.FFI.PSL2ZWord
+ Data.Number.Flint.Acb.Poly.Instances: AcbPoly :: {-# UNPACK #-} !ForeignPtr CAcbPoly -> AcbPoly
+ Data.Number.Flint.Acb.Poly.Instances: data AcbPoly
+ Data.Number.Flint.Acb.Poly.Instances: instance GHC.Exts.IsList Data.Number.Flint.Acb.Poly.FFI.AcbPoly
+ Data.Number.Flint.Acb.Poly.Instances: instance GHC.Show.Show Data.Number.Flint.Acb.Poly.FFI.AcbPoly
+ Data.Number.Flint.Arb: arb_radref :: Ptr CArb -> Ptr CMag
+ Data.Number.Flint.Arb: type ArbStrOption = CULong
+ Data.Number.Flint.Arb.Calc: arb_calc_imprecise_input :: ArbCalcReturn
+ Data.Number.Flint.Arb.Calc: arb_calc_no_convergence :: ArbCalcReturn
+ Data.Number.Flint.Arb.Calc: arb_calc_success :: ArbCalcReturn
+ Data.Number.Flint.Arb.Calc: withNewArfInterval :: (Ptr CArfInterval -> IO a) -> IO (ArfInterval, a)
+ Data.Number.Flint.Arb.Fmpz.Poly: arb_fmpz_poly_roots_verbose :: ArbFmpzPolyFlags
+ Data.Number.Flint.Arb.Instances: Arb :: {-# UNPACK #-} !ForeignPtr CArb -> Arb
+ Data.Number.Flint.Arb.Instances: data Arb
+ Data.Number.Flint.Arb.Instances: instance GHC.Show.Show Data.Number.Flint.Arb.Types.FFI.Arb
+ Data.Number.Flint.Arb.Mag: mag_get_str :: Ptr CMag -> IO CString
+ Data.Number.Flint.Arb.Mag.Instances: Mag :: {-# UNPACK #-} !ForeignPtr CMag -> Mag
+ Data.Number.Flint.Arb.Mag.Instances: data Mag
+ Data.Number.Flint.Arb.Mag.Instances: instance GHC.Classes.Eq Data.Number.Flint.Arb.Types.FFI.Mag
+ Data.Number.Flint.Arb.Mag.Instances: instance GHC.Classes.Ord Data.Number.Flint.Arb.Types.FFI.Mag
+ Data.Number.Flint.Arb.Mag.Instances: instance GHC.Num.Num Data.Number.Flint.Arb.Types.FFI.Mag
+ Data.Number.Flint.Arb.Mag.Instances: instance GHC.Real.Fractional Data.Number.Flint.Arb.Types.FFI.Mag
+ Data.Number.Flint.Arb.Mag.Instances: instance GHC.Show.Show Data.Number.Flint.Arb.Types.FFI.Mag
+ Data.Number.Flint.Arb.Mat.Instances: instance GHC.Show.Show Data.Number.Flint.Arb.Mat.FFI.ArbMat
+ Data.Number.Flint.Arb.Poly: _arb_poly_zeta_series :: Ptr CArb -> Ptr CArb -> CLong -> Ptr CArb -> CInt -> CLong -> CLong -> IO ()
+ Data.Number.Flint.Arb.Poly.Instances: ArbPoly :: {-# UNPACK #-} !ForeignPtr CArbPoly -> ArbPoly
+ Data.Number.Flint.Arb.Poly.Instances: data ArbPoly
+ Data.Number.Flint.Arb.Poly.Instances: instance GHC.Exts.IsList Data.Number.Flint.Arb.Types.FFI.ArbPoly
+ Data.Number.Flint.Arb.Poly.Instances: instance GHC.Show.Show Data.Number.Flint.Arb.Types.FFI.ArbPoly
+ Data.Number.Flint.Arb.Types: type ArbStrOption = CULong
+ Data.Number.Flint.Bernoulli: _bernoulli_fmpq_ui_multi_mod :: Ptr CFmpz -> Ptr CFmpz -> CULong -> CDouble -> IO ()
+ Data.Number.Flint.Bernoulli: bernoulli_fmpq_ui :: Ptr CFmpq -> CULong -> IO ()
+ Data.Number.Flint.Calcium: CCalciumFunctionCode :: CULong -> CCalciumFunctionCode
+ Data.Number.Flint.Calcium: CCalciumStream :: Ptr CFile -> CString -> CLong -> CLong -> CCalciumStream
+ Data.Number.Flint.Calcium: CTruth :: CULong -> CTruth
+ Data.Number.Flint.Calcium: CalciumStream :: {-# UNPACK #-} !ForeignPtr CCalciumStream -> CalciumStream
+ Data.Number.Flint.Calcium: [_CCalciumFunctionCode] :: CCalciumFunctionCode -> CULong
+ Data.Number.Flint.Calcium: [_CTruth] :: CTruth -> CULong
+ Data.Number.Flint.Calcium: ca_Abs :: CCalciumFunctionCode
+ Data.Number.Flint.Calcium: ca_Acos :: CCalciumFunctionCode
+ Data.Number.Flint.Calcium: ca_Acosh :: CCalciumFunctionCode
+ Data.Number.Flint.Calcium: ca_Acot :: CCalciumFunctionCode
+ Data.Number.Flint.Calcium: ca_Acoth :: CCalciumFunctionCode
+ Data.Number.Flint.Calcium: ca_Add :: CCalciumFunctionCode
+ Data.Number.Flint.Calcium: ca_Arg :: CCalciumFunctionCode
+ Data.Number.Flint.Calcium: ca_Asin :: CCalciumFunctionCode
+ Data.Number.Flint.Calcium: ca_Asinh :: CCalciumFunctionCode
+ Data.Number.Flint.Calcium: ca_Atan :: CCalciumFunctionCode
+ Data.Number.Flint.Calcium: ca_Atanh :: CCalciumFunctionCode
+ Data.Number.Flint.Calcium: ca_Cbrt :: CCalciumFunctionCode
+ Data.Number.Flint.Calcium: ca_Ceil :: CCalciumFunctionCode
+ Data.Number.Flint.Calcium: ca_Conjugate :: CCalciumFunctionCode
+ Data.Number.Flint.Calcium: ca_Cos :: CCalciumFunctionCode
+ Data.Number.Flint.Calcium: ca_Cosh :: CCalciumFunctionCode
+ Data.Number.Flint.Calcium: ca_Cot :: CCalciumFunctionCode
+ Data.Number.Flint.Calcium: ca_Coth :: CCalciumFunctionCode
+ Data.Number.Flint.Calcium: ca_Div :: CCalciumFunctionCode
+ Data.Number.Flint.Calcium: ca_Erf :: CCalciumFunctionCode
+ Data.Number.Flint.Calcium: ca_Erfc :: CCalciumFunctionCode
+ Data.Number.Flint.Calcium: ca_Erfi :: CCalciumFunctionCode
+ Data.Number.Flint.Calcium: ca_Euler :: CCalciumFunctionCode
+ Data.Number.Flint.Calcium: ca_Exp :: CCalciumFunctionCode
+ Data.Number.Flint.Calcium: ca_FUNC_CODE_LENGTH :: CCalciumFunctionCode
+ Data.Number.Flint.Calcium: ca_Floor :: CCalciumFunctionCode
+ Data.Number.Flint.Calcium: ca_Gamma :: CCalciumFunctionCode
+ Data.Number.Flint.Calcium: ca_HurwitzZeta :: CCalciumFunctionCode
+ Data.Number.Flint.Calcium: ca_Im :: CCalciumFunctionCode
+ Data.Number.Flint.Calcium: ca_Log :: CCalciumFunctionCode
+ Data.Number.Flint.Calcium: ca_LogGamma :: CCalciumFunctionCode
+ Data.Number.Flint.Calcium: ca_Mul :: CCalciumFunctionCode
+ Data.Number.Flint.Calcium: ca_Neg :: CCalciumFunctionCode
+ Data.Number.Flint.Calcium: ca_Pi :: CCalciumFunctionCode
+ Data.Number.Flint.Calcium: ca_Pow :: CCalciumFunctionCode
+ Data.Number.Flint.Calcium: ca_Psi :: CCalciumFunctionCode
+ Data.Number.Flint.Calcium: ca_QQBar :: CCalciumFunctionCode
+ Data.Number.Flint.Calcium: ca_Re :: CCalciumFunctionCode
+ Data.Number.Flint.Calcium: ca_RiemannZeta :: CCalciumFunctionCode
+ Data.Number.Flint.Calcium: ca_Root :: CCalciumFunctionCode
+ Data.Number.Flint.Calcium: ca_Sign :: CCalciumFunctionCode
+ Data.Number.Flint.Calcium: ca_Sin :: CCalciumFunctionCode
+ Data.Number.Flint.Calcium: ca_Sinh :: CCalciumFunctionCode
+ Data.Number.Flint.Calcium: ca_Sqrt :: CCalciumFunctionCode
+ Data.Number.Flint.Calcium: ca_Sub :: CCalciumFunctionCode
+ Data.Number.Flint.Calcium: ca_Tan :: CCalciumFunctionCode
+ Data.Number.Flint.Calcium: ca_Tanh :: CCalciumFunctionCode
+ Data.Number.Flint.Calcium: calcium_func_name :: CCalciumFunctionCode -> IO CString
+ Data.Number.Flint.Calcium: calcium_stream_init_file :: Ptr CCalciumStream -> Ptr CFile -> IO ()
+ Data.Number.Flint.Calcium: calcium_stream_init_str :: Ptr CCalciumStream -> IO ()
+ Data.Number.Flint.Calcium: calcium_version :: IO CString
+ Data.Number.Flint.Calcium: calcium_write :: Ptr CCalciumStream -> CString -> IO ()
+ Data.Number.Flint.Calcium: calcium_write_acb :: Ptr CCalciumStream -> Ptr CAcb -> CLong -> CULong -> IO ()
+ Data.Number.Flint.Calcium: calcium_write_arb :: Ptr CCalciumStream -> Ptr CArb -> CLong -> CULong -> IO ()
+ Data.Number.Flint.Calcium: calcium_write_fmpz :: Ptr CCalciumStream -> Ptr CFmpz -> IO ()
+ Data.Number.Flint.Calcium: calcium_write_free :: Ptr CCalciumStream -> CString -> IO ()
+ Data.Number.Flint.Calcium: calcium_write_si :: Ptr CCalciumStream -> CLong -> IO ()
+ Data.Number.Flint.Calcium: data CCalciumStream
+ Data.Number.Flint.Calcium: data CalciumStream
+ Data.Number.Flint.Calcium: newCalciumStreamFile :: Ptr CFile -> IO CalciumStream
+ Data.Number.Flint.Calcium: newCalciumStreamStr :: p -> IO CalciumStream
+ Data.Number.Flint.Calcium: newtype CCalciumFunctionCode
+ Data.Number.Flint.Calcium: newtype CTruth
+ Data.Number.Flint.Calcium: t_false :: CTruth
+ Data.Number.Flint.Calcium: t_true :: CTruth
+ Data.Number.Flint.Calcium: t_unknown :: CTruth
+ Data.Number.Flint.Calcium: withCalciumStream :: CalciumStream -> (Ptr CCalciumStream -> IO a) -> IO (CalciumStream, a)
+ Data.Number.Flint.Calcium.Ca: Ca :: {-# UNPACK #-} !ForeignPtr CCa -> Ca
+ Data.Number.Flint.Calcium.Ca: CaCtx :: {-# UNPACK #-} !ForeignPtr CCaCtx -> CaCtx
+ Data.Number.Flint.Calcium.Ca: CaFactor :: {-# UNPACK #-} !ForeignPtr CCaFactor -> CaFactor
+ Data.Number.Flint.Calcium.Ca: _ca_make_field_element :: Ptr CCa -> Ptr CCaField -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: _ca_make_fmpq :: Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_abs :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_acos :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_acos_direct :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_acos_logarithm :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_add :: Ptr CCa -> Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_add_fmpq :: Ptr CCa -> Ptr CCa -> Ptr CFmpq -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_add_fmpz :: Ptr CCa -> Ptr CCa -> Ptr CFmpz -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_add_si :: Ptr CCa -> Ptr CCa -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_add_ui :: Ptr CCa -> Ptr CCa -> CULong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_arg :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_asin :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_asin_direct :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_asin_logarithm :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_atan :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_atan_direct :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_atan_logarithm :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_can_evaluate_qqbar :: Ptr CCa -> Ptr CCaCtx -> IO CInt
+ Data.Number.Flint.Calcium.Ca: ca_ceil :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_check_equal :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO CTruth
+ Data.Number.Flint.Calcium.Ca: ca_check_ge :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO CTruth
+ Data.Number.Flint.Calcium.Ca: ca_check_gt :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO CTruth
+ Data.Number.Flint.Calcium.Ca: ca_check_is_algebraic :: Ptr CCa -> Ptr CCaCtx -> IO CTruth
+ Data.Number.Flint.Calcium.Ca: ca_check_is_i :: Ptr CCa -> Ptr CCaCtx -> IO CTruth
+ Data.Number.Flint.Calcium.Ca: ca_check_is_imaginary :: Ptr CCa -> Ptr CCaCtx -> IO CTruth
+ Data.Number.Flint.Calcium.Ca: ca_check_is_infinity :: Ptr CCa -> Ptr CCaCtx -> IO CTruth
+ Data.Number.Flint.Calcium.Ca: ca_check_is_integer :: Ptr CCa -> Ptr CCaCtx -> IO CTruth
+ Data.Number.Flint.Calcium.Ca: ca_check_is_neg_i :: Ptr CCa -> Ptr CCaCtx -> IO CTruth
+ Data.Number.Flint.Calcium.Ca: ca_check_is_neg_i_inf :: Ptr CCa -> Ptr CCaCtx -> IO CTruth
+ Data.Number.Flint.Calcium.Ca: ca_check_is_neg_inf :: Ptr CCa -> Ptr CCaCtx -> IO CTruth
+ Data.Number.Flint.Calcium.Ca: ca_check_is_neg_one :: Ptr CCa -> Ptr CCaCtx -> IO CTruth
+ Data.Number.Flint.Calcium.Ca: ca_check_is_negative_real :: Ptr CCa -> Ptr CCaCtx -> IO CTruth
+ Data.Number.Flint.Calcium.Ca: ca_check_is_number :: Ptr CCa -> Ptr CCaCtx -> IO CTruth
+ Data.Number.Flint.Calcium.Ca: ca_check_is_one :: Ptr CCa -> Ptr CCaCtx -> IO CTruth
+ Data.Number.Flint.Calcium.Ca: ca_check_is_pos_i_inf :: Ptr CCa -> Ptr CCaCtx -> IO CTruth
+ Data.Number.Flint.Calcium.Ca: ca_check_is_pos_inf :: Ptr CCa -> Ptr CCaCtx -> IO CTruth
+ Data.Number.Flint.Calcium.Ca: ca_check_is_rational :: Ptr CCa -> Ptr CCaCtx -> IO CTruth
+ Data.Number.Flint.Calcium.Ca: ca_check_is_real :: Ptr CCa -> Ptr CCaCtx -> IO CTruth
+ Data.Number.Flint.Calcium.Ca: ca_check_is_signed_inf :: Ptr CCa -> Ptr CCaCtx -> IO CTruth
+ Data.Number.Flint.Calcium.Ca: ca_check_is_uinf :: Ptr CCa -> Ptr CCaCtx -> IO CTruth
+ Data.Number.Flint.Calcium.Ca: ca_check_is_undefined :: Ptr CCa -> Ptr CCaCtx -> IO CTruth
+ Data.Number.Flint.Calcium.Ca: ca_check_is_zero :: Ptr CCa -> Ptr CCaCtx -> IO CTruth
+ Data.Number.Flint.Calcium.Ca: ca_check_le :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO CTruth
+ Data.Number.Flint.Calcium.Ca: ca_check_lt :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO CTruth
+ Data.Number.Flint.Calcium.Ca: ca_clear :: Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_cmp_repr :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO CInt
+ Data.Number.Flint.Calcium.Ca: ca_condense_field :: Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_conj :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_conj_deep :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_conj_shallow :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_cos :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_cot :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_csgn :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_ctx_clear :: Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_ctx_get_option :: Ptr CCaCtx -> CLong -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_ctx_init :: Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_ctx_print :: Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_ctx_set_option :: Ptr CCaCtx -> CLong -> CLong -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_div :: Ptr CCa -> Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_div_fmpq :: Ptr CCa -> Ptr CCa -> Ptr CFmpq -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_div_fmpz :: Ptr CCa -> Ptr CCa -> Ptr CFmpz -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_div_si :: Ptr CCa -> Ptr CCa -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_div_ui :: Ptr CCa -> Ptr CCa -> CULong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_dot :: Ptr CCa -> Ptr CCa -> CInt -> Ptr CCa -> CLong -> Ptr CCa -> CLong -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_equal_repr :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO CInt
+ Data.Number.Flint.Calcium.Ca: ca_erf :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_erfc :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_erfi :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_euler :: Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_exp :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_factor :: Ptr CCaFactor -> Ptr CCa -> CULong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_factor_clear :: Ptr CCaFactor -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_factor_get_ca :: Ptr CCa -> Ptr CCaFactor -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_factor_init :: Ptr CCaFactor -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_factor_insert :: Ptr CCaFactor -> Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_factor_one :: Ptr CCaFactor -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_factor_poly_content :: CaFactorOption
+ Data.Number.Flint.Calcium.Ca: ca_factor_poly_full :: CaFactorOption
+ Data.Number.Flint.Calcium.Ca: ca_factor_poly_none :: CaFactorOption
+ Data.Number.Flint.Calcium.Ca: ca_factor_poly_sqf :: CaFactorOption
+ Data.Number.Flint.Calcium.Ca: ca_factor_print :: Ptr CCaFactor -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_factor_zz_full :: CaFactorOption
+ Data.Number.Flint.Calcium.Ca: ca_factor_zz_none :: CaFactorOption
+ Data.Number.Flint.Calcium.Ca: ca_factor_zz_smooth :: CaFactorOption
+ Data.Number.Flint.Calcium.Ca: ca_floor :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_fmpq_div :: Ptr CCa -> Ptr CFmpq -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_fmpq_poly_evaluate :: Ptr CCa -> Ptr CFmpqPoly -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_fmpq_sub :: Ptr CCa -> Ptr CFmpq -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_fmpz_div :: Ptr CCa -> Ptr CFmpz -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_fmpz_mpoly_evaluate :: Ptr CCa -> Ptr CFmpzMPoly -> Ptr CCa -> Ptr CFmpzMPolyCtx -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_fmpz_mpoly_evaluate_horner :: Ptr CCa -> Ptr CFmpzMPoly -> Ptr CCa -> Ptr CFmpzMPolyCtx -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_fmpz_mpoly_q_evaluate :: Ptr CCa -> Ptr CFmpzMPolyQ -> Ptr CCa -> Ptr CFmpzMPolyCtx -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_fmpz_mpoly_q_evaluate_no_division_by_zero :: Ptr CCa -> Ptr CFmpzMPolyQ -> Ptr CCa -> Ptr CFmpzMPolyCtx -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_fmpz_poly_evaluate :: Ptr CCa -> Ptr CFmpzPoly -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_fmpz_sub :: Ptr CCa -> Ptr CFmpz -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_fprint :: Ptr CFile -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_gamma :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_get_acb :: Ptr CAcb -> Ptr CCa -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_get_acb_accurate_parts :: Ptr CAcb -> Ptr CCa -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_get_acb_raw :: Ptr CAcb -> Ptr CCa -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_get_decimal_str :: Ptr CCa -> CLong -> CULong -> Ptr CCaCtx -> IO CString
+ Data.Number.Flint.Calcium.Ca: ca_get_fexpr :: Ptr CFexpr -> Ptr CCa -> CULong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_get_fmpq :: Ptr CFmpq -> Ptr CCa -> Ptr CCaCtx -> IO CInt
+ Data.Number.Flint.Calcium.Ca: ca_get_fmpz :: Ptr CFmpz -> Ptr CCa -> Ptr CCaCtx -> IO CInt
+ Data.Number.Flint.Calcium.Ca: ca_get_qqbar :: Ptr CQQbar -> Ptr CCa -> Ptr CCaCtx -> IO CInt
+ Data.Number.Flint.Calcium.Ca: ca_get_str :: Ptr CCa -> Ptr CCaCtx -> IO CString
+ Data.Number.Flint.Calcium.Ca: ca_hash_repr :: Ptr CCa -> Ptr CCaCtx -> IO CULong
+ Data.Number.Flint.Calcium.Ca: ca_i :: Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_im :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_init :: Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_inv :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_inv_no_division_by_zero :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_is_cyclotomic_nf_elem :: Ptr CLong -> Ptr CULong -> Ptr CCa -> Ptr CCaCtx -> IO CInt
+ Data.Number.Flint.Calcium.Ca: ca_is_gen_as_ext :: Ptr CCa -> Ptr CCaCtx -> IO (Ptr CCa)
+ Data.Number.Flint.Calcium.Ca: ca_is_generic_elem :: Ptr CCa -> Ptr CCaCtx -> IO CInt
+ Data.Number.Flint.Calcium.Ca: ca_is_nf_elem :: Ptr CCa -> Ptr CCaCtx -> IO CInt
+ Data.Number.Flint.Calcium.Ca: ca_is_qq_elem :: Ptr CCa -> Ptr CCaCtx -> IO CInt
+ Data.Number.Flint.Calcium.Ca: ca_is_qq_elem_integer :: Ptr CCa -> Ptr CCaCtx -> IO CInt
+ Data.Number.Flint.Calcium.Ca: ca_is_qq_elem_one :: Ptr CCa -> Ptr CCaCtx -> IO CInt
+ Data.Number.Flint.Calcium.Ca: ca_is_qq_elem_zero :: Ptr CCa -> Ptr CCaCtx -> IO CInt
+ Data.Number.Flint.Calcium.Ca: ca_is_special :: Ptr CCa -> Ptr CCaCtx -> IO CInt
+ Data.Number.Flint.Calcium.Ca: ca_is_unknown :: Ptr CCa -> Ptr CCaCtx -> IO CInt
+ Data.Number.Flint.Calcium.Ca: ca_log :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_merge_fields :: Ptr CCa -> Ptr CCa -> Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_mul :: Ptr CCa -> Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_mul_fmpq :: Ptr CCa -> Ptr CCa -> Ptr CFmpq -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_mul_fmpz :: Ptr CCa -> Ptr CCa -> Ptr CFmpz -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_mul_si :: Ptr CCa -> Ptr CCa -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_mul_ui :: Ptr CCa -> Ptr CCa -> CULong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_neg :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_neg_i :: Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_neg_i_inf :: Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_neg_inf :: Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_neg_one :: Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_one :: Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_opt_groebner_length_limit :: CaOption
+ Data.Number.Flint.Calcium.Ca: ca_opt_groebner_poly_bits_limit :: CaOption
+ Data.Number.Flint.Calcium.Ca: ca_opt_groebner_poly_length_limit :: CaOption
+ Data.Number.Flint.Calcium.Ca: ca_opt_lll_prec :: CaOption
+ Data.Number.Flint.Calcium.Ca: ca_opt_low_prec :: CaOption
+ Data.Number.Flint.Calcium.Ca: ca_opt_mpoly_ord :: CaOption
+ Data.Number.Flint.Calcium.Ca: ca_opt_pow_limit :: CaOption
+ Data.Number.Flint.Calcium.Ca: ca_opt_prec_limit :: CaOption
+ Data.Number.Flint.Calcium.Ca: ca_opt_print_flags :: CaOption
+ Data.Number.Flint.Calcium.Ca: ca_opt_qqbar_deg_limit :: CaOption
+ Data.Number.Flint.Calcium.Ca: ca_opt_smooth_limit :: CaOption
+ Data.Number.Flint.Calcium.Ca: ca_opt_trig_form :: CaOption
+ Data.Number.Flint.Calcium.Ca: ca_opt_use_groebner :: CaOption
+ Data.Number.Flint.Calcium.Ca: ca_opt_verbose :: CaOption
+ Data.Number.Flint.Calcium.Ca: ca_opt_vieta_limit :: CaOption
+ Data.Number.Flint.Calcium.Ca: ca_pi :: Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_pi_i :: Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_pos_i_inf :: Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_pos_inf :: Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_pow :: Ptr CCa -> Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_pow_fmpq :: Ptr CCa -> Ptr CCa -> Ptr CFmpq -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_pow_fmpz :: Ptr CCa -> Ptr CCa -> Ptr CFmpz -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_pow_si :: Ptr CCa -> Ptr CCa -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_pow_si_arithmetic :: Ptr CCa -> Ptr CCa -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_pow_ui :: Ptr CCa -> Ptr CCa -> CULong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_print :: Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_print_debug :: CalciumPrintOption
+ Data.Number.Flint.Calcium.Ca: ca_print_default :: CalciumPrintOption
+ Data.Number.Flint.Calcium.Ca: ca_print_digits :: CalciumPrintOption
+ Data.Number.Flint.Calcium.Ca: ca_print_field :: CalciumPrintOption
+ Data.Number.Flint.Calcium.Ca: ca_print_n :: CalciumPrintOption
+ Data.Number.Flint.Calcium.Ca: ca_print_repr :: CalciumPrintOption
+ Data.Number.Flint.Calcium.Ca: ca_printn :: Ptr CCa -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_randtest :: Ptr CCa -> Ptr CFRandState -> CLong -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_randtest_rational :: Ptr CCa -> Ptr CFRandState -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_randtest_same_nf :: Ptr CCa -> Ptr CFRandState -> Ptr CCa -> CLong -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_randtest_special :: Ptr CCa -> Ptr CFRandState -> CLong -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_re :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_rewrite_complex_normal_form :: Ptr CCa -> Ptr CCa -> CInt -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_set :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_set_d :: Ptr CCa -> CDouble -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_set_d_d :: Ptr CCa -> CDouble -> CDouble -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_set_fexpr :: Ptr CCa -> Ptr CFexpr -> Ptr CCaCtx -> IO CInt
+ Data.Number.Flint.Calcium.Ca: ca_set_fmpq :: Ptr CCa -> Ptr CFmpq -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_set_fmpz :: Ptr CCa -> Ptr CFmpz -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_set_qqbar :: Ptr CCa -> Ptr CQQbar -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_set_si :: Ptr CCa -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_set_ui :: Ptr CCa -> CULong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_sgn :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_si_div :: Ptr CCa -> CLong -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_si_sub :: Ptr CCa -> CLong -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_sin :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_sin_cos :: Ptr CCa -> Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_sin_cos_direct :: Ptr CCa -> Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_sin_cos_exponential :: Ptr CCa -> Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_sin_cos_tangent :: Ptr CCa -> Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_sqr :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_sqrt :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_sqrt_factor :: Ptr CCa -> Ptr CCa -> CULong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_sqrt_inert :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_sqrt_nofactor :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_sqrt_ui :: Ptr CCa -> CULong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_sub :: Ptr CCa -> Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_sub_fmpq :: Ptr CCa -> Ptr CCa -> Ptr CFmpq -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_sub_fmpz :: Ptr CCa -> Ptr CCa -> Ptr CFmpz -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_sub_si :: Ptr CCa -> Ptr CCa -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_sub_ui :: Ptr CCa -> Ptr CCa -> CULong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_swap :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_tan :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_tan_direct :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_tan_exponential :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_tan_sine_cosine :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_transfer :: Ptr CCa -> Ptr CCaCtx -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_trig_direct :: CaOption
+ Data.Number.Flint.Calcium.Ca: ca_trig_exponential :: CaOption
+ Data.Number.Flint.Calcium.Ca: ca_trig_sine_cosine :: CaOption
+ Data.Number.Flint.Calcium.Ca: ca_trig_tangent :: CaOption
+ Data.Number.Flint.Calcium.Ca: ca_ui_div :: Ptr CCa -> CULong -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_ui_sub :: Ptr CCa -> CULong -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_uinf :: Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_undefined :: Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_unknown :: Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: ca_zero :: Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca: data Ca
+ Data.Number.Flint.Calcium.Ca: data CaCtx
+ Data.Number.Flint.Calcium.Ca: data CaFactor
+ Data.Number.Flint.Calcium.Ca: newCa :: CaCtx -> IO Ca
+ Data.Number.Flint.Calcium.Ca: newCaCtx :: IO CaCtx
+ Data.Number.Flint.Calcium.Ca: newCaFactor :: CaCtx -> IO CaFactor
+ Data.Number.Flint.Calcium.Ca: type CCa = CFlint Ca
+ Data.Number.Flint.Calcium.Ca: type CCaCtx = CFlint CaCtx
+ Data.Number.Flint.Calcium.Ca: type CCaFactor = CFlint CaFactor
+ Data.Number.Flint.Calcium.Ca: type CalciumPrintOption = CULong
+ Data.Number.Flint.Calcium.Ca: withCa :: Ca -> (Ptr CCa -> IO a) -> IO (Ca, a)
+ Data.Number.Flint.Calcium.Ca: withCaCtx :: CaCtx -> (Ptr CCaCtx -> IO a) -> IO (CaCtx, a)
+ Data.Number.Flint.Calcium.Ca: withCaFactor :: CaFactor -> (Ptr CCaFactor -> IO a) -> IO (CaFactor, a)
+ Data.Number.Flint.Calcium.Ca: withNewCa :: CaCtx -> (Ptr CCa -> IO a) -> IO (Ca, a)
+ Data.Number.Flint.Calcium.Ca.Ext: CaExt :: {-# UNPACK #-} !ForeignPtr CCaExt -> CaExt
+ Data.Number.Flint.Calcium.Ca.Ext: ca_ext_cache_clear :: Ptr CCaExtCache -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Ext: ca_ext_cache_init :: Ptr CCaExtCache -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Ext: ca_ext_cache_insert :: Ptr CCaExtCache -> Ptr CCaExt -> Ptr CCaCtx -> IO (Ptr CCaExt)
+ Data.Number.Flint.Calcium.Ca.Ext: ca_ext_clear :: Ptr CCaExt -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Ext: ca_ext_cmp_repr :: Ptr CCaExt -> Ptr CCaExt -> Ptr CCaCtx -> IO CInt
+ Data.Number.Flint.Calcium.Ca.Ext: ca_ext_equal_repr :: Ptr CCaExt -> Ptr CCaExt -> Ptr CCaCtx -> IO CInt
+ Data.Number.Flint.Calcium.Ca.Ext: ca_ext_get_acb_raw :: Ptr CAcb -> Ptr CCaExt -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Ext: ca_ext_get_arg :: Ptr CCa -> Ptr CCaExt -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Ext: ca_ext_hash :: Ptr CCaExt -> Ptr CCaCtx -> IO CULong
+ Data.Number.Flint.Calcium.Ca.Ext: ca_ext_init_const :: Ptr CCaExt -> CCalciumFunctionCode -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Ext: ca_ext_init_fx :: Ptr CCaExt -> CCalciumFunctionCode -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Ext: ca_ext_init_fxn :: Ptr CCaExt -> CCalciumFunctionCode -> Ptr CCa -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Ext: ca_ext_init_fxy :: Ptr CCaExt -> CCalciumFunctionCode -> Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Ext: ca_ext_init_qqbar :: Ptr CCaExt -> Ptr CQQbar -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Ext: ca_ext_init_set :: Ptr CCaExt -> Ptr CCaExt -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Ext: ca_ext_nargs :: Ptr CCaExt -> Ptr CCaCtx -> IO CLong
+ Data.Number.Flint.Calcium.Ca.Ext: ca_ext_print :: Ptr CCaExt -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Ext: data CaExt
+ Data.Number.Flint.Calcium.Ca.Ext: newCaExtConst :: CCalciumFunctionCode -> CaCtx -> IO CaExt
+ Data.Number.Flint.Calcium.Ca.Ext: newCaExtFx :: CCalciumFunctionCode -> Ca -> CaCtx -> IO CaExt
+ Data.Number.Flint.Calcium.Ca.Ext: newCaExtFxn :: CCalciumFunctionCode -> Ca -> CLong -> CaCtx -> IO CaExt
+ Data.Number.Flint.Calcium.Ca.Ext: newCaExtFxy :: CCalciumFunctionCode -> Ca -> Ca -> CaCtx -> IO CaExt
+ Data.Number.Flint.Calcium.Ca.Ext: newCaExtQQbar :: QQbar -> CaCtx -> IO CaExt
+ Data.Number.Flint.Calcium.Ca.Ext: type CCaExt = CFlint CaExt
+ Data.Number.Flint.Calcium.Ca.Ext: withCaExt :: CaExt -> (Ptr CCaExt -> IO a) -> IO (CaExt, a)
+ Data.Number.Flint.Calcium.Ca.Field: CaField :: {-# UNPACK #-} !ForeignPtr CCaField -> CaField
+ Data.Number.Flint.Calcium.Ca.Field: ca_field_build_ideal :: Ptr CCaField -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Field: ca_field_build_ideal_erf :: Ptr CCaField -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Field: ca_field_cache_clear :: Ptr CCaFieldCache -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Field: ca_field_cache_init :: Ptr CCaFieldCache -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Field: ca_field_cache_insert_ext :: Ptr CCaFieldCache -> Ptr (Ptr CCaExt) -> CLong -> Ptr CCaCtx -> IO (Ptr CCaField)
+ Data.Number.Flint.Calcium.Ca.Field: ca_field_clear :: Ptr CCaField -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Field: ca_field_cmp :: Ptr CCaField -> Ptr CCaField -> Ptr CCaCtx -> IO CInt
+ Data.Number.Flint.Calcium.Ca.Field: ca_field_init_const :: Ptr CCaField -> CCalciumFunctionCode -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Field: ca_field_init_fx :: Ptr CCaField -> CCalciumFunctionCode -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Field: ca_field_init_fxy :: Ptr CCaField -> CCalciumFunctionCode -> Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Field: ca_field_init_multi :: Ptr CCaField -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Field: ca_field_init_nf :: Ptr CCaField -> Ptr CQQbar -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Field: ca_field_init_qq :: Ptr CCaField -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Field: ca_field_print :: Ptr CCaField -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Field: ca_field_set_ext :: Ptr CCaField -> CLong -> Ptr CCaExt -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Field: data CaField
+ Data.Number.Flint.Calcium.Ca.Field: type CCaField = CFlint CaField
+ Data.Number.Flint.Calcium.Ca.Mat: CCaMat :: Ptr CCa -> CLong -> CLong -> Ptr CCa -> CCaMat
+ Data.Number.Flint.Calcium.Ca.Mat: CaMat :: {-# UNPACK #-} !ForeignPtr CCaMat -> CaMat
+ Data.Number.Flint.Calcium.Ca.Mat: _ca_mat_ca_poly_evaluate :: Ptr CCaMat -> Ptr CCa -> CLong -> Ptr CCaMat -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Mat: _ca_mat_charpoly :: Ptr CCa -> Ptr CCaMat -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Mat: _ca_mat_charpoly_berkowitz :: Ptr CCa -> Ptr CCaMat -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Mat: _ca_mat_charpoly_danilevsky :: Ptr CCa -> Ptr CCaMat -> Ptr CCaCtx -> IO CInt
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_add :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCaMat -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_add_ca :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_addmul_ca :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_adjugate :: Ptr CCaMat -> Ptr CCa -> Ptr CCaMat -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_adjugate_charpoly :: Ptr CCaMat -> Ptr CCa -> Ptr CCaMat -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_adjugate_cofactor :: Ptr CCaMat -> Ptr CCa -> Ptr CCaMat -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_ca_poly_evaluate :: Ptr CCaMat -> Ptr CCaPoly -> Ptr CCaMat -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_charpoly :: Ptr CCaPoly -> Ptr CCaMat -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_charpoly_berkowitz :: Ptr CCaPoly -> Ptr CCaMat -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_charpoly_danilevsky :: Ptr CCaPoly -> Ptr CCaMat -> Ptr CCaCtx -> IO CInt
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_check_equal :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCaCtx -> IO (Ptr CTruth)
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_check_is_one :: Ptr CCaMat -> Ptr CCaCtx -> IO (Ptr CTruth)
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_check_is_zero :: Ptr CCaMat -> Ptr CCaCtx -> IO (Ptr CTruth)
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_clear :: Ptr CCaMat -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_companion :: Ptr CCaMat -> Ptr CCaPoly -> Ptr CCaCtx -> IO CInt
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_conj :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_conj_transpose :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_det :: Ptr CCa -> Ptr CCaMat -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_det_bareiss :: Ptr CCa -> Ptr CCaMat -> Ptr CCaCtx -> IO CInt
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_det_berkowitz :: Ptr CCa -> Ptr CCaMat -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_det_cofactor :: Ptr CCa -> Ptr CCaMat -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_det_lu :: Ptr CCa -> Ptr CCaMat -> Ptr CCaCtx -> IO CInt
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_dft :: Ptr CCaMat -> CInt -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_diagonalization :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCaMat -> Ptr CCaCtx -> IO (Ptr CTruth)
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_div_ca :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_div_fmpq :: Ptr CCaMat -> Ptr CCaMat -> Ptr CFmpq -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_div_fmpz :: Ptr CCaMat -> Ptr CCaMat -> Ptr CFmpz -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_div_si :: Ptr CCaMat -> Ptr CCaMat -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_eigenvalues :: Ptr CCaVec -> Ptr CULong -> Ptr CCaMat -> Ptr CCaCtx -> IO CInt
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_entry :: Ptr CCaMat -> CLong -> CLong -> IO (Ptr CCa)
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_entry_ptr :: Ptr CCaMat -> CLong -> CLong -> IO (Ptr CCa)
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_exp :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCaCtx -> IO CInt
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_fflu :: Ptr CLong -> Ptr CLong -> Ptr CCaMat -> Ptr CCa -> Ptr CCaMat -> CInt -> Ptr CCaCtx -> IO CInt
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_find_pivot :: Ptr CLong -> Ptr CCaMat -> CLong -> CLong -> CLong -> Ptr CCaCtx -> IO (Ptr CTruth)
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_fprint :: Ptr CFile -> Ptr CCaMat -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_get_str :: Ptr CCaMat -> Ptr CCaCtx -> IO CString
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_hilbert :: Ptr CCaMat -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_init :: Ptr CCaMat -> CLong -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_inv :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCaCtx -> IO (Ptr CTruth)
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_jordan_blocks :: Ptr CCaVec -> Ptr CLong -> Ptr CLong -> Ptr CLong -> Ptr CCaMat -> Ptr CCaCtx -> IO CInt
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_jordan_form :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCaMat -> Ptr CCaCtx -> IO CInt
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_jordan_transformation :: Ptr CCaMat -> Ptr CCaVec -> CLong -> Ptr CLong -> Ptr CLong -> Ptr CCaMat -> Ptr CCaCtx -> IO CInt
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_log :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCaCtx -> IO (Ptr CTruth)
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_lu :: Ptr CLong -> Ptr CLong -> Ptr CCaMat -> Ptr CCaMat -> CInt -> Ptr CCaCtx -> IO CInt
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_lu_classical :: Ptr CLong -> Ptr CLong -> Ptr CCaMat -> Ptr CCaMat -> CInt -> Ptr CCaCtx -> IO CInt
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_lu_recursive :: Ptr CLong -> Ptr CLong -> Ptr CCaMat -> Ptr CCaMat -> CInt -> Ptr CCaCtx -> IO CInt
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_mul :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCaMat -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_mul_ca :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_mul_classical :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCaMat -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_mul_fmpq :: Ptr CCaMat -> Ptr CCaMat -> Ptr CFmpq -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_mul_fmpz :: Ptr CCaMat -> Ptr CCaMat -> Ptr CFmpz -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_mul_same_nf :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCaMat -> Ptr CCaField -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_mul_si :: Ptr CCaMat -> Ptr CCaMat -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_neg :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_nonsingular_fflu :: Ptr CLong -> Ptr CCaMat -> Ptr CCa -> Ptr CCaMat -> Ptr CCaCtx -> IO (Ptr CTruth)
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_nonsingular_lu :: Ptr CLong -> Ptr CCaMat -> Ptr CCaMat -> Ptr CCaCtx -> IO (Ptr CTruth)
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_nonsingular_solve :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCaMat -> Ptr CCaCtx -> IO (Ptr CTruth)
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_nonsingular_solve_adjugate :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCaMat -> Ptr CCaCtx -> IO (Ptr CTruth)
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_nonsingular_solve_fflu :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCaMat -> Ptr CCaCtx -> IO (Ptr CTruth)
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_nonsingular_solve_lu :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCaMat -> Ptr CCaCtx -> IO (Ptr CTruth)
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_one :: Ptr CCaMat -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_ones :: Ptr CCaMat -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_pascal :: Ptr CCaMat -> CInt -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_pow_ui_binexp :: Ptr CCaMat -> Ptr CCaMat -> CULong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_print :: Ptr CCaMat -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_printn :: Ptr CCaMat -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_randops :: Ptr CCaMat -> Ptr CFRandState -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_randtest :: Ptr CCaMat -> Ptr CFRandState -> CLong -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_randtest_rational :: Ptr CCaMat -> Ptr CFRandState -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_rank :: Ptr CLong -> Ptr CCaMat -> Ptr CCaCtx -> IO CInt
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_right_kernel :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCaCtx -> IO CInt
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_rref :: Ptr CLong -> Ptr CCaMat -> Ptr CCaMat -> Ptr CCaCtx -> IO CInt
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_rref_fflu :: Ptr CLong -> Ptr CCaMat -> Ptr CCaMat -> Ptr CCaCtx -> IO CInt
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_rref_lu :: Ptr CLong -> Ptr CCaMat -> Ptr CCaMat -> Ptr CCaCtx -> IO CInt
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_set :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_set_ca :: Ptr CCaMat -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_set_fmpq_mat :: Ptr CCaMat -> Ptr CFmpqMat -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_set_fmpz_mat :: Ptr CCaMat -> Ptr CFmpzMat -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_set_jordan_blocks :: Ptr CCaMat -> Ptr CCaVec -> CLong -> Ptr CLong -> Ptr CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_solve_fflu_precomp :: Ptr CCaMat -> Ptr CLong -> Ptr CCaMat -> Ptr CCa -> Ptr CCaMat -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_solve_lu_precomp :: Ptr CCaMat -> Ptr CLong -> Ptr CCaMat -> Ptr CCaMat -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_solve_tril :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCaMat -> CInt -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_solve_tril_classical :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCaMat -> CInt -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_solve_tril_recursive :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCaMat -> CInt -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_solve_triu :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCaMat -> CInt -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_solve_triu_classical :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCaMat -> CInt -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_solve_triu_recursive :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCaMat -> CInt -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_sqr :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_stirling :: Ptr CCaMat -> CInt -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_sub :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCaMat -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_sub_ca :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_submul_ca :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_swap :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_trace :: Ptr CCa -> Ptr CCaMat -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_transfer :: Ptr CCaMat -> Ptr CCaCtx -> Ptr CCaMat -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_transpose :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_window_clear :: Ptr CCaMat -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_window_init :: Ptr CCaMat -> Ptr CCaMat -> CLong -> CLong -> CLong -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Mat: ca_mat_zero :: Ptr CCaMat -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Mat: data CCaMat
+ Data.Number.Flint.Calcium.Ca.Mat: data CaMat
+ Data.Number.Flint.Calcium.Ca.Mat: newCaMat :: CLong -> CLong -> CaCtx -> IO CaMat
+ Data.Number.Flint.Calcium.Ca.Mat: withCaMat :: CaMat -> (Ptr CCaMat -> IO a) -> IO (CaMat, a)
+ Data.Number.Flint.Calcium.Ca.Mat: withNewCaMat :: CLong -> CLong -> CaCtx -> (Ptr CCaMat -> IO a) -> IO (CaMat, a)
+ Data.Number.Flint.Calcium.Ca.Poly: CaPoly :: {-# UNPACK #-} !ForeignPtr CCaPoly -> CaPoly
+ Data.Number.Flint.Calcium.Ca.Poly: _ca_poly_add :: Ptr CCa -> Ptr CCa -> CLong -> Ptr CCa -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: _ca_poly_check_equal :: Ptr CCa -> CLong -> Ptr CCa -> CLong -> Ptr CCaCtx -> IO (Ptr CTruth)
+ Data.Number.Flint.Calcium.Ca.Poly: _ca_poly_compose :: Ptr CCa -> Ptr CCa -> CLong -> Ptr CCa -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: _ca_poly_derivative :: Ptr CCa -> Ptr CCa -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: _ca_poly_div_series :: Ptr CCa -> Ptr CCa -> CLong -> Ptr CCa -> CLong -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: _ca_poly_divrem :: Ptr CCa -> Ptr CCa -> Ptr CCa -> CLong -> Ptr CCa -> CLong -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: _ca_poly_divrem_basecase :: Ptr CCa -> Ptr CCa -> Ptr CCa -> CLong -> Ptr CCa -> CLong -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: _ca_poly_evaluate :: Ptr CCa -> Ptr CCa -> CLong -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: _ca_poly_evaluate_horner :: Ptr CCa -> Ptr CCa -> CLong -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: _ca_poly_exp_series :: Ptr CCa -> Ptr CCa -> CLong -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: _ca_poly_gcd :: Ptr CCa -> Ptr CCa -> CLong -> Ptr CCa -> CLong -> Ptr CCaCtx -> IO CLong
+ Data.Number.Flint.Calcium.Ca.Poly: _ca_poly_gcd_euclidean :: Ptr CCa -> Ptr CCa -> CLong -> Ptr CCa -> CLong -> Ptr CCaCtx -> IO CLong
+ Data.Number.Flint.Calcium.Ca.Poly: _ca_poly_integral :: Ptr CCa -> Ptr CCa -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: _ca_poly_inv_series :: Ptr CCa -> Ptr CCa -> CLong -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: _ca_poly_log_series :: Ptr CCa -> Ptr CCa -> CLong -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: _ca_poly_mul :: Ptr CCa -> Ptr CCa -> CLong -> Ptr CCa -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: _ca_poly_mullow :: Ptr CCa -> Ptr CCa -> CLong -> Ptr CCa -> CLong -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: _ca_poly_normalise :: Ptr CCaPoly -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: _ca_poly_pow_ui :: Ptr CCa -> Ptr CCa -> CLong -> CULong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: _ca_poly_pow_ui_trunc :: Ptr CCa -> Ptr CCa -> CLong -> CULong -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: _ca_poly_reverse :: Ptr CCa -> Ptr CCa -> CLong -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: _ca_poly_roots :: Ptr CCa -> Ptr CCa -> CLong -> Ptr CCaCtx -> IO CInt
+ Data.Number.Flint.Calcium.Ca.Poly: _ca_poly_set_length :: Ptr CCaPoly -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: _ca_poly_set_roots :: Ptr CCa -> Ptr CCa -> Ptr CULong -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: _ca_poly_shift_left :: Ptr CCa -> Ptr CCa -> CLong -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: _ca_poly_shift_right :: Ptr CCa -> Ptr CCa -> CLong -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: _ca_poly_sub :: Ptr CCa -> Ptr CCa -> CLong -> Ptr CCa -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: _ca_poly_vec_clear :: Ptr CCaPoly -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: _ca_poly_vec_fit_length :: Ptr CCaPolyVec -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: _ca_poly_vec_init :: CLong -> Ptr CCaCtx -> IO (Ptr CCaPoly)
+ Data.Number.Flint.Calcium.Ca.Poly: ca_poly_add :: Ptr CCaPoly -> Ptr CCaPoly -> Ptr CCaPoly -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: ca_poly_check_equal :: Ptr CCaPoly -> Ptr CCaPoly -> Ptr CCaCtx -> IO (Ptr CTruth)
+ Data.Number.Flint.Calcium.Ca.Poly: ca_poly_check_is_one :: Ptr CCaPoly -> Ptr CCaCtx -> IO (Ptr CTruth)
+ Data.Number.Flint.Calcium.Ca.Poly: ca_poly_check_is_zero :: Ptr CCaPoly -> Ptr CCaCtx -> IO (Ptr CTruth)
+ Data.Number.Flint.Calcium.Ca.Poly: ca_poly_clear :: Ptr CCaPoly -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: ca_poly_compose :: Ptr CCaPoly -> Ptr CCaPoly -> Ptr CCaPoly -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: ca_poly_derivative :: Ptr CCaPoly -> Ptr CCaPoly -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: ca_poly_div :: Ptr CCaPoly -> Ptr CCaPoly -> Ptr CCaPoly -> Ptr CCaCtx -> IO CInt
+ Data.Number.Flint.Calcium.Ca.Poly: ca_poly_div_ca :: Ptr CCaPoly -> Ptr CCaPoly -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: ca_poly_div_series :: Ptr CCaPoly -> Ptr CCaPoly -> Ptr CCaPoly -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: ca_poly_divrem :: Ptr CCaPoly -> Ptr CCaPoly -> Ptr CCaPoly -> Ptr CCaPoly -> Ptr CCaCtx -> IO CInt
+ Data.Number.Flint.Calcium.Ca.Poly: ca_poly_divrem_basecase :: Ptr CCaPoly -> Ptr CCaPoly -> Ptr CCaPoly -> Ptr CCaPoly -> Ptr CCaCtx -> IO CInt
+ Data.Number.Flint.Calcium.Ca.Poly: ca_poly_evaluate :: Ptr CCa -> Ptr CCaPoly -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: ca_poly_evaluate_horner :: Ptr CCa -> Ptr CCaPoly -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: ca_poly_exp_series :: Ptr CCaPoly -> Ptr CCaPoly -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: ca_poly_factor_squarefree :: Ptr CCa -> Ptr CCaPolyVec -> Ptr CULong -> Ptr CCaPoly -> Ptr CCaCtx -> IO CInt
+ Data.Number.Flint.Calcium.Ca.Poly: ca_poly_fit_length :: Ptr CCaPoly -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: ca_poly_fprint :: Ptr CFile -> Ptr CCaPoly -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: ca_poly_gcd :: Ptr CCaPoly -> Ptr CCaPoly -> Ptr CCaPoly -> Ptr CCaCtx -> IO CInt
+ Data.Number.Flint.Calcium.Ca.Poly: ca_poly_gcd_euclidean :: Ptr CCaPoly -> Ptr CCaPoly -> Ptr CCaPoly -> Ptr CCaCtx -> IO CInt
+ Data.Number.Flint.Calcium.Ca.Poly: ca_poly_get_str :: Ptr CCaPoly -> Ptr CCaCtx -> IO CString
+ Data.Number.Flint.Calcium.Ca.Poly: ca_poly_init :: Ptr CCaPoly -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: ca_poly_integral :: Ptr CCaPoly -> Ptr CCaPoly -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: ca_poly_inv_series :: Ptr CCaPoly -> Ptr CCaPoly -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: ca_poly_is_proper :: Ptr CCaPoly -> Ptr CCaCtx -> IO CInt
+ Data.Number.Flint.Calcium.Ca.Poly: ca_poly_log_series :: Ptr CCaPoly -> Ptr CCaPoly -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: ca_poly_make_monic :: Ptr CCaPoly -> Ptr CCaPoly -> Ptr CCaCtx -> IO CInt
+ Data.Number.Flint.Calcium.Ca.Poly: ca_poly_mul :: Ptr CCaPoly -> Ptr CCaPoly -> Ptr CCaPoly -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: ca_poly_mul_ca :: Ptr CCaPoly -> Ptr CCaPoly -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: ca_poly_mullow :: Ptr CCaPoly -> Ptr CCaPoly -> Ptr CCaPoly -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: ca_poly_neg :: Ptr CCaPoly -> Ptr CCaPoly -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: ca_poly_one :: Ptr CCaPoly -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: ca_poly_pow_ui :: Ptr CCaPoly -> Ptr CCaPoly -> CULong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: ca_poly_pow_ui_trunc :: Ptr CCaPoly -> Ptr CCaPoly -> CULong -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: ca_poly_print :: Ptr CCaPoly -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: ca_poly_printn :: Ptr CCaPoly -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: ca_poly_randtest :: Ptr CCaPoly -> Ptr CFRandState -> CLong -> CLong -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: ca_poly_randtest_rational :: Ptr CCaPoly -> Ptr CFRandState -> CLong -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: ca_poly_rem :: Ptr CCaPoly -> Ptr CCaPoly -> Ptr CCaPoly -> Ptr CCaCtx -> IO CInt
+ Data.Number.Flint.Calcium.Ca.Poly: ca_poly_reverse :: Ptr CCaPoly -> Ptr CCaPoly -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: ca_poly_roots :: Ptr CCaVec -> Ptr CULong -> Ptr CCaPoly -> Ptr CCaCtx -> IO CInt
+ Data.Number.Flint.Calcium.Ca.Poly: ca_poly_set :: Ptr CCaPoly -> Ptr CCaPoly -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: ca_poly_set_ca :: Ptr CCaPoly -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: ca_poly_set_coeff_ca :: Ptr CCaPoly -> CLong -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: ca_poly_set_fmpq_poly :: Ptr CCaPoly -> Ptr CFmpqPoly -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: ca_poly_set_fmpz_poly :: Ptr CCaPoly -> Ptr CFmpzPoly -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: ca_poly_set_roots :: Ptr CCaPoly -> Ptr CCaVec -> Ptr CULong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: ca_poly_set_si :: Ptr CCaPoly -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: ca_poly_shift_left :: Ptr CCaPoly -> Ptr CCaPoly -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: ca_poly_shift_right :: Ptr CCaPoly -> Ptr CCaPoly -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: ca_poly_squarefree_part :: Ptr CCaPoly -> Ptr CCaPoly -> Ptr CCaCtx -> IO CInt
+ Data.Number.Flint.Calcium.Ca.Poly: ca_poly_sub :: Ptr CCaPoly -> Ptr CCaPoly -> Ptr CCaPoly -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: ca_poly_transfer :: Ptr CCaPoly -> Ptr CCaCtx -> Ptr CCaPoly -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: ca_poly_vec_append :: Ptr CCaPolyVec -> Ptr CCaPoly -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: ca_poly_vec_clear :: Ptr CCaPolyVec -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: ca_poly_vec_init :: Ptr CCaPolyVec -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: ca_poly_vec_set_length :: Ptr CCaPolyVec -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: ca_poly_x :: Ptr CCaPoly -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: ca_poly_zero :: Ptr CCaPoly -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Poly: data CaPoly
+ Data.Number.Flint.Calcium.Ca.Poly: newCaPoly :: CaCtx -> IO CaPoly
+ Data.Number.Flint.Calcium.Ca.Poly: type CCaPoly = CFlint CaPoly
+ Data.Number.Flint.Calcium.Ca.Poly: withCaPoly :: CaPoly -> (Ptr CCaPoly -> IO a) -> IO (CaPoly, a)
+ Data.Number.Flint.Calcium.Ca.Poly: withNewCaPoly :: CaCtx -> (Ptr CCaPoly -> IO a) -> IO (CaPoly, a)
+ Data.Number.Flint.Calcium.Ca.Types: CCaMat :: Ptr CCa -> CLong -> CLong -> Ptr CCa -> CCaMat
+ Data.Number.Flint.Calcium.Ca.Types: Ca :: {-# UNPACK #-} !ForeignPtr CCa -> Ca
+ Data.Number.Flint.Calcium.Ca.Types: CaCtx :: {-# UNPACK #-} !ForeignPtr CCaCtx -> CaCtx
+ Data.Number.Flint.Calcium.Ca.Types: CaExt :: {-# UNPACK #-} !ForeignPtr CCaExt -> CaExt
+ Data.Number.Flint.Calcium.Ca.Types: CaExtCache :: {-# UNPACK #-} !ForeignPtr CCaExtCache -> CaExtCache
+ Data.Number.Flint.Calcium.Ca.Types: CaFactor :: {-# UNPACK #-} !ForeignPtr CCaFactor -> CaFactor
+ Data.Number.Flint.Calcium.Ca.Types: CaField :: {-# UNPACK #-} !ForeignPtr CCaField -> CaField
+ Data.Number.Flint.Calcium.Ca.Types: CaFieldCache :: {-# UNPACK #-} !ForeignPtr CCaFieldCache -> CaFieldCache
+ Data.Number.Flint.Calcium.Ca.Types: CaMat :: {-# UNPACK #-} !ForeignPtr CCaMat -> CaMat
+ Data.Number.Flint.Calcium.Ca.Types: CaPoly :: {-# UNPACK #-} !ForeignPtr CCaPoly -> CaPoly
+ Data.Number.Flint.Calcium.Ca.Types: CaPolyVec :: {-# UNPACK #-} !ForeignPtr CCaPolyVec -> CaPolyVec
+ Data.Number.Flint.Calcium.Ca.Types: CaVec :: {-# UNPACK #-} !ForeignPtr CCaVec -> CaVec
+ Data.Number.Flint.Calcium.Ca.Types: data CCaMat
+ Data.Number.Flint.Calcium.Ca.Types: data CFexpr
+ Data.Number.Flint.Calcium.Ca.Types: data Ca
+ Data.Number.Flint.Calcium.Ca.Types: data CaCtx
+ Data.Number.Flint.Calcium.Ca.Types: data CaExt
+ Data.Number.Flint.Calcium.Ca.Types: data CaExtCache
+ Data.Number.Flint.Calcium.Ca.Types: data CaFactor
+ Data.Number.Flint.Calcium.Ca.Types: data CaField
+ Data.Number.Flint.Calcium.Ca.Types: data CaFieldCache
+ Data.Number.Flint.Calcium.Ca.Types: data CaMat
+ Data.Number.Flint.Calcium.Ca.Types: data CaPoly
+ Data.Number.Flint.Calcium.Ca.Types: data CaPolyVec
+ Data.Number.Flint.Calcium.Ca.Types: data CaVec
+ Data.Number.Flint.Calcium.Ca.Types: type CCa = CFlint Ca
+ Data.Number.Flint.Calcium.Ca.Types: type CCaCtx = CFlint CaCtx
+ Data.Number.Flint.Calcium.Ca.Types: type CCaExt = CFlint CaExt
+ Data.Number.Flint.Calcium.Ca.Types: type CCaExtCache = CFlint CaExtCache
+ Data.Number.Flint.Calcium.Ca.Types: type CCaFactor = CFlint CaFactor
+ Data.Number.Flint.Calcium.Ca.Types: type CCaField = CFlint CaField
+ Data.Number.Flint.Calcium.Ca.Types: type CCaFieldCache = CFlint CaFieldCache
+ Data.Number.Flint.Calcium.Ca.Types: type CCaPoly = CFlint CaPoly
+ Data.Number.Flint.Calcium.Ca.Types: type CCaPolyVec = CFlint CaPolyVec
+ Data.Number.Flint.Calcium.Ca.Types: type CCaVec = CFlint CaVec
+ Data.Number.Flint.Calcium.Ca.Vec: CaVec :: {-# UNPACK #-} !ForeignPtr CCaVec -> CaVec
+ Data.Number.Flint.Calcium.Ca.Vec: _ca_vec_add :: Ptr CCa -> Ptr CCa -> Ptr CCa -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Vec: _ca_vec_check_is_zero :: Ptr CCa -> CLong -> Ptr CCaCtx -> IO (Ptr CTruth)
+ Data.Number.Flint.Calcium.Ca.Vec: _ca_vec_clear :: Ptr CCa -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Vec: _ca_vec_fit_length :: Ptr CCaVec -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Vec: _ca_vec_fmpq_vec_get_fmpz_vec_den :: Ptr CFmpz -> Ptr CFmpz -> Ptr CCa -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Vec: _ca_vec_fmpq_vec_is_fmpz_vec :: Ptr CCa -> CLong -> Ptr CCaCtx -> IO CInt
+ Data.Number.Flint.Calcium.Ca.Vec: _ca_vec_init :: CLong -> Ptr CCaCtx -> IO (Ptr CCa)
+ Data.Number.Flint.Calcium.Ca.Vec: _ca_vec_is_fmpq_vec :: Ptr CCa -> CLong -> Ptr CCaCtx -> IO CInt
+ Data.Number.Flint.Calcium.Ca.Vec: _ca_vec_neg :: Ptr CCa -> Ptr CCa -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Vec: _ca_vec_scalar_addmul_ca :: Ptr CCa -> Ptr CCa -> CLong -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Vec: _ca_vec_scalar_div_ca :: Ptr CCa -> Ptr CCa -> CLong -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Vec: _ca_vec_scalar_mul_ca :: Ptr CCa -> Ptr CCa -> CLong -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Vec: _ca_vec_scalar_submul_ca :: Ptr CCa -> Ptr CCa -> CLong -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Vec: _ca_vec_set :: Ptr CCa -> Ptr CCa -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Vec: _ca_vec_set_fmpz_vec_div_fmpz :: Ptr CCa -> Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Vec: _ca_vec_sub :: Ptr CCa -> Ptr CCa -> Ptr CCa -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Vec: _ca_vec_swap :: Ptr CCa -> Ptr CCa -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Vec: _ca_vec_zero :: Ptr CCa -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Vec: ca_vec_append :: Ptr CCaVec -> Ptr CCa -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Vec: ca_vec_clear :: Ptr CCaVec -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Vec: ca_vec_entry_ptr :: Ptr CCaVec -> CLong -> Ptr CCa
+ Data.Number.Flint.Calcium.Ca.Vec: ca_vec_init :: Ptr CCaVec -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Vec: ca_vec_length :: Ptr CCaVec -> Ptr CCaCtx -> IO CLong
+ Data.Number.Flint.Calcium.Ca.Vec: ca_vec_neg :: Ptr CCaVec -> Ptr CCaVec -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Vec: ca_vec_print :: Ptr CCaVec -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Vec: ca_vec_printn :: Ptr CCaVec -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Vec: ca_vec_set :: Ptr CCaVec -> Ptr CCaVec -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Vec: ca_vec_set_length :: Ptr CCaVec -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Vec: ca_vec_swap :: Ptr CCaVec -> Ptr CCaVec -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Vec: ca_vec_zero :: Ptr CCaVec -> CLong -> Ptr CCaCtx -> IO ()
+ Data.Number.Flint.Calcium.Ca.Vec: data CaVec
+ Data.Number.Flint.Calcium.Ca.Vec: newCaVec :: CLong -> CaCtx -> IO CaVec
+ Data.Number.Flint.Calcium.Ca.Vec: type CCaVec = CFlint CaVec
+ Data.Number.Flint.Calcium.Ca.Vec: withCaVec :: CaVec -> (Ptr CCaVec -> IO a) -> IO (CaVec, a)
+ Data.Number.Flint.Calcium.Ca.Vec: withNewCaVec :: CLong -> CaCtx -> (Ptr CCaVec -> IO a) -> IO (CaCtx, (CaVec, a))
+ Data.Number.Flint.Calcium.Fexpr: Fexpr :: {-# UNPACK #-} !ForeignPtr CFexpr -> Fexpr
+ Data.Number.Flint.Calcium.Fexpr: _fexpr_vec_clear :: Ptr Fexpr -> CLong -> IO ()
+ Data.Number.Flint.Calcium.Fexpr: _fexpr_vec_init :: CLong -> IO (Ptr Fexpr)
+ Data.Number.Flint.Calcium.Fexpr: _fexpr_vec_sort_fast :: Ptr Fexpr -> CLong -> IO ()
+ Data.Number.Flint.Calcium.Fexpr: data CFexpr
+ Data.Number.Flint.Calcium.Fexpr: data Fexpr
+ Data.Number.Flint.Calcium.Fexpr: fexpr_add :: Ptr CFexpr -> Ptr CFexpr -> Ptr CFexpr -> IO ()
+ Data.Number.Flint.Calcium.Fexpr: fexpr_allocated_bytes :: Ptr CFexpr -> IO CLong
+ Data.Number.Flint.Calcium.Fexpr: fexpr_arg :: Ptr CFexpr -> Ptr CFexpr -> CLong -> IO ()
+ Data.Number.Flint.Calcium.Fexpr: fexpr_arithmetic_nodes :: Ptr CFexprVec -> Ptr CFexpr -> IO ()
+ Data.Number.Flint.Calcium.Fexpr: fexpr_call0 :: Ptr CFexpr -> Ptr CFexpr -> IO ()
+ Data.Number.Flint.Calcium.Fexpr: fexpr_call1 :: Ptr CFexpr -> Ptr CFexpr -> Ptr CFexpr -> IO ()
+ Data.Number.Flint.Calcium.Fexpr: fexpr_call2 :: Ptr CFexpr -> Ptr CFexpr -> Ptr CFexpr -> Ptr CFexpr -> IO ()
+ Data.Number.Flint.Calcium.Fexpr: fexpr_call3 :: Ptr CFexpr -> Ptr CFexpr -> Ptr CFexpr -> Ptr CFexpr -> Ptr CFexpr -> IO ()
+ Data.Number.Flint.Calcium.Fexpr: fexpr_call4 :: Ptr CFexpr -> Ptr CFexpr -> Ptr CFexpr -> Ptr CFexpr -> Ptr CFexpr -> Ptr CFexpr -> IO ()
+ Data.Number.Flint.Calcium.Fexpr: fexpr_call_builtin1 :: Ptr CFexpr -> CLong -> Ptr CFexpr -> IO ()
+ Data.Number.Flint.Calcium.Fexpr: fexpr_call_builtin2 :: Ptr CFexpr -> CLong -> Ptr CFexpr -> Ptr CFexpr -> IO ()
+ Data.Number.Flint.Calcium.Fexpr: fexpr_call_vec :: Ptr CFexpr -> Ptr CFexpr -> Ptr Fexpr -> CLong -> IO ()
+ Data.Number.Flint.Calcium.Fexpr: fexpr_clear :: Ptr CFexpr -> IO ()
+ Data.Number.Flint.Calcium.Fexpr: fexpr_cmp_fast :: Ptr CFexpr -> Ptr CFexpr -> IO CInt
+ Data.Number.Flint.Calcium.Fexpr: fexpr_contains :: Ptr CFexpr -> Ptr CFexpr -> IO CInt
+ Data.Number.Flint.Calcium.Fexpr: fexpr_depth :: Ptr CFexpr -> IO CLong
+ Data.Number.Flint.Calcium.Fexpr: fexpr_div :: Ptr CFexpr -> Ptr CFexpr -> Ptr CFexpr -> IO ()
+ Data.Number.Flint.Calcium.Fexpr: fexpr_equal :: Ptr CFexpr -> Ptr CFexpr -> IO CInt
+ Data.Number.Flint.Calcium.Fexpr: fexpr_equal_si :: Ptr CFexpr -> CLong -> IO CInt
+ Data.Number.Flint.Calcium.Fexpr: fexpr_equal_ui :: Ptr CFexpr -> CULong -> IO CInt
+ Data.Number.Flint.Calcium.Fexpr: fexpr_expanded_normal_form :: Ptr CFexpr -> Ptr CFexpr -> CULong -> IO CInt
+ Data.Number.Flint.Calcium.Fexpr: fexpr_fit_size :: Ptr CFexpr -> CLong -> IO ()
+ Data.Number.Flint.Calcium.Fexpr: fexpr_func :: Ptr CFexpr -> Ptr CFexpr -> IO ()
+ Data.Number.Flint.Calcium.Fexpr: fexpr_get_fmpz :: Ptr CFmpz -> Ptr CFexpr -> IO CInt
+ Data.Number.Flint.Calcium.Fexpr: fexpr_get_fmpz_mpoly_q :: Ptr CFmpzMPolyQ -> Ptr CFexpr -> Ptr CFexprVec -> Ptr CFmpzMPolyCtx -> IO CInt
+ Data.Number.Flint.Calcium.Fexpr: fexpr_get_str :: Ptr CFexpr -> IO CString
+ Data.Number.Flint.Calcium.Fexpr: fexpr_get_str_latex :: Ptr CFexpr -> CULong -> IO CString
+ Data.Number.Flint.Calcium.Fexpr: fexpr_get_string :: Ptr CFexpr -> IO CString
+ Data.Number.Flint.Calcium.Fexpr: fexpr_get_symbol_str :: Ptr CFexpr -> IO CString
+ Data.Number.Flint.Calcium.Fexpr: fexpr_hash :: Ptr CFexpr -> IO CULong
+ Data.Number.Flint.Calcium.Fexpr: fexpr_init :: Ptr CFexpr -> IO ()
+ Data.Number.Flint.Calcium.Fexpr: fexpr_is_any_builtin_call :: Ptr CFexpr -> IO CInt
+ Data.Number.Flint.Calcium.Fexpr: fexpr_is_any_builtin_symbol :: Ptr CFexpr -> IO CInt
+ Data.Number.Flint.Calcium.Fexpr: fexpr_is_arithmetic_operation :: Ptr CFexpr -> IO CInt
+ Data.Number.Flint.Calcium.Fexpr: fexpr_is_atom :: Ptr CFexpr -> IO CInt
+ Data.Number.Flint.Calcium.Fexpr: fexpr_is_builtin_call :: Ptr CFexpr -> CLong -> IO CInt
+ Data.Number.Flint.Calcium.Fexpr: fexpr_is_builtin_symbol :: Ptr CFexpr -> CLong -> IO CInt
+ Data.Number.Flint.Calcium.Fexpr: fexpr_is_integer :: Ptr CFexpr -> IO CInt
+ Data.Number.Flint.Calcium.Fexpr: fexpr_is_neg_integer :: Ptr CFexpr -> IO CInt
+ Data.Number.Flint.Calcium.Fexpr: fexpr_is_string :: Ptr CFexpr -> IO CInt
+ Data.Number.Flint.Calcium.Fexpr: fexpr_is_symbol :: Ptr CFexpr -> IO CInt
+ Data.Number.Flint.Calcium.Fexpr: fexpr_is_zero :: Ptr CFexpr -> IO CInt
+ Data.Number.Flint.Calcium.Fexpr: fexpr_latex_logic :: FexprLatexFlag
+ Data.Number.Flint.Calcium.Fexpr: fexpr_latex_small :: FexprLatexFlag
+ Data.Number.Flint.Calcium.Fexpr: fexpr_mul :: Ptr CFexpr -> Ptr CFexpr -> Ptr CFexpr -> IO ()
+ Data.Number.Flint.Calcium.Fexpr: fexpr_nargs :: Ptr CFexpr -> IO CLong
+ Data.Number.Flint.Calcium.Fexpr: fexpr_neg :: Ptr CFexpr -> Ptr CFexpr -> IO ()
+ Data.Number.Flint.Calcium.Fexpr: fexpr_num_leaves :: Ptr CFexpr -> IO CLong
+ Data.Number.Flint.Calcium.Fexpr: fexpr_pow :: Ptr CFexpr -> Ptr CFexpr -> Ptr CFexpr -> IO ()
+ Data.Number.Flint.Calcium.Fexpr: fexpr_print :: Ptr CFexpr -> IO ()
+ Data.Number.Flint.Calcium.Fexpr: fexpr_print_latex :: Ptr CFexpr -> CULong -> IO ()
+ Data.Number.Flint.Calcium.Fexpr: fexpr_replace :: Ptr CFexpr -> Ptr CFexpr -> Ptr CFexpr -> Ptr CFexpr -> IO CInt
+ Data.Number.Flint.Calcium.Fexpr: fexpr_replace2 :: Ptr CFexpr -> Ptr CFexpr -> Ptr CFexpr -> Ptr CFexpr -> Ptr CFexpr -> Ptr CFexpr -> IO CInt
+ Data.Number.Flint.Calcium.Fexpr: fexpr_replace_vec :: Ptr CFexpr -> Ptr CFexpr -> Ptr CFexprVec -> Ptr CFexprVec -> IO CInt
+ Data.Number.Flint.Calcium.Fexpr: fexpr_set :: Ptr CFexpr -> Ptr CFexpr -> IO ()
+ Data.Number.Flint.Calcium.Fexpr: fexpr_set_arf :: Ptr CFexpr -> Ptr CArf -> IO ()
+ Data.Number.Flint.Calcium.Fexpr: fexpr_set_d :: Ptr CFexpr -> CDouble -> IO ()
+ Data.Number.Flint.Calcium.Fexpr: fexpr_set_fmpq :: Ptr CFexpr -> Ptr CFmpq -> IO ()
+ Data.Number.Flint.Calcium.Fexpr: fexpr_set_fmpz :: Ptr CFexpr -> Ptr CFmpz -> IO ()
+ Data.Number.Flint.Calcium.Fexpr: fexpr_set_fmpz_mpoly :: Ptr CFexpr -> Ptr CFmpzMPoly -> Ptr CFexprVec -> Ptr CFmpzMPolyCtx -> IO ()
+ Data.Number.Flint.Calcium.Fexpr: fexpr_set_fmpz_mpoly_q :: Ptr CFexpr -> Ptr CFmpzMPolyQ -> Ptr CFexprVec -> Ptr CFmpzMPolyCtx -> IO ()
+ Data.Number.Flint.Calcium.Fexpr: fexpr_set_re_im_d :: Ptr CFexpr -> CDouble -> CDouble -> IO ()
+ Data.Number.Flint.Calcium.Fexpr: fexpr_set_si :: Ptr CFexpr -> CLong -> IO ()
+ Data.Number.Flint.Calcium.Fexpr: fexpr_set_string :: Ptr CFexpr -> CString -> IO ()
+ Data.Number.Flint.Calcium.Fexpr: fexpr_set_symbol_builtin :: Ptr CFexpr -> CLong -> IO ()
+ Data.Number.Flint.Calcium.Fexpr: fexpr_set_symbol_str :: Ptr CFexpr -> CString -> IO ()
+ Data.Number.Flint.Calcium.Fexpr: fexpr_set_ui :: Ptr CFexpr -> CULong -> IO ()
+ Data.Number.Flint.Calcium.Fexpr: fexpr_size :: Ptr CFexpr -> IO CLong
+ Data.Number.Flint.Calcium.Fexpr: fexpr_size_bytes :: Ptr CFexpr -> IO CLong
+ Data.Number.Flint.Calcium.Fexpr: fexpr_sub :: Ptr CFexpr -> Ptr CFexpr -> Ptr CFexpr -> IO ()
+ Data.Number.Flint.Calcium.Fexpr: fexpr_swap :: Ptr CFexpr -> Ptr CFexpr -> IO ()
+ Data.Number.Flint.Calcium.Fexpr: fexpr_type_big_int_neg :: FexprType
+ Data.Number.Flint.Calcium.Fexpr: fexpr_type_big_int_pos :: FexprType
+ Data.Number.Flint.Calcium.Fexpr: fexpr_type_big_string :: FexprType
+ Data.Number.Flint.Calcium.Fexpr: fexpr_type_big_symbol :: FexprType
+ Data.Number.Flint.Calcium.Fexpr: fexpr_type_call0 :: FexprType
+ Data.Number.Flint.Calcium.Fexpr: fexpr_type_call1 :: FexprType
+ Data.Number.Flint.Calcium.Fexpr: fexpr_type_call2 :: FexprType
+ Data.Number.Flint.Calcium.Fexpr: fexpr_type_call3 :: FexprType
+ Data.Number.Flint.Calcium.Fexpr: fexpr_type_call4 :: FexprType
+ Data.Number.Flint.Calcium.Fexpr: fexpr_type_calln :: FexprType
+ Data.Number.Flint.Calcium.Fexpr: fexpr_type_small_int :: FexprType
+ Data.Number.Flint.Calcium.Fexpr: fexpr_type_small_string :: FexprType
+ Data.Number.Flint.Calcium.Fexpr: fexpr_type_small_symbol :: FexprType
+ Data.Number.Flint.Calcium.Fexpr: fexpr_vec_append :: Ptr CFexprVec -> Ptr CFexpr -> IO ()
+ Data.Number.Flint.Calcium.Fexpr: fexpr_vec_clear :: Ptr CFexprVec -> IO ()
+ Data.Number.Flint.Calcium.Fexpr: fexpr_vec_fit_length :: Ptr CFexprVec -> CLong -> IO ()
+ Data.Number.Flint.Calcium.Fexpr: fexpr_vec_init :: Ptr CFexprVec -> CLong -> IO ()
+ Data.Number.Flint.Calcium.Fexpr: fexpr_vec_insert_unique :: Ptr CFexprVec -> Ptr CFexpr -> IO CLong
+ Data.Number.Flint.Calcium.Fexpr: fexpr_vec_print :: Ptr CFexprVec -> IO ()
+ Data.Number.Flint.Calcium.Fexpr: fexpr_vec_set :: Ptr CFexprVec -> Ptr CFexprVec -> IO ()
+ Data.Number.Flint.Calcium.Fexpr: fexpr_vec_set_length :: Ptr CFexprVec -> CLong -> IO ()
+ Data.Number.Flint.Calcium.Fexpr: fexpr_vec_swap :: Ptr CFexprVec -> Ptr CFexprVec -> IO ()
+ Data.Number.Flint.Calcium.Fexpr: fexpr_view_arg :: Ptr CFexpr -> Ptr CFexpr -> CLong -> IO ()
+ Data.Number.Flint.Calcium.Fexpr: fexpr_view_func :: Ptr CFexpr -> Ptr CFexpr -> IO ()
+ Data.Number.Flint.Calcium.Fexpr: fexpr_view_next :: Ptr CFexpr -> IO ()
+ Data.Number.Flint.Calcium.Fexpr: fexpr_write :: Ptr CCalciumStream -> Ptr CFexpr -> IO ()
+ Data.Number.Flint.Calcium.Fexpr: fexpr_write_latex :: Ptr CCalciumStream -> Ptr CFexpr -> CULong -> IO ()
+ Data.Number.Flint.Calcium.Fexpr: fexpr_zero :: Ptr CFexpr -> IO ()
+ Data.Number.Flint.Calcium.Fexpr: newFexpr :: IO Fexpr
+ Data.Number.Flint.Calcium.Fexpr: newFexprVec :: CLong -> IO FexprVec
+ Data.Number.Flint.Calcium.Fexpr: withFexpr :: Fexpr -> (Ptr CFexpr -> IO a) -> IO (Fexpr, a)
+ Data.Number.Flint.Calcium.Fexpr: withFexprVec :: FexprVec -> (Ptr CFexprVec -> IO a) -> IO (FexprVec, a)
+ Data.Number.Flint.Calcium.Fexpr: withNewFexpr :: (Ptr CFexpr -> IO a) -> IO (Fexpr, a)
+ Data.Number.Flint.Calcium.Fexpr: withNewFexprVec :: CLong -> (Ptr CFexprVec -> IO a) -> IO (FexprVec, a)
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_AGM :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_AGMSequence :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Abs :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Acos :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Acosh :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Acot :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Acoth :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Acsc :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Acsch :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Add :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_AiryAi :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_AiryAiZero :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_AiryBi :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_AiryBiZero :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_AlgebraicNumberSerialized :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_AlgebraicNumbers :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_All :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_AnalyticContinuation :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_And :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_AngleBrackets :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Approximation :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Arg :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_ArgMax :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_ArgMaxUnique :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_ArgMin :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_ArgMinUnique :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Asec :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Asech :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Asin :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Asinh :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_AsymptoticTo :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Atan :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Atan2 :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Atanh :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_BarnesG :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_BellNumber :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_BernoulliB :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_BernoulliPolynomial :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_BernsteinEllipse :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_BesselI :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_BesselJ :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_BesselJZero :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_BesselK :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_BesselY :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_BesselYZero :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_BetaFunction :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Binomial :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Braces :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Brackets :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_CC :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Call :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_CallIndeterminate :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Cardinality :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_CarlsonHypergeometricR :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_CarlsonHypergeometricT :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_CarlsonRC :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_CarlsonRD :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_CarlsonRF :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_CarlsonRG :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_CarlsonRJ :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_CartesianPower :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_CartesianProduct :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Case :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Cases :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_CatalanConstant :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Ceil :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Characteristic :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_ChebyshevT :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_ChebyshevU :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_ClosedComplexDisk :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_ClosedOpenInterval :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Coefficient :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Column :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_ColumnMatrix :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_CommutativeRings :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_ComplexBranchDerivative :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_ComplexDerivative :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_ComplexInfinities :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_ComplexLimit :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_ComplexSignedInfinities :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_ComplexSingularityClosure :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_ComplexZeroMultiplicity :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Concatenation :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_CongruentMod :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Conjugate :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_ConreyGenerator :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Cos :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_CosIntegral :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Cosh :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_CoshIntegral :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Cot :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Coth :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_CoulombC :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_CoulombF :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_CoulombG :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_CoulombH :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_CoulombSigma :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Csc :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Csch :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Csgn :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_CurvePath :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Cyclotomic :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Decimal :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_DedekindEta :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_DedekindEtaEpsilon :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_DedekindSum :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Def :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Delta :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Delta_ :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Derivative :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Det :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_DiagonalMatrix :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_DigammaFunction :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_DigammaFunctionZero :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_DirichletCharacter :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_DirichletGroup :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_DirichletL :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_DirichletLZero :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_DirichletLambda :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_DiscreteLog :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Div :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Divides :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_DivisorProduct :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_DivisorSigma :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_DivisorSum :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_DoubleFactorial :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_EisensteinE :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_EisensteinG :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Element :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Ellipsis :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_EllipticE :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_EllipticK :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_EllipticPi :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_EllipticRootE :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Enclosure :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Equal :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_EqualAndElement :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_EqualNearestDecimal :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_EqualQSeriesEllipsis :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Equivalent :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Erf :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Erfc :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Erfi :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Euler :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_EulerE :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_EulerPhi :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_EulerPolynomial :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_EulerQSeries :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Exists :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Exp :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_ExpIntegralE :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_ExpIntegralEi :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_ExtendedRealNumbers :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Factorial :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_FallingFactorial :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_False :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Fibonacci :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Fields :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_FiniteField :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Floor :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_For :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_FormalLaurentSeries :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_FormalPowerSeries :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_FormalPuiseuxSeries :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_FresnelC :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_FresnelS :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Fun :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_GCD :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Gamma :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_GaussLegendreWeight :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_GaussSum :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_GegenbauerC :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_GeneralLinearGroup :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_GeneralizedBernoulliB :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_GeneralizedRiemannHypothesis :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_GlaisherConstant :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_GoldenRatio :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Greater :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_GreaterEqual :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_GreekGamma :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_GreekGamma_ :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_GreekPi :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_GreekPi_ :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Guess :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_HankelH1 :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_HankelH2 :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_HarmonicNumber :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_HermiteH :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_HilbertClassPolynomial :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_HilbertMatrix :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_HurwitzZeta :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Hypergeometric0F1 :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Hypergeometric0F1Regularized :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Hypergeometric1F1 :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Hypergeometric1F1Regularized :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Hypergeometric1F2 :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Hypergeometric1F2Regularized :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Hypergeometric2F0 :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Hypergeometric2F1 :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Hypergeometric2F1Regularized :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Hypergeometric2F2 :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Hypergeometric2F2Regularized :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Hypergeometric3F2 :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Hypergeometric3F2Regularized :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_HypergeometricU :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_HypergeometricUStar :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_HypergeometricUStarRemainder :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_IdentityMatrix :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Im :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Implies :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_IncompleteBeta :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_IncompleteBetaRegularized :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_IncompleteEllipticE :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_IncompleteEllipticF :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_IncompleteEllipticPi :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_IndefiniteIntegralEqual :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Infimum :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Infinity :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_IntegersGreaterEqual :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_IntegersLessEqual :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Integral :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Intersection :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Interval :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_IsEven :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_IsHolomorphicOn :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_IsMeromorphicOn :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_IsOdd :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_IsPrime :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Item :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_JacobiP :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_JacobiSymbol :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_JacobiTheta :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_JacobiThetaEpsilon :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_JacobiThetaPermutation :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_JacobiThetaQ :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_KeiperLiLambda :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_KhinchinConstant :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_KroneckerDelta :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_KroneckerSymbol :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_LCM :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_LaguerreL :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_LambertW :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Lamda :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Lamda_ :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_LandauG :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Lattice :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_LeftLimit :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_LegendreP :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_LegendrePolynomialZero :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_LegendreSymbol :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Length :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_LerchPhi :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Less :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_LessEqual :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Limit :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_LiouvilleLambda :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_List :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Log :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_LogBarnesG :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_LogBarnesGRemainder :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_LogGamma :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_LogIntegral :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Logic :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_LowerGamma :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Matrices :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Matrix :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Matrix2x2 :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Max :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Maximum :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_MeromorphicDerivative :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_MeromorphicLimit :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Min :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Minimum :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Mod :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_ModularGroupAction :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_ModularGroupFundamentalDomain :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_ModularJ :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_ModularLambda :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_ModularLambdaFundamentalDomain :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_MoebiusMu :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Mul :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_MultiZetaValue :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_NN :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Neg :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Not :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_NotElement :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_NotEqual :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_NumberE :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_NumberI :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Omega :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Omega_ :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_One :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_OpenClosedInterval :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_OpenComplexDisk :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_OpenInterval :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_OpenRealBall :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Or :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Otherwise :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_PSL2Z :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Parentheses :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_PartitionsP :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Path :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Phi :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Phi_ :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Pi :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Pol :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Poles :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_PolyLog :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Polynomial :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_PolynomialDegree :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_PolynomialFractions :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_PolynomialRootIndexed :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_PolynomialRootNearest :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Polynomials :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Pos :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Pow :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Prime :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_PrimePi :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_PrimeProduct :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_PrimeSum :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Primes :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_PrimitiveDirichletCharacters :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_PrimitiveReducedPositiveIntegralBinaryQuadraticForms :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Product :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_ProjectiveComplexNumbers :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_ProjectiveRealNumbers :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Psi :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Psi_ :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_QQ :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_QSeriesCoefficient :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_QuotientRing :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_RR :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Range :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Re :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_RealAbs :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_RealAlgebraicNumbers :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_RealBall :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_RealDerivative :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_RealInfinities :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_RealLimit :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_RealSignedInfinities :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_RealSingularityClosure :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Repeat :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Residue :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_RiemannHypothesis :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_RiemannXi :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_RiemannZeta :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_RiemannZetaZero :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_RightLimit :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Rings :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_RisingFactorial :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Root :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_RootOfUnity :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Row :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_RowMatrix :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_SL2Z :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Same :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Sec :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Sech :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_SequenceLimit :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_SequenceLimitInferior :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_SequenceLimitSuperior :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Ser :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Set :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_SetMinus :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Sets :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_ShowExpandedNormalForm :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Sigma :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Sigma_ :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Sign :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_SignExtendedComplexNumbers :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Sin :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_SinIntegral :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Sinc :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_SingularValues :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Sinh :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_SinhIntegral :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_SloaneA :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Solutions :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_SpecialLinearGroup :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Spectrum :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_SphericalHarmonicY :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Sqrt :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_SquaresR :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Step :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_StieltjesGamma :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_StirlingCycle :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_StirlingS1 :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_StirlingS2 :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_StirlingSeriesRemainder :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Sub :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Subscript :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Subset :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_SubsetEqual :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Subsets :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Sum :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Supremum :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_SymmetricPolynomial :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Tan :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Tanh :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Theta :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Theta_ :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_True :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Tuple :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Tuples :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Undefined :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Union :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_UniqueSolution :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_UniqueZero :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_UnitCircle :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Unknown :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_UnsignedInfinity :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_UpperGamma :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_UpperHalfPlane :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_WeierstrassP :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_WeierstrassSigma :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_WeierstrassZeta :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Where :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_XGCD :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_XX :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Xi :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Xi_ :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_ZZ :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Zero :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_ZeroMatrix :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_Zeros :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_alpha :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_alpha_ :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_beta :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_beta_ :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_chi :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_chi_ :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_delta :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_delta_ :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_ell :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_ell_ :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_epsilon :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_epsilon_ :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_eta :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_eta_ :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_gamma :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_gamma_ :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_iota :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_iota_ :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_kappa :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_kappa_ :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_lamda :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_lamda_ :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_mu :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_mu_ :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_nu :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_nu_ :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_omega :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_omega_ :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_phi :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_phi_ :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_pi :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_pi_ :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_rho :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_rho_ :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_sigma :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_sigma_ :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_tau :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_tau_ :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_theta :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_theta_ :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_varphi :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_varphi_ :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_vartheta :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_vartheta_ :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_xi :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_xi_ :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_zeta :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: FEXPR_zeta_ :: FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: data FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: fexpr_builtin_hash :: Map FEXR_Builtin CLong
+ Data.Number.Flint.Calcium.Fexpr.Builtin: fexpr_builtin_hash_name :: Map String CLong
+ Data.Number.Flint.Calcium.Fexpr.Builtin: fexpr_builtin_length :: Integer
+ Data.Number.Flint.Calcium.Fexpr.Builtin: fexpr_builtin_lookup :: CString -> IO CLong
+ Data.Number.Flint.Calcium.Fexpr.Builtin: fexpr_builtin_name :: CLong -> IO CString
+ Data.Number.Flint.Calcium.Fexpr.Builtin: instance GHC.Classes.Eq Data.Number.Flint.Calcium.Fexpr.Builtin.FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: instance GHC.Classes.Ord Data.Number.Flint.Calcium.Fexpr.Builtin.FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: instance GHC.Enum.Enum Data.Number.Flint.Calcium.Fexpr.Builtin.FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Builtin: instance GHC.Show.Show Data.Number.Flint.Calcium.Fexpr.Builtin.FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Instances: class FlintExpression a
+ Data.Number.Flint.Calcium.Fexpr.Instances: instance Data.Number.Flint.Calcium.Fexpr.Instances.FlintExpression Data.Number.Flint.Arb.Types.FFI.Arf
+ Data.Number.Flint.Calcium.Fexpr.Instances: instance Data.Number.Flint.Calcium.Fexpr.Instances.FlintExpression Data.Number.Flint.Calcium.Fexpr.Builtin.FEXR_Builtin
+ Data.Number.Flint.Calcium.Fexpr.Instances: instance Data.Number.Flint.Calcium.Fexpr.Instances.FlintExpression Data.Number.Flint.Fmpq.FFI.Fmpq
+ Data.Number.Flint.Calcium.Fexpr.Instances: instance Data.Number.Flint.Calcium.Fexpr.Instances.FlintExpression Data.Number.Flint.Fmpz.FFI.Fmpz
+ Data.Number.Flint.Calcium.Fexpr.Instances: instance Data.Number.Flint.Calcium.Fexpr.Instances.FlintExpression Foreign.C.Types.CDouble
+ Data.Number.Flint.Calcium.Fexpr.Instances: instance Data.Number.Flint.Calcium.Fexpr.Instances.FlintExpression Foreign.C.Types.CLong
+ Data.Number.Flint.Calcium.Fexpr.Instances: instance Data.Number.Flint.Calcium.Fexpr.Instances.FlintExpression Foreign.C.Types.CULong
+ Data.Number.Flint.Calcium.Fexpr.Instances: instance Data.Number.Flint.Calcium.Fexpr.Instances.FlintExpression GHC.Base.String
+ Data.Number.Flint.Calcium.Fexpr.Instances: instance GHC.Num.Num Data.Number.Flint.Calcium.Fexpr.FFI.Fexpr
+ Data.Number.Flint.Calcium.Fexpr.Instances: instance GHC.Show.Show Data.Number.Flint.Calcium.Fexpr.FFI.Fexpr
+ Data.Number.Flint.Calcium.Fexpr.Instances: lift1 :: (Ptr CFexpr -> Ptr CFexpr -> IO a) -> Fexpr -> Fexpr
+ Data.Number.Flint.Calcium.Fexpr.Instances: lift2 :: (Ptr CFexpr -> Ptr CFexpr -> Ptr CFexpr -> IO a) -> Fexpr -> Fexpr -> Fexpr
+ Data.Number.Flint.Calcium.Fexpr.Instances: liftTo :: (Ptr CFexpr -> t -> IO a) -> t -> IO Fexpr
+ Data.Number.Flint.Calcium.Fexpr.Instances: toFexpr :: FlintExpression a => a -> IO Fexpr
+ Data.Number.Flint.Flint: FRandState :: {-# UNPACK #-} !ForeignPtr CFRandState -> FRandState
+ Data.Number.Flint.Flint: data FRandState
+ Data.Number.Flint.Flint: flint_bits :: CULong
+ Data.Number.Flint.Flint: flint_calloc :: Ptr CSize -> Ptr CSize -> IO ()
+ Data.Number.Flint.Flint: flint_get_num_threads :: IO ()
+ Data.Number.Flint.Flint: flint_malloc :: Ptr CSize -> IO ()
+ Data.Number.Flint.Flint: flint_rand_alloc :: IO (Ptr CFRandState)
+ Data.Number.Flint.Flint: flint_rand_free :: Ptr CFRandState -> IO ()
+ Data.Number.Flint.Flint: flint_randclear :: Ptr CFRandState -> IO ()
+ Data.Number.Flint.Flint: flint_randinit :: Ptr CFRandState -> IO ()
+ Data.Number.Flint.Flint: flint_realloc :: Ptr () -> Ptr CSize -> IO ()
+ Data.Number.Flint.Flint: flint_reset_num_workers :: CInt -> IO ()
+ Data.Number.Flint.Flint: flint_set_num_threads :: CInt -> IO ()
+ Data.Number.Flint.Flint: flint_set_num_workers :: CInt -> IO CInt
+ Data.Number.Flint.Flint: newFRandState :: IO FRandState
+ Data.Number.Flint.Flint: type CFRandState = CFlint FRandState
+ Data.Number.Flint.Flint: withFRandState :: FRandState -> (Ptr CFRandState -> IO a) -> IO (FRandState, a)
+ Data.Number.Flint.Flint.External: CMp :: {-# UNPACK #-} !ForeignPtr CMp -> Mp
+ Data.Number.Flint.Flint.External: CMpf :: {-# UNPACK #-} !ForeignPtr CMpf -> Mpf
+ Data.Number.Flint.Flint.External: CMpfr :: {-# UNPACK #-} !ForeignPtr CMpfr -> Mpfr
+ Data.Number.Flint.Flint.External: CMpfrPrec :: CInt -> CMpfrPrec
+ Data.Number.Flint.Flint.External: CMpfrRnd :: CInt -> CMpfrRnd
+ Data.Number.Flint.Flint.External: CMpq :: {-# UNPACK #-} !ForeignPtr CMpq -> Mpq
+ Data.Number.Flint.Flint.External: CMpz :: {-# UNPACK #-} !ForeignPtr CMpz -> Mpz
+ Data.Number.Flint.Flint.External: GmpRandstate :: {-# UNPACK #-} !ForeignPtr CGmpRandstate -> GmpRandstate
+ Data.Number.Flint.Flint.External: [_MpfrPrec] :: CMpfrPrec -> CInt
+ Data.Number.Flint.Flint.External: [_MpfrRnd] :: CMpfrRnd -> CInt
+ Data.Number.Flint.Flint.External: data GmpRandstate
+ Data.Number.Flint.Flint.External: data Mp
+ Data.Number.Flint.Flint.External: data Mpf
+ Data.Number.Flint.Flint.External: data Mpfr
+ Data.Number.Flint.Flint.External: data Mpq
+ Data.Number.Flint.Flint.External: data Mpz
+ Data.Number.Flint.Flint.External: newtype CMpfrPrec
+ Data.Number.Flint.Flint.External: newtype CMpfrRnd
+ Data.Number.Flint.Flint.External: type CGmpRandstate = CFlint GmpRandstate
+ Data.Number.Flint.Flint.External: type CMp = CFlint Mp
+ Data.Number.Flint.Flint.External: type CMpBitCnt = Word64
+ Data.Number.Flint.Flint.External: type CMpLimb = Word64
+ Data.Number.Flint.Flint.External: type CMpSLimb = Int64
+ Data.Number.Flint.Flint.External: type CMpSize = Int64
+ Data.Number.Flint.Flint.External: type CMpf = CFlint Mpf
+ Data.Number.Flint.Flint.External: type CMpfr = CFlint Mpfr
+ Data.Number.Flint.Flint.External: type CMpq = CFlint Mpq
+ Data.Number.Flint.Flint.External: type CMpz = CFlint Mpz
+ Data.Number.Flint.Flint.Internal: class Flint a where {
+ Data.Number.Flint.Flint.Internal: data CFlint a :: *;
+ Data.Number.Flint.Flint.Internal: printCStr :: (Ptr a -> IO CString) -> Ptr a -> IO CInt
+ Data.Number.Flint.Flint.Internal: printCVec :: Storable a => (Ptr a -> IO CInt) -> Ptr a -> CLong -> IO CInt
+ Data.Number.Flint.Flint.Internal: type CFBitCnt = Word64
+ Data.Number.Flint.Flint.Internal: }
+ Data.Number.Flint.Fmpq.Instances: data Fmpq
+ Data.Number.Flint.Fmpq.Instances: instance GHC.Classes.Eq Data.Number.Flint.Fmpq.FFI.Fmpq
+ Data.Number.Flint.Fmpq.Instances: instance GHC.Classes.Ord Data.Number.Flint.Fmpq.FFI.Fmpq
+ Data.Number.Flint.Fmpq.Instances: instance GHC.Num.Num Data.Number.Flint.Fmpq.FFI.Fmpq
+ Data.Number.Flint.Fmpq.Instances: instance GHC.Read.Read Data.Number.Flint.Fmpq.FFI.Fmpq
+ Data.Number.Flint.Fmpq.Instances: instance GHC.Real.Fractional Data.Number.Flint.Fmpq.FFI.Fmpq
+ Data.Number.Flint.Fmpq.Instances: instance GHC.Real.Real Data.Number.Flint.Fmpq.FFI.Fmpq
+ Data.Number.Flint.Fmpq.Instances: instance GHC.Real.RealFrac Data.Number.Flint.Fmpq.FFI.Fmpq
+ Data.Number.Flint.Fmpq.Instances: instance GHC.Show.Show Data.Number.Flint.Fmpq.FFI.Fmpq
+ Data.Number.Flint.Fmpq.Mat.Instances: instance GHC.Base.Semigroup Data.Number.Flint.Fmpq.Mat.FFI.FmpqMat
+ Data.Number.Flint.Fmpq.Mat.Instances: instance GHC.Classes.Eq Data.Number.Flint.Fmpq.Mat.FFI.FmpqMat
+ Data.Number.Flint.Fmpq.Mat.Instances: instance GHC.Num.Num Data.Number.Flint.Fmpq.Mat.FFI.FmpqMat
+ Data.Number.Flint.Fmpq.Mat.Instances: instance GHC.Real.Fractional Data.Number.Flint.Fmpq.Mat.FFI.FmpqMat
+ Data.Number.Flint.Fmpq.Mat.Instances: instance GHC.Show.Show Data.Number.Flint.Fmpq.Mat.FFI.FmpqMat
+ Data.Number.Flint.Fmpq.Mat.Instances: lift1 :: (Ptr CFmpqMat -> Ptr CFmpqMat -> IO a) -> FmpqMat -> FmpqMat
+ Data.Number.Flint.Fmpq.Mat.Instances: lift2 :: (Ptr CFmpqMat -> Ptr CFmpqMat -> Ptr CFmpqMat -> IO a) -> FmpqMat -> FmpqMat -> FmpqMat
+ Data.Number.Flint.Fmpq.Poly.Instances: FmpqPoly :: {-# UNPACK #-} !ForeignPtr CFmpqPoly -> FmpqPoly
+ Data.Number.Flint.Fmpq.Poly.Instances: data FmpqPoly
+ Data.Number.Flint.Fmpq.Poly.Instances: instance GHC.Exts.IsList Data.Number.Flint.Fmpq.Poly.FFI.FmpqPoly
+ Data.Number.Flint.Fmpq.Poly.Instances: instance GHC.Num.Num Data.Number.Flint.Fmpq.Poly.FFI.FmpqPoly
+ Data.Number.Flint.Fmpq.Poly.Instances: instance GHC.Read.Read Data.Number.Flint.Fmpq.Poly.FFI.FmpqPoly
+ Data.Number.Flint.Fmpq.Poly.Instances: instance GHC.Show.Show Data.Number.Flint.Fmpq.Poly.FFI.FmpqPoly
+ Data.Number.Flint.Fmpz: fmpz_clog_ui :: Ptr CFmpz -> CULong -> IO CLong
+ Data.Number.Flint.Fmpz.Instances: class (Num a) => UFD a
+ Data.Number.Flint.Fmpz.Instances: data Fmpz
+ Data.Number.Flint.Fmpz.Instances: factor :: UFD a => a -> [(a, Int)]
+ Data.Number.Flint.Fmpz.Instances: instance Data.Number.Flint.UFD.UFD Data.Number.Flint.Fmpz.FFI.Fmpz
+ Data.Number.Flint.Fmpz.Instances: instance GHC.Classes.Eq Data.Number.Flint.Fmpz.FFI.Fmpz
+ Data.Number.Flint.Fmpz.Instances: instance GHC.Classes.Ord Data.Number.Flint.Fmpz.FFI.Fmpz
+ Data.Number.Flint.Fmpz.Instances: instance GHC.Enum.Enum Data.Number.Flint.Fmpz.FFI.Fmpz
+ Data.Number.Flint.Fmpz.Instances: instance GHC.Num.Num Data.Number.Flint.Fmpz.FFI.Fmpz
+ Data.Number.Flint.Fmpz.Instances: instance GHC.Read.Read Data.Number.Flint.Fmpz.FFI.Fmpz
+ Data.Number.Flint.Fmpz.Instances: instance GHC.Real.Integral Data.Number.Flint.Fmpz.FFI.Fmpz
+ Data.Number.Flint.Fmpz.Instances: instance GHC.Real.Real Data.Number.Flint.Fmpz.FFI.Fmpz
+ Data.Number.Flint.Fmpz.Instances: instance GHC.Show.Show Data.Number.Flint.Fmpz.FFI.Fmpz
+ Data.Number.Flint.Fmpz.Instances: instance Test.QuickCheck.Arbitrary.Arbitrary Data.Number.Flint.Fmpz.FFI.Fmpz
+ Data.Number.Flint.Fmpz.Instances: unfactor :: UFD a => [(a, Int)] -> a
+ Data.Number.Flint.Fmpz.MPoly: withNewFmpzMPoly :: FmpzMPolyCtx -> (Ptr CFmpzMPoly -> IO a) -> IO (FmpzMPoly, a)
+ Data.Number.Flint.Fmpz.MPoly: withNewFmpzMPolyCtx :: CLong -> COrdering -> (Ptr CFmpzMPolyCtx -> IO a) -> IO (FmpzMPolyCtx, a)
+ Data.Number.Flint.Fmpz.MPoly.Factor: fmpz_mpoly_factor_fprint_pretty :: Ptr CFile -> Ptr CFmpzMPolyFactor -> Ptr (Ptr CChar) -> Ptr CFmpzMPolyCtx -> IO ()
+ Data.Number.Flint.Fmpz.MPoly.Factor: fmpz_mpoly_factor_print_pretty :: Ptr CFmpzMPolyFactor -> Ptr (Ptr CChar) -> Ptr CFmpzMPolyCtx -> IO ()
+ Data.Number.Flint.Fmpz.MPoly.Factor: fmpz_mpoly_get_str_pretty :: Ptr CFmpzMPoly -> Ptr (Ptr CChar) -> Ptr CFmpzMPolyCtx -> IO CString
+ Data.Number.Flint.Fmpz.MPoly.Factor: withNewFmpzMPolyFactor :: FmpzMPolyCtx -> (Ptr CFmpzMPolyFactor -> IO a) -> IO (FmpzMPolyFactor, a)
+ Data.Number.Flint.Fmpz.Mat.Instances: instance GHC.Base.Semigroup Data.Number.Flint.Fmpz.Mat.FFI.FmpzMat
+ Data.Number.Flint.Fmpz.Mat.Instances: instance GHC.Classes.Eq Data.Number.Flint.Fmpz.Mat.FFI.FmpzMat
+ Data.Number.Flint.Fmpz.Mat.Instances: instance GHC.Num.Num Data.Number.Flint.Fmpz.Mat.FFI.FmpzMat
+ Data.Number.Flint.Fmpz.Mat.Instances: instance GHC.Show.Show Data.Number.Flint.Fmpz.Mat.FFI.FmpzMat
+ Data.Number.Flint.Fmpz.Mat.Instances: lift1 :: (Ptr CFmpzMat -> Ptr CFmpzMat -> IO a) -> FmpzMat -> FmpzMat
+ Data.Number.Flint.Fmpz.Mat.Instances: lift2 :: (Ptr CFmpzMat -> Ptr CFmpzMat -> Ptr CFmpzMat -> IO a) -> FmpzMat -> FmpzMat -> FmpzMat
+ Data.Number.Flint.Fmpz.Mod.Poly: FmpzModPolyRadix :: {-# UNPACK #-} !ForeignPtr CFmpzModPolyRadix -> FmpzModPolyRadix
+ Data.Number.Flint.Fmpz.Mod.Poly: data FmpzModPolyRadix
+ Data.Number.Flint.Fmpz.Mod.Poly: fmpz_mod_poly_radix_clear :: Ptr CFmpzModPolyRadix -> IO ()
+ Data.Number.Flint.Fmpz.Mod.Poly: newFmpzModPolyRadix :: FmpzModPoly -> CLong -> FmpzModCtx -> IO FmpzModPolyRadix
+ Data.Number.Flint.Fmpz.Mod.Poly: type CFmpzModPolyRadix = CFlint FmpzModPolyRadix
+ Data.Number.Flint.Fmpz.Mod.Poly: withFmpzModPolyRadix :: FmpzModPolyRadix -> (Ptr CFmpzModPolyRadix -> IO a) -> IO (FmpzModPolyRadix, a)
+ Data.Number.Flint.Fmpz.Poly: fmpz_poly_bound_roots :: Ptr CFmpz -> Ptr CFmpzPoly -> IO ()
+ Data.Number.Flint.Fmpz.Poly: fmpz_poly_chebyshev_t :: Ptr CFmpzPoly -> CULong -> IO ()
+ Data.Number.Flint.Fmpz.Poly: fmpz_poly_chebyshev_u :: Ptr CFmpzPoly -> CULong -> IO ()
+ Data.Number.Flint.Fmpz.Poly: fmpz_poly_cos_minpoly :: Ptr CFmpzPoly -> CULong -> IO ()
+ Data.Number.Flint.Fmpz.Poly: fmpz_poly_eta_qexp :: Ptr CFmpzPoly -> CLong -> CLong -> IO ()
+ Data.Number.Flint.Fmpz.Poly: fmpz_poly_is_cyclotomic :: Ptr CFmpzPoly -> IO CULong
+ Data.Number.Flint.Fmpz.Poly: fmpz_poly_pseudo_divrem :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CULong -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()
+ Data.Number.Flint.Fmpz.Poly: fmpz_poly_randtest_irreducible :: Ptr CFmpzPoly -> Ptr CFRandState -> CLong -> CMpBitCnt -> IO ()
+ Data.Number.Flint.Fmpz.Poly: fmpz_poly_randtest_irreducible1 :: Ptr CFmpzPoly -> Ptr CFRandState -> CLong -> CMpBitCnt -> IO ()
+ Data.Number.Flint.Fmpz.Poly: fmpz_poly_randtest_irreducible2 :: Ptr CFmpzPoly -> Ptr CFRandState -> CLong -> CMpBitCnt -> IO ()
+ Data.Number.Flint.Fmpz.Poly: fmpz_poly_swinnerton_dyer :: Ptr CFmpzPoly -> CULong -> IO ()
+ Data.Number.Flint.Fmpz.Poly: fmpz_poly_theta_qexp :: Ptr CFmpzPoly -> CLong -> CLong -> IO ()
+ Data.Number.Flint.Fmpz.Poly.Factor: withNewFmpzPolyFactor :: (Ptr CFmpzPolyFactor -> IO a) -> IO (FmpzPolyFactor, a)
+ Data.Number.Flint.Fmpz.Poly.Instances: FmpzPoly :: {-# UNPACK #-} !ForeignPtr CFmpzPoly -> FmpzPoly
+ Data.Number.Flint.Fmpz.Poly.Instances: data FmpzPoly
+ Data.Number.Flint.Fmpz.Poly.Instances: instance Data.Number.Flint.UFD.UFD Data.Number.Flint.Fmpz.Poly.FFI.FmpzPoly
+ Data.Number.Flint.Fmpz.Poly.Instances: instance GHC.Base.Semigroup Data.Number.Flint.Fmpz.Poly.FFI.FmpzPoly
+ Data.Number.Flint.Fmpz.Poly.Instances: instance GHC.Classes.Eq Data.Number.Flint.Fmpz.Poly.FFI.FmpzPoly
+ Data.Number.Flint.Fmpz.Poly.Instances: instance GHC.Classes.Ord Data.Number.Flint.Fmpz.Poly.FFI.FmpzPoly
+ Data.Number.Flint.Fmpz.Poly.Instances: instance GHC.Enum.Enum Data.Number.Flint.Fmpz.Poly.FFI.FmpzPoly
+ Data.Number.Flint.Fmpz.Poly.Instances: instance GHC.Exts.IsList Data.Number.Flint.Fmpz.Poly.FFI.FmpzPoly
+ Data.Number.Flint.Fmpz.Poly.Instances: instance GHC.Num.Num Data.Number.Flint.Fmpz.Poly.FFI.FmpzPoly
+ Data.Number.Flint.Fmpz.Poly.Instances: instance GHC.Read.Read Data.Number.Flint.Fmpz.Poly.FFI.FmpzPoly
+ Data.Number.Flint.Fmpz.Poly.Instances: instance GHC.Real.Integral Data.Number.Flint.Fmpz.Poly.FFI.FmpzPoly
+ Data.Number.Flint.Fmpz.Poly.Instances: instance GHC.Real.Real Data.Number.Flint.Fmpz.Poly.FFI.FmpzPoly
+ Data.Number.Flint.Fmpz.Poly.Instances: instance GHC.Show.Show Data.Number.Flint.Fmpz.Poly.FFI.FmpzPoly
+ Data.Number.Flint.Fmpz.Poly.Instances: instance Test.QuickCheck.Arbitrary.Arbitrary Data.Number.Flint.Fmpz.Poly.FFI.FmpzPoly
+ Data.Number.Flint.Fmpz.Poly.Q.Instances: FmpzPolyQ :: {-# UNPACK #-} !ForeignPtr CFmpzPolyQ -> FmpzPolyQ
+ Data.Number.Flint.Fmpz.Poly.Q.Instances: data FmpzPolyQ
+ Data.Number.Flint.Fmpz.Poly.Q.Instances: instance Data.Number.Flint.Quotient.Quotient Data.Number.Flint.Fmpz.Poly.Q.FFI.FmpzPolyQ Data.Number.Flint.Fmpz.Poly.FFI.FmpzPoly
+ Data.Number.Flint.Fmpz.Poly.Q.Instances: instance GHC.Classes.Eq Data.Number.Flint.Fmpz.Poly.Q.FFI.FmpzPolyQ
+ Data.Number.Flint.Fmpz.Poly.Q.Instances: instance GHC.Classes.Ord Data.Number.Flint.Fmpz.Poly.Q.FFI.FmpzPolyQ
+ Data.Number.Flint.Fmpz.Poly.Q.Instances: instance GHC.Enum.Enum Data.Number.Flint.Fmpz.Poly.Q.FFI.FmpzPolyQ
+ Data.Number.Flint.Fmpz.Poly.Q.Instances: instance GHC.Num.Num Data.Number.Flint.Fmpz.Poly.Q.FFI.FmpzPolyQ
+ Data.Number.Flint.Fmpz.Poly.Q.Instances: instance GHC.Real.Real Data.Number.Flint.Fmpz.Poly.Q.FFI.FmpzPolyQ
+ Data.Number.Flint.Fmpz.Poly.Q.Instances: instance GHC.Show.Show Data.Number.Flint.Fmpz.Poly.Q.FFI.FmpzPolyQ
+ Data.Number.Flint.Fq.Embed: _fq_embed_gens_naive :: Ptr CFq -> Ptr CFq -> Ptr CFmpzModPoly -> Ptr CFqCtx -> Ptr CFqCtx -> IO ()
+ Data.Number.Flint.Fq.Embed: fq_embed_composition_matrix :: Ptr CFmpzModMat -> Ptr CFq -> Ptr CFqCtx -> IO ()
+ Data.Number.Flint.Fq.Embed: fq_embed_composition_matrix_sub :: Ptr CFmpzModMat -> Ptr CFq -> Ptr CFqCtx -> CLong -> IO ()
+ Data.Number.Flint.Fq.Embed: fq_embed_dual_to_mono_matrix :: Ptr CFmpzModMat -> Ptr CFqCtx -> IO ()
+ Data.Number.Flint.Fq.Embed: fq_embed_gens :: Ptr CFq -> Ptr CFq -> Ptr CFmpzModPoly -> Ptr CFqCtx -> Ptr CFqCtx -> IO ()
+ Data.Number.Flint.Fq.Embed: fq_embed_matrices :: Ptr CFmpzModMat -> Ptr CFmpzModMat -> Ptr CFq -> Ptr CFqCtx -> Ptr CFq -> Ptr CFqCtx -> Ptr CFmpzModPoly -> IO ()
+ Data.Number.Flint.Fq.Embed: fq_embed_mono_to_dual_matrix :: Ptr CFmpzModMat -> Ptr CFqCtx -> IO ()
+ Data.Number.Flint.Fq.Embed: fq_embed_mul_matrix :: Ptr CFmpzModMat -> Ptr CFq -> Ptr CFqCtx -> IO ()
+ Data.Number.Flint.Fq.Embed: fq_embed_trace_matrix :: Ptr CFmpzModMat -> Ptr CFmpzModMat -> Ptr CFqCtx -> Ptr CFqCtx -> IO ()
+ Data.Number.Flint.Fq.Embed: fq_modulus_derivative_inv :: Ptr CFq -> Ptr CFq -> Ptr CFqCtx -> IO ()
+ Data.Number.Flint.Fq.Embed: fq_modulus_pow_series_inv :: Ptr CFmpzModPoly -> Ptr CFqCtx -> CLong -> IO ()
+ Data.Number.Flint.Fq.NMod.Types: CFqNModCtx :: Ptr CFmpz -> Ptr CNMod -> CInt -> CInt -> Ptr CMpLimb -> Ptr CLong -> Ptr CLong -> Ptr CNModPoly -> Ptr CNModPoly -> CString -> CFqNModCtx
+ Data.Number.Flint.Fq.NMod.Types: CFqNModMat :: Ptr CFqNMod -> CLong -> CLong -> Ptr (Ptr CFqNMod) -> CFqNModMat
+ Data.Number.Flint.Fq.NMod.Types: CFqNModPolyFactor :: Ptr CFqNModPoly -> Ptr CLong -> CLong -> CLong -> CFqNModPolyFactor
+ Data.Number.Flint.Fq.NMod.Types: FqNMod :: {-# UNPACK #-} !ForeignPtr CFqNMod -> FqNMod
+ Data.Number.Flint.Fq.NMod.Types: FqNModCtx :: {-# UNPACK #-} !ForeignPtr CFqNModCtx -> FqNModCtx
+ Data.Number.Flint.Fq.NMod.Types: FqNModMPoly :: {-# UNPACK #-} !ForeignPtr CFqNModMPoly -> FqNModMPoly
+ Data.Number.Flint.Fq.NMod.Types: FqNModMat :: {-# UNPACK #-} !ForeignPtr CFqNModMat -> FqNModMat
+ Data.Number.Flint.Fq.NMod.Types: FqNModPoly :: {-# UNPACK #-} !ForeignPtr CFqNModPoly -> FqNModPoly
+ Data.Number.Flint.Fq.NMod.Types: FqNModPolyFactor :: {-# UNPACK #-} !ForeignPtr CFqNModPolyFactor -> FqNModPolyFactor
+ Data.Number.Flint.Fq.NMod.Types: data CFqNModCtx
+ Data.Number.Flint.Fq.NMod.Types: data CFqNModMat
+ Data.Number.Flint.Fq.NMod.Types: data CFqNModPolyFactor
+ Data.Number.Flint.Fq.NMod.Types: data FqNMod
+ Data.Number.Flint.Fq.NMod.Types: data FqNModCtx
+ Data.Number.Flint.Fq.NMod.Types: data FqNModMPoly
+ Data.Number.Flint.Fq.NMod.Types: data FqNModMat
+ Data.Number.Flint.Fq.NMod.Types: data FqNModPoly
+ Data.Number.Flint.Fq.NMod.Types: data FqNModPolyFactor
+ Data.Number.Flint.Fq.NMod.Types: type CFqNMod = CFlint FqNMod
+ Data.Number.Flint.Fq.NMod.Types: type CFqNModMPoly = CFlint FqNModMPoly
+ Data.Number.Flint.Fq.NMod.Types: type CFqNModPoly = CFlint FqNModPoly
+ Data.Number.Flint.Fq.Types: CFqMat :: Ptr CFq -> CLong -> CLong -> Ptr (Ptr CFq) -> CFqMat
+ Data.Number.Flint.Fq.Types: Fq :: {-# UNPACK #-} !ForeignPtr CFq -> Fq
+ Data.Number.Flint.Fq.Types: FqMat :: {-# UNPACK #-} !ForeignPtr CFqMat -> FqMat
+ Data.Number.Flint.Fq.Types: FqPoly :: {-# UNPACK #-} !ForeignPtr CFqPoly -> FqPoly
+ Data.Number.Flint.Fq.Types: data CFqMat
+ Data.Number.Flint.Fq.Types: data Fq
+ Data.Number.Flint.Fq.Types: data FqMat
+ Data.Number.Flint.Fq.Types: data FqPoly
+ Data.Number.Flint.Fq.Types: type CFq = CFmpzPoly
+ Data.Number.Flint.Fq.Types: type CFqPoly = CFlint FqPoly
+ Data.Number.Flint.Fq.Zech.Types: CFqZechMat :: Ptr CFqZech -> CLong -> CLong -> Ptr (Ptr CFqZech) -> CFqZechMat
+ Data.Number.Flint.Fq.Zech.Types: CFqZechPolyFactor :: Ptr CFqZechPoly -> Ptr CLong -> CLong -> CLong -> CFqZechPolyFactor
+ Data.Number.Flint.Fq.Zech.Types: FqZech :: {-# UNPACK #-} !ForeignPtr CFqZech -> FqZech
+ Data.Number.Flint.Fq.Zech.Types: FqZechCtx :: {-# UNPACK #-} !ForeignPtr CFqZechCtx -> FqZechCtx
+ Data.Number.Flint.Fq.Zech.Types: FqZechMat :: {-# UNPACK #-} !ForeignPtr CFqZechMat -> FqZechMat
+ Data.Number.Flint.Fq.Zech.Types: FqZechPoly :: {-# UNPACK #-} !ForeignPtr CFqZechPoly -> FqZechPoly
+ Data.Number.Flint.Fq.Zech.Types: FqZechPolyFactor :: {-# UNPACK #-} !ForeignPtr CFqZechPolyFactor -> FqZechPolyFactor
+ Data.Number.Flint.Fq.Zech.Types: data CFqZechMat
+ Data.Number.Flint.Fq.Zech.Types: data CFqZechPolyFactor
+ Data.Number.Flint.Fq.Zech.Types: data FqZech
+ Data.Number.Flint.Fq.Zech.Types: data FqZechCtx
+ Data.Number.Flint.Fq.Zech.Types: data FqZechMat
+ Data.Number.Flint.Fq.Zech.Types: data FqZechPoly
+ Data.Number.Flint.Fq.Zech.Types: data FqZechPolyFactor
+ Data.Number.Flint.Fq.Zech.Types: type CFqZech = CFlint FqZech
+ Data.Number.Flint.Fq.Zech.Types: type CFqZechCtx = CFlint FqZechCtx
+ Data.Number.Flint.Fq.Zech.Types: type CFqZechPoly = CFlint FqZechPoly
+ Data.Number.Flint.Groups.Qfb.Instances: instance GHC.Show.Show Data.Number.Flint.Groups.Qfb.FFI.Qfb
+ Data.Number.Flint.NF.Fmpzi.Instances: instance GHC.Classes.Eq Data.Number.Flint.NF.Fmpzi.FFI.Fmpzi
+ Data.Number.Flint.NF.Fmpzi.Instances: instance GHC.Num.Num Data.Number.Flint.NF.Fmpzi.FFI.Fmpzi
+ Data.Number.Flint.NF.Fmpzi.Instances: instance GHC.Show.Show Data.Number.Flint.NF.Fmpzi.FFI.Fmpzi
+ Data.Number.Flint.NF.Fmpzi.Instances: lift1 :: (Ptr CFmpzi -> Ptr CFmpzi -> IO a) -> Fmpzi -> Fmpzi
+ Data.Number.Flint.NF.Fmpzi.Instances: lift2 :: (Ptr CFmpzi -> Ptr CFmpzi -> Ptr CFmpzi -> IO a) -> Fmpzi -> Fmpzi -> Fmpzi
+ Data.Number.Flint.NF.QQbar: _qqbar_vec_clear :: Ptr CQQbar -> CLong -> IO ()
+ Data.Number.Flint.NF.QQbar: _qqbar_vec_init :: CLong -> IO (Ptr CQQbar)
+ Data.Number.Flint.NF.QQbar.Instances: instance GHC.Classes.Eq Data.Number.Flint.NF.QQbar.FFI.QQbar
+ Data.Number.Flint.NF.QQbar.Instances: instance GHC.Num.Num Data.Number.Flint.NF.QQbar.FFI.QQbar
+ Data.Number.Flint.NF.QQbar.Instances: instance GHC.Show.Show Data.Number.Flint.NF.QQbar.FFI.QQbar
+ Data.Number.Flint.NF.QQbar.Instances: lift1 :: (Ptr CQQbar -> Ptr CQQbar -> IO a) -> QQbar -> QQbar
+ Data.Number.Flint.NF.QQbar.Instances: lift2 :: (Ptr CQQbar -> Ptr CQQbar -> Ptr CQQbar -> IO a) -> QQbar -> QQbar -> QQbar
+ Data.Number.Flint.NMod.Poly.Instances: NModPoly :: {-# UNPACK #-} !ForeignPtr CNModPoly -> NModPoly
+ Data.Number.Flint.NMod.Poly.Instances: data NModPoly
+ Data.Number.Flint.NMod.Poly.Instances: instance Data.Number.Flint.UFD.UFD Data.Number.Flint.NMod.Types.FFI.NModPoly
+ Data.Number.Flint.NMod.Poly.Instances: instance GHC.Base.Semigroup Data.Number.Flint.NMod.Types.FFI.NModPoly
+ Data.Number.Flint.NMod.Poly.Instances: instance GHC.Classes.Eq Data.Number.Flint.NMod.Types.FFI.NModPoly
+ Data.Number.Flint.NMod.Poly.Instances: instance GHC.Classes.Ord Data.Number.Flint.NMod.Types.FFI.NModPoly
+ Data.Number.Flint.NMod.Poly.Instances: instance GHC.Enum.Enum Data.Number.Flint.NMod.Types.FFI.NModPoly
+ Data.Number.Flint.NMod.Poly.Instances: instance GHC.Num.Num Data.Number.Flint.NMod.Types.FFI.NModPoly
+ Data.Number.Flint.NMod.Poly.Instances: instance GHC.Real.Integral Data.Number.Flint.NMod.Types.FFI.NModPoly
+ Data.Number.Flint.NMod.Poly.Instances: instance GHC.Real.Real Data.Number.Flint.NMod.Types.FFI.NModPoly
+ Data.Number.Flint.NMod.Poly.Instances: instance GHC.Show.Show Data.Number.Flint.NMod.Types.FFI.NModPoly
+ Data.Number.Flint.NMod.Types: CNModMat :: Ptr CMpLimb -> CLong -> CLong -> Ptr (Ptr CMpLimb) -> Ptr CNMod -> CNModMat
+ Data.Number.Flint.NMod.Types: CNModPolyFactor :: Ptr CNModPoly -> Ptr CLong -> CLong -> CLong -> CNModPolyFactor
+ Data.Number.Flint.NMod.Types: CNModPolyMat :: Ptr CNModPoly -> CLong -> CLong -> Ptr (Ptr CNModPoly) -> Ptr CNMod -> CNModPolyMat
+ Data.Number.Flint.NMod.Types: NModMat :: {-# UNPACK #-} !ForeignPtr CNModMat -> NModMat
+ Data.Number.Flint.NMod.Types: NModPoly :: {-# UNPACK #-} !ForeignPtr CNModPoly -> NModPoly
+ Data.Number.Flint.NMod.Types: NModPolyFactor :: {-# UNPACK #-} !ForeignPtr CNModPolyFactor -> NModPolyFactor
+ Data.Number.Flint.NMod.Types: NModPolyMat :: {-# UNPACK #-} !ForeignPtr CNModPolyMat -> NModPolyMat
+ Data.Number.Flint.NMod.Types: data CNModMat
+ Data.Number.Flint.NMod.Types: data CNModPolyFactor
+ Data.Number.Flint.NMod.Types: data CNModPolyMat
+ Data.Number.Flint.NMod.Types: data NModMat
+ Data.Number.Flint.NMod.Types: data NModPoly
+ Data.Number.Flint.NMod.Types: data NModPolyFactor
+ Data.Number.Flint.NMod.Types: data NModPolyMat
+ Data.Number.Flint.NMod.Types: type CNModPoly = CFlint NModPoly
+ Data.Number.Flint.Qadic: newQadicWithPrec :: CLong -> IO Qadic
+ Data.Number.Flint.Qadic: withNewQadicWithPrec :: CLong -> (Ptr CQadic -> IO a) -> IO (Qadic, a)
+ Data.Number.Flint.Support.D.Mat.Instances: instance GHC.Show.Show Data.Number.Flint.Support.D.Mat.FFI.DMat
- Data.Number.Flint.Acb.Calc: type CAcbCalcFunc = Ptr CAcb -> Ptr () -> CLong -> CLong
+ Data.Number.Flint.Acb.Calc: type CAcbCalcFunc = (Ptr CAcb -> Ptr CAcb -> Ptr () -> CLong -> CLong -> IO CInt)
- Data.Number.Flint.Arb: arb_midref :: Ptr CArb -> IO (Ptr CArf)
+ Data.Number.Flint.Arb: arb_midref :: Ptr CArb -> Ptr CArf
- Data.Number.Flint.Arb.Calc: type CArbCalcFunc = Ptr CArb -> Ptr CArb -> Ptr () -> CLong -> CLong
+ Data.Number.Flint.Arb.Calc: type CArbCalcFunc = Ptr CArb -> Ptr CArb -> Ptr () -> CLong -> CLong -> IO CInt
- Data.Number.Flint.Fmpz.Poly: _fmpz_poly_hensel_continue_lift :: Ptr CFmpzPolyFactor -> Ptr CLong -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> CLong -> CLong -> Ptr CFmpz -> IO CLong
+ Data.Number.Flint.Fmpz.Poly: _fmpz_poly_hensel_continue_lift :: Ptr CFmpzPolyFactor -> Ptr CLong -> Ptr (Ptr CFmpzPoly) -> Ptr (Ptr CFmpzPoly) -> Ptr CFmpzPoly -> CLong -> CLong -> CLong -> Ptr CFmpz -> IO CLong
- Data.Number.Flint.Fmpz.Poly: _fmpz_poly_hensel_start_lift :: Ptr CFmpzPolyFactor -> Ptr CLong -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CNModPolyFactor -> CLong -> IO CLong
+ Data.Number.Flint.Fmpz.Poly: _fmpz_poly_hensel_start_lift :: Ptr CFmpzPolyFactor -> Ptr CLong -> Ptr (Ptr CFmpzPoly) -> Ptr (Ptr CFmpzPoly) -> Ptr CFmpzPoly -> Ptr CNModPolyFactor -> CLong -> IO CLong
- Data.Number.Flint.Fmpz.Poly: _fmpz_poly_inv_series :: Ptr CFmpz -> Ptr CFmpz -> CLong -> IO ()
+ Data.Number.Flint.Fmpz.Poly: _fmpz_poly_inv_series :: Ptr CFmpz -> Ptr CFmpz -> CLong -> CLong -> IO ()
- Data.Number.Flint.Fmpz.Poly: _fmpz_poly_inv_series_newton :: Ptr CFmpz -> Ptr CFmpz -> CLong -> IO ()
+ Data.Number.Flint.Fmpz.Poly: _fmpz_poly_inv_series_newton :: Ptr CFmpz -> Ptr CFmpz -> CLong -> CLong -> IO ()
- Data.Number.Flint.Fmpz.Poly: fmpz_poly_add_series :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> CULong -> IO ()
+ Data.Number.Flint.Fmpz.Poly: fmpz_poly_add_series :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()
- Data.Number.Flint.Fmpz.Poly: fmpz_poly_hensel_build_tree :: Ptr CLong -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CNModPolyFactor -> IO ()
+ Data.Number.Flint.Fmpz.Poly: fmpz_poly_hensel_build_tree :: Ptr CLong -> Ptr (Ptr CFmpzPoly) -> Ptr (Ptr CFmpzPoly) -> Ptr CNModPolyFactor -> IO ()
- Data.Number.Flint.Fmpz.Poly: fmpz_poly_hensel_lift_tree :: Ptr CLong -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> Ptr CFmpz -> CLong -> CLong -> CLong -> IO ()
+ Data.Number.Flint.Fmpz.Poly: fmpz_poly_hensel_lift_tree :: Ptr CLong -> Ptr (Ptr CFmpzPoly) -> Ptr (Ptr CFmpzPoly) -> Ptr CFmpzPoly -> CLong -> Ptr CFmpz -> CLong -> CLong -> CLong -> IO ()
- Data.Number.Flint.Fmpz.Poly: fmpz_poly_hensel_lift_tree_recursive :: Ptr CLong -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> CLong -> Ptr CFmpz -> Ptr CFmpz -> IO ()
+ Data.Number.Flint.Fmpz.Poly: fmpz_poly_hensel_lift_tree_recursive :: Ptr CLong -> Ptr (Ptr CFmpzPoly) -> Ptr (Ptr CFmpzPoly) -> Ptr CFmpzPoly -> CLong -> CLong -> Ptr CFmpz -> Ptr CFmpz -> IO ()
- Data.Number.Flint.Fmpz.Poly: fmpz_poly_inv_series_newton :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> CLong -> IO ()
+ Data.Number.Flint.Fmpz.Poly: fmpz_poly_inv_series_newton :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()
- Data.Number.Flint.Fmpz.Poly: fmpz_poly_sub_series :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> CULong -> IO ()
+ Data.Number.Flint.Fmpz.Poly: fmpz_poly_sub_series :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()
- Data.Number.Flint.Groups.Dirichlet: newDirichletChar :: Ptr CDirichletGroup -> IO DirichletChar
+ Data.Number.Flint.Groups.Dirichlet: newDirichletChar :: DirichletGroup -> IO DirichletChar
- Data.Number.Flint.Groups.Dirichlet: withNewDirichletChar :: Ptr CDirichletGroup -> (Ptr CDirichletChar -> IO a) -> IO (DirichletChar, a)
+ Data.Number.Flint.Groups.Dirichlet: withNewDirichletChar :: DirichletGroup -> (Ptr CDirichletChar -> IO a) -> IO (DirichletChar, a)
- Data.Number.Flint.NF.QQbar: qqbar_eigenvalues_fmpq_mat :: Ptr CQQbar -> Ptr CFmpzMat -> CInt -> IO ()
+ Data.Number.Flint.NF.QQbar: qqbar_eigenvalues_fmpq_mat :: Ptr CQQbar -> Ptr CFmpqMat -> CInt -> IO ()
Files
- Flint2.cabal +43/−7
- LICENSE +233/−396
- README.md +13/−30
- csrc/arb.h +2/−0
- csrc/arb/radref.c +12/−0
- csrc/ca_ext/io.c +76/−0
- csrc/ca_mat/io.c +50/−0
- csrc/ca_poly/io.c +46/−0
- csrc/dirichlet.h +16/−0
- csrc/dirichlet/io.c +47/−0
- csrc/fmpz_mpoly_factor.h +18/−0
- csrc/fmpz_mpoly_factor/io.c +38/−0
- package.yaml +63/−8
- src/Data/Number/Flint.hs +25/−2
- src/Data/Number/Flint/Acb/Calc/FFI.hsc +31/−6
- src/Data/Number/Flint/Acb/FFI.hsc +19/−3
- src/Data/Number/Flint/Acb/Instances.hs +0/−1
- src/Data/Number/Flint/Acb/Mat/Instances.hs +0/−1
- src/Data/Number/Flint/Acb/Modular/FFI.hsc +0/−1
- src/Data/Number/Flint/Acb/Modular/Instances.hs +0/−1
- src/Data/Number/Flint/Acb/Poly/Instances.hs +0/−1
- src/Data/Number/Flint/Acb/Types.hs +0/−1
- src/Data/Number/Flint/Arb/Arf/FFI.hsc +2/−1
- src/Data/Number/Flint/Arb/Calc/FFI.hsc +18/−2
- src/Data/Number/Flint/Arb/FFI.hsc +12/−2
- src/Data/Number/Flint/Arb/Fmpz/Poly/FFI.hsc +11/−1
- src/Data/Number/Flint/Arb/Instances.hs +5/−2
- src/Data/Number/Flint/Arb/Mag/FFI.hsc +1/−0
- src/Data/Number/Flint/Arb/Mag/Instances.hs +67/−0
- src/Data/Number/Flint/Arb/Mat/Instances.hs +0/−1
- src/Data/Number/Flint/Arb/Poly/FFI.hsc +7/−0
- src/Data/Number/Flint/Arb/Poly/Instances.hs +0/−1
- src/Data/Number/Flint/Arb/RealField.hs +1/−2
- src/Data/Number/Flint/Arb/Types.hs +0/−1
- src/Data/Number/Flint/Arb/Types/FFI.hsc +9/−13
- src/Data/Number/Flint/Bernoulli/FFI.hsc +7/−0
- src/Data/Number/Flint/Calcium.hs +17/−0
- src/Data/Number/Flint/Calcium/Ca.hs +82/−0
- src/Data/Number/Flint/Calcium/Ca/Ext.hs +33/−0
- src/Data/Number/Flint/Calcium/Ca/Ext/FFI.hsc +262/−0
- src/Data/Number/Flint/Calcium/Ca/FFI.hsc +2106/−0
- src/Data/Number/Flint/Calcium/Ca/Field.hs +33/−0
- src/Data/Number/Flint/Calcium/Ca/Field/FFI.hsc +176/−0
- src/Data/Number/Flint/Calcium/Ca/Mat.hs +21/−0
- src/Data/Number/Flint/Calcium/Ca/Mat/FFI.hsc +933/−0
- src/Data/Number/Flint/Calcium/Ca/Poly.hs +11/−0
- src/Data/Number/Flint/Calcium/Ca/Poly/FFI.hsc +728/−0
- src/Data/Number/Flint/Calcium/Ca/Types.hs +11/−0
- src/Data/Number/Flint/Calcium/Ca/Types/FFI.hsc +65/−0
- src/Data/Number/Flint/Calcium/Ca/Vec.hs +22/−0
- src/Data/Number/Flint/Calcium/Ca/Vec/FFI.hsc +304/−0
- src/Data/Number/Flint/Calcium/FFI.hsc +280/−0
- src/Data/Number/Flint/Calcium/Fexpr.hs +114/−0
- src/Data/Number/Flint/Calcium/Fexpr/Builtin.hs +543/−0
- src/Data/Number/Flint/Calcium/Fexpr/FFI.hsc +863/−0
- src/Data/Number/Flint/Calcium/Fexpr/Instances.hs +117/−0
- src/Data/Number/Flint/Flint.hs +0/−1
- src/Data/Number/Flint/Flint/External.hs +0/−1
- src/Data/Number/Flint/Flint/Internal.hs +0/−1
- src/Data/Number/Flint/Fmpq/Instances.hs +13/−11
- src/Data/Number/Flint/Fmpq/Mat/Instances.hs +0/−1
- src/Data/Number/Flint/Fmpq/Poly/Instances.hs +20/−1
- src/Data/Number/Flint/Fmpz/FFI.hsc +4/−0
- src/Data/Number/Flint/Fmpz/Instances.hs +0/−1
- src/Data/Number/Flint/Fmpz/MPoly/FFI.hsc +6/−0
- src/Data/Number/Flint/Fmpz/MPoly/Factor/FFI.hsc +22/−0
- src/Data/Number/Flint/Fmpz/Mat.hs +4/−4
- src/Data/Number/Flint/Fmpz/Mat/Instances.hs +0/−1
- src/Data/Number/Flint/Fmpz/Mod/Poly/FFI.hsc +41/−10
- src/Data/Number/Flint/Fmpz/Poly/FFI.hsc +4519/−4485
- src/Data/Number/Flint/Fmpz/Poly/Factor/FFI.hsc +1/−0
- src/Data/Number/Flint/Fmpz/Poly/Instances.hs +18/−15
- src/Data/Number/Flint/Fmpz/Poly/Q/Instances.hs +0/−1
- src/Data/Number/Flint/Fq/Embed.hs +0/−1
- src/Data/Number/Flint/Fq/Mat.hs +4/−4
- src/Data/Number/Flint/Fq/NMod.hs +4/−4
- src/Data/Number/Flint/Fq/NMod/Embed.hs +4/−4
- src/Data/Number/Flint/Fq/NMod/Mat.hs +4/−4
- src/Data/Number/Flint/Fq/NMod/Types.hs +0/−1
- src/Data/Number/Flint/Fq/NMod/Types/FFI.hsc +0/−1
- src/Data/Number/Flint/Fq/NMod/Vec.hs +4/−4
- src/Data/Number/Flint/Fq/Poly.hs +4/−4
- src/Data/Number/Flint/Fq/Types.hs +0/−1
- src/Data/Number/Flint/Fq/Types/FFI.hsc +0/−1
- src/Data/Number/Flint/Fq/Vec.hs +4/−4
- src/Data/Number/Flint/Fq/Zech.hs +4/−4
- src/Data/Number/Flint/Fq/Zech/Embed.hs +4/−4
- src/Data/Number/Flint/Fq/Zech/Mat.hs +4/−4
- src/Data/Number/Flint/Fq/Zech/Poly.hs +4/−4
- src/Data/Number/Flint/Fq/Zech/Types.hs +4/−5
- src/Data/Number/Flint/Fq/Zech/Vec.hs +4/−4
- src/Data/Number/Flint/Groups/Dirichlet/FFI.hsc +14/−3
- src/Data/Number/Flint/Groups/Qfb/Instances.hs +0/−1
- src/Data/Number/Flint/NF/Fmpzi/Instances.hs +0/−1
- src/Data/Number/Flint/NF/QQbar/FFI.hsc +5/−1
- src/Data/Number/Flint/NF/QQbar/Instances.hs +0/−1
- src/Data/Number/Flint/NMod/Poly/Instances.hs +0/−1
- src/Data/Number/Flint/NMod/Types.hs +0/−1
- src/Data/Number/Flint/Padic/Poly/FFI.hsc +6/−1
- src/Data/Number/Flint/Qadic/FFI.hsc +14/−0
- src/Data/Number/Flint/Support/D/Mat/Instances.hs +0/−1
Flint2.cabal view
@@ -5,16 +5,22 @@ -- see: https://github.com/sol/hpack name: Flint2-version: 0.1.0.1+version: 0.1.0.2 synopsis: Haskell bindings for the flint library for number theory-description: Please see the README on GitHub at <https://github.com/monien/Flint2#readme>+description: A Haskell Wrapper for Flint+ This library provides access to the functionality of the FLINT.+ So what is it?+ FLINT is a C library for doing number theory, freely available under the GNU LGPL at [https://flintlib.org](https://flintlib.org)+ At its core, FLINT provides arithmetic in standard rings such as the integers, rationals, algebraic, real, complex and p-adic numbers, finite fields, and number fields. It also provides polynomials (univariate and multivariate), power series, and matrices.+ At the research frontier+ FLINT has been used for many large scale research computations (e.g. A Trillion Triangles) and has been cited in hundreds of publications. FLINT's authors themselves have published more than 20 papers describing new algorithms first implemented within or on top of FLINT. category: Math homepage: https://github.com/monien/Flint2#readme bug-reports: https://github.com/monien/Flint2/issues author: Hartmut Monien maintainer: hmonien@uni-bonn.de-copyright: Copyright (c) 2022 Hartmut Monien-license: BSD3+copyright: Copyright (c) 2023 Hartmut Monien+license: GPL-2 license-file: LICENSE build-type: Simple extra-source-files:@@ -134,6 +140,7 @@ Data.Number.Flint.Arb Data.Number.Flint.Arb.Instances Data.Number.Flint.Arb.Mag+ Data.Number.Flint.Arb.Mag.Instances Data.Number.Flint.Arb.Arf Data.Number.Flint.Arb.Poly Data.Number.Flint.Arb.Poly.Instances@@ -160,6 +167,17 @@ Data.Number.Flint.Acb.DFT Data.Number.Flint.Acb.ComplexField Data.Number.Flint.Acb.Calc+ Data.Number.Flint.Calcium+ Data.Number.Flint.Calcium.Ca+ Data.Number.Flint.Calcium.Ca.Types+ Data.Number.Flint.Calcium.Ca.Poly+ Data.Number.Flint.Calcium.Ca.Vec+ Data.Number.Flint.Calcium.Ca.Mat+ Data.Number.Flint.Calcium.Ca.Field+ Data.Number.Flint.Calcium.Ca.Ext+ Data.Number.Flint.Calcium.Fexpr+ Data.Number.Flint.Calcium.Fexpr.Instances+ Data.Number.Flint.Calcium.Fexpr.Builtin Data.Number.Flint.Bernoulli Data.Number.Flint.Partitions Data.Number.Flint.Hypgeom@@ -276,6 +294,15 @@ Data.Number.Flint.Acb.Dirichlet.FFI Data.Number.Flint.Acb.DFT.FFI Data.Number.Flint.Acb.Calc.FFI+ Data.Number.Flint.Calcium.FFI+ Data.Number.Flint.Calcium.Ca.FFI+ Data.Number.Flint.Calcium.Ca.Types.FFI+ Data.Number.Flint.Calcium.Ca.Poly.FFI+ Data.Number.Flint.Calcium.Ca.Vec.FFI+ Data.Number.Flint.Calcium.Ca.Mat.FFI+ Data.Number.Flint.Calcium.Ca.Field.FFI+ Data.Number.Flint.Calcium.Ca.Ext.FFI+ Data.Number.Flint.Calcium.Fexpr.FFI Data.Number.Flint.Bernoulli.FFI Data.Number.Flint.Partitions.FFI Data.Number.Flint.Hypgeom.FFI@@ -317,6 +344,7 @@ arf.h bool_mat.h d_mat.h+ dirichlet.h double_interval.h fmpq.h fmpq_mat.h@@ -326,6 +354,7 @@ fmpz_factor.h fmpz_mat.h fmpz_mod_poly_factor.h+ fmpz_mpoly_factor.h fmpz_mpoly_q.h fmpz_poly_mat.h fmpz_vec.h@@ -356,6 +385,7 @@ csrc/fmpz_poly_mat/fprint.c csrc/fmpz_poly_mat/get_str.c csrc/fmpz_factor/get_str.c+ csrc/fmpz_mpoly_factor/io.c csrc/fmpz_mpoly_q/fprint.c csrc/fmpz_mpoly_q/get_str_pretty.c csrc/fmpz_vec/get_str.c@@ -382,6 +412,7 @@ csrc/aprcl/fprint.c csrc/aprcl/get_str.c csrc/bool_mat/get_str.c+ csrc/dirichlet/io.c csrc/qfb/get_str.c csrc/qfb/fprint.c csrc/qqbar/fprint.c@@ -410,6 +441,7 @@ csrc/d_mat/entry.c csrc/d_mat/io.c csrc/arb/midref.c+ csrc/arb/radref.c csrc/arf/inlines.c csrc/mag/get_str.c csrc/arb/get_strd.c@@ -434,21 +466,25 @@ csrc/acb_modular/inlines.c csrc/acb_modular/get_str.c csrc/mpfr_mat/swap_entrywise.c+ csrc/ca_poly/io.c+ csrc/ca_mat/io.c+ csrc/ca_ext/io.c csrc/psl2z/word_problem.c csrc/perm/order.c csrc/perm/print_pretty.c csrc/perm/power.c csrc/perm/mat.c extra-libraries:- flint, gmp+ flint pkgconfig-depends: flint >= 2.9, gmp build-tools: hsc2hs build-depends:- QuickCheck+ QuickCheck >=2.14.3 && <2.15 , base >=4.7 && <5- , groups+ , containers >=0.6.5 && <0.7+ , groups >=0.5.3 && <0.6 default-language: Haskell2010 test-suite Flint2-test
LICENSE view
@@ -1,397 +1,221 @@- GNU LESSER GENERAL PUBLIC LICENSE- Version 2.1, February 1999+ GNU GENERAL PUBLIC LICENSE+ Version 2, June 1991 - Copyright (C) 1991, 1999 Free Software Foundation, Inc.- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. -[This is the first released version of the Lesser GPL. It also counts- as the successor of the GNU Library Public License, version 2, hence- the version number 2.1.]- Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public-Licenses are intended to guarantee your freedom to share and change-free software--to make sure the software is free for all its users.-- This license, the Lesser General Public License, applies to some-specially designated software packages--typically libraries--of the-Free Software Foundation and other authors who decide to use it. You-can use it too, but we suggest you first think carefully about whether-this license or the ordinary General Public License is the better-strategy to use in any particular case, based on the explanations below.+License is intended to guarantee your freedom to share and change free+software--to make sure the software is free for all its users. This+General Public License applies to most of the Free Software+Foundation's software and to any other program whose authors commit to+using it. (Some other Free Software Foundation software is covered by+the GNU Lesser General Public License instead.) You can apply it to+your programs, too. - When we speak of free software, we are referring to freedom of use,-not price. Our General Public Licenses are designed to make sure that-you have the freedom to distribute copies of free software (and charge-for this service if you wish); that you receive source code or can get-it if you want it; that you can change the software and use pieces of-it in new free programs; and that you are informed that you can do-these things.+ When we speak of free software, we are referring to freedom, not+price. Our General Public Licenses are designed to make sure that you+have the freedom to distribute copies of free software (and charge for+this service if you wish), that you receive source code or can get it+if you want it, that you can change the software or use pieces of it+in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid-distributors to deny you these rights or to ask you to surrender these-rights. These restrictions translate to certain responsibilities for-you if you distribute copies of the library or if you modify it.-- For example, if you distribute copies of the library, whether gratis-or for a fee, you must give the recipients all the rights that we gave-you. You must make sure that they, too, receive or can get the source-code. If you link other code with the library, you must provide-complete object files to the recipients, so that they can relink them-with the library after making changes to the library and recompiling-it. And you must show them these terms so they know their rights.-- We protect your rights with a two-step method: (1) we copyright the-library, and (2) we offer you this license, which gives you legal-permission to copy, distribute and/or modify the library.-- To protect each distributor, we want to make it very clear that-there is no warranty for the free library. Also, if the library is-modified by someone else and passed on, the recipients should know-that what they have is not the original version, so that the original-author's reputation will not be affected by problems that might be-introduced by others.-- Finally, software patents pose a constant threat to the existence of-any free program. We wish to make sure that a company cannot-effectively restrict the users of a free program by obtaining a-restrictive license from a patent holder. Therefore, we insist that-any patent license obtained for a version of the library must be-consistent with the full freedom of use specified in this license.-- Most GNU software, including some libraries, is covered by the-ordinary GNU General Public License. This license, the GNU Lesser-General Public License, applies to certain designated libraries, and-is quite different from the ordinary General Public License. We use-this license for certain libraries in order to permit linking those-libraries into non-free programs.-- When a program is linked with a library, whether statically or using-a shared library, the combination of the two is legally speaking a-combined work, a derivative of the original library. The ordinary-General Public License therefore permits such linking only if the-entire combination fits its criteria of freedom. The Lesser General-Public License permits more lax criteria for linking other code with-the library.+anyone to deny you these rights or to ask you to surrender the rights.+These restrictions translate to certain responsibilities for you if you+distribute copies of the software, or if you modify it. - We call this license the "Lesser" General Public License because it-does Less to protect the user's freedom than the ordinary General-Public License. It also provides other free software developers Less-of an advantage over competing non-free programs. These disadvantages-are the reason we use the ordinary General Public License for many-libraries. However, the Lesser license provides advantages in certain-special circumstances.+ For example, if you distribute copies of such a program, whether+gratis or for a fee, you must give the recipients all the rights that+you have. You must make sure that they, too, receive or can get the+source code. And you must show them these terms so they know their+rights. - For example, on rare occasions, there may be a special need to-encourage the widest possible use of a certain library, so that it becomes-a de-facto standard. To achieve this, non-free programs must be-allowed to use the library. A more frequent case is that a free-library does the same job as widely used non-free libraries. In this-case, there is little to gain by limiting the free library to free-software only, so we use the Lesser General Public License.+ We protect your rights with two steps: (1) copyright the software, and+(2) offer you this license which gives you legal permission to copy,+distribute and/or modify the software. - In other cases, permission to use a particular library in non-free-programs enables a greater number of people to use a large body of-free software. For example, permission to use the GNU C Library in-non-free programs enables many more people to use the whole GNU-operating system, as well as its variant, the GNU/Linux operating-system.+ Also, for each author's protection and ours, we want to make certain+that everyone understands that there is no warranty for this free+software. If the software is modified by someone else and passed on, we+want its recipients to know that what they have is not the original, so+that any problems introduced by others will not reflect on the original+authors' reputations. - Although the Lesser General Public License is Less protective of the-users' freedom, it does ensure that the user of a program that is-linked with the Library has the freedom and the wherewithal to run-that program using a modified version of the Library.+ Finally, any free program is threatened constantly by software+patents. We wish to avoid the danger that redistributors of a free+program will individually obtain patent licenses, in effect making the+program proprietary. To prevent this, we have made it clear that any+patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and-modification follow. Pay close attention to the difference between a-"work based on the library" and a "work that uses the library". The-former contains code derived from the library, whereas the latter must-be combined with the library in order to run.-- GNU LESSER GENERAL PUBLIC LICENSE- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION-- 0. This License Agreement applies to any software library or other-program which contains a notice placed by the copyright holder or-other authorized party saying it may be distributed under the terms of-this Lesser General Public License (also called "this License").-Each licensee is addressed as "you".-- A "library" means a collection of software functions and/or data-prepared so as to be conveniently linked with application programs-(which use some of those functions and data) to form executables.+modification follow. - The "Library", below, refers to any such software library or work-which has been distributed under these terms. A "work based on the-Library" means either the Library or any derivative work under-copyright law: that is to say, a work containing the Library or a-portion of it, either verbatim or with modifications and/or translated-straightforwardly into another language. (Hereinafter, translation is-included without limitation in the term "modification".)+ GNU GENERAL PUBLIC LICENSE+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - "Source code" for a work means the preferred form of the work for-making modifications to it. For a library, complete source code means-all the source code for all modules it contains, plus any associated-interface definition files, plus the scripts used to control compilation-and installation of the library.+ 0. This License applies to any program or other work which contains+a notice placed by the copyright holder saying it may be distributed+under the terms of this General Public License. The "Program", below,+refers to any such program or work, and a "work based on the Program"+means either the Program or any derivative work under copyright law:+that is to say, a work containing the Program or a portion of it,+either verbatim or with modifications and/or translated into another+language. (Hereinafter, translation is included without limitation in+the term "modification".) Each licensee is addressed as "you". - Activities other than copying, distribution and modification are not+Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of-running a program using the Library is not restricted, and output from-such a program is covered only if its contents constitute a work based-on the Library (independent of the use of the Library in a tool for-writing it). Whether that is true depends on what the Library does-and what the program that uses the Library does.+running the Program is not restricted, and the output from the Program+is covered only if its contents constitute a work based on the+Program (independent of having been made by running the Program).+Whether that is true depends on what the Program does. - 1. You may copy and distribute verbatim copies of the Library's-complete source code as you receive it, in any medium, provided that-you conspicuously and appropriately publish on each copy an-appropriate copyright notice and disclaimer of warranty; keep intact-all the notices that refer to this License and to the absence of any-warranty; and distribute a copy of this License along with the-Library.+ 1. You may copy and distribute verbatim copies of the Program's+source code as you receive it, in any medium, provided that you+conspicuously and appropriately publish on each copy an appropriate+copyright notice and disclaimer of warranty; keep intact all the+notices that refer to this License and to the absence of any warranty;+and give any other recipients of the Program a copy of this License+along with the Program. - You may charge a fee for the physical act of transferring a copy,-and you may at your option offer warranty protection in exchange for a-fee.-- 2. You may modify your copy or copies of the Library or any portion-of it, thus forming a work based on the Library, and copy and+You may charge a fee for the physical act of transferring a copy, and+you may at your option offer warranty protection in exchange for a fee.++ 2. You may modify your copy or copies of the Program or any portion+of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: - a) The modified work must itself be a software library.-- b) You must cause the files modified to carry prominent notices+ a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. - c) You must cause the whole of the work to be licensed at no- charge to all third parties under the terms of this License.-- d) If a facility in the modified Library refers to a function or a- table of data to be supplied by an application program that uses- the facility, other than as an argument passed when the facility- is invoked, then you must make a good faith effort to ensure that,- in the event an application does not supply such function or- table, the facility still operates, and performs whatever part of- its purpose remains meaningful.+ b) You must cause any work that you distribute or publish, that in+ whole or in part contains or is derived from the Program or any+ part thereof, to be licensed as a whole at no charge to all third+ parties under the terms of this License. - (For example, a function in a library to compute square roots has- a purpose that is entirely well-defined independent of the- application. Therefore, Subsection 2d requires that any- application-supplied function or table used by this function must- be optional: if the application does not supply it, the square- root function must still compute square roots.)+ c) If the modified program normally reads commands interactively+ when run, you must cause it, when started running for such+ interactive use in the most ordinary way, to print or display an+ announcement including an appropriate copyright notice and a+ notice that there is no warranty (or else, saying that you provide+ a warranty) and that users may redistribute the program under+ these conditions, and telling the user how to view a copy of this+ License. (Exception: if the Program itself is interactive but+ does not normally print such an announcement, your work based on+ the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If-identifiable sections of that work are not derived from the Library,+identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based-on the Library, the distribution of the whole must be on the terms of+on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the-entire whole, and thus to each and every part regardless of who wrote-it.+entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or-collective works based on the Library.+collective works based on the Program. -In addition, mere aggregation of another work not based on the Library-with the Library (or with a work based on the Library) on a volume of+In addition, mere aggregation of another work not based on the Program+with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. - 3. You may opt to apply the terms of the ordinary GNU General Public-License instead of this License to a given copy of the Library. To do-this, you must alter all the notices that refer to this License, so-that they refer to the ordinary GNU General Public License, version 2,-instead of to this License. (If a newer version than version 2 of the-ordinary GNU General Public License has appeared, then you can specify-that version instead if you wish.) Do not make any other change in-these notices.-- Once this change is made in a given copy, it is irreversible for-that copy, so the ordinary GNU General Public License applies to all-subsequent copies and derivative works made from that copy.-- This option is useful when you wish to copy part of the code of-the Library into a program that is not a library.-- 4. You may copy and distribute the Library (or a portion or-derivative of it, under Section 2) in object code or executable form-under the terms of Sections 1 and 2 above provided that you accompany-it with the complete corresponding machine-readable source code, which-must be distributed under the terms of Sections 1 and 2 above on a-medium customarily used for software interchange.-- If distribution of object code is made by offering access to copy-from a designated place, then offering equivalent access to copy the-source code from the same place satisfies the requirement to-distribute the source code, even though third parties are not-compelled to copy the source along with the object code.-- 5. A program that contains no derivative of any portion of the-Library, but is designed to work with the Library by being compiled or-linked with it, is called a "work that uses the Library". Such a-work, in isolation, is not a derivative work of the Library, and-therefore falls outside the scope of this License.-- However, linking a "work that uses the Library" with the Library-creates an executable that is a derivative of the Library (because it-contains portions of the Library), rather than a "work that uses the-library". The executable is therefore covered by this License.-Section 6 states terms for distribution of such executables.-- When a "work that uses the Library" uses material from a header file-that is part of the Library, the object code for the work may be a-derivative work of the Library even though the source code is not.-Whether this is true is especially significant if the work can be-linked without the Library, or if the work is itself a library. The-threshold for this to be true is not precisely defined by law.-- If such an object file uses only numerical parameters, data-structure layouts and accessors, and small macros and small inline-functions (ten lines or less in length), then the use of the object-file is unrestricted, regardless of whether it is legally a derivative-work. (Executables containing this object code plus portions of the-Library will still fall under Section 6.)-- Otherwise, if the work is a derivative of the Library, you may-distribute the object code for the work under the terms of Section 6.-Any executables containing that work also fall under Section 6,-whether or not they are linked directly with the Library itself.-- 6. As an exception to the Sections above, you may also combine or-link a "work that uses the Library" with the Library to produce a-work containing portions of the Library, and distribute that work-under terms of your choice, provided that the terms permit-modification of the work for the customer's own use and reverse-engineering for debugging such modifications.-- You must give prominent notice with each copy of the work that the-Library is used in it and that the Library and its use are covered by-this License. You must supply a copy of this License. If the work-during execution displays copyright notices, you must include the-copyright notice for the Library among them, as well as a reference-directing the user to the copy of this License. Also, you must do one-of these things:-- a) Accompany the work with the complete corresponding- machine-readable source code for the Library including whatever- changes were used in the work (which must be distributed under- Sections 1 and 2 above); and, if the work is an executable linked- with the Library, with the complete machine-readable "work that- uses the Library", as object code and/or source code, so that the- user can modify the Library and then relink to produce a modified- executable containing the modified Library. (It is understood- that the user who changes the contents of definitions files in the- Library will not necessarily be able to recompile the application- to use the modified definitions.)-- b) Use a suitable shared library mechanism for linking with the- Library. A suitable mechanism is one that (1) uses at run time a- copy of the library already present on the user's computer system,- rather than copying library functions into the executable, and (2)- will operate properly with a modified version of the library, if- the user installs one, as long as the modified version is- interface-compatible with the version that the work was made with.-- c) Accompany the work with a written offer, valid for at- least three years, to give the same user the materials- specified in Subsection 6a, above, for a charge no more- than the cost of performing this distribution.-- d) If distribution of the work is made by offering access to copy- from a designated place, offer equivalent access to copy the above- specified materials from the same place.+ 3. You may copy and distribute the Program (or a work based on it,+under Section 2) in object code or executable form under the terms of+Sections 1 and 2 above provided that you also do one of the following: - e) Verify that the user has already received a copy of these- materials or that you have already sent this user a copy.+ a) Accompany it with the complete corresponding machine-readable+ source code, which must be distributed under the terms of Sections+ 1 and 2 above on a medium customarily used for software interchange; or, - For an executable, the required form of the "work that uses the-Library" must include any data and utility programs needed for-reproducing the executable from it. However, as a special exception,-the materials to be distributed need not include anything that is-normally distributed (in either source or binary form) with the major-components (compiler, kernel, and so on) of the operating system on-which the executable runs, unless that component itself accompanies-the executable.+ b) Accompany it with a written offer, valid for at least three+ years, to give any third party, for a charge no more than your+ cost of physically performing source distribution, a complete+ machine-readable copy of the corresponding source code, to be+ distributed under the terms of Sections 1 and 2 above on a medium+ customarily used for software interchange; or, - It may happen that this requirement contradicts the license-restrictions of other proprietary libraries that do not normally-accompany the operating system. Such a contradiction means you cannot-use both them and the Library together in an executable that you-distribute.-- 7. You may place library facilities that are a work based on the-Library side-by-side in a single library together with other library-facilities not covered by this License, and distribute such a combined-library, provided that the separate distribution of the work based on-the Library and of the other library facilities is otherwise-permitted, and provided that you do these two things:+ c) Accompany it with the information you received as to the offer+ to distribute corresponding source code. (This alternative is+ allowed only for noncommercial distribution and only if you+ received the program in object code or executable form with such+ an offer, in accord with Subsection b above.) - a) Accompany the combined library with a copy of the same work- based on the Library, uncombined with any other library- facilities. This must be distributed under the terms of the- Sections above.+The source code for a work means the preferred form of the work for+making modifications to it. For an executable work, complete source+code means all the source code for all modules it contains, plus any+associated interface definition files, plus the scripts used to+control compilation and installation of the executable. However, as a+special exception, the source code distributed need not include+anything that is normally distributed (in either source or binary+form) with the major components (compiler, kernel, and so on) of the+operating system on which the executable runs, unless that component+itself accompanies the executable. - b) Give prominent notice with the combined library of the fact- that part of it is a work based on the Library, and explaining- where to find the accompanying uncombined form of the same work.+If distribution of executable or object code is made by offering+access to copy from a designated place, then offering equivalent+access to copy the source code from the same place counts as+distribution of the source code, even though third parties are not+compelled to copy the source along with the object code. - 8. You may not copy, modify, sublicense, link with, or distribute-the Library except as expressly provided under this License. Any-attempt otherwise to copy, modify, sublicense, link with, or-distribute the Library is void, and will automatically terminate your-rights under this License. However, parties who have received copies,-or rights, from you under this License will not have their licenses-terminated so long as such parties remain in full compliance.+ 4. You may not copy, modify, sublicense, or distribute the Program+except as expressly provided under this License. Any attempt+otherwise to copy, modify, sublicense or distribute the Program is+void, and will automatically terminate your rights under this License.+However, parties who have received copies, or rights, from you under+this License will not have their licenses terminated so long as such+parties remain in full compliance. - 9. You are not required to accept this License, since you have not+ 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or-distribute the Library or its derivative works. These actions are+distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by-modifying or distributing the Library (or any work based on the-Library), you indicate your acceptance of this License to do so, and+modifying or distributing the Program (or any work based on the+Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying-the Library or works based on it.+the Program or works based on it. - 10. Each time you redistribute the Library (or any work based on the-Library), the recipient automatically receives a license from the-original licensor to copy, distribute, link with or modify the Library-subject to these terms and conditions. You may not impose any further+ 6. Each time you redistribute the Program (or any work based on the+Program), the recipient automatically receives a license from the+original licensor to copy, distribute or modify the Program subject to+these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein.-You are not responsible for enforcing compliance by third parties with+You are not responsible for enforcing compliance by third parties to this License.-- 11. If, as a consequence of a court judgment or allegation of patent++ 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you-may not distribute the Library at all. For example, if a patent-license would not permit royalty-free redistribution of the Library by+may not distribute the Program at all. For example, if a patent+license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to-refrain entirely from distribution of the Library.+refrain entirely from distribution of the Program. -If any portion of this section is held invalid or unenforceable under any-particular circumstance, the balance of the section is intended to apply,-and the section as a whole is intended to apply in other circumstances.+If any portion of this section is held invalid or unenforceable under+any particular circumstance, the balance of the section is intended to+apply and the section as a whole is intended to apply in other+circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the-integrity of the free software distribution system which is+integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that@@ -402,101 +226,114 @@ This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. - 12. If the distribution and/or use of the Library is restricted in+ 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the-original copyright holder who places the Library under this License may add-an explicit geographical distribution limitation excluding those countries,-so that distribution is permitted only in or among countries not thus-excluded. In such case, this License incorporates the limitation as if-written in the body of this License.+original copyright holder who places the Program under this License+may add an explicit geographical distribution limitation excluding+those countries, so that distribution is permitted only in or among+countries not thus excluded. In such case, this License incorporates+the limitation as if written in the body of this License. - 13. The Free Software Foundation may publish revised and/or new-versions of the Lesser General Public License from time to time.-Such new versions will be similar in spirit to the present version,-but may differ in detail to address new problems or concerns.+ 9. The Free Software Foundation may publish revised and/or new versions+of the General Public License from time to time. Such new versions will+be similar in spirit to the present version, but may differ in detail to+address new problems or concerns. -Each version is given a distinguishing version number. If the Library-specifies a version number of this License which applies to it and-"any later version", you have the option of following the terms and-conditions either of that version or of any later version published by-the Free Software Foundation. If the Library does not specify a-license version number, you may choose any version ever published by-the Free Software Foundation.-- 14. If you wish to incorporate parts of the Library into other free-programs whose distribution conditions are incompatible with these,-write to the author to ask for permission. For software which is-copyrighted by the Free Software Foundation, write to the Free-Software Foundation; we sometimes make exceptions for this. Our-decision will be guided by the two goals of preserving the free status-of all derivatives of our free software and of promoting the sharing-and reuse of software generally.+Each version is given a distinguishing version number. If the Program+specifies a version number of this License which applies to it and "any+later version", you have the option of following the terms and conditions+either of that version or of any later version published by the Free+Software Foundation. If the Program does not specify a version number of+this License, you may choose any version ever published by the Free Software+Foundation. + 10. If you wish to incorporate parts of the Program into other free+programs whose distribution conditions are different, write to the author+to ask for permission. For software which is copyrighted by the Free+Software Foundation, write to the Free Software Foundation; we sometimes+make exceptions for this. Our decision will be guided by the two goals+of preserving the free status of all derivatives of our free software and+of promoting the sharing and reuse of software generally.+ NO WARRANTY - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO-WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.-EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR-OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY-KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE-LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME-THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,+REPAIR OR CORRECTION. - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY-AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU-FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR-CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE-LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A-FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH-DAMAGES.+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE+POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS-- How to Apply These Terms to Your New Libraries - If you develop a new library, and you want it to be of the greatest-possible use to the public, we recommend making it free software that-everyone can redistribute and change. You can do so by permitting-redistribution under these terms (or, alternatively, under the terms of the-ordinary General Public License).+ How to Apply These Terms to Your New Programs - To apply these terms, attach the following notices to the library. It is-safest to attach them to the start of each source file to most effectively-convey the exclusion of warranty; and each file should have at least the-"copyright" line and a pointer to where the full notice is found.+ If you develop a new program, and you want it to be of the greatest+possible use to the public, the best way to achieve this is to make it+free software which everyone can redistribute and change under these terms. - <one line to give the library's name and a brief idea of what it does.>+ To do so, attach the following notices to the program. It is safest+to attach them to the start of each source file to most effectively+convey the exclusion of warranty; and each file should have at least+the "copyright" line and a pointer to where the full notice is found.++ <one line to give the program's name and a brief idea of what it does.> Copyright (C) <year> <name of author> - This library is free software; you can redistribute it and/or- modify it under the terms of the GNU Lesser General Public- License as published by the Free Software Foundation; either- version 2.1 of the License, or (at your option) any later version.+ This program is free software; you can redistribute it and/or modify+ it under the terms of the GNU General Public License as published by+ the Free Software Foundation; either version 2 of the License, or+ (at your option) any later version. - This library is distributed in the hope that it will be useful,+ This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU- Lesser General Public License for more details.+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+ GNU General Public License for more details. - You should have received a copy of the GNU Lesser General Public- License along with this library; if not, write to the Free Software- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA+ You should have received a copy of the GNU General Public License along+ with this program; if not, write to the Free Software Foundation, Inc.,+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. +If the program is interactive, make it output a short notice like this+when it starts in an interactive mode:++ Gnomovision version 69, Copyright (C) year name of author+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.+ This is free software, and you are welcome to redistribute it+ under certain conditions; type `show c' for details.++The hypothetical commands `show w' and `show c' should show the appropriate+parts of the General Public License. Of course, the commands you use may+be called something other than `show w' and `show c'; they could even be+mouse-clicks or menu items--whatever suits your program.+ You should also get your employer (if you work as a programmer) or your-school, if any, to sign a "copyright disclaimer" for the library, if+school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: - Yoyodyne, Inc., hereby disclaims all copyright interest in the- library `Frob' (a library for tweaking knobs) written by James Random Hacker.+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program+ `Gnomovision' (which makes passes at compilers) written by James Hacker. - <signature of Ty Coon>, 1 April 1990+ <signature of Ty Coon>, 1 April 1989 Ty Coon, President of Vice -That's all there is to it!+This General Public License does not permit incorporating your program into+proprietary programs. If your program is a subroutine library, you may+consider it more useful to permit linking proprietary applications with the+library. If this is what you want to do, use the GNU Lesser General+Public License instead of this License.
README.md view
@@ -1,3 +1,5 @@++ # Flint2 **Flint2** provides a thin Haskell wrapper for [Flint](https://flintlib.org) C-library. @@ -9,46 +11,27 @@ - Install the Haskell interface with ```bash-cabal install Flint2+cabal install Flint2 --lib ``` +The depencies are minimal. Flint2 relies on just three libraries:+QuickCheck, groups, containers.+ ## Quick Start -A simple program using the thin wrapper would be+A simple example for the application of the library is the+factorization of $2^{256}-1$: ```haskell import Data.Number.Flint -main = do - x <- newFmpz- y <- newFmpz- withFmpz x $ \x -> do- withFmpz y $ \y -> do- fmpz_set_ui x 7- fmpz_set_ui y 6- fmpz_mul x x y- fmpz_print x -```--which will print the numerical value 42.--In the app directory more practical information on how to use the thin wrapper can be found. -The above example simplifies to --```haskell-include Fmpz--main = do- let x = 7 :: Fmpz - y = 6 :: Fmpz- print $ x*y- print $ factor (42 :: Fmpz)- +main = print $ factor (2^256 - 1 :: Fmpz) ``` -which prints +runnnig main prints ```-42 -[(2,1),(3,1),(7,1)]+[(3,1),(5,1),(17,1),(257,1),(641,1),(65537,1),(274177,1),(6700417,1),(67280421310721,1),(59649589127497217,1),(5704689200685129054721,1)] ```++examples can be found soon in **FLINT2-Examples**.
csrc/arb.h view
@@ -4,6 +4,8 @@ #include <flint/arb.h> arf_struct * arb_midref_(arb_t x);+mag_struct * arb_radref_(arb_t x);+ char * arb_get_str_(const arb_t x); char * arb_get_strd(const arb_t x, slong digits); char * arb_get_strn(const arb_t x, slong digits, ulong options);
+ csrc/arb/radref.c view
@@ -0,0 +1,12 @@+#include <stdlib.h>+#include <stdio.h>+#include <string.h>++#include <flint/flint.h>+#include <flint/arb.h>++#include "../arb.h"++mag_struct * arb_radref_(arb_t x) {+ return &(x->rad);+}
+ csrc/ca_ext/io.c view
@@ -0,0 +1,76 @@+/*+ Copyright (C) 2020 Fredrik Johansson++ This file is part of Calcium.++ Calcium is free software: you can redistribute it and/or modify it under+ the terms of the GNU Lesser General Public License (LGPL) as published+ by the Free Software Foundation; either version 2.1 of the License, or+ (at your option) any later version. See <http://www.gnu.org/licenses/>.+*/++#include <stdio.h>+#include <flint/flint.h>+#include <flint/ca_ext.h>++#include "../qqbar.h"+#include "../ca_ext.h"++void+ca_ext_fprint(FILE *file, const ca_ext_t x, ca_ctx_t ctx)+{+ if (x->head == CA_QQBar)+ {+ flint_fprintf(file, "Algebraic ");++ if (qqbar_is_i(CA_EXT_QQBAR(x)))+ flint_fprintf(file, "I");+ else+ {+ /*+ flint_fprintf(file, "Algebraic [deg %wd] ", qqbar_degree(CA_EXT_QQBAR(x)));+ qqbar_printn(CA_EXT_QQBAR(x), 10);+ */++ qqbar_fprintn(file, CA_EXT_QQBAR(x), 8);+ /*+ flint_fprintf(file, " (");+ fmpz_poly_print_pretty(QQBAR_POLY(CA_EXT_QQBAR(x)), "a");+ flint_fprintf(file, "=0)");+ */+ }+ }+ else+ {+ flint_fprintf(file, "%s", calcium_func_name(CA_EXT_HEAD(x)));++ if (CA_EXT_FUNC_NARGS(x) != 0)+ {+ slong i;+ flint_fprintf(file, "(");+ for (i = 0; i < CA_EXT_FUNC_NARGS(x); i++)+ {+ ca_fprint(file, CA_EXT_FUNC_ARGS(x) + i, ctx);++ if (i < CA_EXT_FUNC_NARGS(x) - 1)+ flint_fprintf(file, ", ");+ }+ flint_fprintf(file, ")");+ }+ }+}++char*+ca_ext_get_str(const ca_ext_t x, ca_ctx_t ctx)+{+ char * buffer = NULL;+ size_t buffer_size = 0;++ FILE * out = open_memstream(&buffer, &buffer_size);++ ca_ext_fprint(out, x, ctx);++ fclose(out);++ return buffer;+}
+ csrc/ca_mat/io.c view
@@ -0,0 +1,50 @@+#include <stdlib.h>+#include <stdio.h>+#include <string.h>++#include <stdio.h>+#include <flint/flint.h>+#include <flint/ca.h>+#include <flint/ca_mat.h>++#include "../ca_mat.h"++char*+ca_mat_get_str(const ca_mat_t mat, ca_ctx_t ctx)+{+ char * buffer = NULL;+ size_t buffer_size = 0;++ FILE * out = open_memstream(&buffer, &buffer_size);++ ca_mat_fprint(out, mat, ctx);++ fclose(out);++ return buffer;+}++void+ca_mat_fprint(FILE *file, const ca_mat_t mat, ca_ctx_t ctx)+{+ slong r, c;+ slong i, j;++ r = ca_mat_nrows(mat);+ c = ca_mat_ncols(mat);++ flint_fprintf(file, "ca_mat of size %wd x %wd:\n", r, c);++ for (i = 0; i < r; i++)+ {+ for (j = 0; j < c; j++)+ {+ flint_fprintf(file, " ");+ ca_fprint(file, ca_mat_entry(mat, i, j), ctx);+ flint_fprintf(file, "\n");+ }++ }++ flint_fprintf(file, "\n");+}
+ csrc/ca_poly/io.c view
@@ -0,0 +1,46 @@+/*+ Copyright (C) 2020 Fredrik Johansson++ This file is part of Calcium.++ Calcium is free software: you can redistribute it and/or modify it under+ the terms of the GNU Lesser General Public License (LGPL) as published+ by the Free Software Foundation; either version 2.1 of the License, or+ (at your option) any later version. See <http://www.gnu.org/licenses/>.+*/++#include "ca_poly.h"++void+ca_poly_fprint(FILE *file, const ca_poly_t poly, ca_ctx_t ctx)+{+ slong i, len;++ len = poly->length;++ flint_fprintf(file, "ca_poly of length %wd:\n", len);++ for (i = 0; i < len; i++)+ {+ char *str = ca_get_str(poly->coeffs + i, ctx);+ flint_fprintf(file, " %s\n", str);+ flint_free(str);+ }++ flint_fprintf(file, "\n");+}++char*+ca_poly_get_str(const ca_poly_t poly, ca_ctx_t ctx)+{+ char * buffer = NULL;+ size_t buffer_size = 0;++ FILE * out = open_memstream(&buffer, &buffer_size);++ ca_poly_fprint(out, poly, ctx);++ fclose(out);++ return buffer;+}
+ csrc/dirichlet.h view
@@ -0,0 +1,16 @@+#ifndef CSRC_DIRICHLET_H_+#define CSRC_DIRICHLET_H_++#include <stdlib.h>+#include <flint/dirichlet.h>++void+dirichlet_char_fprint(FILE *file,+ const dirichlet_group_t G,+ const dirichlet_char_t x);++char*+dirichlet_char_get_str(const dirichlet_group_t G,+ const dirichlet_char_t x);++#endif // CSRC_DIRICHLET_H_
+ csrc/dirichlet/io.c view
@@ -0,0 +1,47 @@+/*+ Copyright (C) 2022 Hartmut Monien++ This file is part of Arb.++ Arb is free software: you can redistribute it and/or modify it under+ the terms of the GNU Lesser General Public License (LGPL) as published+ by the Free Software Foundation; either version 2.1 of the License, or+ (at your option) any later version. See <http://www.gnu.org/licenses/>.+*/++#include <stdlib.h>+#include <flint/dirichlet.h>++#include "dirichlet.h"++void+dirichlet_char_fprint(FILE *file,+ const dirichlet_group_t G,+ const dirichlet_char_t x)+{+ slong k;+ if (G->num)+ flint_fprintf(file, "[%wu", x->log[0]);+ else+ flint_printf("[");+ for (k = 1; k < G->num; k++)+ flint_fprintf(file, ", %wu", x->log[k]);+ flint_fprintf(file, "]");+}++char*+dirichlet_char_get_str(const dirichlet_group_t G,+ const dirichlet_char_t x)+{+ char * buffer = NULL;+ size_t buffer_size = 0;++ FILE * out = open_memstream(&buffer, &buffer_size);++ dirichlet_char_fprint(out, G, x);++ fclose(out);++ return buffer;+}+
+ csrc/fmpz_mpoly_factor.h view
@@ -0,0 +1,18 @@+#ifndef CSRC_FMPZ_MPOLY_FACTOR_H_+#define CSRC_FMPZ_MPOLY_FACTOR_H_++#include <stdio.h>+#include <flint/fmpz_mpoly_factor.h>++void+fmpz_mpoly_factor_fprint_pretty(FILE *file,+ const fmpz_mpoly_factor_t f,+ const char ** vars,+ const fmpz_mpoly_ctx_t ctx);++char*+fmpz_mpoly_factor_get_str_pretty(const fmpz_mpoly_factor_t f,+ const char ** vars,+ const fmpz_mpoly_ctx_t ctx);++#endif
+ csrc/fmpz_mpoly_factor/io.c view
@@ -0,0 +1,38 @@+#include <stdio.h>+#include <flint/fmpz_mpoly_factor.h>+++void+fmpz_mpoly_factor_fprint_pretty(FILE *file,+ const fmpz_mpoly_factor_t f,+ const char ** vars,+ const fmpz_mpoly_ctx_t ctx) {+ slong i;+ + fmpz_fprint(file, f->constant);+ for (i = 0; i < f->num; i++) {+ flint_fprintf(file, "*(", i);+ fmpz_mpoly_fprint_pretty(file, f->poly + i, vars, ctx);+ flint_fprintf(file, ")^");+ fmpz_fprint(file, f->exp + i);+ }++ +}++char*+fmpz_mpoly_factor_get_str_pretty(const fmpz_mpoly_factor_t f,+ const char ** vars,+ const fmpz_mpoly_ctx_t ctx) {+ char * buffer = NULL;+ size_t buffer_size = 0;++ FILE * out = open_memstream(&buffer, &buffer_size);++ fmpz_mpoly_factor_fprint_pretty(out, f, vars, ctx);++ fclose(out);++ return buffer;+}+
package.yaml view
@@ -1,10 +1,10 @@ name: Flint2-version: 0.1.0.1+version: 0.1.0.2 github: "monien/Flint2"-license: BSD3+license: GPL-2 author: "Hartmut Monien" maintainer: "hmonien@uni-bonn.de"-copyright: "Copyright (c) 2022 Hartmut Monien"+copyright: "Copyright (c) 2023 Hartmut Monien" category: Math synopsis: "Haskell bindings for the flint library for number theory" @@ -17,8 +17,30 @@ extra-doc-files: docs/*.png -description: Please see the README on GitHub at <https://github.com/monien/Flint2#readme>+description:+ A Haskell Wrapper for Flint+ + This library provides access to the functionality of the FLINT. + So what is it?+ + FLINT is a C library for doing number theory, freely+ available under the GNU LGPL at+ [https://flintlib.org](https://flintlib.org)++ At its core, FLINT provides arithmetic in standard rings such as the+ integers, rationals, algebraic, real, complex and p-adic numbers,+ finite fields, and number fields. It also provides polynomials+ (univariate and multivariate), power series, and matrices.++ At the research frontier+ + FLINT has been used for many large scale research computations+ (e.g. A Trillion Triangles) and has been cited in hundreds+ of publications. FLINT's authors themselves have published more+ than 20 papers describing new algorithms first implemented within+ or on top of FLINT.+ dependencies: - base >= 4.7 && < 5 @@ -157,6 +179,7 @@ - Data.Number.Flint.Arb - Data.Number.Flint.Arb.Instances - Data.Number.Flint.Arb.Mag+ - Data.Number.Flint.Arb.Mag.Instances - Data.Number.Flint.Arb.Arf - Data.Number.Flint.Arb.Poly - Data.Number.Flint.Arb.Poly.Instances@@ -184,6 +207,18 @@ - Data.Number.Flint.Acb.DFT - Data.Number.Flint.Acb.ComplexField - Data.Number.Flint.Acb.Calc+ # Exact real and complex numbers+ - Data.Number.Flint.Calcium+ - Data.Number.Flint.Calcium.Ca+ - Data.Number.Flint.Calcium.Ca.Types+ - Data.Number.Flint.Calcium.Ca.Poly+ - Data.Number.Flint.Calcium.Ca.Vec+ - Data.Number.Flint.Calcium.Ca.Mat+ - Data.Number.Flint.Calcium.Ca.Field+ - Data.Number.Flint.Calcium.Ca.Ext+ - Data.Number.Flint.Calcium.Fexpr+ - Data.Number.Flint.Calcium.Fexpr.Instances+ - Data.Number.Flint.Calcium.Fexpr.Builtin # Other - Data.Number.Flint.Bernoulli - Data.Number.Flint.Partitions@@ -318,6 +353,16 @@ - Data.Number.Flint.Acb.Dirichlet.FFI - Data.Number.Flint.Acb.DFT.FFI - Data.Number.Flint.Acb.Calc.FFI+ # Calcium+ - Data.Number.Flint.Calcium.FFI+ - Data.Number.Flint.Calcium.Ca.FFI+ - Data.Number.Flint.Calcium.Ca.Types.FFI+ - Data.Number.Flint.Calcium.Ca.Poly.FFI+ - Data.Number.Flint.Calcium.Ca.Vec.FFI+ - Data.Number.Flint.Calcium.Ca.Mat.FFI+ - Data.Number.Flint.Calcium.Ca.Field.FFI+ - Data.Number.Flint.Calcium.Ca.Ext.FFI+ - Data.Number.Flint.Calcium.Fexpr.FFI # Other - Data.Number.Flint.Bernoulli.FFI - Data.Number.Flint.Partitions.FFI@@ -327,6 +372,7 @@ - Data.Number.Flint.NF.Elem.FFI - Data.Number.Flint.NF.Fmpzi.FFI - Data.Number.Flint.NF.QQbar.FFI+ include-dirs: csrc install-includes: - acb.h - acb_mat.h@@ -341,6 +387,7 @@ - arf.h - bool_mat.h - d_mat.h+ - dirichlet.h - double_interval.h - fmpq.h - fmpq_mat.h@@ -350,6 +397,7 @@ - fmpz_factor.h - fmpz_mat.h - fmpz_mod_poly_factor.h+ - fmpz_mpoly_factor.h - fmpz_mpoly_q.h - fmpz_poly_mat.h - fmpz_vec.h@@ -381,6 +429,7 @@ - csrc/fmpz_poly_mat/fprint.c - csrc/fmpz_poly_mat/get_str.c - csrc/fmpz_factor/get_str.c+ - csrc/fmpz_mpoly_factor/io.c - csrc/fmpz_mpoly_q/fprint.c - csrc/fmpz_mpoly_q/get_str_pretty.c - csrc/fmpz_vec/get_str.c@@ -411,6 +460,7 @@ - csrc/aprcl/get_str.c # Groups - csrc/bool_mat/get_str.c+ - csrc/dirichlet/io.c - csrc/qfb/get_str.c - csrc/qfb/fprint.c - csrc/qqbar/fprint.c@@ -446,6 +496,7 @@ - csrc/d_mat/io.c # arb - csrc/arb/midref.c+ - csrc/arb/radref.c - csrc/arf/inlines.c - csrc/mag/get_str.c - csrc/arb/get_strd.c@@ -471,6 +522,10 @@ - csrc/acb_modular/inlines.c - csrc/acb_modular/get_str.c - csrc/mpfr_mat/swap_entrywise.c+ # calcium+ - csrc/ca_poly/io.c+ - csrc/ca_mat/io.c+ - csrc/ca_ext/io.c # word problem - csrc/psl2z/word_problem.c # perm@@ -478,13 +533,13 @@ - csrc/perm/print_pretty.c - csrc/perm/power.c - csrc/perm/mat.c- include-dirs: csrc build-tools: hsc2hs- extra-libraries: flint, gmp+ extra-libraries: flint pkgconfig-depends: flint >= 2.9, gmp dependencies:- - QuickCheck- - groups+ - QuickCheck >= 2.14.3 && < 2.15+ - groups >= 0.5.3 && < 0.6+ - containers >= 0.6.5 && < 0.7 tests: Flint2-test:
src/Data/Number/Flint.hs view
@@ -1,5 +1,3 @@-{-# OPTIONS_HADDOCK prune, ignore-exports #-}- {-| module : Data.Number.Flint.Flint copyright : (c) 2022 Hartmut Monien@@ -125,6 +123,7 @@ , module Data.Number.Flint.Arb , module Data.Number.Flint.Arb.RealField , module Data.Number.Flint.Arb.Mag+, module Data.Number.Flint.Arb.Mag.Instances , module Data.Number.Flint.Arb.Arf , module Data.Number.Flint.Arb.Poly , module Data.Number.Flint.Arb.Fmpz.Poly@@ -143,6 +142,17 @@ , module Data.Number.Flint.Acb.Dirichlet , module Data.Number.Flint.Acb.DFT , module Data.Number.Flint.Acb.Calc+-- ** Exact real and complex numbers+, module Data.Number.Flint.Calcium+, module Data.Number.Flint.Calcium.Ca+, module Data.Number.Flint.Calcium.Ca.Poly+, module Data.Number.Flint.Calcium.Ca.Vec+, module Data.Number.Flint.Calcium.Ca.Mat+, module Data.Number.Flint.Calcium.Ca.Field+, module Data.Number.Flint.Calcium.Ca.Ext+, module Data.Number.Flint.Calcium.Fexpr+, module Data.Number.Flint.Calcium.Fexpr.Instances+, module Data.Number.Flint.Calcium.Fexpr.Builtin -- ** Partitions , module Data.Number.Flint.Partitions -- ** Bernoulli numbers@@ -295,6 +305,16 @@ import Data.Number.Flint.Acb.DFT import Data.Number.Flint.Acb.ComplexField import Data.Number.Flint.Acb.Calc+-- Exact real and complex numbers+import Data.Number.Flint.Calcium+import Data.Number.Flint.Calcium.Ca+import Data.Number.Flint.Calcium.Ca.Poly+import Data.Number.Flint.Calcium.Ca.Vec+import Data.Number.Flint.Calcium.Ca.Mat+import Data.Number.Flint.Calcium.Ca.Field+import Data.Number.Flint.Calcium.Ca.Ext+import Data.Number.Flint.Calcium.Fexpr+import Data.Number.Flint.Calcium.Fexpr.Builtin -- Partitions import Data.Number.Flint.Partitions -- Bernoulli numbers@@ -328,6 +348,7 @@ import Data.Number.Flint.NMod.Poly.Instances import Data.Number.Flint.Arb.Instances+import Data.Number.Flint.Arb.Mag.Instances import Data.Number.Flint.Arb.Poly.Instances import Data.Number.Flint.Arb.Mat.Instances @@ -340,3 +361,5 @@ import Data.Number.Flint.Groups.Bool.Mat.Instances import Data.Number.Flint.Support.D.Mat.Instances++import Data.Number.Flint.Calcium.Fexpr.Instances
src/Data/Number/Flint/Acb/Calc/FFI.hsc view
@@ -11,10 +11,14 @@ -- * Integration , acb_calc_integrate -- * Options for integration- , AcbCalcIntegrateOpt ()- , CAcbCalcIntegrateOpt+ , AcbCalcIntegrateOpt (..)+ , CAcbCalcIntegrateOpt (..) , newAcbCalcIntegrateOpt+ , newAcbCalcIntegrateOpt_ , withAcbCalcIntegrateOpt+ , withNewAcbCalcIntegrateOpt+ , withNewAcbCalcIntegrateOpt_+ -- * Memory management , acb_calc_integrate_opt_init -- * Local integration algorithms , acb_calc_integrate_gl_auto_deg@@ -61,19 +65,40 @@ <*> #{peek acb_calc_integrate_opt_struct, depth_limit} ptr <*> #{peek acb_calc_integrate_opt_struct, use_heap } ptr <*> #{peek acb_calc_integrate_opt_struct, verbose } ptr- poke = error "CAcbCalcIntegrateOpt.poke undefined."-+ poke ptr (CAcbCalcIntegrateOpt deg eval depth heap verbose) = do+ (#poke acb_calc_integrate_opt_struct, deg_limit ) ptr deg+ (#poke acb_calc_integrate_opt_struct, eval_limit ) ptr eval+ (#poke acb_calc_integrate_opt_struct, depth_limit) ptr depth+ (#poke acb_calc_integrate_opt_struct, use_heap ) ptr heap+ (#poke acb_calc_integrate_opt_struct, verbose ) ptr verbose+ newAcbCalcIntegrateOpt = do x <- mallocForeignPtr withForeignPtr x acb_calc_integrate_opt_init return $ AcbCalcIntegrateOpt x +newAcbCalcIntegrateOpt_ deg eval depth heap verbose = do+ x <- mallocForeignPtr+ withForeignPtr x $ \x -> do+ acb_calc_integrate_opt_init x+ poke x (CAcbCalcIntegrateOpt deg eval depth heap verbose)+ return $ AcbCalcIntegrateOpt x+ withAcbCalcIntegrateOpt (AcbCalcIntegrateOpt x) f = withForeignPtr x $ \xp -> f xp <&> (AcbCalcIntegrateOpt x,)- ++withNewAcbCalcIntegrateOpt f = do+ x <- newAcbCalcIntegrateOpt+ withAcbCalcIntegrateOpt x f++withNewAcbCalcIntegrateOpt_ deg eval depth heap verbose f = do+ x <- newAcbCalcIntegrateOpt_ deg eval depth heap verbose+ withAcbCalcIntegrateOpt x f+ -- acb_calc_func_t ------------------------------------------------------------- -type CAcbCalcFunc = Ptr CAcb -> Ptr () -> CLong -> CLong+type CAcbCalcFunc =+ (Ptr CAcb -> Ptr CAcb -> Ptr () -> CLong -> CLong -> IO CInt) -- Integration -----------------------------------------------------------------
src/Data/Number/Flint/Acb/FFI.hsc view
@@ -14,6 +14,8 @@ , withNewAcb , withAcbRe , withAcbIm+ , acb_realref+ , acb_imagref -- * Memory management , acb_init , acb_clear@@ -317,20 +319,34 @@ withAcbRe :: Acb -> (Ptr CArb -> IO t) -> IO (Acb, t) withAcbRe (Acb p) f = do withForeignPtr p $ \fp -> do- withForeignPtr p $ \fp -> (Acb p,) <$> f (castPtr fp)+ withForeignPtr p $ \fp -> (Acb p,) <$> f (acb_realref fp) -- | Apply function `f` to imaginary part of `Acb` withAcbIm :: Acb -> (Ptr CArb -> IO t) -> IO (Acb, t) withAcbIm (Acb p) f = do withForeignPtr p $ \fp -> do- withForeignPtr p $ \fp -> (Acb p,) <$> f (castPtr fp `advancePtr` 1)+ withForeignPtr p $ \fp -> (Acb p,) <$> f (acb_imagref fp) instance Storable CAcb where sizeOf _ = #{size acb_t} alignment _ = #{alignment acb_t} peek = error "CAcb.peek not defined." poke = error "CAcb.poke not defined."- ++-- Access to real and imaginary part -------------------------------------------++-- | /acb_realref/ /z/+--+-- /acb_realref/ returns a `CArb` pointer to the real part of /z/.+acb_realref :: Ptr CAcb -> Ptr CArb+acb_realref z = castPtr z++-- | /acb_imagref/ /z/+--+-- /acb_imagref/ returns a `CArb` pointer to the imaginary part of /z/.+acb_imagref :: Ptr CAcb -> Ptr CArb+acb_imagref z = castPtr z `advancePtr` 1+ -- Memory management ----------------------------------------------------------- -- | /acb_init/ /x/
src/Data/Number/Flint/Acb/Instances.hs view
@@ -1,4 +1,3 @@-{-# OPTIONS_HADDOCK hide, prune, ignore-exports #-} module Data.Number.Flint.Acb.Instances where import System.IO.Unsafe
src/Data/Number/Flint/Acb/Mat/Instances.hs view
@@ -1,4 +1,3 @@-{-# OPTIONS_HADDOCK hide, prune, ignore-exports #-} module Data.Number.Flint.Acb.Mat.Instances where import System.IO.Unsafe
src/Data/Number/Flint/Acb/Modular/FFI.hsc view
@@ -904,4 +904,3 @@ -- input, /res/ is set to the zero polynomial. foreign import ccall "acb_modular.h acb_modular_hilbert_class_poly" acb_modular_hilbert_class_poly :: Ptr CFmpzPoly -> CLong -> IO ()-
src/Data/Number/Flint/Acb/Modular/Instances.hs view
@@ -1,4 +1,3 @@-{-# OPTIONS_HADDOCK hide, prune, ignore-exports #-} {-| module : Data.Number.Flint.Acb.Modular.Instances copyright : (c) 2022 Hartmut Monien
src/Data/Number/Flint/Acb/Poly/Instances.hs view
@@ -1,4 +1,3 @@-{-# OPTIONS_HADDOCK hide, prune, ignore-exports #-} module Data.Number.Flint.Acb.Poly.Instances ( AcbPoly (..) , module GHC.Exts
src/Data/Number/Flint/Acb/Types.hs view
@@ -1,4 +1,3 @@--- {-# OPTIONS_HADDOCK hide, prune, ignore-exports #-} module Data.Number.Flint.Acb.Types ( module Data.Number.Flint.Acb.Types.FFI ) where
src/Data/Number/Flint/Arb/Arf/FFI.hsc view
@@ -235,6 +235,7 @@ #define ARF_INLINES_C #include <flint/arf.h>+#include <flint/arb_calc.h> -- arf_t ----------------------------------------------------------------------- @@ -252,7 +253,7 @@ withNewArf f = do x <- newArf withArf x $ \x -> f x- + -- Memory management ----------------------------------------------------------- -- | /arf_init/ /x/
src/Data/Number/Flint/Arb/Calc/FFI.hsc view
@@ -10,6 +10,7 @@ , CArfInterval (..) , newArfInterval , withArfInterval+ , withNewArfInterval , CArbCalcFunc , arf_interval_init , arf_interval_clear@@ -26,6 +27,10 @@ , arb_calc_newton_conv_factor , arb_calc_newton_step , arb_calc_refine_root_newton+ -- * Return types+ , arb_calc_success + , arb_calc_imprecise_input + , arb_calc_no_convergence ) where -- Calculus with real-valued functions -----------------------------------------@@ -48,6 +53,7 @@ #include <flint/flint.h> #include <flint/arf_types.h>+#include <flint/arb_calc.h> -- arf_interval_t -------------------------------------------------------------- @@ -80,8 +86,18 @@ -- arb_calc_func_t ------------------------------------------------------------- -type CArbCalcFunc = Ptr CArb -> Ptr CArb -> Ptr () -> CLong -> CLong+type CArbCalcFunc = Ptr CArb -> Ptr CArb -> Ptr () -> CLong -> CLong -> IO CInt +-- arb_calc_returns ------------------------------------------------------------++type ArbCalcReturn = CInt++arb_calc_success, arb_calc_imprecise_input, arb_calc_no_convergence :: ArbCalcReturn++arb_calc_success = #const ARB_CALC_SUCCESS+arb_calc_imprecise_input = #const ARB_CALC_IMPRECISE_INPUT+arb_calc_no_convergence = #const ARB_CALC_NO_CONVERGENCE+ -- Subdivision-based root finding ---------------------------------------------- -- | /arf_interval_init/ /v/ @@ -189,7 +205,7 @@ -- represented exactly as floating-point numbers in memory. Do not pass -- \(1 \pm 2^{-10^{100}}\) as input. foreign import ccall "arb_calc.h arb_calc_isolate_roots"- arb_calc_isolate_roots :: Ptr (Ptr CArfInterval) -> Ptr (Ptr CInt) -> FunPtr CArbCalcFunc -> Ptr () -> Ptr CArfInterval -> CLong -> CLong -> CLong -> CLong -> IO CLong+ arb_calc_isolate_roots :: Ptr (Ptr CArfInterval) -> Ptr (Ptr CInt)-> FunPtr CArbCalcFunc -> Ptr () -> Ptr CArfInterval -> CLong -> CLong -> CLong -> CLong -> IO CLong -- | /arb_calc_refine_root_bisect/ /r/ /func/ /param/ /start/ /iter/ /prec/ --
src/Data/Number/Flint/Arb/FFI.hsc view
@@ -19,6 +19,7 @@ , arb_init , arb_clear , arb_midref+ , arb_radref , _arb_vec_init , _arb_vec_clear , arb_swap@@ -396,6 +397,8 @@ -- Real numbers ---------------------------------------------------------------- +import System.IO.Unsafe+ import Foreign.Ptr import Foreign.ForeignPtr import Foreign.C.Types@@ -470,8 +473,15 @@ p_arb_clear :: FunPtr (Ptr CArb -> IO ()) foreign import ccall "arb.h arb_midref_"- arb_midref :: Ptr CArb -> IO (Ptr CArf)- + arb_midref_ :: Ptr CArb -> IO (Ptr CArf)++arb_midref = unsafePerformIO . arb_midref_++foreign import ccall "arb.h arb_radref_"+ arb_radref_ :: Ptr CArb -> IO (Ptr CMag)++arb_radref = unsafePerformIO . arb_radref_+ -- | /_arb_vec_init/ /n/ -- -- Returns a pointer to an array of /n/ initialized @arb_struct@ entries.
src/Data/Number/Flint/Arb/Fmpz/Poly/FFI.hsc view
@@ -24,6 +24,7 @@ , arb_fmpz_poly_deflate -- * Polynomial roots , arb_fmpz_poly_complex_roots+ , arb_fmpz_poly_roots_verbose -- * Special polynomials , arb_fmpz_poly_cos_minpoly , arb_fmpz_poly_gauss_period_minpoly@@ -52,6 +53,15 @@ import Data.Number.Flint.Acb.Types import Data.Number.Flint.Acb.Poly +#include <flint/arb_fmpz_poly.h>++-- Flags -----------------------------------------------------------------------++type ArbFmpzPolyFlags = CInt++arb_fmpz_poly_roots_verbose :: ArbFmpzPolyFlags+arb_fmpz_poly_roots_verbose = #const ARB_FMPZ_POLY_ROOTS_VERBOSE+ -- Evaluation ------------------------------------------------------------------ -- | /_arb_fmpz_poly_evaluate_arb_horner/ /res/ /poly/ /len/ /x/ /prec/ @@ -174,7 +184,7 @@ -- -- The following /flags/ are supported: -- --- - /ARB_FMPZ_POLY_ROOTS_VERBOSE/+-- - /arb_fmpz_poly_roots_verbose/ foreign import ccall "arb_fmpz_poly.h arb_fmpz_poly_complex_roots" arb_fmpz_poly_complex_roots :: Ptr CAcb -> Ptr CFmpzPoly -> CInt -> CLong -> IO ()
src/Data/Number/Flint/Arb/Instances.hs view
@@ -1,5 +1,6 @@-{-# OPTIONS_HADDOCK hide, prune, ignore-exports #-}-module Data.Number.Flint.Arb.Instances where+module Data.Number.Flint.Arb.Instances (+ Arb (..)+) where import Test.QuickCheck @@ -7,6 +8,7 @@ import Foreign.C.String import Foreign.Marshal.Alloc ( free ) +import Data.Char import Data.Number.Flint.Arb instance Show Arb where@@ -16,3 +18,4 @@ free cs return s +
src/Data/Number/Flint/Arb/Mag/FFI.hsc view
@@ -55,6 +55,7 @@ , mag_min , mag_max -- * Input and output+ , mag_get_str , mag_print , mag_fprint , mag_dump_str
+ src/Data/Number/Flint/Arb/Mag/Instances.hs view
@@ -0,0 +1,67 @@+module Data.Number.Flint.Arb.Mag.Instances (+ Mag (..)+) where++import System.IO.Unsafe+import Foreign.C.String+import Foreign.Marshal.Alloc++import Data.Number.Flint.Fmpz+import Data.Number.Flint.Fmpz.Instances+import Data.Number.Flint.Arb.Mag++instance Show Mag where+ show x = unsafePerformIO $ do+ (_, cs) <- withMag x mag_get_str+ s <- peekCString cs+ free cs+ return s++instance Eq Mag where+ (==) x y = snd $ snd $ unsafePerformIO $ do+ withMag x $ \x -> do+ withMag y $ \y -> do+ f <- mag_equal x y+ return $ f == 1++instance Ord Mag where+ compare x y = snd $ snd $ unsafePerformIO $ do+ withMag x $ \x -> do+ withMag y $ \y -> do+ f <- mag_cmp x y+ return $ f `compare` 0++instance Num Mag where+ (+) = lift2 mag_add+ (-) = lift2 mag_sub+ (*) = lift2 mag_mul+ abs = undefined+ signum = undefined+ fromInteger x = unsafePerformIO $ do+ let tmp = fromInteger x :: Fmpz+ result <- newMag+ withMag result $ \p -> do+ withFmpz tmp $ \tmp -> do+ mag_set_fmpz p tmp+ return result++instance Fractional Mag where+ (/) = lift2 mag_div+ recip = lift1 mag_inv+ fromRational = undefined+ +lift1 f x = fst $ unsafePerformIO $ + withNewMag $ \result -> + withMag x $ \x ->+ f result x+ +lift2 f x y = unsafePerformIO $ do+ result <- newMag+ withMag result $ \result -> do+ withMag x $ \x -> do+ withMag y $ \y -> do+ f result x y+ return result+++
src/Data/Number/Flint/Arb/Mat/Instances.hs view
@@ -1,4 +1,3 @@-{-# OPTIONS_HADDOCK hide, prune, ignore-exports #-} module Data.Number.Flint.Arb.Mat.Instances where import System.IO.Unsafe
src/Data/Number/Flint/Arb/Poly/FFI.hsc view
@@ -249,6 +249,7 @@ , _arb_poly_rising_ui_series , arb_poly_rising_ui_series -- * Zeta function+ , _arb_poly_zeta_series , arb_poly_zeta_series , _arb_poly_riemann_siegel_theta_series , arb_poly_riemann_siegel_theta_series@@ -1823,6 +1824,12 @@ arb_poly_rising_ui_series :: Ptr CArbPoly -> Ptr CArbPoly -> CULong -> CLong -> CLong -> IO () -- Zeta function ---------------------------------------------------------------++-- | /_arb_poly_zeta_series/ /res/ /h/ /hlen/ /a/ /deflate/ /len/ /prec/+--+foreign import ccall "arb_poly.h _arb_poly_zeta_series"+ _arb_poly_zeta_series :: Ptr CArb -> Ptr CArb-> CLong -> Ptr CArb -> CInt+ -> CLong -> CLong -> IO () -- | /arb_poly_zeta_series/ /res/ /s/ /a/ /deflate/ /n/ /prec/ --
src/Data/Number/Flint/Arb/Poly/Instances.hs view
@@ -1,4 +1,3 @@-{-# OPTIONS_HADDOCK hide, prune, ignore-exports #-} module Data.Number.Flint.Arb.Poly.Instances ( ArbPoly (..) , module GHC.Exts
src/Data/Number/Flint/Arb/RealField.hs view
@@ -97,10 +97,9 @@ man <- newFmpz exp <- newFmpz withArb x $ \a -> do- arf <- arb_midref a withFmpz man $ \man -> do withFmpz exp $ \exp -> do- arf_get_fmpz_2exp man exp arf+ arf_get_fmpz_2exp man exp (arb_midref a) return (toInteger man, fromIntegral exp) encodeFloat man exp = unsafePerformIO $ do let prec = fromInteger $ natVal (Proxy :: Proxy n)
src/Data/Number/Flint/Arb/Types.hs view
@@ -1,4 +1,3 @@--- {-# OPTIONS_HADDOCK hide, prune, ignore-exports #-} module Data.Number.Flint.Arb.Types ( module Data.Number.Flint.Arb.Types.FFI ) where
src/Data/Number/Flint/Arb/Types/FFI.hsc view
@@ -21,7 +21,10 @@ #include <flint/arf.h> #include <flint/mag.h> #include <flint/arb.h>+#include <flint/arb_calc.h> +-- mag_t -----------------------------------------------------------------------+ -- | Data structure containing the CMag pointer data Mag = Mag {-# UNPACK #-} !(ForeignPtr CMag) data CMag = CMag CFmpz CMpLimb@@ -107,32 +110,25 @@ poke = error "CArb.poke undefined." -- | string options-newtype ArbStrOption = ArbStrOption {_ArbStrOption :: CULong}- deriving (Show, Eq)+type ArbStrOption = CULong -instance Num ArbStrOption where- (+) (ArbStrOption x) (ArbStrOption y) = ArbStrOption (x + y)- (*) = undefined- abs = undefined- signum = undefined- fromInteger = undefined- negate = undefined+arb_str_none, arb_str_more, arb_str_no_radius, arb_str_condense :: ArbStrOption -- | Default print option-arb_str_none = ArbStrOption 0+arb_str_none = 0 -- | If /arb_str_more/ is added to flags, more (possibly incorrect) -- digits may be printed-arb_str_more = ArbStrOption #const ARB_STR_MORE+arb_str_more = #const ARB_STR_MORE -- | If /arb_str_no_radius/ is added to /flags/, the radius is not -- included in the output if at least 1 digit of the midpoint can be -- printed.-arb_str_no_radius = ArbStrOption #const ARB_STR_NO_RADIUS+arb_str_no_radius = #const ARB_STR_NO_RADIUS -- | By adding a multiple m of /arb_str_condense/ to /flags/, strings of -- more than three times m consecutive digits are condensed, only -- printing the leading and trailing m digits along with brackets -- indicating the number of digits omitted (useful when computing -- values to extremely high precision).-arb_str_condense = ArbStrOption #const ARB_STR_CONDENSE+arb_str_condense = #const ARB_STR_CONDENSE -- arb_poly_t ------------------------------------------------------------------
src/Data/Number/Flint/Bernoulli/FFI.hsc view
@@ -23,7 +23,9 @@ -- * Isolated Bernoulli numbers , bernoulli_mod_p_harvey , _bernoulli_fmpq_ui_zeta+ , _bernoulli_fmpq_ui_multi_mod , _bernoulli_fmpq_ui+ , bernoulli_fmpq_ui ) where -- Support for Bernoulli numbers -----------------------------------------------@@ -168,6 +170,9 @@ foreign import ccall "bernoulli.h _bernoulli_fmpq_ui_zeta" _bernoulli_fmpq_ui_zeta :: Ptr CFmpz -> Ptr CFmpz -> CULong -> IO () +foreign import ccall "bernoulli.h _bernoulli_fmpq_ui_multi_mod"+ _bernoulli_fmpq_ui_multi_mod :: Ptr CFmpz -> Ptr CFmpz -> CULong+ -> CDouble -> IO () -- | /_bernoulli_fmpq_ui/ /num/ /den/ /n/ -- -- Computes the Bernoulli number \(B_n\) as an exact fraction, for an@@ -177,3 +182,5 @@ foreign import ccall "bernoulli.h _bernoulli_fmpq_ui" _bernoulli_fmpq_ui :: Ptr CFmpz -> Ptr CFmpz -> CULong -> IO () +foreign import ccall "bernoulli.h bernoulli_fmpq_ui"+ bernoulli_fmpq_ui :: Ptr CFmpq -> CULong -> IO ()
+ src/Data/Number/Flint/Calcium.hs view
@@ -0,0 +1,17 @@+{-|+module : Data.Number.Flint.Calcium+copyright : (c) 2023 Hartmut Monien+license : GNU GPL, version 2 or above (see LICENSE)+maintainer : hmonien@uni-bonn.de++Here we collect various utility methods for Flint, Arb and Antic types+that are missing in those libraries. Some of these functions may be+migrated upstream in the future.+-}++module Data.Number.Flint.Calcium (+ module Data.Number.Flint.Calcium.FFI+) where++import Data.Number.Flint.Calcium.FFI+
+ src/Data/Number/Flint/Calcium/Ca.hs view
@@ -0,0 +1,82 @@+{-|+module : Data.Number.Flint.Calcium.Ca+copyright : (c) 2023 Hartmut Monien+license : GNU GPL, version 2 or above (see LICENSE)+maintainer : hmonien@uni-bonn.de++== Exact real and complex numbers++A @Ca@ represents a real or complex number in a form suitable for+exact field arithmetic or comparison. Exceptionally, a @Ca@ may+represent a special nonnumerical value, such as an infinity.++== Introduction: numbers ++A /Calcium number/ is a real or complex number represented as an element+of a formal field \(K = \mathbb{Q}(a_1, \ldots, a_n)\) where the +symbols \(a_k\) denote fixed algebraic or transcendental numbers called+/extension numbers/. For example, \(e^{\,- 2 \pi} - 3i\) may be+represented as \((1 - 3 a_2^2 a_1) / a_2^2\) in the+field \(\mathbb{Q}(a_1,a_2)\) with \(a_1 = i, a_2 = e^{\pi}\). +Extension numbers+and fields are documented in the following separate modules:++The user does not need to construct extension numbers or formal+extension fields explicitly: each @Ca@ contains an internal pointer to+its formal field, and operations on Calcium numbers generate and cache+fields automatically as needed to express the results.++This representation is not canonical (in general). A given complex+number can be represented in different ways depending on the choice of+formal field /K/. Even within a fixed field /K/, a number can have+different representations if there are algebraic relations between the+extension numbers. Two numbers /x/ and /y/ can be tested for inequality+using numerical evaluation; to test for equality, it may be necessary to+eliminate dependencies between extension numbers. One of the central+goals of Calcium will be to implement heuristics for such elimination.++Together with each formal field /K/, Calcium stores a /reduction ideal/+ \(I = \{g_1,\ldots,g_m\}\) with \(g_i \in \mathbb{Z}[a_1,\ldots,a_n]\),+defining a set of algebraic relations \( g_i(a_1,\ldots,a_n) = 0\). Relations+can be absolute, say \(g_i = a_j^2 + 1\), or relative, say+ \(g_i = 2 a_j - 4 a_k - a_l a_m\). The reduction ideal effectively+partitions \(K\) into equivalence classes of complex numbers (e.g.+ \(i^2 = -1\) or \(2 \log(\pi i) = 4 \log(\sqrt{\pi}) + \pi i\)),+enabling simplifications and equality proving.++Extension numbers are always sorted+ \(a_1 \succ a_2 \succ \ldots \succ a_n\) where \(\succ\) denotes a+structural ordering (see @ca_cmp_repr@). If the reduction ideal is+triangular and the multivariate polynomial arithmetic uses lexicographic+ordering, reduction by /I/ eliminates numbers \(a_i\) with higher+complexity in the sense of \(\succ\).++The reduction ideal is an imperfect computational crutch: it is not+guaranteed to capture /all/ algebraic relations, and reduction is not+guaranteed to produce uniquely defined representatives. However, in the+specific case of an absolute number field \(K = \mathbb{Q}(a)\) where+/a/ is a @qqbar_t@ extension, the reduction ideal (consisting of a+single minimal polynomial) is canonical and field elements of /K/ can be+chosen canonically.++== Introduction: special values++In order to provide a closed arithmetic system and express limiting+cases of operators and special functions, a @Ca@ can hold any of the+following special values besides ordinary numbers:++The distinction between /Calcium numbers/ (which must represent elements+of \(\mathbb{C}\)) and the different kinds of nonnumerical values+(infinities, Undefined or Unknown) is essential. Nonnumerical values may+not be used as field extension numbers \(a_k\), and the denominator of a+formal field element must always represent a nonzero complex number.+Accordingly, for any given Calcium value /x/ that is not /Unknown/, it+is exactly known whether /x/ represents A) a number, B) unsigned+infinity, C) a signed infinity, or D) Undefined.+-}+module Data.Number.Flint.Calcium.Ca (+ module Data.Number.Flint.Calcium.Ca.FFI+ ) where+ +import GHC.Exts+import Data.Number.Flint.Calcium.Ca.FFI
+ src/Data/Number/Flint/Calcium/Ca/Ext.hs view
@@ -0,0 +1,33 @@+{-|+module : Data.Number.Flint.Calcium.Ca.Ext+copyright : (c) 2023 Hartmut Monien+license : GNU GPL, version 2 or above (see LICENSE)+maintainer : hmonien@uni-bonn.de+++A @CaExt@ represents a fixed real or complex number /a/.++The @CaExt@ structure is heavy-weight object, not just meant to act+as a node in a symbolic expression. It will cache various data to+support repeated computation with this particular number, including its+numerical enclosure and number field data in the case of algebraic+numbers.++Extension numbers are used internally by the @Ca@ type to define the+embeddings \(\mathbb{Q}(a) \to \mathbb{C}\) of formal fields. The user+does not normally need to create @ca_ext_t@ instances directly; the+intended way for the user to work with the extension number /a/ is to+create a @ca_t@ representing the field element \(1 \cdot a\). The+underlying @CaExt@ may be accessed to determine symbolic and+numerical properties of this number.++Since extension numbers may depend recursively on nontrivial fields for+function arguments, @CaExt@ operations require a @CaCtx@ context+object.++-}+module Data.Number.Flint.Calcium.Ca.Ext (+ module Data.Number.Flint.Calcium.Ca.Ext.FFI+ ) where+ +import Data.Number.Flint.Calcium.Ca.Ext.FFI
+ src/Data/Number/Flint/Calcium/Ca/Ext/FFI.hsc view
@@ -0,0 +1,262 @@+module Data.Number.Flint.Calcium.Ca.Ext.FFI (+ -- * Real and complex extension numbers+ -- * Type and macros+ CaExt (..)+ , CCaExt (..)+ , newCaExtQQbar+ , newCaExtConst+ , newCaExtFx+ , newCaExtFxy+ , newCaExtFxn+ , withCaExt+ -- * Memory management+ , ca_ext_init_qqbar+ , ca_ext_init_const+ , ca_ext_init_fx+ , ca_ext_init_fxy+ , ca_ext_init_fxn+ , ca_ext_init_set+ , ca_ext_clear+ -- * Structure+ , ca_ext_nargs+ , ca_ext_get_arg+ , ca_ext_hash+ , ca_ext_equal_repr+ , ca_ext_cmp_repr+ -- * Input and output+ , ca_ext_print+ -- * Numerical evaluation+ , ca_ext_get_acb_raw+ -- * Cache+ , ca_ext_cache_init+ , ca_ext_cache_clear+ , ca_ext_cache_insert+) where ++-- Real and complex extension numbers ------------------------------------------++import Foreign.Ptr+import Foreign.ForeignPtr+import Foreign.C.Types+import Foreign.C.String+import Foreign.Storable+import Foreign.Marshal.Array++import Data.Number.Flint.Flint+import Data.Number.Flint.Fmpz+import Data.Number.Flint.Acb.Types+import Data.Number.Flint.NF.QQbar+import Data.Number.Flint.Calcium+import Data.Number.Flint.Calcium.Ca+import Data.Number.Flint.Calcium.Ca.Types++#include <flint/ca_ext.h>++-- ca_ext_t --------------------------------------------------------------------++instance Storable CCaExt where+ {-# INLINE sizeOf #-}+ sizeOf _ = #{size ca_ext_t}+ {-# INLINE alignment #-}+ alignment _ = #{alignment ca_ext_t}+ peek = error "CCaExt.peek: Not defined"+ poke = error "CCaExt.poke: Not defined"++newCaExtQQbar x ctx@(CaCtx ctxf) = do+ res <- mallocForeignPtr+ withForeignPtr res $ \resp -> do+ withCaCtx ctx $ \ctxp -> do+ withQQbar x $ \xp -> do+ ca_ext_init_qqbar resp xp ctxp+ addForeignPtrFinalizerEnv p_ca_ext_clear resp ctxf+ return $ CaExt res++newCaExtConst fc ctx@(CaCtx ctxf) = do+ res <- mallocForeignPtr+ withForeignPtr res $ \resp -> do+ withCaCtx ctx $ \ctxp -> do+ ca_ext_init_const resp fc ctxp+ addForeignPtrFinalizerEnv p_ca_ext_clear resp ctxf+ return $ CaExt res++newCaExtFx fx x ctx@(CaCtx ctxf) = do+ res <- mallocForeignPtr+ withForeignPtr res $ \resp -> do+ withCaCtx ctx $ \ctxp -> do+ withCa x $ \x -> do+ ca_ext_init_fx resp fx x ctxp+ addForeignPtrFinalizerEnv p_ca_ext_clear resp ctxf+ return $ CaExt res++newCaExtFxy fxy x y ctx@(CaCtx ctxf) = do+ res <- mallocForeignPtr+ withForeignPtr res $ \resp -> do+ withCaCtx ctx $ \ctxp -> do+ withCa x $ \x -> do+ withCa y $ \y -> do+ ca_ext_init_fxy resp fxy x y ctxp+ addForeignPtrFinalizerEnv p_ca_ext_clear resp ctxf+ return $ CaExt res++newCaExtFxn fxn x nargs ctx@(CaCtx ctxf) = do+ res <- mallocForeignPtr+ withForeignPtr res $ \resp -> do+ withCaCtx ctx $ \ctxp -> do+ withCa x $ \x -> do+ ca_ext_init_fxn resp fxn x nargs ctxp+ addForeignPtrFinalizerEnv p_ca_ext_clear resp ctxf+ return $ CaExt res++withCaExt (CaExt x) f = do+ withForeignPtr x $ \px -> f px >>= return . (CaExt x,)++-- Memory management -----------------------------------------------------------++-- | /ca_ext_init_qqbar/ /res/ /x/ /ctx/ +--+-- Initializes /res/ and sets it to the algebraic constant /x/.+foreign import ccall "ca_ext.h ca_ext_init_qqbar"+ ca_ext_init_qqbar :: Ptr CCaExt -> Ptr CQQbar -> Ptr CCaCtx -> IO ()++-- | /ca_ext_init_const/ /res/ /func/ /ctx/ +--+-- Initializes /res/ and sets it to the constant defined by /func/+-- (example: /func/ = /CA_Pi/ for \(x = \pi\)).+foreign import ccall "ca_ext.h ca_ext_init_const"+ ca_ext_init_const :: Ptr CCaExt -> CCalciumFunctionCode -> Ptr CCaCtx -> IO ()++-- | /ca_ext_init_fx/ /res/ /func/ /x/ /ctx/ +--+-- Initializes /res/ and sets it to the univariate function value \(f(x)\)+-- where /f/ is defined by /func/ (example: /func/ = /CA_Exp/ for \(e^x\)).+foreign import ccall "ca_ext.h ca_ext_init_fx"+ ca_ext_init_fx :: Ptr CCaExt -> CCalciumFunctionCode -> Ptr CCa -> Ptr CCaCtx -> IO ()++-- | /ca_ext_init_fxy/ /res/ /func/ /x/ /y/ /ctx/ +--+-- Initializes /res/ and sets it to the bivariate function value+-- \(f(x, y)\) where /f/ is defined by /func/ (example: /func/ = /CA_Pow/+-- for \(x^y\)).+foreign import ccall "ca_ext.h ca_ext_init_fxy"+ ca_ext_init_fxy :: Ptr CCaExt -> CCalciumFunctionCode -> Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()++-- | /ca_ext_init_fxn/ /res/ /func/ /x/ /nargs/ /ctx/ +--+-- Initializes /res/ and sets it to the multivariate function value+-- \(f(x_1, \ldots, x_n)\) where /f/ is defined by /func/ and /n/ is given+-- by /nargs/.+foreign import ccall "ca_ext.h ca_ext_init_fxn"+ ca_ext_init_fxn :: Ptr CCaExt -> CCalciumFunctionCode -> Ptr CCa -> CLong -> Ptr CCaCtx -> IO ()++-- | /ca_ext_init_set/ /res/ /x/ /ctx/ +--+-- Initializes /res/ and sets it to a copy of /x/.+foreign import ccall "ca_ext.h ca_ext_init_set"+ ca_ext_init_set :: Ptr CCaExt -> Ptr CCaExt -> Ptr CCaCtx -> IO ()++-- | /ca_ext_clear/ /res/ /ctx/ +--+-- Clears /res/.+foreign import ccall "ca_ext.h ca_ext_clear"+ ca_ext_clear :: Ptr CCaExt -> Ptr CCaCtx -> IO ()++foreign import ccall "ca_ext.h &ca_ext_clear"+ p_ca_ext_clear :: FunPtr (Ptr CCaExt -> Ptr CCaCtx -> IO ())++-- Structure -------------------------------------------------------------------++-- | /ca_ext_nargs/ /x/ /ctx/ +--+-- Returns the number of function arguments of /x/. The return value is 0+-- for any algebraic constant and for any built-in symbolic constant such+-- as \(\pi\).+foreign import ccall "ca_ext.h ca_ext_nargs"+ ca_ext_nargs :: Ptr CCaExt -> Ptr CCaCtx -> IO CLong++-- | /ca_ext_get_arg/ /res/ /x/ /i/ /ctx/ +--+-- Sets /res/ to argument /i/ (indexed from zero) of /x/. This calls+-- /flint_abort/ if /i/ is out of range.+foreign import ccall "ca_ext.h ca_ext_get_arg"+ ca_ext_get_arg :: Ptr CCa -> Ptr CCaExt -> CLong -> Ptr CCaCtx -> IO ()++-- | /ca_ext_hash/ /x/ /ctx/ +--+-- Returns a hash of the structural representation of /x/.+foreign import ccall "ca_ext.h ca_ext_hash"+ ca_ext_hash :: Ptr CCaExt -> Ptr CCaCtx -> IO CULong++-- | /ca_ext_equal_repr/ /x/ /y/ /ctx/ +--+-- Tests /x/ and /y/ for structural equality, returning 0 (false) or 1+-- (true).+foreign import ccall "ca_ext.h ca_ext_equal_repr"+ ca_ext_equal_repr :: Ptr CCaExt -> Ptr CCaExt -> Ptr CCaCtx -> IO CInt++-- | /ca_ext_cmp_repr/ /x/ /y/ /ctx/ +--+-- Compares the representations of /x/ and /y/ in a canonical sort order,+-- returning -1, 0 or 1. This only performs a structural comparison of the+-- symbolic representations; the return value does not say anything+-- meaningful about the numbers represented by /x/ and /y/.+foreign import ccall "ca_ext.h ca_ext_cmp_repr"+ ca_ext_cmp_repr :: Ptr CCaExt -> Ptr CCaExt -> Ptr CCaCtx -> IO CInt++-- Input and output ------------------------------------------------------------++foreign import ccall "ca_ext.h ca_ext_get_str"+ ca_ext_get_str :: Ptr CCaExt -> Ptr CCaCtx -> IO CString++foreign import ccall "ca_ext.h ca_ext_fprint"+ ca_ext_fprint :: Ptr CFile -> Ptr CCaExt -> Ptr CCaCtx -> IO ()++-- | /ca_ext_print/ /x/ /ctx/ +--+-- Prints a description of /x/ to standard output.+ca_ext_print :: Ptr CCaExt -> Ptr CCaCtx -> IO ()+ca_ext_print x ctx = do+ printCStr (flip ca_ext_get_str ctx) x+ return ()++-- Numerical evaluation --------------------------------------------------------++-- | /ca_ext_get_acb_raw/ /res/ /x/ /prec/ /ctx/ +--+-- Sets /res/ to an enclosure of the numerical value of /x/. A working+-- precision of /prec/ bits is used for the evaluation, without adaptive+-- refinement.+foreign import ccall "ca_ext.h ca_ext_get_acb_raw"+ ca_ext_get_acb_raw :: Ptr CAcb -> Ptr CCaExt -> CLong -> Ptr CCaCtx -> IO ()++-- Cache -----------------------------------------------------------------------++++++++-- | /ca_ext_cache_init/ /cache/ /ctx/ +--+-- Initializes /cache/ for use.+foreign import ccall "ca_ext.h ca_ext_cache_init"+ ca_ext_cache_init :: Ptr CCaExtCache -> Ptr CCaCtx -> IO ()++-- | /ca_ext_cache_clear/ /cache/ /ctx/ +--+-- Clears /cache/, freeing the memory allocated internally.+foreign import ccall "ca_ext.h ca_ext_cache_clear"+ ca_ext_cache_clear :: Ptr CCaExtCache -> Ptr CCaCtx -> IO ()++-- | /ca_ext_cache_insert/ /cache/ /x/ /ctx/ +--+-- Adds /x/ to /cache/ without duplication. If a structurally identical+-- instance already exists in /cache/, a pointer to that instance is+-- returned. Otherwise, a copy of /x/ is inserted into /cache/ and a+-- pointer to that new instance is returned.+foreign import ccall "ca_ext.h ca_ext_cache_insert"+ ca_ext_cache_insert :: Ptr CCaExtCache -> Ptr CCaExt -> Ptr CCaCtx -> IO (Ptr CCaExt)++++
+ src/Data/Number/Flint/Calcium/Ca/FFI.hsc view
@@ -0,0 +1,2106 @@+{-| +module : Data.Number.Flint.Calcium.Ca.FFI+copyright : (c) 2022 Hartmut Monien+license : GNU GPL, version 2 or above (see LICENSE)+maintainer : hmonien@uni-bonn.de+-}+module Data.Number.Flint.Calcium.Ca.FFI (+ -- * Exact Numbers+ Ca (..)+ , CCa (..)+ , CaCtx (..)+ , CCaCtx (..)+ , newCa+ , withCa+ , withNewCa+ , newCaCtx+ , withCaCtx+ -- * Number objects+ -- * Context objects+ , ca_ctx_init+ , ca_ctx_clear+ , ca_ctx_print+ , ca_ctx_get_option+ , ca_ctx_set_option+ -- * Memory management for numbers+ , ca_init+ , ca_clear+ , ca_swap+ -- * Symbolic expressions+ , ca_get_fexpr+ , ca_set_fexpr+ -- * Print flags+ , CalciumPrintOption (..)+ -- + -- | The style of printed output is controlled a flag which can be+ -- set to any combination of the following flags:+ , ca_print_n+ , ca_print_repr+ , ca_print_field+ , ca_print_digits+ , ca_print_default+ , ca_print_debug+ -- $printflags+ + -- * Print+ , ca_print+ , ca_fprint+ , ca_get_str+ , ca_printn+ -- * Special values+ , ca_zero+ , ca_one+ , ca_neg_one+ , ca_i+ , ca_neg_i+ , ca_pi+ , ca_pi_i+ , ca_euler+ , ca_unknown+ , ca_undefined+ , ca_uinf+ , ca_pos_inf+ , ca_neg_inf+ , ca_pos_i_inf+ , ca_neg_i_inf+ -- * Assignment and conversion+ , ca_set+ , ca_set_si+ , ca_set_ui+ , ca_set_fmpz+ , ca_set_fmpq+ , ca_set_d+ , ca_set_d_d+ , ca_transfer+ -- * Conversion of algebraic numbers+ , ca_set_qqbar+ , ca_get_fmpz+ , ca_get_fmpq+ , ca_get_qqbar+ , ca_can_evaluate_qqbar+ -- * Random generation+ , ca_randtest_rational+ , ca_randtest+ , ca_randtest_special+ , ca_randtest_same_nf+ -- * Representation properties+ -- $representation+ , ca_equal_repr+ , ca_cmp_repr+ , ca_hash_repr+ , ca_is_unknown+ , ca_is_special+ , ca_is_qq_elem+ , ca_is_qq_elem_zero+ , ca_is_qq_elem_one+ , ca_is_qq_elem_integer+ , ca_is_nf_elem+ , ca_is_cyclotomic_nf_elem+ , ca_is_generic_elem+ -- * Value predicates+ , ca_check_is_number+ , ca_check_is_zero+ , ca_check_is_one+ , ca_check_is_neg_one+ , ca_check_is_i+ , ca_check_is_neg_i+ , ca_check_is_algebraic+ , ca_check_is_rational+ , ca_check_is_integer+ , ca_check_is_real+ , ca_check_is_negative_real+ , ca_check_is_imaginary+ , ca_check_is_undefined+ , ca_check_is_infinity+ , ca_check_is_uinf+ , ca_check_is_signed_inf+ , ca_check_is_pos_inf+ , ca_check_is_neg_inf+ , ca_check_is_pos_i_inf+ , ca_check_is_neg_i_inf+ -- * Comparisons+ , ca_check_equal+ , ca_check_lt+ , ca_check_le+ , ca_check_gt+ , ca_check_ge+ -- * Field structure operations+ , ca_merge_fields+ , ca_condense_field+ , ca_is_gen_as_ext+ -- * Arithmetic+ , ca_neg+ , ca_add_fmpq+ , ca_add_fmpz+ , ca_add_ui+ , ca_add_si+ , ca_add+ , ca_sub_fmpq+ , ca_sub_fmpz+ , ca_sub_ui+ , ca_sub_si+ , ca_fmpq_sub+ , ca_fmpz_sub+ , ca_ui_sub+ , ca_si_sub+ , ca_sub+ , ca_mul_fmpq+ , ca_mul_fmpz+ , ca_mul_ui+ , ca_mul_si+ , ca_mul+ , ca_inv+ , ca_fmpq_div+ , ca_fmpz_div+ , ca_ui_div+ , ca_si_div+ , ca_div_fmpq+ , ca_div_fmpz+ , ca_div_ui+ , ca_div_si+ , ca_div+ , ca_dot+ , ca_fmpz_poly_evaluate+ , ca_fmpq_poly_evaluate+ , ca_fmpz_mpoly_evaluate_horner+--, ca_fmpz_mpoly_evaluate_iter+ , ca_fmpz_mpoly_evaluate+ , ca_fmpz_mpoly_q_evaluate+ , ca_fmpz_mpoly_q_evaluate_no_division_by_zero+ , ca_inv_no_division_by_zero+ -- * Powers and roots+ , ca_sqr+ , ca_pow_fmpq+ , ca_pow_fmpz+ , ca_pow_ui+ , ca_pow_si+ , ca_pow+ , ca_pow_si_arithmetic+ , ca_sqrt_inert+ , ca_sqrt_nofactor+ , ca_sqrt_factor+ , ca_sqrt+ , ca_sqrt_ui+ -- * Complex parts+ , ca_abs+ , ca_sgn+ , ca_csgn+ , ca_arg+ , ca_re+ , ca_im+ , ca_conj_deep+ , ca_conj_shallow+ , ca_conj+ , ca_floor+ , ca_ceil+ -- * Exponentials and logarithms+ , ca_exp+ , ca_log+ -- * Trigonometric functions+ , ca_sin_cos_exponential+ , ca_sin_cos_direct+ , ca_sin_cos_tangent+ , ca_sin_cos+ , ca_sin+ , ca_cos+ , ca_tan_sine_cosine+ , ca_tan_exponential+ , ca_tan_direct+ , ca_tan+ , ca_cot+ , ca_atan_logarithm+ , ca_atan_direct+ , ca_atan+ , ca_asin_logarithm+ , ca_acos_logarithm+ , ca_asin_direct+ , ca_acos_direct+ , ca_asin+ , ca_acos+ -- * Special functions+ , ca_gamma+ , ca_erf+ , ca_erfc+ , ca_erfi+ -- * Numerical evaluation+ , ca_get_acb_raw+ , ca_get_acb+ , ca_get_acb_accurate_parts+ , ca_get_decimal_str+ -- * Rewriting and simplification+ , ca_rewrite_complex_normal_form+ -- * Factorization+ , CaFactor (..)+ , CCaFactor (..)+ , newCaFactor+ , withCaFactor+ , ca_factor_init+ , ca_factor_clear+ , ca_factor_one+ , ca_factor_print+ , ca_factor_insert+ , ca_factor_get_ca+ , ca_factor+ -- * Factorization options+ --+ -- $factorization_options+ + , ca_factor_poly_none+ , ca_factor_poly_content+ , ca_factor_poly_sqf+ , ca_factor_poly_full+ , ca_factor_zz_none+ , ca_factor_zz_smooth+ , ca_factor_zz_full+ -- * Context options+ --+ -- $context_options+ + , ca_opt_verbose+ , ca_opt_print_flags+ , ca_opt_mpoly_ord+ , ca_opt_prec_limit+ , ca_opt_qqbar_deg_limit+ , ca_opt_low_prec+ , ca_opt_smooth_limit+ , ca_opt_lll_prec+ , ca_opt_pow_limit+ , ca_opt_use_groebner+ , ca_opt_groebner_length_limit+ , ca_opt_groebner_poly_length_limit+ , ca_opt_groebner_poly_bits_limit+ , ca_opt_vieta_limit+ , ca_opt_trig_form+ , ca_trig_direct+ , ca_trig_exponential+ , ca_trig_sine_cosine+ , ca_trig_tangent+ -- * Internal representation+ , _ca_make_field_element+ , _ca_make_fmpq+) where++-- Exact real and complex numbers ----------------------------------------------++import Foreign.Ptr+import Foreign.ForeignPtr+import Foreign.Storable+import Foreign.C.Types+import Foreign.C.String++import Data.Number.Flint.Flint++import Data.Number.Flint.Fmpz+import Data.Number.Flint.Fmpz.Poly+import Data.Number.Flint.Fmpz.MPoly+import Data.Number.Flint.Fmpz.MPoly.Q+import Data.Number.Flint.Fmpq+import Data.Number.Flint.Fmpq.Poly++import Data.Number.Flint.NF.QQbar++import Data.Number.Flint.Arb.Types+import Data.Number.Flint.Acb.Types++import Data.Number.Flint.Calcium+import Data.Number.Flint.Calcium.Ca.Types++#include <flint/ca.h>++-- ca_t ------------------------------------------------------------------------++instance Storable CCa where+ {-# INLINE sizeOf #-}+ sizeOf _ = #{size ca_t}+ {-# INLINE alignment #-}+ alignment _ = #{alignment ca_t}+ peek = error "CCa.peek: Not defined"+ poke = error "CCa.poke: Not defined"++newCa ctx@(CaCtx fctx) = do+ x <- mallocForeignPtr+ withForeignPtr x $ \xp -> do+ withCaCtx ctx $ \ctxp -> do+ ca_init xp ctxp+ addForeignPtrFinalizerEnv p_ca_clear xp fctx+ return $ Ca x++{-# INLINE withCa #-}+withCa (Ca x) f = do+ withForeignPtr x $ \xp -> f xp >>= return . (Ca x,)++withNewCa ctx f = do+ x <- newCa ctx+ withCa x f+ +-- ca_factor -------------------------------------------------------------------++instance Storable CCaFactor where+ {-# INLINE sizeOf #-}+ sizeOf _ = #{size ca_factor_t}+ {-# INLINE alignment #-}+ alignment _ = #{alignment ca_factor_t}+ peek = error "CCaFactor.peek: Not defined"+ poke = error "CCaFactor.poke: Not defined"++newCaFactor ctx@(CaCtx fctx) = do+ x <- mallocForeignPtr+ withForeignPtr x $ \xp -> do+ withCaCtx ctx $ \ctxp -> do+ ca_factor_init xp ctxp+ addForeignPtrFinalizerEnv p_ca_factor_clear xp fctx+ return $ CaFactor x++{-# INLINE withCaFactor #-}+withCaFactor (CaFactor x) f = do+ withForeignPtr x $ \xp -> f xp >>= return . (CaFactor x,)++withNewCaFactor ctx f = do+ x <- newCaFactor ctx+ withCaCtx ctx $ \ctx -> do+ withCaFactor x $ \x -> do+ f x ctx+ +-- ca_ctx ----------------------------------------------------------------------++instance Storable CCaCtx where+ {-# INLINE sizeOf #-}+ sizeOf _ = #{size ca_ctx_t}+ {-# INLINE alignment #-}+ alignment _ = #{alignment ca_ctx_t}+ peek = error "CCaCtx.peek: Not defined"+ poke = error "CCaCtx.poke: Not defined"++newCaCtx = do+ ctx <- mallocForeignPtr+ withForeignPtr ctx $ \ctxp -> do+ ca_ctx_init ctxp+ addForeignPtrFinalizer p_ca_ctx_clear ctx+ return $ CaCtx ctx++withCaCtx (CaCtx x) f = do+ withForeignPtr x $ \xp -> f xp >>= return . (CaCtx x,)+ +--------------------------------------------------------------------------------++-- | /ca_ctx_init/ /ctx/ +--+-- Initializes the context object /ctx/ for use. Any evaluation options+-- stored in the context object are set to default values.+foreign import ccall "ca.h ca_ctx_init"+ ca_ctx_init :: Ptr CCaCtx -> IO ()++-- | /ca_ctx_clear/ /ctx/ +--+-- Clears the context object /ctx/, freeing any memory allocated+-- internally. This function should only be called after all @ca_t@+-- instances referring to this context have been cleared.+foreign import ccall "ca.h ca_ctx_clear"+ ca_ctx_clear :: Ptr CCaCtx -> IO ()++foreign import ccall "ca.h &ca_ctx_clear"+ p_ca_ctx_clear :: FunPtr (Ptr CCaCtx -> IO ())++-- | /ca_ctx_print/ /ctx/ +--+-- Prints a description of the context /ctx/ to standard output. This will+-- give a complete listing of the cached fields in /ctx/.+foreign import ccall "ca.h ca_ctx_print"+ ca_ctx_print :: Ptr CCaCtx -> IO ()++-- | /ca_ctx_get_options/ /ctx/ /i/+foreign import ccall "ca.h ca_ctx_get_option"+ ca_ctx_get_option :: Ptr CCaCtx -> CLong -> IO ()++-- | /ca_ctx_set_option/ /ctx/ /i/ /value/+foreign import ccall "ca.h ca_ctx_set_option"+ ca_ctx_set_option :: Ptr CCaCtx -> CLong -> CLong -> IO ()+ +-- Memory management for numbers -----------------------------------------------++-- | /ca_init/ /x/ /ctx/ +--+-- Initializes the variable /x/ for use, associating it with the context+-- object /ctx/. The value of /x/ is set to the rational number 0.+foreign import ccall "ca.h ca_init"+ ca_init :: Ptr CCa -> Ptr CCaCtx -> IO ()++-- | /ca_clear/ /x/ /ctx/ +--+-- Clears the variable /x/.+foreign import ccall "ca.h ca_clear"+ ca_clear :: Ptr CCa -> Ptr CCaCtx -> IO ()++foreign import ccall "ca.h &ca_clear"+ p_ca_clear :: FunPtr (Ptr CCa -> Ptr CCaCtx -> IO ())++-- | /ca_swap/ /x/ /y/ /ctx/ +--+-- Efficiently swaps the variables /x/ and /y/.+foreign import ccall "ca.h ca_swap"+ ca_swap :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()++-- Symbolic expressions --------------------------------------------------------++-- | /ca_get_fexpr/ /res/ /x/ /flags/ /ctx/ +--+-- Sets /res/ to a symbolic expression representing /x/.+foreign import ccall "ca.h ca_get_fexpr"+ ca_get_fexpr :: Ptr CFexpr -> Ptr CCa -> CULong -> Ptr CCaCtx -> IO ()++-- | /ca_set_fexpr/ /res/ /expr/ /ctx/ +--+-- Sets /res/ to the value represented by the symbolic expression /expr/.+-- Returns 1 on success and 0 on failure. This function essentially just+-- traverses the expression tree using @ca@ arithmetic; it does not provide+-- advanced symbolic evaluation. It is guaranteed to at least be able to+-- parse the output of @ca_get_fexpr@.+foreign import ccall "ca.h ca_set_fexpr"+ ca_set_fexpr :: Ptr CCa -> Ptr CFexpr -> Ptr CCaCtx -> IO CInt++-- Printing --------------------------------------------------------------------++type CalciumPrintOption = CULong++ca_print_n, ca_print_digits, ca_print_repr, ca_print_field, ca_print_default, ca_print_debug :: CalciumPrintOption++-- | /ca_print_n/+--+-- Print a decimal approximation of the number.+-- The approximation is guaranteed to be correctly rounded to within+-- one unit in the last place.+-- +-- If combined with ``ca_print_repr``, numbers appearing+-- within the symbolic representation will also be printed with+-- decimal approximations.+--+-- Warning: printing a decimal approximation requires a computation,+-- which can be expensive. It can also mutate+-- cached data (numerical enclosures of extension numbers), affecting+-- subsequent computations.+ca_print_n = #const CA_PRINT_N +-- | /ca_print_digits/+--+-- Multiplied by a positive integer, specifies the number of+-- decimal digits to show with ``ca_print_n``. If not given,+-- the default precision is six digits.+ca_print_digits = #const CA_PRINT_DIGITS+-- | /ca_print_repr/+--+-- Print the symbolic representation of the number (including+-- its recursive elements). If used together with ``ca_print_n``,+-- field elements will print as ``decimal {symbolic}`` while+-- extension numbers will print as ``decimal [symbolic]``.+--+-- All extension numbers appearing in the field defining ``x``+-- and in the inner constructions of those extension numbers+-- will be given local labels ``a``, ``b``, etc. for this printing.+ca_print_repr = #const CA_PRINT_REPR+-- | /ca_print_field/+--+-- For each field element, explicitly print its formal field+-- along with its reduction ideal if present, e.g. ``QQ`` or+-- ``QQ(a,b,c) / <a-b, c^2+1>``.+ca_print_field = #const CA_PRINT_FIELD+-- | /ca_print_default/+--+-- The default print style. Equivalent to ``ca_print_n | ca_print_repr``.+ca_print_default = #const CA_PRINT_DEFAULT+-- | /ca_print_debug/+--+-- Verbose print style for debugging. Equivalent to ``ca_print_n |+-- ca_print_repr | ca_print_field``.+ca_print_debug = #const CA_PRINT_DEBUG++-- $printflags+--+-- == Example for print flags+-- +-- As a special case, small integers are always printed as simple literals.+--+-- As illustration, here are the numbers -7, \(2/3\), \((\sqrt{3}+5)/2\)+-- and \(\sqrt{2} (\log(\pi) + \pi i)\) printed in various styles:+--+-- >> ca_print_default+-- -7+-- 0.666667 {2/3}+-- 3.36603 {(a+5)/2 where a = 1.73205 [a^2-3=0]}+-- 1.61889 + 4.44288*I {a*c+b*c*d where a = 1.14473 [Log(3.14159 {b})], b = 3.14159 [Pi], c = 1.41421 [c^2-2=0], d = I [d^2+1=0]}+--+-- >> ca_print_n+-- -7+-- 0.666667+-- 3.36603+-- 1.61889 + 4.44288*I+--+-- >> ca_print_n .|. (ca_print_digits * 20)+-- -7+-- 0.66666666666666666667+-- 3.3660254037844386468+-- 1.6188925298220266685 + 4.4428829381583662470*I+--+-- >> ca_print_repr+-- -7+-- 2/3+-- (a+5)/2 where a = [a^2-3=0]+-- a*c+b*c*d where a = Log(b), b = Pi, c = [c^2-2=0], d = [d^2+1=0]+--+-- >> ca_print_debug+-- -7+-- 0.666667 {2/3 in QQ}+-- 3.36603 {(a+5)/2 in QQ(a)/<a^2-3> where a = 1.73205 [a^2-3=0]}+-- 1.61889 + 4.44288*I {a*c+b*c*d in QQ(a,b,c,d)/<c^2-2, d^2+1> where a = 1.14473 [Log(3.14159 {b in QQ(b)})], b = 3.14159 [Pi], c = 1.41421 [c^2-2=0], d = I [d^2+1=0]}++-- | /ca_print/ /x/ /ctx/ +--+-- Prints /x/ to standard output.+ca_print :: Ptr CCa -> Ptr CCaCtx -> IO ()+ca_print x ctx = do+ printCStr (\x -> ca_get_str x ctx) x+ return ()+ +-- | /ca_fprint/ /fp/ /x/ /ctx/ +--+-- Prints /x/ to the file /fp/.+foreign import ccall "ca.h ca_fprint"+ ca_fprint :: Ptr CFile -> Ptr CCa -> Ptr CCaCtx -> IO ()++-- | /ca_get_str/ /x/ /ctx/ +--+-- Prints /x/ to a string which is returned. The user should free this+-- string by calling @flint_free@.+foreign import ccall "ca.h ca_get_str"+ ca_get_str :: Ptr CCa -> Ptr CCaCtx -> IO CString++-- | /ca_printn/ /x/ /n/ /ctx/ +--+-- Prints an /n/-digit numerical representation of /x/ to standard output.+foreign import ccall "ca.h ca_printn"+ ca_printn :: Ptr CCa -> CLong -> Ptr CCaCtx -> IO ()++-- Special values --------------------------------------------------------------++-- | /ca_zero/ /res/ /ctx/ +foreign import ccall "ca.h ca_zero"+ ca_zero :: Ptr CCa -> Ptr CCaCtx -> IO ()+-- | /ca_one/ /res/ /ctx/ +foreign import ccall "ca.h ca_one"+ ca_one :: Ptr CCa -> Ptr CCaCtx -> IO ()+-- | /ca_neg_one/ /res/ /ctx/ +--+-- Sets /res/ to the integer 0, 1 or -1. This creates a canonical+-- representation of this number as an element of the trivial field+-- \(\mathbb{Q}\).+foreign import ccall "ca.h ca_neg_one"+ ca_neg_one :: Ptr CCa -> Ptr CCaCtx -> IO ()++-- | /ca_i/ /res/ /ctx/ +foreign import ccall "ca.h ca_i"+ ca_i :: Ptr CCa -> Ptr CCaCtx -> IO ()+-- | /ca_neg_i/ /res/ /ctx/ +--+-- Sets /res/ to the imaginary unit \(i = \sqrt{-1}\), or its negation+-- \(-i\). This creates a canonical representation of \(i\) as the+-- generator of the algebraic number field \(\mathbb{Q}(i)\).+foreign import ccall "ca.h ca_neg_i"+ ca_neg_i :: Ptr CCa -> Ptr CCaCtx -> IO ()++-- | /ca_pi/ /res/ /ctx/ +--+-- Sets /res/ to the constant \(\pi\). This creates an element of the+-- transcendental number field \(\mathbb{Q}(\pi)\).+foreign import ccall "ca.h ca_pi"+ ca_pi :: Ptr CCa -> Ptr CCaCtx -> IO ()++-- | /ca_pi_i/ /res/ /ctx/ +--+-- Sets /res/ to the constant \(\pi i\). This creates an element of the+-- composite field \(\mathbb{Q}(i,\pi)\) rather than representing \(\pi i\)+-- (or even \(2 \pi i\), which for some purposes would be more elegant) as+-- an atomic quantity.+foreign import ccall "ca.h ca_pi_i"+ ca_pi_i :: Ptr CCa -> Ptr CCaCtx -> IO ()++-- | /ca_euler/ /res/ /ctx/ +--+-- Sets /res/ to Euler\'s constant \(\gamma\). This creates an element of+-- the (transcendental?) number field \(\mathbb{Q}(\gamma)\).+foreign import ccall "ca.h ca_euler"+ ca_euler :: Ptr CCa -> Ptr CCaCtx -> IO ()++-- | /ca_unknown/ /res/ /ctx/ +--+-- Sets /res/ to the meta-value /Unknown/.+foreign import ccall "ca.h ca_unknown"+ ca_unknown :: Ptr CCa -> Ptr CCaCtx -> IO ()++-- | /ca_undefined/ /res/ /ctx/ +--+-- Sets /res/ to /Undefined/.+foreign import ccall "ca.h ca_undefined"+ ca_undefined :: Ptr CCa -> Ptr CCaCtx -> IO ()++-- | /ca_uinf/ /res/ /ctx/ +--+-- Sets /res/ to unsigned infinity \({\tilde \infty}\).+foreign import ccall "ca.h ca_uinf"+ ca_uinf :: Ptr CCa -> Ptr CCaCtx -> IO ()++-- | /ca_pos_inf/ /res/ /ctx/ +foreign import ccall "ca.h ca_pos_inf"+ ca_pos_inf :: Ptr CCa -> Ptr CCaCtx -> IO ()+ +-- | /ca_neg_inf/ /res/ /ctx/ +foreign import ccall "ca.h ca_neg_inf"+ ca_neg_inf :: Ptr CCa -> Ptr CCaCtx -> IO ()+ +-- | /ca_pos_i_inf/ /res/ /ctx/ +foreign import ccall "ca.h ca_pos_i_inf"+ ca_pos_i_inf :: Ptr CCa -> Ptr CCaCtx -> IO ()+ +-- | /ca_neg_i_inf/ /res/ /ctx/ +--+-- Sets /res/ to the signed infinity \(+\infty\), \(-\infty\),+-- \(+i \infty\) or \(-i \infty\).+foreign import ccall "ca.h ca_neg_i_inf"+ ca_neg_i_inf :: Ptr CCa -> Ptr CCaCtx -> IO ()++-- Assignment and conversion ---------------------------------------------------++-- | /ca_set/ /res/ /x/ /ctx/ +--+-- Sets /res/ to a copy of /x/.+foreign import ccall "ca.h ca_set"+ ca_set :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()++-- | /ca_set_si/ /res/ /v/ /ctx/ +foreign import ccall "ca.h ca_set_si"+ ca_set_si :: Ptr CCa -> CLong -> Ptr CCaCtx -> IO ()+-- | /ca_set_ui/ /res/ /v/ /ctx/ +foreign import ccall "ca.h ca_set_ui"+ ca_set_ui :: Ptr CCa -> CULong -> Ptr CCaCtx -> IO ()+-- | /ca_set_fmpz/ /res/ /v/ /ctx/ +foreign import ccall "ca.h ca_set_fmpz"+ ca_set_fmpz :: Ptr CCa -> Ptr CFmpz -> Ptr CCaCtx -> IO ()+-- | /ca_set_fmpq/ /res/ /v/ /ctx/ +--+-- Sets /res/ to the integer or rational number /v/. This creates a+-- canonical representation of this number as an element of the trivial+-- field \(\mathbb{Q}\).+foreign import ccall "ca.h ca_set_fmpq"+ ca_set_fmpq :: Ptr CCa -> Ptr CFmpq -> Ptr CCaCtx -> IO ()++-- | /ca_set_d/ /res/ /x/ /ctx/ +foreign import ccall "ca.h ca_set_d"+ ca_set_d :: Ptr CCa -> CDouble -> Ptr CCaCtx -> IO ()+-- | /ca_set_d_d/ /res/ /x/ /y/ /ctx/ +--+-- Sets /res/ to the value of /x/, or the complex value \(x + yi\). NaN is+-- interpreted as /Unknown/ (not /Undefined/).+foreign import ccall "ca.h ca_set_d_d"+ ca_set_d_d :: Ptr CCa -> CDouble -> CDouble -> Ptr CCaCtx -> IO ()++-- | /ca_transfer/ /res/ /res_ctx/ /src/ /src_ctx/ +--+-- Sets /res/ to /src/ where the corresponding context objects /res_ctx/+-- and /src_ctx/ may be different.+-- +-- This operation preserves the mathematical value represented by /src/,+-- but may result in a different internal representation depending on the+-- settings of the context objects.+foreign import ccall "ca.h ca_transfer"+ ca_transfer :: Ptr CCa -> Ptr CCaCtx -> Ptr CCa -> Ptr CCaCtx -> IO ()++-- Conversion of algebraic numbers ---------------------------------------------++-- | /ca_set_qqbar/ /res/ /x/ /ctx/ +--+-- Sets /res/ to the algebraic number /x/.+-- +-- If /x/ is rational, /res/ is set to the canonical representation as an+-- element in the trivial field \(\mathbb{Q}\).+-- +-- If /x/ is irrational, this function always sets /res/ to an element of a+-- univariate number field \(\mathbb{Q}(a)\). It will not, for example,+-- identify \(\sqrt{2} + \sqrt{3}\) as an element of+-- \(\mathbb{Q}(\sqrt{2}, \sqrt{3})\). However, it may attempt to find a+-- simpler number field than that generated by /x/ itself. For example:+-- +-- - If /x/ is quadratic, it will be expressed as an element of+-- \(\mathbb{Q}(\sqrt{N})\) where /N/ has no small repeated factors+-- (obtained by performing a smooth factorization of the discriminant).+-- - TODO: if possible, coerce /x/ to a low-degree cyclotomic field.+foreign import ccall "ca.h ca_set_qqbar"+ ca_set_qqbar :: Ptr CCa -> Ptr CQQbar -> Ptr CCaCtx -> IO ()++-- | /ca_get_fmpz/ /res/ /x/ /ctx/ +foreign import ccall "ca.h ca_get_fmpz"+ ca_get_fmpz :: Ptr CFmpz -> Ptr CCa -> Ptr CCaCtx -> IO CInt+ +-- | /ca_get_fmpq/ /res/ /x/ /ctx/ +foreign import ccall "ca.h ca_get_fmpq"+ ca_get_fmpq :: Ptr CFmpq -> Ptr CCa -> Ptr CCaCtx -> IO CInt+ +-- | /ca_get_qqbar/ /res/ /x/ /ctx/ +--+-- Attempts to evaluate /x/ to an explicit integer, rational or algebraic+-- number. If successful, sets /res/ to this number and returns 1. If+-- unsuccessful, returns 0.+-- +-- The conversion certainly fails if /x/ does not represent an integer,+-- rational or algebraic number (respectively), but can also fail if /x/ is+-- too expensive to compute under the current evaluation limits. In+-- particular, the evaluation will be aborted if an intermediate algebraic+-- number (or more precisely, the resultant polynomial prior to+-- factorization) exceeds @CA_OPT_QQBAR_DEG_LIMIT@ or the coefficients+-- exceed some multiple of @CA_OPT_PREC_LIMIT@. Note that evaluation may+-- hit those limits even if the minimal polynomial for /x/ itself is small.+-- The conversion can also fail if no algorithm has been implemented for+-- the functions appearing in the construction of /x/.+foreign import ccall "ca.h ca_get_qqbar"+ ca_get_qqbar :: Ptr CQQbar -> Ptr CCa -> Ptr CCaCtx -> IO CInt++-- | /ca_can_evaluate_qqbar/ /x/ /ctx/ +--+-- Checks if @ca_get_qqbar@ has a chance to succeed. In effect, this checks+-- if all extension numbers are manifestly algebraic numbers (without doing+-- any evaluation).+foreign import ccall "ca.h ca_can_evaluate_qqbar"+ ca_can_evaluate_qqbar :: Ptr CCa -> Ptr CCaCtx -> IO CInt++-- Random generation -----------------------------------------------------------++-- | /ca_randtest_rational/ /res/ /state/ /bits/ /ctx/ +--+-- Sets /res/ to a random rational number with numerator and denominator up+-- to /bits/ bits in size.+foreign import ccall "ca.h ca_randtest_rational"+ ca_randtest_rational :: Ptr CCa -> Ptr CFRandState -> CLong -> Ptr CCaCtx -> IO ()++-- | /ca_randtest/ /res/ /state/ /depth/ /bits/ /ctx/ +--+-- Sets /res/ to a random number generated by evaluating a random+-- expression. The algorithm randomly selects between generating a+-- \"simple\" number (a random rational number or quadratic field element+-- with coefficients up to /bits/ in size, or a random builtin constant),+-- or if /depth/ is nonzero, applying a random arithmetic operation or+-- function to operands produced through recursive calls with /depth/ - 1.+-- The output is guaranteed to be a number, not a special value.+foreign import ccall "ca.h ca_randtest"+ ca_randtest :: Ptr CCa -> Ptr CFRandState -> CLong -> CLong -> Ptr CCaCtx -> IO ()++-- | /ca_randtest_special/ /res/ /state/ /depth/ /bits/ /ctx/ +--+-- Randomly generates either a special value or a number.+foreign import ccall "ca.h ca_randtest_special"+ ca_randtest_special :: Ptr CCa -> Ptr CFRandState -> CLong -> CLong -> Ptr CCaCtx -> IO ()++-- | /ca_randtest_same_nf/ /res/ /state/ /x/ /bits/ /den_bits/ /ctx/ +--+-- Sets /res/ to a random element in the same number field as /x/, with+-- numerator coefficients up to /bits/ in size and denominator up to+-- /den_bits/ in size. This function requires that /x/ is an element of an+-- absolute number field.+foreign import ccall "ca.h ca_randtest_same_nf"+ ca_randtest_same_nf :: Ptr CCa -> Ptr CFRandState -> Ptr CCa -> CLong -> CLong -> Ptr CCaCtx -> IO ()++-- $representation+--+-- The following functions deal with the representation of a @Ca@ and+-- hence can always be decided quickly and unambiguously. The return value+-- for predicates is 0 for false and 1 for true.++-- | /ca_equal_repr/ /x/ /y/ /ctx/ +--+-- Returns whether /x/ and /y/ have identical representation. For field+-- elements, this checks if /x/ and /y/ belong to the same formal field+-- (with generators having identical representation) and are represented by+-- the same rational function within that field.+-- +-- For special values, this tests equality of the special values, with+-- /Unknown/ handled as if it were a value rather than a meta-value: that+-- is, /Unknown/ = /Unknown/ gives 1, and /Unknown/ = /y/ gives 0 for any+-- other kind of value /y/. If neither /x/ nor /y/ is /Unknown/, then+-- representation equality implies that /x/ and /y/ describe to the same+-- mathematical value, but if either operand is /Unknown/, the result is+-- meaningless for mathematical comparison.+foreign import ccall "ca.h ca_equal_repr"+ ca_equal_repr :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO CInt++-- | /ca_cmp_repr/ /x/ /y/ /ctx/ +--+-- Compares the representations of /x/ and /y/ in a canonical sort order,+-- returning -1, 0 or 1. This only performs a lexicographic comparison of+-- the representations of /x/ and /y/; the return value does not say+-- anything meaningful about the numbers represented by /x/ and /y/.+foreign import ccall "ca.h ca_cmp_repr"+ ca_cmp_repr :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO CInt++-- | /ca_hash_repr/ /x/ /ctx/ +--+-- Hashes the representation of /x/.+foreign import ccall "ca.h ca_hash_repr"+ ca_hash_repr :: Ptr CCa -> Ptr CCaCtx -> IO CULong++-- | /ca_is_unknown/ /x/ /ctx/ +--+-- Returns whether /x/ is Unknown.+foreign import ccall "ca.h ca_is_unknown"+ ca_is_unknown :: Ptr CCa -> Ptr CCaCtx -> IO CInt++-- | /ca_is_special/ /x/ /ctx/ +--+-- Returns whether /x/ is a special value or metavalue (not a field+-- element).+foreign import ccall "ca.h ca_is_special"+ ca_is_special :: Ptr CCa -> Ptr CCaCtx -> IO CInt++-- | /ca_is_qq_elem/ /x/ /ctx/ +--+-- Returns whether /x/ is represented as an element of the rational field+-- \(\mathbb{Q}\).+foreign import ccall "ca.h ca_is_qq_elem"+ ca_is_qq_elem :: Ptr CCa -> Ptr CCaCtx -> IO CInt++-- | /ca_is_qq_elem_zero/ /x/ /ctx/ +foreign import ccall "ca.h ca_is_qq_elem_zero"+ ca_is_qq_elem_zero :: Ptr CCa -> Ptr CCaCtx -> IO CInt+-- | /ca_is_qq_elem_one/ /x/ /ctx/ +foreign import ccall "ca.h ca_is_qq_elem_one"+ ca_is_qq_elem_one :: Ptr CCa -> Ptr CCaCtx -> IO CInt+-- | /ca_is_qq_elem_integer/ /x/ /ctx/ +--+-- Returns whether /x/ is represented as the element 0, 1 or any integer in+-- the rational field \(\mathbb{Q}\).+foreign import ccall "ca.h ca_is_qq_elem_integer"+ ca_is_qq_elem_integer :: Ptr CCa -> Ptr CCaCtx -> IO CInt++-- | /ca_is_nf_elem/ /x/ /ctx/ +--+-- Returns whether /x/ is represented as an element of a univariate+-- algebraic number field \(\mathbb{Q}(a)\).+foreign import ccall "ca.h ca_is_nf_elem"+ ca_is_nf_elem :: Ptr CCa -> Ptr CCaCtx -> IO CInt++-- | /ca_is_cyclotomic_nf_elem/ /p/ /q/ /x/ /ctx/ +--+-- Returns whether /x/ is represented as an element of a univariate+-- cyclotomic field, i.e. \(\mathbb{Q}(a)\) where /a/ is a root of unity.+-- If /p/ and /q/ are not /NULL/ and /x/ is represented as an element of a+-- cyclotomic field, this also sets /p/ and /q/ to the minimal integers+-- with \(0 \le p < q\) such that the generating root of unity is+-- \(a = e^{2 \pi i p / q}\). Note that the answer 0 does not prove that+-- /x/ is not a cyclotomic number, and the order /q/ is also not+-- necessarily the generator of the /smallest/ cyclotomic field containing+-- /x/. For the purposes of this function, only nontrivial cyclotomic+-- fields count; the return value is 0 if /x/ is represented as a rational+-- number.+foreign import ccall "ca.h ca_is_cyclotomic_nf_elem"+ ca_is_cyclotomic_nf_elem :: Ptr CLong -> Ptr CULong -> Ptr CCa -> Ptr CCaCtx -> IO CInt++-- | /ca_is_generic_elem/ /x/ /ctx/ +--+-- Returns whether /x/ is represented as a generic field element; i.e. it+-- is not a special value, not represented as an element of the rational+-- field, and not represented as an element of a univariate algebraic+-- number field.+foreign import ccall "ca.h ca_is_generic_elem"+ ca_is_generic_elem :: Ptr CCa -> Ptr CCaCtx -> IO CInt++-- Value predicates ------------------------------------------------------------++-- The following predicates check a mathematical property which might not+-- be effectively decidable. The result is a @truth_t@ to allow+-- representing an unknown outcome.+--+-- | /ca_check_is_number/ /x/ /ctx/ +--+-- Tests if /x/ is a number. The result is @T_TRUE@ is /x/ is a field+-- element (and hence a complex number), @T_FALSE@ if /x/ is an infinity or+-- /Undefined/, and @T_UNKNOWN@ if /x/ is /Unknown/.+foreign import ccall "ca.h ca_check_is_number"+ ca_check_is_number :: Ptr CCa -> Ptr CCaCtx -> IO CTruth++-- | /ca_check_is_zero/ /x/ /ctx/ +foreign import ccall "ca.h ca_check_is_zero"+ ca_check_is_zero :: Ptr CCa -> Ptr CCaCtx -> IO CTruth+-- | /ca_check_is_one/ /x/ /ctx/ +foreign import ccall "ca.h ca_check_is_one"+ ca_check_is_one :: Ptr CCa -> Ptr CCaCtx -> IO CTruth+-- | /ca_check_is_neg_one/ /x/ /ctx/ +foreign import ccall "ca.h ca_check_is_neg_one"+ ca_check_is_neg_one :: Ptr CCa -> Ptr CCaCtx -> IO CTruth+-- | /ca_check_is_i/ /x/ /ctx/ +foreign import ccall "ca.h ca_check_is_i"+ ca_check_is_i :: Ptr CCa -> Ptr CCaCtx -> IO CTruth+-- | /ca_check_is_neg_i/ /x/ /ctx/ +--+-- Tests if /x/ is equal to the number \(0\), \(1\), \(-1\), \(i\), or+-- \(-i\).+foreign import ccall "ca.h ca_check_is_neg_i"+ ca_check_is_neg_i :: Ptr CCa -> Ptr CCaCtx -> IO CTruth++-- | /ca_check_is_algebraic/ /x/ /ctx/ +foreign import ccall "ca.h ca_check_is_algebraic"+ ca_check_is_algebraic :: Ptr CCa -> Ptr CCaCtx -> IO CTruth+-- | /ca_check_is_rational/ /x/ /ctx/ +foreign import ccall "ca.h ca_check_is_rational"+ ca_check_is_rational :: Ptr CCa -> Ptr CCaCtx -> IO CTruth+-- | /ca_check_is_integer/ /x/ /ctx/ +--+-- Tests if /x/ is respectively an algebraic number, a rational number, or+-- an integer.+foreign import ccall "ca.h ca_check_is_integer"+ ca_check_is_integer :: Ptr CCa -> Ptr CCaCtx -> IO CTruth++-- | /ca_check_is_real/ /x/ /ctx/ +--+-- Tests if /x/ is a real number. Warning: this returns @T_FALSE@ if /x/ is+-- an infinity with real sign.+foreign import ccall "ca.h ca_check_is_real"+ ca_check_is_real :: Ptr CCa -> Ptr CCaCtx -> IO CTruth++-- | /ca_check_is_negative_real/ /x/ /ctx/ +--+-- Tests if /x/ is a negative real number. Warning: this returns @T_FALSE@+-- if /x/ is negative infinity.+foreign import ccall "ca.h ca_check_is_negative_real"+ ca_check_is_negative_real :: Ptr CCa -> Ptr CCaCtx -> IO CTruth++-- | /ca_check_is_imaginary/ /x/ /ctx/ +--+-- Tests if /x/ is an imaginary number. Warning: this returns @T_FALSE@ if+-- /x/ is an infinity with imaginary sign.+foreign import ccall "ca.h ca_check_is_imaginary"+ ca_check_is_imaginary :: Ptr CCa -> Ptr CCaCtx -> IO CTruth++-- | /ca_check_is_undefined/ /x/ /ctx/ +--+-- Tests if /x/ is the special value /Undefined/.+foreign import ccall "ca.h ca_check_is_undefined"+ ca_check_is_undefined :: Ptr CCa -> Ptr CCaCtx -> IO CTruth++-- | /ca_check_is_infinity/ /x/ /ctx/ +--+-- Tests if /x/ is any infinity (unsigned or signed).+foreign import ccall "ca.h ca_check_is_infinity"+ ca_check_is_infinity :: Ptr CCa -> Ptr CCaCtx -> IO CTruth++-- | /ca_check_is_uinf/ /x/ /ctx/ +--+-- Tests if /x/ is unsigned infinity \({\tilde \infty}\).+foreign import ccall "ca.h ca_check_is_uinf"+ ca_check_is_uinf :: Ptr CCa -> Ptr CCaCtx -> IO CTruth++-- | /ca_check_is_signed_inf/ /x/ /ctx/ +--+-- Tests if /x/ is any signed infinity.+foreign import ccall "ca.h ca_check_is_signed_inf"+ ca_check_is_signed_inf :: Ptr CCa -> Ptr CCaCtx -> IO CTruth++-- | /ca_check_is_pos_inf/ /x/ /ctx/ +foreign import ccall "ca.h ca_check_is_pos_inf"+ ca_check_is_pos_inf :: Ptr CCa -> Ptr CCaCtx -> IO CTruth+-- | /ca_check_is_neg_inf/ /x/ /ctx/ +foreign import ccall "ca.h ca_check_is_neg_inf"+ ca_check_is_neg_inf :: Ptr CCa -> Ptr CCaCtx -> IO CTruth+-- | /ca_check_is_pos_i_inf/ /x/ /ctx/ +foreign import ccall "ca.h ca_check_is_pos_i_inf"+ ca_check_is_pos_i_inf :: Ptr CCa -> Ptr CCaCtx -> IO CTruth+-- | /ca_check_is_neg_i_inf/ /x/ /ctx/ +--+-- Tests if /x/ is equal to the signed infinity \(+\infty\), \(-\infty\),+-- \(+i \infty\), \(-i \infty\), respectively.+foreign import ccall "ca.h ca_check_is_neg_i_inf"+ ca_check_is_neg_i_inf :: Ptr CCa -> Ptr CCaCtx -> IO CTruth++-- Comparisons -----------------------------------------------------------------++-- | /ca_check_equal/ /x/ /y/ /ctx/ +--+-- Tests \(x = y\) as a mathematical equality. The result is @T_UNKNOWN@ if+-- either operand is /Unknown/. The result may also be @T_UNKNOWN@ if /x/+-- and /y/ are numerically indistinguishable and cannot be proved equal or+-- unequal by an exact computation.+foreign import ccall "ca.h ca_check_equal"+ ca_check_equal :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO CTruth++-- | /ca_check_lt/ /x/ /y/ /ctx/ +foreign import ccall "ca.h ca_check_lt"+ ca_check_lt :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO CTruth+ +-- | /ca_check_le/ /x/ /y/ /ctx/ +foreign import ccall "ca.h ca_check_le"+ ca_check_le :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO CTruth+ +-- | /ca_check_gt/ /x/ /y/ /ctx/ +foreign import ccall "ca.h ca_check_gt"+ ca_check_gt :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO CTruth+-- | /ca_check_ge/ /x/ /y/ /ctx/ +--+-- Compares /x/ and /y/, implementing the respective operations \(x < y\),+-- \(x \le y\), \(x > y\), \(x \ge y\). Only real numbers and \(-\infty\)+-- and \(+\infty\) are considered comparable. The result is @T_FALSE@ (not+-- @T_UNKNOWN@) if either operand is not comparable (being a nonreal+-- complex number, unsigned infinity, or undefined).+foreign import ccall "ca.h ca_check_ge"+ ca_check_ge :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO CTruth++-- Field structure operations --------------------------------------------------++-- | /ca_merge_fields/ /resx/ /resy/ /x/ /y/ /ctx/ +--+-- Sets /resx/ and /resy/ to copies of /x/ and /y/ coerced to a common+-- field. Both /x/ and /y/ must be field elements (not special values).+-- +-- In the present implementation, this simply merges the lists of+-- generators, avoiding duplication. In the future, it will be able to+-- eliminate generators satisfying algebraic relations.+foreign import ccall "ca.h ca_merge_fields"+ ca_merge_fields :: Ptr CCa -> Ptr CCa -> Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()++-- | /ca_condense_field/ /res/ /ctx/ +--+-- Attempts to demote the value of /res/ to a trivial subfield of its+-- current field by removing unused generators. In particular, this demotes+-- any obviously rational value to the trivial field \(\mathbb{Q}\).+-- +-- This function is applied automatically in most operations (arithmetic+-- operations, etc.).+foreign import ccall "ca.h ca_condense_field"+ ca_condense_field :: Ptr CCa -> Ptr CCaCtx -> IO ()++-- | /ca_is_gen_as_ext/ /x/ /ctx/ +--+-- If /x/ is a generator of its formal field,+-- \(x = a_k \in \mathbb{Q}(a_1,\ldots,a_n)\), returns a pointer to the+-- extension number defining \(a_k\). If /x/ is not a generator, returns+-- /NULL/.+foreign import ccall "ca.h ca_is_gen_as_ext"+ ca_is_gen_as_ext :: Ptr CCa -> Ptr CCaCtx -> IO (Ptr CCa)++-- Arithmetic ------------------------------------------------------------------++-- | /ca_neg/ /res/ /x/ /ctx/ +--+-- Sets /res/ to the negation of /x/. For numbers, this operation amounts+-- to a direct negation within the formal field. For a signed infinity+-- \(c \infty\), negation gives \((-c) \infty\); all other special values+-- are unchanged.+foreign import ccall "ca.h ca_neg"+ ca_neg :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()++-- | /ca_add_fmpq/ /res/ /x/ /y/ /ctx/ +foreign import ccall "ca.h ca_add_fmpq"+ ca_add_fmpq :: Ptr CCa -> Ptr CCa -> Ptr CFmpq -> Ptr CCaCtx -> IO ()+ +-- | /ca_add_fmpz/ /res/ /x/ /y/ /ctx/ +foreign import ccall "ca.h ca_add_fmpz"+ ca_add_fmpz :: Ptr CCa -> Ptr CCa -> Ptr CFmpz -> Ptr CCaCtx -> IO ()+ +-- | /ca_add_ui/ /res/ /x/ /y/ /ctx/ +foreign import ccall "ca.h ca_add_ui"+ ca_add_ui :: Ptr CCa -> Ptr CCa -> CULong -> Ptr CCaCtx -> IO ()+ +-- | /ca_add_si/ /res/ /x/ /y/ /ctx/ +foreign import ccall "ca.h ca_add_si"+ ca_add_si :: Ptr CCa -> Ptr CCa -> CLong -> Ptr CCaCtx -> IO ()+-- | /ca_add/ /res/ /x/ /y/ /ctx/ +--+-- Sets /res/ to the sum of /x/ and /y/. For special values, the following+-- rules apply (c infty denotes a signed infinity, \(|c| = 1\)):+-- +-- - \(c \infty + d \infty = c \infty\) if \(c = d\)+-- - \(c \infty + d \infty = \text{Undefined}\) if \(c \ne d\)+-- - \(\tilde \infty + c \infty = \tilde \infty + \tilde \infty = \text{Undefined}\)+-- - \(c \infty + z = c \infty\) if \(z \in \mathbb{C}\)+-- - \(\tilde \infty + z = \tilde \infty\) if \(z \in \mathbb{C}\)+-- - \(z + \text{Undefined} = \text{Undefined}\) for any value /z/+-- (including /Unknown/)+-- +-- In any other case involving special values, or if the specific case+-- cannot be distinguished, the result is /Unknown/.+foreign import ccall "ca.h ca_add"+ ca_add :: Ptr CCa -> Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()++-- | /ca_sub_fmpq/ /res/ /x/ /y/ /ctx/ +foreign import ccall "ca.h ca_sub_fmpq"+ ca_sub_fmpq :: Ptr CCa -> Ptr CCa -> Ptr CFmpq -> Ptr CCaCtx -> IO ()+-- | /ca_sub_fmpz/ /res/ /x/ /y/ /ctx/ +foreign import ccall "ca.h ca_sub_fmpz"+ ca_sub_fmpz :: Ptr CCa -> Ptr CCa -> Ptr CFmpz -> Ptr CCaCtx -> IO ()+-- | /ca_sub_ui/ /res/ /x/ /y/ /ctx/ +foreign import ccall "ca.h ca_sub_ui"+ ca_sub_ui :: Ptr CCa -> Ptr CCa -> CULong -> Ptr CCaCtx -> IO ()+-- | /ca_sub_si/ /res/ /x/ /y/ /ctx/ +foreign import ccall "ca.h ca_sub_si"+ ca_sub_si :: Ptr CCa -> Ptr CCa -> CLong -> Ptr CCaCtx -> IO ()+-- | /ca_fmpq_sub/ /res/ /x/ /y/ /ctx/ +foreign import ccall "ca.h ca_fmpq_sub"+ ca_fmpq_sub :: Ptr CCa -> Ptr CFmpq -> Ptr CCa -> Ptr CCaCtx -> IO ()+-- | /ca_fmpz_sub/ /res/ /x/ /y/ /ctx/ +foreign import ccall "ca.h ca_fmpz_sub"+ ca_fmpz_sub :: Ptr CCa -> Ptr CFmpz -> Ptr CCa -> Ptr CCaCtx -> IO ()+-- | /ca_ui_sub/ /res/ /x/ /y/ /ctx/ +foreign import ccall "ca.h ca_ui_sub"+ ca_ui_sub :: Ptr CCa -> CULong -> Ptr CCa -> Ptr CCaCtx -> IO ()+-- | /ca_si_sub/ /res/ /x/ /y/ /ctx/ +foreign import ccall "ca.h ca_si_sub"+ ca_si_sub :: Ptr CCa -> CLong -> Ptr CCa -> Ptr CCaCtx -> IO ()+-- | /ca_sub/ /res/ /x/ /y/ /ctx/ +--+-- Sets /res/ to the difference of /x/ and /y/. This is equivalent to+-- computing \(x + (-y)\).+foreign import ccall "ca.h ca_sub"+ ca_sub :: Ptr CCa -> Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()++-- | /ca_mul_fmpq/ /res/ /x/ /y/ /ctx/ +foreign import ccall "ca.h ca_mul_fmpq"+ ca_mul_fmpq :: Ptr CCa -> Ptr CCa -> Ptr CFmpq -> Ptr CCaCtx -> IO ()+-- | /ca_mul_fmpz/ /res/ /x/ /y/ /ctx/ +foreign import ccall "ca.h ca_mul_fmpz"+ ca_mul_fmpz :: Ptr CCa -> Ptr CCa -> Ptr CFmpz -> Ptr CCaCtx -> IO ()+-- | /ca_mul_ui/ /res/ /x/ /y/ /ctx/ +foreign import ccall "ca.h ca_mul_ui"+ ca_mul_ui :: Ptr CCa -> Ptr CCa -> CULong -> Ptr CCaCtx -> IO ()+-- | /ca_mul_si/ /res/ /x/ /y/ /ctx/ +foreign import ccall "ca.h ca_mul_si"+ ca_mul_si :: Ptr CCa -> Ptr CCa -> CLong -> Ptr CCaCtx -> IO ()+-- | /ca_mul/ /res/ /x/ /y/ /ctx/ +--+-- Sets /res/ to the product of /x/ and /y/. For special values, the+-- following rules apply (c infty denotes a signed infinity, \(|c| = 1\)):+-- +-- - \(c \infty \cdot d \infty = c d \infty\)+-- - \(c \infty \cdot \tilde \infty = \tilde \infty\)+-- - \(\tilde \infty \cdot \tilde \infty = \tilde \infty\)+-- - \(c \infty \cdot z = \operatorname{sgn}(z) c \infty\) if+-- \(z \in \mathbb{C} \setminus \{0\}\)+-- - \(c \infty \cdot 0 = \text{Undefined}\)+-- - \(\tilde \infty \cdot 0 = \text{Undefined}\)+-- - \(z \cdot \text{Undefined} = \text{Undefined}\) for any value /z/+-- (including /Unknown/)+-- +-- In any other case involving special values, or if the specific case+-- cannot be distinguished, the result is /Unknown/.+foreign import ccall "ca.h ca_mul"+ ca_mul :: Ptr CCa -> Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()++-- | /ca_inv/ /res/ /x/ /ctx/ +--+-- Sets /res/ to the multiplicative inverse of /x/. In a univariate+-- algebraic number field, this always produces a rational denominator, but+-- the denominator might not be rationalized in a multivariate field. For+-- special values and zero, the following rules apply:+-- +-- - \(1 / (c \infty) = 1 / \tilde \infty = 0\)+-- - \(1 / 0 = \tilde \infty\)+-- - \(1 / \text{Undefined} = \text{Undefined}\)+-- - \(1 / \text{Unknown} = \text{Unknown}\)+-- +-- If it cannot be determined whether /x/ is zero or nonzero, the result is+-- /Unknown/.+foreign import ccall "ca.h ca_inv"+ ca_inv :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()++-- | /ca_fmpq_div/ /res/ /x/ /y/ /ctx/ +foreign import ccall "ca.h ca_fmpq_div"+ ca_fmpq_div :: Ptr CCa -> Ptr CFmpq -> Ptr CCa -> Ptr CCaCtx -> IO ()+-- | /ca_fmpz_div/ /res/ /x/ /y/ /ctx/ +foreign import ccall "ca.h ca_fmpz_div"+ ca_fmpz_div :: Ptr CCa -> Ptr CFmpz -> Ptr CCa -> Ptr CCaCtx -> IO ()+-- | /ca_ui_div/ /res/ /x/ /y/ /ctx/ +foreign import ccall "ca.h ca_ui_div"+ ca_ui_div :: Ptr CCa -> CULong -> Ptr CCa -> Ptr CCaCtx -> IO ()+-- | /ca_si_div/ /res/ /x/ /y/ /ctx/ +foreign import ccall "ca.h ca_si_div"+ ca_si_div :: Ptr CCa -> CLong -> Ptr CCa -> Ptr CCaCtx -> IO ()+-- | /ca_div_fmpq/ /res/ /x/ /y/ /ctx/ +foreign import ccall "ca.h ca_div_fmpq"+ ca_div_fmpq :: Ptr CCa -> Ptr CCa -> Ptr CFmpq -> Ptr CCaCtx -> IO ()+-- | /ca_div_fmpz/ /res/ /x/ /y/ /ctx/ +foreign import ccall "ca.h ca_div_fmpz"+ ca_div_fmpz :: Ptr CCa -> Ptr CCa -> Ptr CFmpz -> Ptr CCaCtx -> IO ()+-- | /ca_div_ui/ /res/ /x/ /y/ /ctx/ +foreign import ccall "ca.h ca_div_ui"+ ca_div_ui :: Ptr CCa -> Ptr CCa -> CULong -> Ptr CCaCtx -> IO ()+-- | /ca_div_si/ /res/ /x/ /y/ /ctx/ +foreign import ccall "ca.h ca_div_si"+ ca_div_si :: Ptr CCa -> Ptr CCa -> CLong -> Ptr CCaCtx -> IO ()+-- | /ca_div/ /res/ /x/ /y/ /ctx/ +--+-- Sets /res/ to the quotient of /x/ and /y/. This is equivalent to+-- computing \(x \cdot (1 / y)\). For special values and division by zero,+-- this implies the following rules (c infty denotes a signed infinity,+-- \(|c| = 1\)):+-- +-- - \((c \infty) / (d \infty) = (c \infty) / \tilde \infty = \tilde \infty / (c \infty) = \tilde \infty / \tilde \infty = \text{Undefined}\)+-- - \(c \infty / z = (c / \operatorname{sgn}(z)) \infty\) if+-- \(z \in \mathbb{C} \setminus \{0\}\)+-- - \(c \infty / 0 = \tilde \infty / 0 = \tilde \infty\)+-- - \(z / (c \infty) = z / \tilde \infty = 0\) if \(z \in \mathbb{C}\)+-- - \(z / 0 = \tilde \infty\) if \(z \in \mathbb{C} \setminus \{0\}\)+-- - \(0 / 0 = \text{Undefined}\)+-- - \(z / \text{Undefined} = \text{Undefined}\) for any value /z/+-- (including /Unknown/)+-- - \(\text{Undefined} / z = \text{Undefined}\) for any value /z/+-- (including /Unknown/)+-- +-- In any other case involving special values, or if the specific case+-- cannot be distinguished, the result is /Unknown/.+foreign import ccall "ca.h ca_div"+ ca_div :: Ptr CCa -> Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()++-- | /ca_dot/ /res/ /initial/ /subtract/ /x/ /xstep/ /y/ /ystep/ /len/ /ctx/ +--+-- Computes the dot product of the vectors /x/ and /y/, setting /res/ to+-- \(s + (-1)^{subtract} \sum_{i=0}^{len-1} x_i y_i\).+-- +-- The initial term /s/ is optional and can be omitted by passing /NULL/+-- (equivalently, \(s = 0\)). The parameter /subtract/ must be 0 or 1. The+-- length /len/ is allowed to be negative, which is equivalent to a length+-- of zero. The parameters /xstep/ or /ystep/ specify a step length for+-- traversing subsequences of the vectors /x/ and /y/; either can be+-- negative to step in the reverse direction starting from the initial+-- pointer. Aliasing is allowed between /res/ and /s/ but not between /res/+-- and the entries of /x/ and /y/.+foreign import ccall "ca.h ca_dot"+ ca_dot :: Ptr CCa -> Ptr CCa -> CInt -> Ptr CCa -> CLong -> Ptr CCa -> CLong -> CLong -> Ptr CCaCtx -> IO ()++-- | /ca_fmpz_poly_evaluate/ /res/ /poly/ /x/ /ctx/ +foreign import ccall "ca.h ca_fmpz_poly_evaluate"+ ca_fmpz_poly_evaluate :: Ptr CCa -> Ptr CFmpzPoly -> Ptr CCa -> Ptr CCaCtx -> IO ()+-- | /ca_fmpq_poly_evaluate/ /res/ /poly/ /x/ /ctx/ +--+-- Sets /res/ to the polynomial /poly/ evaluated at /x/.+foreign import ccall "ca.h ca_fmpq_poly_evaluate"+ ca_fmpq_poly_evaluate :: Ptr CCa -> Ptr CFmpqPoly -> Ptr CCa -> Ptr CCaCtx -> IO ()++-- | /ca_fmpz_mpoly_evaluate_horner/ /res/ /f/ /x/ /mctx/ /ctx/ +foreign import ccall "ca.h ca_fmpz_mpoly_evaluate_horner"+ ca_fmpz_mpoly_evaluate_horner :: Ptr CCa -> Ptr CFmpzMPoly -> Ptr CCa -> Ptr CFmpzMPolyCtx -> Ptr CCaCtx -> IO ()+-- -- | /ca_fmpz_mpoly_evaluate_iter/ /res/ /f/ /x/ /mctx/ /ctx/ +-- foreign import ccall "ca.h ca_fmpz_mpoly_evaluate_iter"+-- ca_fmpz_mpoly_evaluate_iter :: Ptr CCa -> Ptr CFmpzMPoly -> Ptr CCa -> Ptr CFmpzMPolyCtx -> Ptr CCaCtx -> IO ()+-- | /ca_fmpz_mpoly_evaluate/ /res/ /f/ /x/ /mctx/ /ctx/ +--+-- Sets /res/ to the multivariate polynomial /f/ evaluated at the vector of+-- arguments /x/.+foreign import ccall "ca.h ca_fmpz_mpoly_evaluate"+ ca_fmpz_mpoly_evaluate :: Ptr CCa -> Ptr CFmpzMPoly -> Ptr CCa -> Ptr CFmpzMPolyCtx -> Ptr CCaCtx -> IO ()++-- | /ca_fmpz_mpoly_q_evaluate/ /res/ /f/ /x/ /mctx/ /ctx/ +--+-- Sets /res/ to the multivariate rational function /f/ evaluated at the+-- vector of arguments /x/.+foreign import ccall "ca.h ca_fmpz_mpoly_q_evaluate"+ ca_fmpz_mpoly_q_evaluate :: Ptr CCa -> Ptr CFmpzMPolyQ -> Ptr CCa -> Ptr CFmpzMPolyCtx -> Ptr CCaCtx -> IO ()++-- | /ca_fmpz_mpoly_q_evaluate_no_division_by_zero/ /res/ /f/ /x/ /mctx/ /ctx/ +foreign import ccall "ca.h ca_fmpz_mpoly_q_evaluate_no_division_by_zero"+ ca_fmpz_mpoly_q_evaluate_no_division_by_zero :: Ptr CCa -> Ptr CFmpzMPolyQ -> Ptr CCa -> Ptr CFmpzMPolyCtx -> Ptr CCaCtx -> IO ()+-- | /ca_inv_no_division_by_zero/ /res/ /x/ /ctx/ +--+-- These functions behave like the normal arithmetic functions, but assume+-- (and do not check) that division by zero cannot occur. Division by zero+-- will result in undefined behavior.+foreign import ccall "ca.h ca_inv_no_division_by_zero"+ ca_inv_no_division_by_zero :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()++-- Powers and roots ------------------------------------------------------------++-- | /ca_sqr/ /res/ /x/ /ctx/ +--+-- Sets /res/ to the square of /x/.+foreign import ccall "ca.h ca_sqr"+ ca_sqr :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()++-- | /ca_pow_fmpq/ /res/ /x/ /y/ /ctx/ +foreign import ccall "ca.h ca_pow_fmpq"+ ca_pow_fmpq :: Ptr CCa -> Ptr CCa -> Ptr CFmpq -> Ptr CCaCtx -> IO ()+-- | /ca_pow_fmpz/ /res/ /x/ /y/ /ctx/ +foreign import ccall "ca.h ca_pow_fmpz"+ ca_pow_fmpz :: Ptr CCa -> Ptr CCa -> Ptr CFmpz -> Ptr CCaCtx -> IO ()+-- | /ca_pow_ui/ /res/ /x/ /y/ /ctx/ +foreign import ccall "ca.h ca_pow_ui"+ ca_pow_ui :: Ptr CCa -> Ptr CCa -> CULong -> Ptr CCaCtx -> IO ()+-- | /ca_pow_si/ /res/ /x/ /y/ /ctx/ +foreign import ccall "ca.h ca_pow_si"+ ca_pow_si :: Ptr CCa -> Ptr CCa -> CLong -> Ptr CCaCtx -> IO ()+-- | /ca_pow/ /res/ /x/ /y/ /ctx/ +--+-- Sets /res/ to /x/ raised to the power /y/. Handling of special values is+-- not yet implemented.+foreign import ccall "ca.h ca_pow"+ ca_pow :: Ptr CCa -> Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()++-- | /ca_pow_si_arithmetic/ /res/ /x/ /n/ /ctx/ +--+-- Sets /res/ to /x/ raised to the power /n/. Whereas @ca_pow@, @ca_pow_si@+-- etc. may create \(x^n\) as an extension number if /n/ is large, this+-- function always perform the exponentiation using field arithmetic.+foreign import ccall "ca.h ca_pow_si_arithmetic"+ ca_pow_si_arithmetic :: Ptr CCa -> Ptr CCa -> CLong -> Ptr CCaCtx -> IO ()++-- | /ca_sqrt_inert/ /res/ /x/ /ctx/ +foreign import ccall "ca.h ca_sqrt_inert"+ ca_sqrt_inert :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()+-- | /ca_sqrt_nofactor/ /res/ /x/ /ctx/ +foreign import ccall "ca.h ca_sqrt_nofactor"+ ca_sqrt_nofactor :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()+-- | /ca_sqrt_factor/ /res/ /x/ /flags/ /ctx/ +foreign import ccall "ca.h ca_sqrt_factor"+ ca_sqrt_factor :: Ptr CCa -> Ptr CCa -> CULong -> Ptr CCaCtx -> IO ()+-- | /ca_sqrt/ /res/ /x/ /ctx/ +--+-- Sets /res/ to the principal square root of /x/.+-- +-- For special values, the following definitions apply:+-- +-- - \(\sqrt{c \infty} = \sqrt{c} \infty\)+-- - \(\sqrt{\tilde \infty} = \tilde \infty\).+-- - Both /Undefined/ and /Unknown/ map to themselves.+-- +-- The /inert/ version outputs the generator in the formal field+-- \(\mathbb{Q}(\sqrt{x})\) without simplifying.+-- +-- The /factor/ version writes \(x = A^2 B\) in \(K\) where \(K\) is the+-- field of /x/, and outputs \(A \sqrt{B}\) or \(-A \sqrt{B}\) (whichever+-- gives the correct sign) as an element of \(K(\sqrt{B})\) or some+-- subfield thereof. This factorization is only a heuristic and is not+-- guaranteed to make \(B\) minimal. Factorization options can be passed+-- through to /flags/: see @ca_factor@ for details.+-- +-- The /nofactor/ version will not perform a general factorization, but may+-- still perform other simplifications. It may in particular attempt to+-- simplify \(\sqrt{x}\) to a single element in \(\overline{\mathbb{Q}}\).+foreign import ccall "ca.h ca_sqrt"+ ca_sqrt :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()++-- | /ca_sqrt_ui/ /res/ /n/ /ctx/ +--+-- Sets /res/ to the principal square root of /n/.+foreign import ccall "ca.h ca_sqrt_ui"+ ca_sqrt_ui :: Ptr CCa -> CULong -> Ptr CCaCtx -> IO ()++-- Complex parts ---------------------------------------------------------------++-- | /ca_abs/ /res/ /x/ /ctx/ +--+-- Sets /res/ to the absolute value of /x/.+-- +-- For special values, the following definitions apply:+-- +-- - \(|c \infty| = |\tilde \infty| = +\infty\).+-- - Both /Undefined/ and /Unknown/ map to themselves.+-- +-- This function will attempt to simplify its argument through an exact+-- computation. It may in particular attempt to simplify \(|x|\) to a+-- single element in \(\overline{\mathbb{Q}}\).+-- +-- In the generic case, this function outputs an element of the formal+-- field \(\mathbb{Q}(|x|)\).+foreign import ccall "ca.h ca_abs"+ ca_abs :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()++-- | /ca_sgn/ /res/ /x/ /ctx/ +--+-- Sets /res/ to the sign of /x/, defined by+-- +-- \[`\]+-- \[\begin{aligned}+-- \operatorname{sgn}(x) = \begin{cases} 0 & x = 0 \\ \frac{x}{|x|} & x \ne 0 \end{cases}+-- \end{aligned}\]+-- +-- for numbers. For special values, the following definitions apply:+-- +-- - \(\operatorname{sgn}(c \infty) = c\).+-- - \(\operatorname{sgn}(\tilde \infty) = \operatorname{Undefined}\).+-- - Both /Undefined/ and /Unknown/ map to themselves.+-- +-- This function will attempt to simplify its argument through an exact+-- computation. It may in particular attempt to simplify+-- \(\operatorname{sgn}(x)\) to a single element in+-- \(\overline{\mathbb{Q}}\).+-- +-- In the generic case, this function outputs an element of the formal+-- field \(\mathbb{Q}(\operatorname{sgn}(x))\).+foreign import ccall "ca.h ca_sgn"+ ca_sgn :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()++-- | /ca_csgn/ /res/ /x/ /ctx/ +--+-- Sets /res/ to the extension of the real sign function taking the value 1+-- for /z/ strictly in the right half plane, -1 for /z/ strictly in the+-- left half plane, and the sign of the imaginary part when /z/ is on the+-- imaginary axis. Equivalently,+-- \(\operatorname{csgn}(z) = z / \sqrt{z^2}\) except that the value is 0+-- when /z/ is exactly zero. This function gives /Undefined/ for unsigned+-- infinity and+-- \(\operatorname{csgn}(\operatorname{sgn}(c \infty)) = \operatorname{csgn}(c)\)+-- for signed infinities.+foreign import ccall "ca.h ca_csgn"+ ca_csgn :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()++-- | /ca_arg/ /res/ /x/ /ctx/ +--+-- Sets /res/ to the complex argument (phase) of /x/, normalized to the+-- range \((-\pi, +\pi]\). The argument of 0 is defined as 0. For special+-- values, the following definitions apply:+-- +-- - \(\operatorname{arg}(c \infty) = \operatorname{arg}(c)\).+-- - \(\operatorname{arg}(\tilde \infty) = \operatorname{Undefined}\).+-- - Both /Undefined/ and /Unknown/ map to themselves.+foreign import ccall "ca.h ca_arg"+ ca_arg :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()++-- | /ca_re/ /res/ /x/ /ctx/ +--+-- Sets /res/ to the real part of /x/. The result is /Undefined/ if /x/ is+-- any infinity (including a real infinity).+foreign import ccall "ca.h ca_re"+ ca_re :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()++-- | /ca_im/ /res/ /x/ /ctx/ +--+-- Sets /res/ to the imaginary part of /x/. The result is /Undefined/ if+-- /x/ is any infinity (including an imaginary infinity).+foreign import ccall "ca.h ca_im"+ ca_im :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()++-- | /ca_conj_deep/ /res/ /x/ /ctx/ +foreign import ccall "ca.h ca_conj_deep"+ ca_conj_deep :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()+-- | /ca_conj_shallow/ /res/ /x/ /ctx/ +foreign import ccall "ca.h ca_conj_shallow"+ ca_conj_shallow :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()+-- | /ca_conj/ /res/ /x/ /ctx/ +--+-- Sets /res/ to the complex conjugate of /x/. The /shallow/ version+-- creates a new extension element \(\overline{x}\) unless /x/ can be+-- trivially conjugated in-place in the existing field. The /deep/ version+-- recursively conjugates the extension numbers in the field of /x/.+foreign import ccall "ca.h ca_conj"+ ca_conj :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()++-- | /ca_floor/ /res/ /x/ /ctx/ +--+-- Sets /res/ to the floor function of /x/. The result is /Undefined/ if+-- /x/ is any infinity (including a real infinity). For complex numbers,+-- this is presently defined to take the floor of the real part.+foreign import ccall "ca.h ca_floor"+ ca_floor :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()++-- | /ca_ceil/ /res/ /x/ /ctx/ +--+-- Sets /res/ to the ceiling function of /x/. The result is /Undefined/ if+-- /x/ is any infinity (including a real infinity). For complex numbers,+-- this is presently defined to take the ceiling of the real part.+foreign import ccall "ca.h ca_ceil"+ ca_ceil :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()++-- Exponentials and logarithms -------------------------------------------------++-- | /ca_exp/ /res/ /x/ /ctx/ +--+-- Sets /res/ to the exponential function of /x/.+-- +-- For special values, the following definitions apply:+-- +-- - \(e^{+\infty} = +\infty\)+-- - \(e^{c \infty} = \tilde \infty\) if+-- \(0 < \operatorname{Re}(c) < 1\).+-- - \(e^{c \infty} = 0\) if \(\operatorname{Re}(c) < 0\).+-- - \(e^{c \infty} = \text{Undefined}\) if \(\operatorname{Re}(c) = 0\).+-- - \(e^{\tilde \infty} = \text{Undefined}\).+-- - Both /Undefined/ and /Unknown/ map to themselves.+-- +-- The following symbolic simplifications are performed automatically:+-- +-- - \(e^0 = 1\)+-- - \(e^{\log(z)} = z\)+-- - \(e^{(p/q) \log(z)} = z^{p/q}\) (for rational \(p/q\))+-- - \(e^{(p/q) \pi i}\) = algebraic root of unity (for small rational+-- \(p/q\))+-- +-- In the generic case, this function outputs an element of the formal+-- field \(\mathbb{Q}(e^x)\).+foreign import ccall "ca.h ca_exp"+ ca_exp :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()++-- | /ca_log/ /res/ /x/ /ctx/ +--+-- Sets /res/ to the natural logarithm of /x/.+-- +-- For special values and at the origin, the following definitions apply:+-- +-- - For any infinity, \(\log(c\infty) = \log(\tilde \infty) = +\infty\).+-- - \(\log(0) = -\infty\). The result is /Unknown/ if deciding \(x = 0\)+-- fails.+-- - Both /Undefined/ and /Unknown/ map to themselves.+-- +-- The following symbolic simplifications are performed automatically:+-- +-- - \(\log(1) = 0\)+-- - \(\log\left(e^z\right) = z + 2 \pi i k\)+-- - \(\log\left(\sqrt{z}\right) = \tfrac{1}{2} \log(z) + 2 \pi i k\)+-- - \(\log\left(z^a\right) = a \log(z) + 2 \pi i k\)+-- - \(\log(x) = \log(-x) + \pi i\) for negative real /x/+-- +-- In the generic case, this function outputs an element of the formal+-- field \(\mathbb{Q}(\log(x))\).+foreign import ccall "ca.h ca_log"+ ca_log :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()++-- Trigonometric functions -----------------------------------------------------++-- | /ca_sin_cos_exponential/ /res1/ /res2/ /x/ /ctx/ +foreign import ccall "ca.h ca_sin_cos_exponential"+ ca_sin_cos_exponential :: Ptr CCa -> Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()+-- | /ca_sin_cos_direct/ /res1/ /res2/ /x/ /ctx/ +foreign import ccall "ca.h ca_sin_cos_direct"+ ca_sin_cos_direct :: Ptr CCa -> Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()+-- | /ca_sin_cos_tangent/ /res1/ /res2/ /x/ /ctx/ +foreign import ccall "ca.h ca_sin_cos_tangent"+ ca_sin_cos_tangent :: Ptr CCa -> Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()+-- | /ca_sin_cos/ /res1/ /res2/ /x/ /ctx/ +--+-- Sets /res1/ to the sine of /x/ and /res2/ to the cosine of /x/. Either+-- /res1/ or /res2/ can be /NULL/ to compute only the other function.+-- Various representations are implemented:+-- +-- - The /exponential/ version expresses the sine and cosine in terms of+-- complex exponentials. Simple algebraic values will simplify to+-- rational numbers or elements of cyclotomic fields.+-- - The /direct/ method expresses the sine and cosine in terms of the+-- original functions (perhaps after applying some symmetry+-- transformations, which may interchange sin and cos). Extremely+-- simple algebraic values will automatically simplify to elements of+-- real algebraic number fields.+-- - The /tangent/ version expresses the sine and cosine in terms of+-- \(\tan(x/2)\), perhaps after applying some symmetry transformations.+-- Extremely simple algebraic values will automatically simplify to+-- elements of real algebraic number fields.+-- +-- By default, the standard function uses the /exponential/ representation+-- as this typically works best for field arithmetic and simplifications,+-- although it has the disadvantage of introducing complex numbers where+-- real numbers would be sufficient. The behavior of the standard function+-- can be changed using the @ca_opt_trigformM@ context setting.+-- +-- For special values, the following definitions apply:+-- +-- - \(\sin(\pm i \infty) = \pm i \infty\)+-- - \(\cos(\pm i \infty) = +\infty\)+-- - All other infinities give \(\operatorname{Undefined}\)+foreign import ccall "ca.h ca_sin_cos"+ ca_sin_cos :: Ptr CCa -> Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()++-- | /ca_sin/ /res/ /x/ /ctx/ +foreign import ccall "ca.h ca_sin"+ ca_sin :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()+-- | /ca_cos/ /res/ /x/ /ctx/ +--+-- Sets /res/ to the sine or cosine of /x/. These functions are shortcuts+-- for @ca_sin_cos@.+foreign import ccall "ca.h ca_cos"+ ca_cos :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()++-- | /ca_tan_sine_cosine/ /res/ /x/ /ctx/ +foreign import ccall "ca.h ca_tan_sine_cosine"+ ca_tan_sine_cosine :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()+-- | /ca_tan_exponential/ /res/ /x/ /ctx/ +foreign import ccall "ca.h ca_tan_exponential"+ ca_tan_exponential :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()+-- | /ca_tan_direct/ /res/ /x/ /ctx/ +foreign import ccall "ca.h ca_tan_direct"+ ca_tan_direct :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()+-- | /ca_tan/ /res/ /x/ /ctx/ +--+-- Sets /res/ to the tangent of /x/. The /sine_cosine/ version evaluates+-- the tangent as a quotient of a sine and cosine, the /direct/ version+-- evaluates it directly as a tangent (possibly after transforming the+-- variable), and the /exponential/ version evaluates it in terms of+-- complex exponentials. Simple algebraic values will automatically+-- simplify to elements of trigonometric or cyclotomic number fields.+-- +-- By default, the standard function uses the /exponential/ representation+-- as this typically works best for field arithmetic and simplifications,+-- although it has the disadvantage of introducing complex numbers where+-- real numbers would be sufficient. The behavior of the standard function+-- can be changed using the @CA_OPT_TRIG_FORM@ context setting.+-- +-- For special values, the following definitions apply:+-- +-- - At poles, \(\tan((n+\tfrac{1}{2}) \pi) = \tilde \infty\)+-- - \(\tan(e^{i \theta} \infty) = +i, \quad 0 < \theta < \pi\)+-- - \(\tan(e^{i \theta} \infty) = -i, \quad -\pi < \theta < 0\)+-- - \(\tan(\pm \infty) = \tan(\tilde \infty) = \operatorname{Undefined}\)+foreign import ccall "ca.h ca_tan"+ ca_tan :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()++-- | /ca_cot/ /res/ /x/ /ctx/ +--+-- Sets /res/ to the cotangent /x/. This is equivalent to computing the+-- reciprocal of the tangent.+foreign import ccall "ca.h ca_cot"+ ca_cot :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()++-- | /ca_atan_logarithm/ /res/ /x/ /ctx/ +foreign import ccall "ca.h ca_atan_logarithm"+ ca_atan_logarithm :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()+-- | /ca_atan_direct/ /res/ /x/ /ctx/ +foreign import ccall "ca.h ca_atan_direct"+ ca_atan_direct :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()+-- | /ca_atan/ /res/ /x/ /ctx/ +--+-- Sets /res/ to the inverse tangent of /x/.+-- +-- The /direct/ version expresses the result as an inverse tangent+-- (possibly after transforming the variable). The /logarithm/ version+-- expresses it in terms of complex logarithms. Simple algebraic inputs+-- will automatically simplify to rational multiples of \(\pi\).+-- +-- By default, the standard function uses the /logarithm/ representation as+-- this typically works best for field arithmetic and simplifications,+-- although it has the disadvantage of introducing complex numbers where+-- real numbers would be sufficient. The behavior of the standard function+-- can be changed using the @CA_OPT_TRIG_FORM@ context setting (exponential+-- mode results in logarithmic forms).+-- +-- For special values, the following definitions apply:+-- +-- - \(\operatorname{atan}(\pm i) = \pm i \infty\)+-- - \(\operatorname{atan}(c \infty) = \operatorname{csgn}(c) \pi / 2\)+-- - \(\operatorname{atan}(\tilde \infty) = \operatorname{Undefined}\)+foreign import ccall "ca.h ca_atan"+ ca_atan :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()++-- | /ca_asin_logarithm/ /res/ /x/ /ctx/ +foreign import ccall "ca.h ca_asin_logarithm"+ ca_asin_logarithm :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()+-- | /ca_acos_logarithm/ /res/ /x/ /ctx/ +foreign import ccall "ca.h ca_acos_logarithm"+ ca_acos_logarithm :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()+-- | /ca_asin_direct/ /res/ /x/ /ctx/ +foreign import ccall "ca.h ca_asin_direct"+ ca_asin_direct :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()+-- | /ca_acos_direct/ /res/ /x/ /ctx/ +foreign import ccall "ca.h ca_acos_direct"+ ca_acos_direct :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()+-- | /ca_asin/ /res/ /x/ /ctx/ +foreign import ccall "ca.h ca_asin"+ ca_asin :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()+-- | /ca_acos/ /res/ /x/ /ctx/ +--+-- Sets /res/ to the inverse sine (respectively, cosine) of /x/.+-- +-- The /direct/ version expresses the result as an inverse sine or cosine+-- (possibly after transforming the variable). The /logarithm/ version+-- expresses it in terms of complex logarithms. Simple algebraic inputs+-- will automatically simplify to rational multiples of \(\pi\).+-- +-- By default, the standard function uses the /logarithm/ representation as+-- this typically works best for field arithmetic and simplifications,+-- although it has the disadvantage of introducing complex numbers where+-- real numbers would be sufficient. The behavior of the standard function+-- can be changed using the @CA_OPT_TRIG_FORM@ context setting (exponential+-- mode results in logarithmic forms).+-- +-- The inverse cosine is presently implemented as+-- \(\operatorname{acos}(x) = \pi/2 - \operatorname{asin}(x)\).+foreign import ccall "ca.h ca_acos"+ ca_acos :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()++-- Special functions -----------------------------------------------------------++-- | /ca_gamma/ /res/ /x/ /ctx/ +--+-- Sets /res/ to the gamma function of /x/.+foreign import ccall "ca.h ca_gamma"+ ca_gamma :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()++-- | /ca_erf/ /res/ /x/ /ctx/ +--+-- Sets /res/ to the error function of /x/.+foreign import ccall "ca.h ca_erf"+ ca_erf :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()++-- | /ca_erfc/ /res/ /x/ /ctx/ +--+-- Sets /res/ to the complementary error function of /x/.+foreign import ccall "ca.h ca_erfc"+ ca_erfc :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()++-- | /ca_erfi/ /res/ /x/ /ctx/ +--+-- Sets /res/ to the imaginary error function of /x/.+foreign import ccall "ca.h ca_erfi"+ ca_erfi :: Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()++-- Numerical evaluation --------------------------------------------------------++-- | /ca_get_acb_raw/ /res/ /x/ /prec/ /ctx/ +--+-- Sets /res/ to an enclosure of the numerical value of /x/. A working+-- precision of /prec/ bits is used internally for the evaluation, without+-- adaptive refinement. If /x/ is any special value, /res/ is set to+-- /acb_indeterminate/.+foreign import ccall "ca.h ca_get_acb_raw"+ ca_get_acb_raw :: Ptr CAcb -> Ptr CCa -> CLong -> Ptr CCaCtx -> IO ()++-- | /ca_get_acb/ /res/ /x/ /prec/ /ctx/ +foreign import ccall "ca.h ca_get_acb"+ ca_get_acb :: Ptr CAcb -> Ptr CCa -> CLong -> Ptr CCaCtx -> IO ()+ +-- | /ca_get_acb_accurate_parts/ /res/ /x/ /prec/ /ctx/ +--+-- Sets /res/ to an enclosure of the numerical value of /x/. The working+-- precision is increased adaptively to try to ensure /prec/ accurate bits+-- in the output. The /accurate_parts/ version tries to ensure /prec/+-- accurate bits for both the real and imaginary part separately.+-- +-- The refinement is stopped if the working precision exceeds+-- @CA_OPT_PREC_LIMIT@ (or twice the initial precision, if this is larger).+-- The user may call /acb_rel_accuracy_bits/ to check is the calculation+-- was successful.+-- +-- The output is not rounded down to /prec/ bits (to avoid unnecessary+-- double rounding); the user may call /acb_set_round/ when rounding is+-- desired.+foreign import ccall "ca.h ca_get_acb_accurate_parts"+ ca_get_acb_accurate_parts :: Ptr CAcb -> Ptr CCa -> CLong -> Ptr CCaCtx -> IO ()++-- | /ca_get_decimal_str/ /x/ /digits/ /flags/ /ctx/ +--+-- Returns a decimal approximation of /x/ with precision up to /digits/.+-- The output is guaranteed to be correct within 1 ulp in the returned+-- digits, but the number of returned digits may be smaller than /digits/+-- if the numerical evaluation does not succeed.+-- +-- If /flags/ is set to 1, attempts to achieve full accuracy for both the+-- real and imaginary parts separately.+-- +-- If /x/ is not finite or a finite enclosure cannot be produced, returns+-- the string \"?\".+-- +-- The user should free the returned string with @flint_free@.+foreign import ccall "ca.h ca_get_decimal_str"+ ca_get_decimal_str :: Ptr CCa -> CLong -> CULong -> Ptr CCaCtx -> IO CString++-- Rewriting and simplification ------------------------------------------------++-- | /ca_rewrite_complex_normal_form/ /res/ /x/ /deep/ /ctx/ +--+-- Sets /res/ to /x/ rewritten using standardizing transformations over the+-- complex numbers:+-- +-- - Elementary functions are rewritten in terms of (complex)+-- exponentials, roots and logarithms+-- - Complex parts are rewritten using logarithms, square roots, and+-- (deep) complex conjugates+-- - Algebraic numbers are rewritten in terms of cyclotomic fields where+-- applicable+-- +-- If /deep/ is set, the rewriting is applied recursively to the tower of+-- extension numbers; otherwise, the rewriting is only applied to the+-- top-level extension numbers.+-- +-- The result is not a normal form in the strong sense (the same number can+-- have many possible representations even after applying this+-- transformation), but in practice this is a powerful heuristic for+-- simplification.+foreign import ccall "ca.h ca_rewrite_complex_normal_form"+ ca_rewrite_complex_normal_form :: Ptr CCa -> Ptr CCa -> CInt -> Ptr CCaCtx -> IO ()++-- Factorization ---------------------------------------------------------------++-- | /ca_factor_init/ /fac/ /ctx/ +--+-- Initializes /fac/ and sets it to the empty factorization (equivalent to+-- the number 1).+foreign import ccall "ca.h ca_factor_init"+ ca_factor_init :: Ptr CCaFactor -> Ptr CCaCtx -> IO ()++-- | /ca_factor_clear/ /fac/ /ctx/ +--+-- Clears the factorization structure /fac/.+foreign import ccall "ca.h ca_factor_clear"+ ca_factor_clear :: Ptr CCaFactor -> Ptr CCaCtx -> IO ()++foreign import ccall "ca.h &ca_factor_clear"+ p_ca_factor_clear :: FunPtr (Ptr CCaFactor -> Ptr CCaCtx -> IO ())++-- | /ca_factor_one/ /fac/ /ctx/ +--+-- Sets /fac/ to the empty factorization (equivalent to the number 1).+foreign import ccall "ca.h ca_factor_one"+ ca_factor_one :: Ptr CCaFactor -> Ptr CCaCtx -> IO ()++-- | /ca_factor_print/ /fac/ /ctx/ +--+-- Prints a description of /fac/ to standard output.+foreign import ccall "ca.h ca_factor_print"+ ca_factor_print :: Ptr CCaFactor -> Ptr CCaCtx -> IO ()++-- | /ca_factor_insert/ /fac/ /base/ /exp/ /ctx/ +--+-- Inserts \(b^e\) into /fac/ where /b/ is given by /base/ and /e/ is given+-- by /exp/. If a base element structurally identical to /base/ already+-- exists in /fac/, the corresponding exponent is incremented by /exp/;+-- otherwise, this factor is appended.+foreign import ccall "ca.h ca_factor_insert"+ ca_factor_insert :: Ptr CCaFactor -> Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()++-- | /ca_factor_get_ca/ /res/ /fac/ /ctx/ +--+-- Expands /fac/ back to a single @ca_t@ by evaluating the powers and+-- multiplying out the result.+foreign import ccall "ca.h ca_factor_get_ca"+ ca_factor_get_ca :: Ptr CCa -> Ptr CCaFactor -> Ptr CCaCtx -> IO ()++-- | /ca_factor/ /res/ /x/ /flags/ /ctx/ +--+-- Sets /res/ to a factorization of /x/ of the form+-- \(x = b_1^{e_1} b_2^{e_2} \cdots b_n^{e_n}\). Requires that /x/ is not a+-- special value. The type of factorization is controlled by /flags/, which+-- can be set to a combination of constants in the following section.+foreign import ccall "ca.h ca_factor"+ ca_factor :: Ptr CCaFactor -> Ptr CCa -> CULong -> Ptr CCaCtx -> IO ()++-- Factorization options -------------------------------------------------------++-- $factorization_options+-- The following flags select the structural polynomial factorization+-- to perform over formal fields \(\mathbb{Q}(a_1,\ldots,a_n)\). Each+-- flag in the list strictly encompasses the factorization power of+-- the preceding flag, so it is unnecessary to pass more than one+-- flag.++type CaFactorOption = CULong++ca_factor_poly_none, ca_factor_poly_content, ca_factor_poly_sqf, ca_factor_poly_full, ca_factor_zz_none, ca_factor_zz_smooth, ca_factor_zz_full :: CaFactorOption++-- | /ca_factor_poly_none/+-- +-- No polynomial factorization at all.+-- +ca_factor_poly_none = #const CA_FACTOR_POLY_NONE+-- | /ca_factor_poly_content/+-- +-- Only extract the rational content.+-- +ca_factor_poly_content = #const CA_FACTOR_POLY_CONTENT+-- | /ca_factor_poly_sqf/+-- +-- Perform a squarefree factorization in addition to extracting+-- the rational content.+-- +ca_factor_poly_sqf = #const CA_FACTOR_POLY_SQF+-- | /ca_factor_poly_full/+-- +-- Perform a full multivariate polynomial factorization.+-- +-- The following flags select the factorization to perform over `\mathbb{Z}`.+-- Integer factorization is applied if *x* is an element of `\mathbb{Q}`, and to+-- the extracted rational content of polynomials.+-- Each flag in the list strictly encompasses the factorization power of+-- the preceding flag, so it is unnecessary to pass more than one flag.+-- +ca_factor_poly_full = #const CA_FACTOR_POLY_FULL+-- | /ca_factor_zz_none/+-- +-- No integer factorization at all.+-- +ca_factor_zz_none = #const CA_FACTOR_ZZ_NONE+-- | /ca_factor_zz_smooth/+-- +-- Perform a smooth factorization to extract small prime factors+-- (heuristically up to ``CA_OPT_SMOOTH_LIMIT`` bits) in addition to+-- identifying perfect powers.+-- +ca_factor_zz_smooth = #const CA_FACTOR_ZZ_SMOOTH+-- | /ca_factor_zz_full/+-- +-- Perform a complete integer factorization into prime numbers.+-- This is prohibitively slow for general integers exceeding 70-80 digits.+ca_factor_zz_full = #const CA_FACTOR_ZZ_FULL++-- The following flags select the factorization to perform over+-- \(\mathbb{Z}\). Integer factorization is applied if /x/ is an element of+-- \(\mathbb{Q}\), and to the extracted rational content of polynomials.+-- Each flag in the list strictly encompasses the factorization power of+-- the preceding flag, so it is unnecessary to pass more than one flag.++-- Context options -------------------------------------------------------------++-- $context_options+-- The /options/ member of a @CaCtx@ object is an array of /slong/+-- values controlling simplification behavior and various other settings.+-- The values of the array at the following indices can be changed by the+-- user (example: @ctx->options[CA_OPT_PREC_LIMIT] = 65536@).+--+-- It is recommended to set options controlling evaluation only at the time+-- when a context object is created. Changing such options later should+-- normally be harmless, but since the update will not apply retroactively+-- to objects that have already been computed and cached, one might not see+-- the expected behavior. Superficial options (printing) can be changed at+-- any time.++type CaOption = CLong++ca_opt_verbose, ca_opt_print_flags, ca_opt_mpoly_ord, ca_opt_prec_limit, ca_opt_qqbar_deg_limit, ca_opt_low_prec, ca_opt_smooth_limit, ca_opt_lll_prec, ca_opt_pow_limit, ca_opt_use_groebner, ca_opt_groebner_length_limit, ca_opt_groebner_poly_length_limit, ca_opt_groebner_poly_bits_limit, ca_opt_vieta_limit, ca_opt_trig_form, ca_trig_direct, ca_trig_exponential, ca_trig_sine_cosine, ca_trig_tangent :: CaOption++-- | /ca_opt_verbose/+-- +-- Whether to print debug information. Default value: 0.+-- +ca_opt_verbose = #const CA_OPT_VERBOSE+-- | /ca_opt_print_flags/+-- +-- Printing style. See :ref:`ca-printing` for details.+-- Default value: ``CA_PRINT_DEFAULT``.+-- +ca_opt_print_flags = #const CA_OPT_PRINT_FLAGS+-- | /ca_opt_mpoly_ord/+-- +-- Monomial ordering to use for multivariate polynomials. Possible+-- values are ``ORD_LEX``, ``ORD_DEGLEX`` and ``ORD_DEGREVLEX``.+-- Default value: ``ORD_LEX``.+-- This option must be set before doing any computations.+-- +ca_opt_mpoly_ord = #const CA_OPT_MPOLY_ORD+-- | /ca_opt_prec_limit/+-- +-- Maximum precision to use internally for numerical evaluation with Arb,+-- and in some cases for the magntiude of exact coefficients.+-- This parameter affects the possibility to prove inequalities+-- and find simplifications between related extension numbers.+-- This is not a strict limit; some calculations may use higher precision+-- when there is a good reason to do so.+-- Default value: 4096.+-- +ca_opt_prec_limit = #const CA_OPT_PREC_LIMIT+-- | /ca_opt_qqbar_deg_limit/+-- +-- Maximum degree of :type:`qqbar_t` elements allowed internally during+-- simplification of algebraic numbers. This limit may be exceeded+-- when the user provides explicit :type:`qqbar_t` input of higher degree.+-- Default value: 120.+-- +ca_opt_qqbar_deg_limit = #const CA_OPT_QQBAR_DEG_LIMIT+-- | /ca_opt_low_prec/+-- +-- Numerical precision to use for fast checks (typically, before attempting+-- more expensive operations). Default value: 64.+-- +ca_opt_low_prec = #const CA_OPT_LOW_PREC+-- | /ca_opt_smooth_limit/+-- +-- Size in bits for factors in smooth integer factorization. Default value: 32.+-- +ca_opt_smooth_limit = #const CA_OPT_SMOOTH_LIMIT+-- | /ca_opt_lll_prec/+-- +-- Precision to use to find integer relations using LLL. Default value: 128.+-- +ca_opt_lll_prec = #const CA_OPT_LLL_PREC+-- | /ca_opt_pow_limit/+-- +-- Largest exponent to expand powers automatically. This only applies+-- in multivariate and transcendental fields: in number fields,+-- ``CA_OPT_PREC_LIMIT`` applies instead. Default value: 20.+-- +ca_opt_pow_limit = #const CA_OPT_POW_LIMIT+-- | /ca_opt_use_groebner/+-- +-- Boolean flag for whether to use Gröbner basis computation.+-- This flag and the following limits affect the ability to+-- prove multivariate identities.+-- Default value: 1.+-- +ca_opt_use_groebner = #const CA_OPT_USE_GROEBNER+-- | /ca_opt_groebner_length_limit/+-- +-- Maximum length of ideal basis allowed in Buchberger's algorithm.+-- Default value: 100.+-- +ca_opt_groebner_length_limit = #const CA_OPT_GROEBNER_LENGTH_LIMIT+-- | /ca_opt_groebner_poly_length_limit/+-- +-- Maximum length of polynomials allowed in Buchberger's algorithm.+-- Default value: 1000.+-- +ca_opt_groebner_poly_length_limit = #const CA_OPT_GROEBNER_POLY_LENGTH_LIMIT+-- | /ca_opt_groebner_poly_bits_limit/+-- +-- Maximum coefficient size in bits of polynomials allowed in+-- Buchberger's algorithm.+-- Default value: 10000.+-- +ca_opt_groebner_poly_bits_limit = #const CA_OPT_GROEBNER_POLY_BITS_LIMIT+-- | /ca_opt_vieta_limit/+-- +-- Maximum degree *n* of algebraic numbers for which to add Vieta's+-- formulas to the reduction ideal.+-- This must be set relatively low+-- since the number of terms in Vieta's formulas is `O(2^n)`+-- and the resulting Gröbner basis computations can be expensive.+-- Default value: 6.+-- +ca_opt_vieta_limit = #const CA_OPT_VIETA_LIMIT+-- | /ca_opt_trig_form/+-- +-- Default representation of trigonometric functions.+--+-- Default value: ``ca_trig_exponential``.+-- +-- The *exponential* representation is currently used by default+-- as typically works best for field arithmetic+-- and simplifications, although it has the disadvantage of+-- introducing complex numbers where real numbers would be sufficient.+-- This may change in the future.+--+-- The following values are possible:+ca_opt_trig_form = #const CA_OPT_TRIG_FORM+-- | /ca_trig_direct/+-- +-- Use the direct functions (with some exceptions).+-- +ca_trig_direct = #const CA_TRIG_DIRECT+-- | /ca_trig_exponential/+-- +-- Use complex exponentials.+-- +ca_trig_exponential = #const CA_TRIG_EXPONENTIAL+-- | /ca_trig_sine_cosine/+-- +-- Use sines and cosines.+-- +ca_trig_sine_cosine = #const CA_TRIG_SINE_COSINE+-- | /ca_trig_tangent/+-- +-- Use tangents.+-- +ca_trig_tangent = #const CA_TRIG_TANGENT++-- Internal representation -----------------------------------------------------++-- | /_ca_make_field_element/ /x/ /new_index/ /ctx/ +--+-- Changes the internal representation of /x/ to that of an element of the+-- field with index /new_index/ in the context object /ctx/. This may+-- destroy the value of /x/.+foreign import ccall "ca.h _ca_make_field_element"+ _ca_make_field_element :: Ptr CCa -> Ptr CCaField -> Ptr CCaCtx -> IO ()++-- | /_ca_make_fmpq/ /x/ /ctx/ +--+-- Changes the internal representation of /x/ to that of an element of the+-- trivial field \(\mathbb{Q}\). This may destroy the value of /x/.+foreign import ccall "ca.h _ca_make_fmpq"+ _ca_make_fmpq :: Ptr CCa -> Ptr CCaCtx -> IO ()++++
+ src/Data/Number/Flint/Calcium/Ca/Field.hs view
@@ -0,0 +1,33 @@+{-|+module : Data.Number.Flint.Calcium.Ca.Field+copyright : (c) 2023 Hartmut Monien+license : GNU GPL, version 2 or above (see LICENSE)+maintainer : hmonien@uni-bonn.de++A @CaFieldt@ represents the parent field \(K = \mathbb{Q}(a_1,\ldots,a_n)\)+of a @Ca@ element. A @CaField@ contains a list of pointers to+@CaExt@ objects as well as a reduction ideal.++The user does not normally need to create @CaField@ objects manually:+a @CaCtx@ context object manages a cache of fields automatically.++Internally, three types of field representation are used:++* The trivial field \(\mathbb{Q}\).++* An Antic number field \(\mathbb{Q}(a)\) where \(a\) is defined + by a @QQbar@.++* A generic field \(\mathbb{Q}(a_1,\ldots,a_n)\) where \(n \ge 1\),+ and \(a_1\) is not defined by a @QQbar@ if \(n = 1\).++The field type mainly affects the internal storage of the field+elements; the distinction is mostly transparent to the external+interface.++-}+module Data.Number.Flint.Calcium.Ca.Field (+ module Data.Number.Flint.Calcium.Ca.Field.FFI+ ) where+ +import Data.Number.Flint.Calcium.Ca.Field.FFI
+ src/Data/Number/Flint/Calcium/Ca/Field/FFI.hsc view
@@ -0,0 +1,176 @@+module Data.Number.Flint.Calcium.Ca.Field.FFI (+ -- * Extension fields+ CaField (..)+ , CCaField (..)+ -- * Memory management+ , ca_field_init_qq+ , ca_field_init_nf+ , ca_field_init_const+ , ca_field_init_fx+ , ca_field_init_fxy+ , ca_field_init_multi+ , ca_field_set_ext+ , ca_field_clear+ -- * Input and output+ , ca_field_print+ -- * Ideal+ , ca_field_build_ideal+ , ca_field_build_ideal_erf+ -- * Structure operations+ , ca_field_cmp+ -- * Cache+ , ca_field_cache_init+ , ca_field_cache_clear+ , ca_field_cache_insert_ext+) where ++-- Extension fields ------------------------------------------------------------++import Foreign.Ptr+import Foreign.ForeignPtr+import Foreign.C.Types++import Data.Number.Flint.NF.QQbar+import Data.Number.Flint.Calcium+import Data.Number.Flint.Calcium.Ca.Types++-- ca_field -------------------------------------------------------------------+ +-- Memory management -----------------------------------------------------------++-- | /ca_field_init_qq/ /K/ /ctx/ +--+-- Initializes /K/ to represent the trivial field \(\mathbb{Q}\).+foreign import ccall "ca_field.h ca_field_init_qq"+ ca_field_init_qq :: Ptr CCaField -> Ptr CCaCtx -> IO ()++-- | /ca_field_init_nf/ /K/ /x/ /ctx/ +--+-- Initializes /K/ to represent the algebraic number field+-- \(\mathbb{Q}(x)\).+foreign import ccall "ca_field.h ca_field_init_nf"+ ca_field_init_nf :: Ptr CCaField -> Ptr CQQbar -> Ptr CCaCtx -> IO ()++-- | /ca_field_init_const/ /K/ /func/ /ctx/ +--+-- Initializes /K/ to represent the field \(\mathbb{Q}(x)\) where /x/ is a+-- builtin constant defined by /func/ (example: /func/ = /CA_Pi/ for+-- \(x = \pi\)).+foreign import ccall "ca_field.h ca_field_init_const"+ ca_field_init_const :: Ptr CCaField -> CCalciumFunctionCode -> Ptr CCaCtx -> IO ()++-- | /ca_field_init_fx/ /K/ /func/ /x/ /ctx/ +--+-- Initializes /K/ to represent the field \(\mathbb{Q}(a)\) where+-- \(a = f(x)\), given a number /x/ and a builtin univariate function+-- /func/ (example: /func/ = /CA_Exp/ for \(e^x\)).+foreign import ccall "ca_field.h ca_field_init_fx"+ ca_field_init_fx :: Ptr CCaField -> CCalciumFunctionCode -> Ptr CCa -> Ptr CCaCtx -> IO ()++-- | /ca_field_init_fxy/ /K/ /func/ /x/ /y/ /ctx/ +--+-- Initializes /K/ to represent the field \(\mathbb{Q}(a,b)\) where+-- \(a = f(x, y)\).+foreign import ccall "ca_field.h ca_field_init_fxy"+ ca_field_init_fxy :: Ptr CCaField -> CCalciumFunctionCode -> Ptr CCa -> Ptr CCa -> Ptr CCaCtx -> IO ()++-- | /ca_field_init_multi/ /K/ /len/ /ctx/ +--+-- Initializes /K/ to represent a multivariate field+-- \(\mathbb{Q}(a_1, \ldots, a_n)\) in /n/ extension numbers. The extension+-- numbers must subsequently be assigned one by one using+-- @ca_field_set_ext@.+foreign import ccall "ca_field.h ca_field_init_multi"+ ca_field_init_multi :: Ptr CCaField -> CLong -> Ptr CCaCtx -> IO ()++-- | /ca_field_set_ext/ /K/ /i/ /x_index/ /ctx/ +--+-- Sets the extension number at position /i/ (here indexed from 0) of /K/+-- to the generator of the field with index /x_index/ in /ctx/. (It is+-- assumed that the generating field is a univariate field.)+-- +-- This only inserts a shallow reference: the field at index /x_index/ must+-- be kept alive until /K/ has been cleared.+foreign import ccall "ca_field.h ca_field_set_ext"+ ca_field_set_ext :: Ptr CCaField -> CLong -> Ptr CCaExt -> Ptr CCaCtx -> IO ()++-- | /ca_field_clear/ /K/ /ctx/ +--+-- Clears the field /K/. This does not clear the individual extension+-- numbers, which are only held as references.+foreign import ccall "ca_field.h ca_field_clear"+ ca_field_clear :: Ptr CCaField -> Ptr CCaCtx -> IO ()++foreign import ccall "ca_field.h &ca_field_clear"+ p_ca_field_clear :: FunPtr (Ptr CCaField -> Ptr CCaCtx -> IO ())++-- Input and output ------------------------------------------------------------++-- | /ca_field_print/ /K/ /ctx/ +--+-- Prints a description of the field /K/ to standard output.+foreign import ccall "ca_field.h ca_field_print"+ ca_field_print :: Ptr CCaField -> Ptr CCaCtx -> IO ()++-- Ideal -----------------------------------------------------------------------++-- | /ca_field_build_ideal/ /K/ /ctx/ +--+-- Given /K/ with assigned extension numbers, builds the reduction ideal+-- in-place.+foreign import ccall "ca_field.h ca_field_build_ideal"+ ca_field_build_ideal :: Ptr CCaField -> Ptr CCaCtx -> IO ()++-- | /ca_field_build_ideal_erf/ /K/ /ctx/ +--+-- Builds relations for error functions present among the extension numbers+-- in /K/. This heuristic adds relations that are consequences of the+-- functional equations+-- \(\operatorname{erf}(x) = -\operatorname{erf}(-x)\),+-- \(\operatorname{erfc}(x) = 1-\operatorname{erf}(x)\),+-- \(\operatorname{erfi}(x) = -i\operatorname{erf}(ix)\).+foreign import ccall "ca_field.h ca_field_build_ideal_erf"+ ca_field_build_ideal_erf :: Ptr CCaField -> Ptr CCaCtx -> IO ()++-- Structure operations --------------------------------------------------------++-- | /ca_field_cmp/ /K1/ /K2/ /ctx/ +--+-- Compares the field objects /K1/ and /K2/ in a canonical sort order,+-- returning -1, 0 or 1. This only performs a lexicographic comparison of+-- the representations of /K1/ and /K2/; the return value does not say+-- anything meaningful about the relative structures of /K1/ and /K2/ as+-- mathematical fields.+foreign import ccall "ca_field.h ca_field_cmp"+ ca_field_cmp :: Ptr CCaField -> Ptr CCaField -> Ptr CCaCtx -> IO CInt++-- Cache -----------------------------------------------------------------------++-- | /ca_field_cache_init/ /cache/ /ctx/ +--+-- Initializes /cache/ for use.+foreign import ccall "ca_field.h ca_field_cache_init"+ ca_field_cache_init :: Ptr CCaFieldCache -> Ptr CCaCtx -> IO ()++-- | /ca_field_cache_clear/ /cache/ /ctx/ +--+-- Clears /cache/, freeing the memory allocated internally. This does not+-- clear the individual extension numbers, which are only held as+-- references.+foreign import ccall "ca_field.h ca_field_cache_clear"+ ca_field_cache_clear :: Ptr CCaFieldCache -> Ptr CCaCtx -> IO ()++-- | /ca_field_cache_insert_ext/ /cache/ /x/ /len/ /ctx/ +--+-- Adds the field defined by the length-/len/ list of extension numbers /x/+-- to /cache/ without duplication. If such a field already exists in+-- /cache/, a pointer to that instance is returned. Otherwise, a field with+-- extension numbers /x/ is inserted into /cache/ and a pointer to that new+-- instance is returned. Upon insertion of a new field, the reduction ideal+-- is constructed via @ca_field_build_ideal@.+foreign import ccall "ca_field.h ca_field_cache_insert_ext"+ ca_field_cache_insert_ext :: Ptr CCaFieldCache -> Ptr (Ptr CCaExt) -> CLong -> Ptr CCaCtx -> IO (Ptr CCaField)++++
+ src/Data/Number/Flint/Calcium/Ca/Mat.hs view
@@ -0,0 +1,21 @@+{-|+module : Data.Number.Flint.Calcium.Ca.Mat+copyright : (c) 2023 Hartmut Monien+license : GNU GPL, version 2 or above (see LICENSE)+maintainer : hmonien@uni-bonn.de+++-- A @CaMat@ represents a dense matrix over the real or complex numbers,+-- implemented as an array of entries of type @Ca@. The dimension+-- (number of rows and columns) of a matrix is fixed at initialization, and+-- the user must ensure that inputs and outputs to an operation have+-- compatible dimensions. The number of rows or columns in a matrix can be+-- zero.+--++-}+module Data.Number.Flint.Calcium.Ca.Mat (+ module Data.Number.Flint.Calcium.Ca.Mat.FFI+ ) where+ +import Data.Number.Flint.Calcium.Ca.Mat.FFI
+ src/Data/Number/Flint/Calcium/Ca/Mat/FFI.hsc view
@@ -0,0 +1,933 @@+module Data.Number.Flint.Calcium.Ca.Mat.FFI (+ -- * Matrices over the real and complex numbers+ CaMat (..)+ , CCaMat (..)+ , newCaMat+ , withCaMat+ , withNewCaMat+ -- * Types, macros and constants+ , ca_mat_entry+ , ca_mat_entry_ptr+ -- * Memory management+ , ca_mat_init+ , ca_mat_clear+ , ca_mat_swap+ , ca_mat_window_init+ , ca_mat_window_clear+ -- * Assignment and conversions+ , ca_mat_set+ , ca_mat_set_fmpz_mat+ , ca_mat_set_fmpq_mat+ , ca_mat_set_ca+ , ca_mat_transfer+ -- * Random generation+ , ca_mat_randtest+ , ca_mat_randtest_rational+ , ca_mat_randops+ -- * Input and output+ , ca_mat_get_str+ , ca_mat_fprint+ , ca_mat_print+ , ca_mat_printn+ -- * Special matrices+ , ca_mat_zero+ , ca_mat_one+ , ca_mat_ones+ , ca_mat_pascal+ , ca_mat_stirling+ , ca_mat_hilbert+ , ca_mat_dft+ -- * Comparisons and properties+ , ca_mat_check_equal+ , ca_mat_check_is_zero+ , ca_mat_check_is_one+ -- * Conjugate and transpose+ , ca_mat_transpose+ , ca_mat_conj+ , ca_mat_conj_transpose+ -- * Arithmetic+ , ca_mat_neg+ , ca_mat_add+ , ca_mat_sub+ , ca_mat_mul_classical+ , ca_mat_mul_same_nf+ , ca_mat_mul+ , ca_mat_mul_si+ , ca_mat_mul_fmpz+ , ca_mat_mul_fmpq+ , ca_mat_mul_ca+ , ca_mat_div_si+ , ca_mat_div_fmpz+ , ca_mat_div_fmpq+ , ca_mat_div_ca+ , ca_mat_add_ca+ , ca_mat_sub_ca+ , ca_mat_addmul_ca+ , ca_mat_submul_ca+ -- * Powers+ , ca_mat_sqr+ , ca_mat_pow_ui_binexp+ -- * Polynomial evaluation+ , _ca_mat_ca_poly_evaluate+ , ca_mat_ca_poly_evaluate+ -- * Gaussian elimination and LU decomposition+ , ca_mat_find_pivot+ , ca_mat_lu_classical+ , ca_mat_lu_recursive+ , ca_mat_lu+ , ca_mat_fflu+ , ca_mat_nonsingular_lu+ , ca_mat_nonsingular_fflu+ -- * Solving and inverse+ , ca_mat_inv+ , ca_mat_nonsingular_solve_adjugate+ , ca_mat_nonsingular_solve_fflu+ , ca_mat_nonsingular_solve_lu+ , ca_mat_nonsingular_solve+ , ca_mat_solve_tril_classical+ , ca_mat_solve_tril_recursive+ , ca_mat_solve_tril+ , ca_mat_solve_triu_classical+ , ca_mat_solve_triu_recursive+ , ca_mat_solve_triu+ , ca_mat_solve_fflu_precomp+ , ca_mat_solve_lu_precomp+ -- * Rank and echelon form+ , ca_mat_rank+ , ca_mat_rref_fflu+ , ca_mat_rref_lu+ , ca_mat_rref+ , ca_mat_right_kernel+ -- * Determinant and trace+ , ca_mat_trace+ , ca_mat_det_berkowitz+ , ca_mat_det_lu+ , ca_mat_det_bareiss+ , ca_mat_det_cofactor+ , ca_mat_det+ , ca_mat_adjugate_cofactor+ , ca_mat_adjugate_charpoly+ , ca_mat_adjugate+ -- * Characteristic polynomial+ , _ca_mat_charpoly_berkowitz+ , ca_mat_charpoly_berkowitz+ , _ca_mat_charpoly_danilevsky+ , ca_mat_charpoly_danilevsky+ , _ca_mat_charpoly+ , ca_mat_charpoly+ , ca_mat_companion+ -- * Eigenvalues and eigenvectors+ , ca_mat_eigenvalues+ , ca_mat_diagonalization+ -- * Jordan canonical form+ , ca_mat_jordan_blocks+ , ca_mat_set_jordan_blocks+ , ca_mat_jordan_transformation+ , ca_mat_jordan_form+ -- * Matrix functions+ , ca_mat_exp+ , ca_mat_log+) where++-- Matrices over the real and complex numbers ----------------------------------++import Foreign.Ptr+import Foreign.ForeignPtr+import Foreign.C.Types+import Foreign.C.String+import Foreign.Storable++import Data.Number.Flint.Flint+import Data.Number.Flint.Fmpz+import Data.Number.Flint.Fmpz.Mat+import Data.Number.Flint.Fmpq+import Data.Number.Flint.Fmpq.Mat+import Data.Number.Flint.Calcium+import Data.Number.Flint.Calcium.Ca+import Data.Number.Flint.Calcium.Ca.Types++#include <flint/ca_mat.h>++-- ca_mat_t --------------------------------------------------------------------++instance Storable CCaMat where+ {-# INLINE sizeOf #-}+ sizeOf _ = #{size ca_mat_t}+ {-# INLINE alignment #-}+ alignment _ = #{alignment ca_mat_t}+ peek ptr = CCaMat+ <$> #{peek ca_mat_struct, entries} ptr+ <*> #{peek ca_mat_struct, r } ptr+ <*> #{peek ca_mat_struct, c } ptr+ <*> #{peek ca_mat_struct, rows } ptr+ poke = error "CCaMat.poke: Not defined."+ +newCaMat rows cols ctx@(CaCtx fctx) = do+ x <- mallocForeignPtr+ withForeignPtr x $ \xp -> do+ withCaCtx ctx $ \ctxp -> do+ ca_mat_init xp rows cols ctxp+ addForeignPtrFinalizerEnv p_ca_mat_clear xp fctx+ return $ CaMat x+ +{-# INLINE withCaMat #-}+withCaMat (CaMat x) f = do+ withForeignPtr x $ \px -> f px >>= return . (CaMat x,)++{-# INLINE withNewCaMat #-}+withNewCaMat rows cols ctx f = do+ x <- newCaMat rows cols ctx+ withCaMat x f+ +--------------------------------------------------------------------------------++-- | /ca_mat_entry_ptr/ /mat/ /i/ /j/ +--+-- Returns a pointer to the entry at row /i/ and column /j/. Equivalent to+-- @ca_mat_entry@ but implemented as a function.+foreign import ccall "ca_mat.h ca_mat_entry_ptr"+ ca_mat_entry_ptr :: Ptr CCaMat -> CLong -> CLong -> IO (Ptr CCa)++ca_mat_entry = ca_mat_entry_ptr++-- Memory management -----------------------------------------------------------++-- | /ca_mat_init/ /mat/ /r/ /c/ /ctx/ +--+-- Initializes the matrix, setting it to the zero matrix with /r/ rows and+-- /c/ columns.+foreign import ccall "ca_mat.h ca_mat_init"+ ca_mat_init :: Ptr CCaMat -> CLong -> CLong -> Ptr CCaCtx -> IO ()++-- | /ca_mat_clear/ /mat/ /ctx/ +--+-- Clears the matrix, deallocating all entries.+foreign import ccall "ca_mat.h ca_mat_clear"+ ca_mat_clear :: Ptr CCaMat -> Ptr CCaCtx -> IO ()++foreign import ccall "ca_mat.h &ca_mat_clear"+ p_ca_mat_clear :: FunPtr (Ptr CCaMat -> Ptr CCaCtx -> IO ())++-- | /ca_mat_swap/ /mat1/ /mat2/ /ctx/ +--+-- Efficiently swaps /mat1/ and /mat2/.+foreign import ccall "ca_mat.h ca_mat_swap"+ ca_mat_swap :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCaCtx -> IO ()++-- | /ca_mat_window_init/ /window/ /mat/ /r1/ /c1/ /r2/ /c2/ /ctx/ +--+-- Initializes /window/ to a window matrix into the submatrix of /mat/+-- starting at the corner at row /r1/ and column /c1/ (inclusive) and+-- ending at row /r2/ and column /c2/ (exclusive).+foreign import ccall "ca_mat.h ca_mat_window_init"+ ca_mat_window_init :: Ptr CCaMat -> Ptr CCaMat -> CLong -> CLong -> CLong -> CLong -> Ptr CCaCtx -> IO ()++-- | /ca_mat_window_clear/ /window/ /ctx/ +--+-- Frees the window matrix.+foreign import ccall "ca_mat.h ca_mat_window_clear"+ ca_mat_window_clear :: Ptr CCaMat -> Ptr CCaCtx -> IO ()++-- Assignment and conversions --------------------------------------------------++-- | /ca_mat_set/ /dest/ /src/ /ctx/ +foreign import ccall "ca_mat.h ca_mat_set"+ ca_mat_set :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCaCtx -> IO ()+-- | /ca_mat_set_fmpz_mat/ /dest/ /src/ /ctx/ +foreign import ccall "ca_mat.h ca_mat_set_fmpz_mat"+ ca_mat_set_fmpz_mat :: Ptr CCaMat -> Ptr CFmpzMat -> Ptr CCaCtx -> IO ()+-- | /ca_mat_set_fmpq_mat/ /dest/ /src/ /ctx/ +--+-- Sets /dest/ to /src/. The operands must have identical dimensions.+foreign import ccall "ca_mat.h ca_mat_set_fmpq_mat"+ ca_mat_set_fmpq_mat :: Ptr CCaMat -> Ptr CFmpqMat -> Ptr CCaCtx -> IO ()++-- | /ca_mat_set_ca/ /mat/ /c/ /ctx/ +--+-- Sets /mat/ to the matrix with the scalar /c/ on the main diagonal and+-- zeros elsewhere.+foreign import ccall "ca_mat.h ca_mat_set_ca"+ ca_mat_set_ca :: Ptr CCaMat -> Ptr CCa -> Ptr CCaCtx -> IO ()++-- | /ca_mat_transfer/ /res/ /res_ctx/ /src/ /src_ctx/ +--+-- Sets /res/ to /src/ where the corresponding context objects /res_ctx/+-- and /src_ctx/ may be different.+-- +-- This operation preserves the mathematical value represented by /src/,+-- but may result in a different internal representation depending on the+-- settings of the context objects.+foreign import ccall "ca_mat.h ca_mat_transfer"+ ca_mat_transfer :: Ptr CCaMat -> Ptr CCaCtx -> Ptr CCaMat -> Ptr CCaCtx -> IO ()++-- Random generation -----------------------------------------------------------++-- | /ca_mat_randtest/ /mat/ /state/ /depth/ /bits/ /ctx/ +--+-- Sets /mat/ to a random matrix with entries having complexity up to+-- /depth/ and /bits/ (see @ca_randtest@).+foreign import ccall "ca_mat.h ca_mat_randtest"+ ca_mat_randtest :: Ptr CCaMat -> Ptr CFRandState -> CLong -> CLong -> Ptr CCaCtx -> IO ()++-- | /ca_mat_randtest_rational/ /mat/ /state/ /bits/ /ctx/ +--+-- Sets /mat/ to a random rational matrix with entries up to /bits/ bits in+-- size.+foreign import ccall "ca_mat.h ca_mat_randtest_rational"+ ca_mat_randtest_rational :: Ptr CCaMat -> Ptr CFRandState -> CLong -> Ptr CCaCtx -> IO ()++-- | /ca_mat_randops/ /mat/ /state/ /count/ /ctx/ +--+-- Randomizes /mat/ in-place by performing elementary row or column+-- operations. More precisely, at most count random additions or+-- subtractions of distinct rows and columns will be performed. This leaves+-- the rank (and for square matrices, the determinant) unchanged.+foreign import ccall "ca_mat.h ca_mat_randops"+ ca_mat_randops :: Ptr CCaMat -> Ptr CFRandState -> CLong -> Ptr CCaCtx -> IO ()++-- Input and output ------------------------------------------------------------++foreign import ccall "ca_mat.h ca_mat_get_str"+ ca_mat_get_str :: Ptr CCaMat -> Ptr CCaCtx -> IO CString++foreign import ccall "ca_mat.h ca_mat_fprint"+ ca_mat_fprint :: Ptr CFile -> Ptr CCaMat -> Ptr CCaCtx -> IO ()++-- | /ca_mat_print/ /mat/ /ctx/ +--+-- Prints /mat/ to standard output. The entries are printed on separate+-- lines.+ca_mat_print :: Ptr CCaMat -> Ptr CCaCtx -> IO ()+ca_mat_print mat ctx = do+ printCStr (flip ca_mat_get_str ctx) mat+ return ()++-- | /ca_mat_printn/ /mat/ /digits/ /ctx/ +--+-- Prints a decimal representation of /mat/ with precision specified by+-- /digits/. The entries are comma-separated with square brackets and comma+-- separation for the rows.+foreign import ccall "ca_mat.h ca_mat_printn"+ ca_mat_printn :: Ptr CCaMat -> CLong -> Ptr CCaCtx -> IO ()++-- Special matrices ------------------------------------------------------------++-- | /ca_mat_zero/ /mat/ /ctx/ +--+-- Sets all entries in /mat/ to zero.+foreign import ccall "ca_mat.h ca_mat_zero"+ ca_mat_zero :: Ptr CCaMat -> Ptr CCaCtx -> IO ()++-- | /ca_mat_one/ /mat/ /ctx/ +--+-- Sets the entries on the main diagonal of /mat/ to one, and all other+-- entries to zero.+foreign import ccall "ca_mat.h ca_mat_one"+ ca_mat_one :: Ptr CCaMat -> Ptr CCaCtx -> IO ()++-- | /ca_mat_ones/ /mat/ /ctx/ +--+-- Sets all entries in /mat/ to one.+foreign import ccall "ca_mat.h ca_mat_ones"+ ca_mat_ones :: Ptr CCaMat -> Ptr CCaCtx -> IO ()++-- | /ca_mat_pascal/ /mat/ /triangular/ /ctx/ +--+-- Sets /mat/ to a Pascal matrix, whose entries are binomial coefficients.+-- If /triangular/ is 0, constructs a full symmetric matrix with the rows+-- of Pascal\'s triangle as successive antidiagonals. If /triangular/ is 1,+-- constructs the upper triangular matrix with the rows of Pascal\'s+-- triangle as columns, and if /triangular/ is -1, constructs the lower+-- triangular matrix with the rows of Pascal\'s triangle as rows.+foreign import ccall "ca_mat.h ca_mat_pascal"+ ca_mat_pascal :: Ptr CCaMat -> CInt -> Ptr CCaCtx -> IO ()++-- | /ca_mat_stirling/ /mat/ /kind/ /ctx/ +--+-- Sets /mat/ to a Stirling matrix, whose entries are Stirling numbers. If+-- /kind/ is 0, the entries are set to the unsigned Stirling numbers of the+-- first kind. If /kind/ is 1, the entries are set to the signed Stirling+-- numbers of the first kind. If /kind/ is 2, the entries are set to the+-- Stirling numbers of the second kind.+foreign import ccall "ca_mat.h ca_mat_stirling"+ ca_mat_stirling :: Ptr CCaMat -> CInt -> Ptr CCaCtx -> IO ()++-- | /ca_mat_hilbert/ /mat/ /ctx/ +--+-- Sets /mat/ to the Hilbert matrix, which has entries+-- \(A_{i,j} = 1/(i+j+1)\).+foreign import ccall "ca_mat.h ca_mat_hilbert"+ ca_mat_hilbert :: Ptr CCaMat -> Ptr CCaCtx -> IO ()++-- | /ca_mat_dft/ /mat/ /type/ /ctx/ +--+-- Sets /mat/ to the DFT (discrete Fourier transform) matrix of order /n/+-- where /n/ is the smallest dimension of /mat/ (if /mat/ is not square,+-- the matrix is extended periodically along the larger dimension). The+-- /type/ parameter selects between four different versions of the DFT+-- matrix (in which \(\omega = e^{2\pi i/n}\)):+-- +-- - Type 0 -- entries \(A_{j,k} = \omega^{-jk}\)+-- - Type 1 -- entries \(A_{j,k} = \omega^{jk} / n\)+-- - Type 2 -- entries \(A_{j,k} = \omega^{-jk} / \sqrt{n}\)+-- - Type 3 -- entries \(A_{j,k} = \omega^{jk} / \sqrt{n}\)+-- +-- The type 0 and 1 matrices are inverse pairs, and similarly for the type+-- 2 and 3 matrices.+foreign import ccall "ca_mat.h ca_mat_dft"+ ca_mat_dft :: Ptr CCaMat -> CInt -> Ptr CCaCtx -> IO ()++-- Comparisons and properties --------------------------------------------------++-- | /ca_mat_check_equal/ /A/ /B/ /ctx/ +--+-- Compares /A/ and /B/ for equality.+foreign import ccall "ca_mat.h ca_mat_check_equal"+ ca_mat_check_equal :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCaCtx -> IO (Ptr CTruth)++-- | /ca_mat_check_is_zero/ /A/ /ctx/ +--+-- Tests if /A/ is the zero matrix.+foreign import ccall "ca_mat.h ca_mat_check_is_zero"+ ca_mat_check_is_zero :: Ptr CCaMat -> Ptr CCaCtx -> IO (Ptr CTruth)++-- | /ca_mat_check_is_one/ /A/ /ctx/ +--+-- Tests if /A/ has ones on the main diagonal and zeros elsewhere.+foreign import ccall "ca_mat.h ca_mat_check_is_one"+ ca_mat_check_is_one :: Ptr CCaMat -> Ptr CCaCtx -> IO (Ptr CTruth)++-- Conjugate and transpose -----------------------------------------------------++-- | /ca_mat_transpose/ /res/ /A/ /ctx/ +--+-- Sets /res/ to the transpose of /A/.+foreign import ccall "ca_mat.h ca_mat_transpose"+ ca_mat_transpose :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCaCtx -> IO ()++-- | /ca_mat_conj/ /res/ /A/ /ctx/ +--+-- Sets /res/ to the entrywise complex conjugate of /A/.+foreign import ccall "ca_mat.h ca_mat_conj"+ ca_mat_conj :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCaCtx -> IO ()++-- | /ca_mat_conj_transpose/ /res/ /A/ /ctx/ +--+-- Sets /res/ to the conjugate transpose (Hermitian transpose) of /A/.+foreign import ccall "ca_mat.h ca_mat_conj_transpose"+ ca_mat_conj_transpose :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCaCtx -> IO ()++-- Arithmetic ------------------------------------------------------------------++-- | /ca_mat_neg/ /res/ /A/ /ctx/ +--+-- Sets /res/ to the negation of /A/.+foreign import ccall "ca_mat.h ca_mat_neg"+ ca_mat_neg :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCaCtx -> IO ()++-- | /ca_mat_add/ /res/ /A/ /B/ /ctx/ +--+-- Sets /res/ to the sum of /A/ and /B/.+foreign import ccall "ca_mat.h ca_mat_add"+ ca_mat_add :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCaMat -> Ptr CCaCtx -> IO ()++-- | /ca_mat_sub/ /res/ /A/ /B/ /ctx/ +--+-- Sets /res/ to the difference of /A/ and /B/.+foreign import ccall "ca_mat.h ca_mat_sub"+ ca_mat_sub :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCaMat -> Ptr CCaCtx -> IO ()++-- | /ca_mat_mul_classical/ /res/ /A/ /B/ /ctx/ +foreign import ccall "ca_mat.h ca_mat_mul_classical"+ ca_mat_mul_classical :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCaMat -> Ptr CCaCtx -> IO ()+-- | /ca_mat_mul_same_nf/ /res/ /A/ /B/ /K/ /ctx/ +foreign import ccall "ca_mat.h ca_mat_mul_same_nf"+ ca_mat_mul_same_nf :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCaMat -> Ptr CCaField -> Ptr CCaCtx -> IO ()+-- | /ca_mat_mul/ /res/ /A/ /B/ /ctx/ +--+-- Sets /res/ to the matrix product of /A/ and /B/. The /classical/ version+-- uses classical multiplication. The /same_nf/ version assumes (not+-- checked) that both /A/ and /B/ have coefficients in the same simple+-- algebraic number field /K/ or in \(\mathbb{Q}\). The default version+-- chooses an algorithm automatically.+foreign import ccall "ca_mat.h ca_mat_mul"+ ca_mat_mul :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCaMat -> Ptr CCaCtx -> IO ()++-- | /ca_mat_mul_si/ /B/ /A/ /c/ /ctx/ +foreign import ccall "ca_mat.h ca_mat_mul_si"+ ca_mat_mul_si :: Ptr CCaMat -> Ptr CCaMat -> CLong -> Ptr CCaCtx -> IO ()+-- | /ca_mat_mul_fmpz/ /B/ /A/ /c/ /ctx/ +foreign import ccall "ca_mat.h ca_mat_mul_fmpz"+ ca_mat_mul_fmpz :: Ptr CCaMat -> Ptr CCaMat -> Ptr CFmpz -> Ptr CCaCtx -> IO ()+-- | /ca_mat_mul_fmpq/ /B/ /A/ /c/ /ctx/ +foreign import ccall "ca_mat.h ca_mat_mul_fmpq"+ ca_mat_mul_fmpq :: Ptr CCaMat -> Ptr CCaMat -> Ptr CFmpq -> Ptr CCaCtx -> IO ()+-- | /ca_mat_mul_ca/ /B/ /A/ /c/ /ctx/ +--+-- Sets /B/ to /A/ multiplied by the scalar /c/.+foreign import ccall "ca_mat.h ca_mat_mul_ca"+ ca_mat_mul_ca :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCa -> Ptr CCaCtx -> IO ()++-- | /ca_mat_div_si/ /B/ /A/ /c/ /ctx/ +foreign import ccall "ca_mat.h ca_mat_div_si"+ ca_mat_div_si :: Ptr CCaMat -> Ptr CCaMat -> CLong -> Ptr CCaCtx -> IO ()+-- | /ca_mat_div_fmpz/ /B/ /A/ /c/ /ctx/ +foreign import ccall "ca_mat.h ca_mat_div_fmpz"+ ca_mat_div_fmpz :: Ptr CCaMat -> Ptr CCaMat -> Ptr CFmpz -> Ptr CCaCtx -> IO ()+-- | /ca_mat_div_fmpq/ /B/ /A/ /c/ /ctx/ +foreign import ccall "ca_mat.h ca_mat_div_fmpq"+ ca_mat_div_fmpq :: Ptr CCaMat -> Ptr CCaMat -> Ptr CFmpq -> Ptr CCaCtx -> IO ()+-- | /ca_mat_div_ca/ /B/ /A/ /c/ /ctx/ +--+-- Sets /B/ to /A/ divided by the scalar /c/.+foreign import ccall "ca_mat.h ca_mat_div_ca"+ ca_mat_div_ca :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCa -> Ptr CCaCtx -> IO ()++-- | /ca_mat_add_ca/ /B/ /A/ /c/ /ctx/ +foreign import ccall "ca_mat.h ca_mat_add_ca"+ ca_mat_add_ca :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCa -> Ptr CCaCtx -> IO ()+-- | /ca_mat_sub_ca/ /B/ /A/ /c/ /ctx/ +--+-- Sets /B/ to /A/ plus or minus the scalar /c/ (interpreted as a diagonal+-- matrix).+foreign import ccall "ca_mat.h ca_mat_sub_ca"+ ca_mat_sub_ca :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCa -> Ptr CCaCtx -> IO ()++-- | /ca_mat_addmul_ca/ /B/ /A/ /c/ /ctx/ +foreign import ccall "ca_mat.h ca_mat_addmul_ca"+ ca_mat_addmul_ca :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCa -> Ptr CCaCtx -> IO ()+-- | /ca_mat_submul_ca/ /B/ /A/ /c/ /ctx/ +--+-- Sets the matrix /B/ to /B/ plus (or minus) the matrix /A/ multiplied by+-- the scalar /c/.+foreign import ccall "ca_mat.h ca_mat_submul_ca"+ ca_mat_submul_ca :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCa -> Ptr CCaCtx -> IO ()++-- Powers ----------------------------------------------------------------------++-- | /ca_mat_sqr/ /B/ /A/ /ctx/ +--+-- Sets /B/ to the square of /A/.+foreign import ccall "ca_mat.h ca_mat_sqr"+ ca_mat_sqr :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCaCtx -> IO ()++-- | /ca_mat_pow_ui_binexp/ /B/ /A/ /exp/ /ctx/ +--+-- Sets /B/ to /A/ raised to the power /exp/, evaluated using binary+-- exponentiation.+foreign import ccall "ca_mat.h ca_mat_pow_ui_binexp"+ ca_mat_pow_ui_binexp :: Ptr CCaMat -> Ptr CCaMat -> CULong -> Ptr CCaCtx -> IO ()++-- Polynomial evaluation -------------------------------------------------------++-- | /_ca_mat_ca_poly_evaluate/ /res/ /poly/ /len/ /A/ /ctx/ +foreign import ccall "ca_mat.h _ca_mat_ca_poly_evaluate"+ _ca_mat_ca_poly_evaluate :: Ptr CCaMat -> Ptr CCa -> CLong -> Ptr CCaMat -> Ptr CCaCtx -> IO ()+-- | /ca_mat_ca_poly_evaluate/ /res/ /poly/ /A/ /ctx/ +--+-- Sets /res/ to \(f(A)\) where /f/ is the polynomial given by /poly/ and+-- /A/ is a square matrix. Uses the Paterson-Stockmeyer algorithm.+foreign import ccall "ca_mat.h ca_mat_ca_poly_evaluate"+ ca_mat_ca_poly_evaluate :: Ptr CCaMat -> Ptr CCaPoly -> Ptr CCaMat -> Ptr CCaCtx -> IO ()++-- Gaussian elimination and LU decomposition -----------------------------------++-- | /ca_mat_find_pivot/ /pivot_row/ /mat/ /start_row/ /end_row/ /column/ /ctx/ +--+-- Attempts to find a nonzero entry in /mat/ with column index /column/ and+-- row index between /start_row/ (inclusive) and /end_row/ (exclusive).+-- +-- If the return value is @T_TRUE@, such an element exists, and /pivot_row/+-- is set to the row index. If the return value is @T_FALSE@, no such+-- element exists (all entries in this part of the column are zero). If the+-- return value is @T_UNKNOWN@, it is unknown whether such an element+-- exists (zero certification failed).+-- +-- This function is destructive: any elements that are nontrivially zero+-- but can be certified zero will be overwritten by exact zeros.+foreign import ccall "ca_mat.h ca_mat_find_pivot"+ ca_mat_find_pivot :: Ptr CLong -> Ptr CCaMat -> CLong -> CLong -> CLong -> Ptr CCaCtx -> IO (Ptr CTruth)++-- | /ca_mat_lu_classical/ /rank/ /P/ /LU/ /A/ /rank_check/ /ctx/ +foreign import ccall "ca_mat.h ca_mat_lu_classical"+ ca_mat_lu_classical :: Ptr CLong -> Ptr CLong -> Ptr CCaMat -> Ptr CCaMat -> CInt -> Ptr CCaCtx -> IO CInt+-- | /ca_mat_lu_recursive/ /rank/ /P/ /LU/ /A/ /rank_check/ /ctx/ +foreign import ccall "ca_mat.h ca_mat_lu_recursive"+ ca_mat_lu_recursive :: Ptr CLong -> Ptr CLong -> Ptr CCaMat -> Ptr CCaMat -> CInt -> Ptr CCaCtx -> IO CInt+-- | /ca_mat_lu/ /rank/ /P/ /LU/ /A/ /rank_check/ /ctx/ +--+-- Computes a generalized LU decomposition \(A = PLU\) of a given matrix+-- /A/, writing the rank of /A/ to /rank/.+-- +-- If /A/ is a nonsingular square matrix, /LU/ will be set to a unit+-- diagonal lower triangular matrix /L/ and an upper triangular matrix /U/+-- (the diagonal of /L/ will not be stored explicitly).+-- +-- If /A/ is an arbitrary matrix of rank /r/, /U/ will be in row echelon+-- form having /r/ nonzero rows, and /L/ will be lower triangular but+-- truncated to /r/ columns, having implicit ones on the /r/ first entries+-- of the main diagonal. All other entries will be zero.+-- +-- If a nonzero value for @rank_check@ is passed, the function will abandon+-- the output matrix in an undefined state and set the rank to 0 if /A/ is+-- detected to be rank-deficient.+-- +-- The algorithm can fail if it fails to certify that a pivot element is+-- zero or nonzero, in which case the correct rank cannot be determined.+-- The return value is 1 on success and 0 on failure. On failure, the data+-- in the output variables @rank@, @P@ and @LU@ will be meaningless.+-- +-- The /classical/ version uses iterative Gaussian elimination. The+-- /recursive/ version uses a block recursive algorithm to take advantage+-- of fast matrix multiplication.+foreign import ccall "ca_mat.h ca_mat_lu"+ ca_mat_lu :: Ptr CLong -> Ptr CLong -> Ptr CCaMat -> Ptr CCaMat -> CInt -> Ptr CCaCtx -> IO CInt++-- | /ca_mat_fflu/ /rank/ /P/ /LU/ /den/ /A/ /rank_check/ /ctx/ +--+-- Similar to @ca_mat_lu@, but computes a fraction-free LU decomposition+-- using the Bareiss algorithm. The denominator is written to /den/. Note+-- that despite being \"fraction-free\", this algorithm may introduce+-- fractions due to incomplete symbolic simplifications.+foreign import ccall "ca_mat.h ca_mat_fflu"+ ca_mat_fflu :: Ptr CLong -> Ptr CLong -> Ptr CCaMat -> Ptr CCa -> Ptr CCaMat -> CInt -> Ptr CCaCtx -> IO CInt++-- | /ca_mat_nonsingular_lu/ /P/ /LU/ /A/ /ctx/ +--+-- Wrapper for @ca_mat_lu@. If /A/ can be proved to be+-- invertible\/nonsingular, returns @T_TRUE@ and sets /P/ and /LU/ to a LU+-- decomposition \(A = PLU\). If /A/ can be proved to be singular, returns+-- @T_FALSE@. If /A/ cannot be proved to be either singular or nonsingular,+-- returns @T_UNKNOWN@. When the return value is @T_FALSE@ or @T_UNKNOWN@,+-- the LU factorization is not completed and the values of /P/ and /LU/ are+-- arbitrary.+foreign import ccall "ca_mat.h ca_mat_nonsingular_lu"+ ca_mat_nonsingular_lu :: Ptr CLong -> Ptr CCaMat -> Ptr CCaMat -> Ptr CCaCtx -> IO (Ptr CTruth)++-- | /ca_mat_nonsingular_fflu/ /P/ /LU/ /den/ /A/ /ctx/ +--+-- Wrapper for @ca_mat_fflu@. Similar to @ca_mat_nonsingular_lu@, but+-- computes a fraction-free LU decomposition using the Bareiss algorithm.+-- The denominator is written to /den/. Note that despite being+-- \"fraction-free\", this algorithm may introduce fractions due to+-- incomplete symbolic simplifications.+foreign import ccall "ca_mat.h ca_mat_nonsingular_fflu"+ ca_mat_nonsingular_fflu :: Ptr CLong -> Ptr CCaMat -> Ptr CCa -> Ptr CCaMat -> Ptr CCaCtx -> IO (Ptr CTruth)++-- Solving and inverse ---------------------------------------------------------++-- | /ca_mat_inv/ /X/ /A/ /ctx/ +--+-- Determines if the square matrix /A/ is nonsingular, and if successful,+-- sets \(X = A^{-1}\) and returns @T_TRUE@. Returns @T_FALSE@ if /A/ is+-- singular, and @T_UNKNOWN@ if the rank of /A/ cannot be determined.+foreign import ccall "ca_mat.h ca_mat_inv"+ ca_mat_inv :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCaCtx -> IO (Ptr CTruth)++-- | /ca_mat_nonsingular_solve_adjugate/ /X/ /A/ /B/ /ctx/ +foreign import ccall "ca_mat.h ca_mat_nonsingular_solve_adjugate"+ ca_mat_nonsingular_solve_adjugate :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCaMat -> Ptr CCaCtx -> IO (Ptr CTruth)+-- | /ca_mat_nonsingular_solve_fflu/ /X/ /A/ /B/ /ctx/ +foreign import ccall "ca_mat.h ca_mat_nonsingular_solve_fflu"+ ca_mat_nonsingular_solve_fflu :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCaMat -> Ptr CCaCtx -> IO (Ptr CTruth)+-- | /ca_mat_nonsingular_solve_lu/ /X/ /A/ /B/ /ctx/ +foreign import ccall "ca_mat.h ca_mat_nonsingular_solve_lu"+ ca_mat_nonsingular_solve_lu :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCaMat -> Ptr CCaCtx -> IO (Ptr CTruth)+-- | /ca_mat_nonsingular_solve/ /X/ /A/ /B/ /ctx/ +--+-- Determines if the square matrix /A/ is nonsingular, and if successful,+-- solves \(AX = B\) and returns @T_TRUE@. Returns @T_FALSE@ if /A/ is+-- singular, and @T_UNKNOWN@ if the rank of /A/ cannot be determined.+foreign import ccall "ca_mat.h ca_mat_nonsingular_solve"+ ca_mat_nonsingular_solve :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCaMat -> Ptr CCaCtx -> IO (Ptr CTruth)++-- | /ca_mat_solve_tril_classical/ /X/ /L/ /B/ /unit/ /ctx/ +foreign import ccall "ca_mat.h ca_mat_solve_tril_classical"+ ca_mat_solve_tril_classical :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCaMat -> CInt -> Ptr CCaCtx -> IO ()+-- | /ca_mat_solve_tril_recursive/ /X/ /L/ /B/ /unit/ /ctx/ +foreign import ccall "ca_mat.h ca_mat_solve_tril_recursive"+ ca_mat_solve_tril_recursive :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCaMat -> CInt -> Ptr CCaCtx -> IO ()+-- | /ca_mat_solve_tril/ /X/ /L/ /B/ /unit/ /ctx/ +foreign import ccall "ca_mat.h ca_mat_solve_tril"+ ca_mat_solve_tril :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCaMat -> CInt -> Ptr CCaCtx -> IO ()+-- | /ca_mat_solve_triu_classical/ /X/ /U/ /B/ /unit/ /ctx/ +foreign import ccall "ca_mat.h ca_mat_solve_triu_classical"+ ca_mat_solve_triu_classical :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCaMat -> CInt -> Ptr CCaCtx -> IO ()+-- | /ca_mat_solve_triu_recursive/ /X/ /U/ /B/ /unit/ /ctx/ +foreign import ccall "ca_mat.h ca_mat_solve_triu_recursive"+ ca_mat_solve_triu_recursive :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCaMat -> CInt -> Ptr CCaCtx -> IO ()+-- | /ca_mat_solve_triu/ /X/ /U/ /B/ /unit/ /ctx/ +--+-- Solves the lower triangular system \(LX = B\) or the upper triangular+-- system \(UX = B\), respectively. It is assumed (not checked) that the+-- diagonal entries are nonzero. If /unit/ is set, the main diagonal of /L/+-- or /U/ is taken to consist of all ones, and in that case the actual+-- entries on the diagonal are not read at all and can contain other data.+-- +-- The /classical/ versions perform the computations iteratively while the+-- /recursive/ versions perform the computations in a block recursive way+-- to benefit from fast matrix multiplication. The default versions choose+-- an algorithm automatically.+foreign import ccall "ca_mat.h ca_mat_solve_triu"+ ca_mat_solve_triu :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCaMat -> CInt -> Ptr CCaCtx -> IO ()++-- | /ca_mat_solve_fflu_precomp/ /X/ /perm/ /A/ /den/ /B/ /ctx/ +foreign import ccall "ca_mat.h ca_mat_solve_fflu_precomp"+ ca_mat_solve_fflu_precomp :: Ptr CCaMat -> Ptr CLong -> Ptr CCaMat -> Ptr CCa -> Ptr CCaMat -> Ptr CCaCtx -> IO ()+-- | /ca_mat_solve_lu_precomp/ /X/ /P/ /LU/ /B/ /ctx/ +--+-- Solves \(AX = B\) given the precomputed nonsingular LU decomposition+-- \(A = PLU\) or fraction-free LU decomposition with denominator /den/.+-- The matrices \(X\) and \(B\) are allowed to be aliased with each other,+-- but \(X\) is not allowed to be aliased with \(LU\).+foreign import ccall "ca_mat.h ca_mat_solve_lu_precomp"+ ca_mat_solve_lu_precomp :: Ptr CCaMat -> Ptr CLong -> Ptr CCaMat -> Ptr CCaMat -> Ptr CCaCtx -> IO ()++-- Rank and echelon form -------------------------------------------------------++-- | /ca_mat_rank/ /rank/ /A/ /ctx/ +--+-- Computes the rank of the matrix /A/. If successful, returns 1 and writes+-- the rank to @rank@. If unsuccessful, returns 0.+foreign import ccall "ca_mat.h ca_mat_rank"+ ca_mat_rank :: Ptr CLong -> Ptr CCaMat -> Ptr CCaCtx -> IO CInt++-- | /ca_mat_rref_fflu/ /rank/ /R/ /A/ /ctx/ +foreign import ccall "ca_mat.h ca_mat_rref_fflu"+ ca_mat_rref_fflu :: Ptr CLong -> Ptr CCaMat -> Ptr CCaMat -> Ptr CCaCtx -> IO CInt+-- | /ca_mat_rref_lu/ /rank/ /R/ /A/ /ctx/ +foreign import ccall "ca_mat.h ca_mat_rref_lu"+ ca_mat_rref_lu :: Ptr CLong -> Ptr CCaMat -> Ptr CCaMat -> Ptr CCaCtx -> IO CInt+-- | /ca_mat_rref/ /rank/ /R/ /A/ /ctx/ +--+-- Computes the reduced row echelon form (rref) of a given matrix. On+-- success, sets /R/ to the rref of /A/, writes the rank to /rank/, and+-- returns 1. On failure to certify the correct rank, returns 0, leaving+-- the data in /rank/ and /R/ meaningless.+-- +-- The /fflu/ version computes a fraction-free LU decomposition and then+-- converts the output ro rref form. The /lu/ version computes a regular LU+-- decomposition and then converts the output to rref form. The default+-- version uses an automatic algorithm choice and may implement additional+-- methods for special cases.+foreign import ccall "ca_mat.h ca_mat_rref"+ ca_mat_rref :: Ptr CLong -> Ptr CCaMat -> Ptr CCaMat -> Ptr CCaCtx -> IO CInt++-- | /ca_mat_right_kernel/ /X/ /A/ /ctx/ +--+-- Sets /X/ to a basis of the right kernel (nullspace) of /A/. The output+-- matrix /X/ will be resized in-place to have a number of columns equal to+-- the nullity of /A/. Returns 1 on success. On failure, returns 0 and+-- leaves the data in /X/ meaningless.+foreign import ccall "ca_mat.h ca_mat_right_kernel"+ ca_mat_right_kernel :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCaCtx -> IO CInt++-- Determinant and trace -------------------------------------------------------++-- | /ca_mat_trace/ /trace/ /mat/ /ctx/ +--+-- Sets /trace/ to the sum of the entries on the main diagonal of /mat/.+foreign import ccall "ca_mat.h ca_mat_trace"+ ca_mat_trace :: Ptr CCa -> Ptr CCaMat -> Ptr CCaCtx -> IO ()++-- | /ca_mat_det_berkowitz/ /det/ /A/ /ctx/ +foreign import ccall "ca_mat.h ca_mat_det_berkowitz"+ ca_mat_det_berkowitz :: Ptr CCa -> Ptr CCaMat -> Ptr CCaCtx -> IO ()+-- | /ca_mat_det_lu/ /det/ /A/ /ctx/ +foreign import ccall "ca_mat.h ca_mat_det_lu"+ ca_mat_det_lu :: Ptr CCa -> Ptr CCaMat -> Ptr CCaCtx -> IO CInt+-- | /ca_mat_det_bareiss/ /det/ /A/ /ctx/ +foreign import ccall "ca_mat.h ca_mat_det_bareiss"+ ca_mat_det_bareiss :: Ptr CCa -> Ptr CCaMat -> Ptr CCaCtx -> IO CInt+-- | /ca_mat_det_cofactor/ /det/ /A/ /ctx/ +foreign import ccall "ca_mat.h ca_mat_det_cofactor"+ ca_mat_det_cofactor :: Ptr CCa -> Ptr CCaMat -> Ptr CCaCtx -> IO ()+-- | /ca_mat_det/ /det/ /A/ /ctx/ +--+-- Sets /det/ to the determinant of the square matrix /A/. Various+-- algorithms are available:+-- +-- - The /berkowitz/ version uses the division-free Berkowitz algorithm+-- performing \(O(n^4)\) operations. Since no zero tests are required,+-- it is guaranteed to succeed.+-- - The /cofactor/ version performs cofactor expansion. This is+-- currently only supported for matrices up to size 4.+-- - The /lu/ and /bareiss/ versions use rational LU decomposition and+-- fraction-free LU decomposition (Bareiss algorithm) respectively,+-- requiring \(O(n^3)\) operations. These algorithms can fail if zero+-- certification fails (see @ca_mat_nonsingular_lu@); they return 1 for+-- success and 0 for failure. Note that the Bareiss algorithm, despite+-- being \"fraction-free\", may introduce fractions due to incomplete+-- symbolic simplifications.+-- +-- The default function chooses an algorithm automatically. It will, in+-- addition, recognize trivially rational and integer matrices and evaluate+-- those determinants using @fmpq_mat_t@ or @fmpz_mat_t@.+-- +-- The various algorithms can produce different symbolic forms of the same+-- determinant. Which algorithm performs better depends strongly and+-- sometimes unpredictably on the structure of the matrix.+foreign import ccall "ca_mat.h ca_mat_det"+ ca_mat_det :: Ptr CCa -> Ptr CCaMat -> Ptr CCaCtx -> IO ()++-- | /ca_mat_adjugate_cofactor/ /adj/ /det/ /A/ /ctx/ +foreign import ccall "ca_mat.h ca_mat_adjugate_cofactor"+ ca_mat_adjugate_cofactor :: Ptr CCaMat -> Ptr CCa -> Ptr CCaMat -> Ptr CCaCtx -> IO ()+-- | /ca_mat_adjugate_charpoly/ /adj/ /det/ /A/ /ctx/ +foreign import ccall "ca_mat.h ca_mat_adjugate_charpoly"+ ca_mat_adjugate_charpoly :: Ptr CCaMat -> Ptr CCa -> Ptr CCaMat -> Ptr CCaCtx -> IO ()+-- | /ca_mat_adjugate/ /adj/ /det/ /A/ /ctx/ +--+-- Sets /adj/ to the adjuate matrix of /A/ and /det/ to the determinant of+-- /A/, both computed simultaneously. The /cofactor/ version uses cofactor+-- expansion. The /charpoly/ version computes and evaluates the+-- characteristic polynomial. The default version uses an automatic+-- algorithm choice.+foreign import ccall "ca_mat.h ca_mat_adjugate"+ ca_mat_adjugate :: Ptr CCaMat -> Ptr CCa -> Ptr CCaMat -> Ptr CCaCtx -> IO ()++-- Characteristic polynomial ---------------------------------------------------++-- | /_ca_mat_charpoly_berkowitz/ /cp/ /mat/ /ctx/ +foreign import ccall "ca_mat.h _ca_mat_charpoly_berkowitz"+ _ca_mat_charpoly_berkowitz :: Ptr CCa -> Ptr CCaMat -> Ptr CCaCtx -> IO ()+-- | /ca_mat_charpoly_berkowitz/ /cp/ /mat/ /ctx/ +foreign import ccall "ca_mat.h ca_mat_charpoly_berkowitz"+ ca_mat_charpoly_berkowitz :: Ptr CCaPoly -> Ptr CCaMat -> Ptr CCaCtx -> IO ()+-- | /_ca_mat_charpoly_danilevsky/ /cp/ /mat/ /ctx/ +foreign import ccall "ca_mat.h _ca_mat_charpoly_danilevsky"+ _ca_mat_charpoly_danilevsky :: Ptr CCa -> Ptr CCaMat -> Ptr CCaCtx -> IO CInt+-- | /ca_mat_charpoly_danilevsky/ /cp/ /mat/ /ctx/ +foreign import ccall "ca_mat.h ca_mat_charpoly_danilevsky"+ ca_mat_charpoly_danilevsky :: Ptr CCaPoly -> Ptr CCaMat -> Ptr CCaCtx -> IO CInt+-- | /_ca_mat_charpoly/ /cp/ /mat/ /ctx/ +foreign import ccall "ca_mat.h _ca_mat_charpoly"+ _ca_mat_charpoly :: Ptr CCa -> Ptr CCaMat -> Ptr CCaCtx -> IO ()+-- | /ca_mat_charpoly/ /cp/ /mat/ /ctx/ +--+-- Sets /poly/ to the characteristic polynomial of /mat/ which must be a+-- square matrix. If the matrix has /n/ rows, the underscore method+-- requires space for \(n + 1\) output coefficients.+-- +-- The /berkowitz/ version uses a division-free algorithm requiring+-- \(O(n^4)\) operations. The /danilevsky/ version only performs \(O(n^3)\)+-- operations, but performs divisions and needs to check for zero which can+-- fail. This version returns 1 on success and 0 on failure. The default+-- version chooses an algorithm automatically.+foreign import ccall "ca_mat.h ca_mat_charpoly"+ ca_mat_charpoly :: Ptr CCaPoly -> Ptr CCaMat -> Ptr CCaCtx -> IO ()++-- | /ca_mat_companion/ /mat/ /poly/ /ctx/ +--+-- Sets /mat/ to the companion matrix of /poly/. This function verifies+-- that the leading coefficient of /poly/ is provably nonzero and that the+-- output matrix has the right size, returning 1 on success. It returns 0+-- if the leading coefficient of /poly/ cannot be proved nonzero or if the+-- size of the output matrix does not match.+foreign import ccall "ca_mat.h ca_mat_companion"+ ca_mat_companion :: Ptr CCaMat -> Ptr CCaPoly -> Ptr CCaCtx -> IO CInt++-- Eigenvalues and eigenvectors ------------------------------------------------++-- | /ca_mat_eigenvalues/ /lambda/ /exp/ /mat/ /ctx/ +--+-- Attempts to compute all complex eigenvalues of the given matrix /mat/.+-- On success, returns 1 and sets /lambda/ to the distinct eigenvalues with+-- corresponding multiplicities in /exp/. The eigenvalues are returned in+-- arbitrary order. On failure, returns 0 and leaves the values in /lambda/+-- and /exp/ arbitrary.+-- +-- This function effectively computes the characteristic polynomial and+-- then calls @ca_poly_roots@.+foreign import ccall "ca_mat.h ca_mat_eigenvalues"+ ca_mat_eigenvalues :: Ptr CCaVec -> Ptr CULong -> Ptr CCaMat -> Ptr CCaCtx -> IO CInt++-- | /ca_mat_diagonalization/ /D/ /P/ /A/ /ctx/ +--+-- Matrix diagonalization: attempts to compute a diagonal matrix /D/ and an+-- invertible matrix /P/ such that \(A = PDP^{-1}\). Returns @T_TRUE@ if+-- /A/ is diagonalizable and the computation succeeds, @T_FALSE@ if /A/ is+-- provably not diagonalizable, and @T_UNKNOWN@ if it is unknown whether+-- /A/ is diagonalizable. If the return value is not @T_TRUE@, the values+-- in /D/ and /P/ are arbitrary.+foreign import ccall "ca_mat.h ca_mat_diagonalization"+ ca_mat_diagonalization :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCaMat -> Ptr CCaCtx -> IO (Ptr CTruth)++-- Jordan canonical form -------------------------------------------------------++-- | /ca_mat_jordan_blocks/ /lambda/ /num_blocks/ /block_lambda/ /block_size/ /A/ /ctx/ +--+-- Computes the blocks of the Jordan canonical form of /A/. On success,+-- returns 1 and sets /lambda/ to the unique eigenvalues of /A/, sets+-- /num_blocks/ to the number of Jordan blocks, entry /i/ of /block_lambda/+-- to the index of the eigenvalue in Jordan block /i/, and entry /i/ of+-- /block_size/ to the size of Jordan block /i/. On failure, returns 0,+-- leaving arbitrary values in the output variables. The user should+-- allocate space in /block_lambda/ and /block_size/ for up to /n/ entries+-- where /n/ is the size of the matrix.+-- +-- The Jordan form is unique up to the ordering of blocks, which is+-- arbitrary.+foreign import ccall "ca_mat.h ca_mat_jordan_blocks"+ ca_mat_jordan_blocks :: Ptr CCaVec -> Ptr CLong -> Ptr CLong -> Ptr CLong -> Ptr CCaMat -> Ptr CCaCtx -> IO CInt++-- | /ca_mat_set_jordan_blocks/ /mat/ /lambda/ /num_blocks/ /block_lambda/ /block_size/ /ctx/ +--+-- Sets /mat/ to the concatenation of the Jordan blocks given in /lambda/,+-- /num_blocks/, /block_lambda/ and /block_size/. See+-- @ca_mat_jordan_blocks@ for an explanation of these variables.+foreign import ccall "ca_mat.h ca_mat_set_jordan_blocks"+ ca_mat_set_jordan_blocks :: Ptr CCaMat -> Ptr CCaVec -> CLong -> Ptr CLong -> Ptr CLong -> Ptr CCaCtx -> IO ()++-- | /ca_mat_jordan_transformation/ /mat/ /lambda/ /num_blocks/ /block_lambda/ /block_size/ /A/ /ctx/ +--+-- Given the precomputed Jordan block decomposition (/lambda/,+-- /num_blocks/, /block_lambda/, /block_size/) of the square matrix /A/,+-- computes the corresponding transformation matrix /P/ such that+-- \(A = P J P^{-1}\). On success, writes /P/ to /mat/ and returns 1. On+-- failure, returns 0, leaving the value of /mat/ arbitrary.+foreign import ccall "ca_mat.h ca_mat_jordan_transformation"+ ca_mat_jordan_transformation :: Ptr CCaMat -> Ptr CCaVec -> CLong -> Ptr CLong -> Ptr CLong -> Ptr CCaMat -> Ptr CCaCtx -> IO CInt++-- | /ca_mat_jordan_form/ /J/ /P/ /A/ /ctx/ +--+-- Computes the Jordan decomposition \(A = P J P^{-1}\) of the given square+-- matrix /A/. The user can pass /NULL/ for the output variable /P/, in+-- which case only /J/ is computed. On success, returns 1. On failure,+-- returns 0, leaving the values of /J/ and /P/ arbitrary.+-- +-- This function is a convenience wrapper around @ca_mat_jordan_blocks@,+-- @ca_mat_set_jordan_blocks@ and @ca_mat_jordan_transformation@. For+-- computations with the Jordan decomposition, it is often better to use+-- those methods directly since they give direct access to the spectrum and+-- block structure.+foreign import ccall "ca_mat.h ca_mat_jordan_form"+ ca_mat_jordan_form :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCaMat -> Ptr CCaCtx -> IO CInt++-- Matrix functions ------------------------------------------------------------++-- | /ca_mat_exp/ /res/ /A/ /ctx/ +--+-- Matrix exponential: given a square matrix /A/, sets /res/ to \(e^A\) and+-- returns 1 on success. If unsuccessful, returns 0, leaving the values in+-- /res/ arbitrary.+-- +-- This function uses Jordan decomposition. The matrix exponential always+-- exists, but computation can fail if computing the Jordan decomposition+-- fails.+foreign import ccall "ca_mat.h ca_mat_exp"+ ca_mat_exp :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCaCtx -> IO CInt++-- | /ca_mat_log/ /res/ /A/ /ctx/ +--+-- Matrix logarithm: given a square matrix /A/, sets /res/ to a logarithm+-- \(\log(A)\) and returns @T_TRUE@ on success. If /A/ can be proved to+-- have no logarithm, returns @T_FALSE@. If the existence of a logarithm+-- cannot be proved, returns @T_UNKNOWN@.+-- +-- This function uses the Jordan decomposition, and the branch of the+-- matrix logarithm is defined by taking the principal values of the+-- logarithms of all eigenvalues.+foreign import ccall "ca_mat.h ca_mat_log"+ ca_mat_log :: Ptr CCaMat -> Ptr CCaMat -> Ptr CCaCtx -> IO (Ptr CTruth)+
+ src/Data/Number/Flint/Calcium/Ca/Poly.hs view
@@ -0,0 +1,11 @@+{-|+module : Data.Number.Flint.Calcium.Ca.Poly+copyright : (c) 2023 Hartmut Monien+license : GNU GPL, version 2 or above (see LICENSE)+maintainer : hmonien@uni-bonn.de+-}+module Data.Number.Flint.Calcium.Ca.Poly (+ module Data.Number.Flint.Calcium.Ca.Poly.FFI+ ) where+ +import Data.Number.Flint.Calcium.Ca.Poly.FFI
+ src/Data/Number/Flint/Calcium/Ca/Poly/FFI.hsc view
@@ -0,0 +1,728 @@+module Data.Number.Flint.Calcium.Ca.Poly.FFI (+ -- * Dense univariate polynomials over the real and complex numbers+ CaPoly (..)+ , CCaPoly (..)+ , newCaPoly+ , withCaPoly+ , withNewCaPoly+ -- * Memory management+ , ca_poly_init+ , ca_poly_clear+ , ca_poly_fit_length+ , _ca_poly_set_length+ , _ca_poly_normalise+ -- * Assignment and simple values+ , ca_poly_zero+ , ca_poly_one+ , ca_poly_x+ , ca_poly_set_ca+ , ca_poly_set_si+ , ca_poly_set+ , ca_poly_set_fmpz_poly+ , ca_poly_set_fmpq_poly+ , ca_poly_set_coeff_ca+ , ca_poly_transfer+ -- * Random generation+ , ca_poly_randtest+ , ca_poly_randtest_rational+ -- * Input and output+ , ca_poly_get_str+ , ca_poly_fprint+ , ca_poly_print+ , ca_poly_printn+ -- * Degree and leading coefficient+ , ca_poly_is_proper+ , ca_poly_make_monic+ , _ca_poly_reverse+ , ca_poly_reverse+ -- * Comparisons+ , _ca_poly_check_equal+ , ca_poly_check_equal+ , ca_poly_check_is_zero+ , ca_poly_check_is_one+ -- * Arithmetic+ , _ca_poly_shift_left+ , ca_poly_shift_left+ , _ca_poly_shift_right+ , ca_poly_shift_right+ , ca_poly_neg+ , _ca_poly_add+ , ca_poly_add+ , _ca_poly_sub+ , ca_poly_sub+ , _ca_poly_mul+ , ca_poly_mul+ , _ca_poly_mullow+ , ca_poly_mullow+ , ca_poly_mul_ca+ , ca_poly_div_ca+ , _ca_poly_divrem_basecase+ , ca_poly_divrem_basecase+ , _ca_poly_divrem+ , ca_poly_divrem+ , ca_poly_div+ , ca_poly_rem+ , _ca_poly_pow_ui_trunc+ , ca_poly_pow_ui_trunc+ , _ca_poly_pow_ui+ , ca_poly_pow_ui+ -- * Evaluation and composition+ , _ca_poly_evaluate_horner+ , ca_poly_evaluate_horner+ , _ca_poly_evaluate+ , ca_poly_evaluate+ , _ca_poly_compose+ , ca_poly_compose+ -- * Derivative and integral+ , _ca_poly_derivative+ , ca_poly_derivative+ , _ca_poly_integral+ , ca_poly_integral+ -- * Power series division+ , _ca_poly_inv_series+ , ca_poly_inv_series+ , _ca_poly_div_series+ , ca_poly_div_series+ -- * Elementary functions+ , _ca_poly_exp_series+ , ca_poly_exp_series+ , _ca_poly_log_series+ , ca_poly_log_series+ -- * Greatest common divisor+ , _ca_poly_gcd_euclidean+ , ca_poly_gcd_euclidean+ , _ca_poly_gcd+ , ca_poly_gcd+ -- * Roots and factorization+ , ca_poly_factor_squarefree+ , ca_poly_squarefree_part+ , _ca_poly_set_roots+ , ca_poly_set_roots+ , _ca_poly_roots+ , ca_poly_roots+ -- * Vectors of polynomials+ , _ca_poly_vec_init+ , ca_poly_vec_init+ , _ca_poly_vec_fit_length+ , ca_poly_vec_set_length+ , _ca_poly_vec_clear+ , ca_poly_vec_clear+ , ca_poly_vec_append+) where++-- Dense univariate polynomials over the real and complex number ---------------++import Foreign.Ptr+import Foreign.ForeignPtr+import Foreign.C.Types+import Foreign.C.String+import Foreign.Storable++import Data.Number.Flint.Flint+import Data.Number.Flint.Fmpz.Poly+import Data.Number.Flint.Fmpq.Poly+import Data.Number.Flint.Calcium+import Data.Number.Flint.Calcium.Ca.Types+import Data.Number.Flint.Calcium.Ca++#include <flint/ca_poly.h>++-- ca_poly_t -------------------------------------------------------------------++instance Storable CCaPoly where+ {-# INLINE sizeOf #-}+ sizeOf _ = #{size ca_poly_t}+ {-# INLINE alignment #-}+ alignment _ = #{alignment ca_poly_t}+ peek = error "CCaPoly.peek: Not defined"+ poke = error "CCaPoly.poke: Not defined"++newCaPoly ctx@(CaCtx fctx) = do+ x <- mallocForeignPtr+ withForeignPtr x $ \xp -> do+ withCaCtx ctx $ \ctxp -> do+ ca_poly_init xp ctxp+ addForeignPtrFinalizerEnv p_ca_poly_clear xp fctx+ return $ CaPoly x++{-# INLINE withCaPoly #-}+withCaPoly (CaPoly x) f = do+ withForeignPtr x $ \xp -> f xp >>= return . (CaPoly x,)++withNewCaPoly ctx f = do+ x <- newCaPoly ctx+ withCaPoly x f++-- A @CaPoly@ represents a univariate polynomial over the real or+-- complex numbers (an element of \(\mathbb{R}[X]\) or \(\mathbb{C}[X]\)),+-- implemented as an array of coefficients of type @ca_struct@.+--+-- Most functions are provided in two versions: an underscore method which+-- operates directly on pre-allocated arrays of coefficients and generally+-- has some restrictions (such as requiring the lengths to be nonzero and+-- not supporting aliasing of the input and output arrays), and a+-- non-underscore method which performs automatic memory management and+-- handles degenerate cases.+--+-- Warnings:+--++++-- A polynomial with numerical coefficients and with a nonzero leading+-- coefficient is called /proper/. The function @ca_poly_is_proper@ can be+-- used to check for violations.+--+-- Types, macros and constants -------------------------------------------------++++++++-- Memory management -----------------------------------------------------------++-- | /ca_poly_init/ /poly/ /ctx/ +--+-- Initializes the polynomial for use, setting it to the zero polynomial.+foreign import ccall "ca_poly.h ca_poly_init"+ ca_poly_init :: Ptr CCaPoly -> Ptr CCaCtx -> IO ()++-- | /ca_poly_clear/ /poly/ /ctx/ +--+-- Clears the polynomial, deallocating all coefficients and the coefficient+-- array.+foreign import ccall "ca_poly.h ca_poly_clear"+ ca_poly_clear :: Ptr CCaPoly -> Ptr CCaCtx -> IO ()++foreign import ccall "ca_poly.h &ca_poly_clear"+ p_ca_poly_clear :: FunPtr (Ptr CCaPoly -> Ptr CCaCtx -> IO ())++-- | /ca_poly_fit_length/ /poly/ /len/ /ctx/ +--+-- Makes sure that the coefficient array of the polynomial contains at+-- least /len/ initialized coefficients.+foreign import ccall "ca_poly.h ca_poly_fit_length"+ ca_poly_fit_length :: Ptr CCaPoly -> CLong -> Ptr CCaCtx -> IO ()++-- | /_ca_poly_set_length/ /poly/ /len/ /ctx/ +--+-- Directly changes the length of the polynomial, without allocating or+-- deallocating coefficients. The value should not exceed the allocation+-- length.+foreign import ccall "ca_poly.h _ca_poly_set_length"+ _ca_poly_set_length :: Ptr CCaPoly -> CLong -> Ptr CCaCtx -> IO ()++-- | /_ca_poly_normalise/ /poly/ /ctx/ +--+-- Strips any top coefficients which can be proved identical to zero.+foreign import ccall "ca_poly.h _ca_poly_normalise"+ _ca_poly_normalise :: Ptr CCaPoly -> Ptr CCaCtx -> IO ()++-- Assignment and simple values ------------------------------------------------++-- | /ca_poly_zero/ /poly/ /ctx/ +--+-- Sets /poly/ to the zero polynomial.+foreign import ccall "ca_poly.h ca_poly_zero"+ ca_poly_zero :: Ptr CCaPoly -> Ptr CCaCtx -> IO ()++-- | /ca_poly_one/ /poly/ /ctx/ +--+-- Sets /poly/ to the constant polynomial 1.+foreign import ccall "ca_poly.h ca_poly_one"+ ca_poly_one :: Ptr CCaPoly -> Ptr CCaCtx -> IO ()++-- | /ca_poly_x/ /poly/ /ctx/ +--+-- Sets /poly/ to the monomial /x/.+foreign import ccall "ca_poly.h ca_poly_x"+ ca_poly_x :: Ptr CCaPoly -> Ptr CCaCtx -> IO ()++-- | /ca_poly_set_ca/ /poly/ /c/ /ctx/ +foreign import ccall "ca_poly.h ca_poly_set_ca"+ ca_poly_set_ca :: Ptr CCaPoly -> Ptr CCa -> Ptr CCaCtx -> IO ()+-- | /ca_poly_set_si/ /poly/ /c/ /ctx/ +--+-- Sets /poly/ to the constant polynomial /c/.+foreign import ccall "ca_poly.h ca_poly_set_si"+ ca_poly_set_si :: Ptr CCaPoly -> CLong -> Ptr CCaCtx -> IO ()++-- | /ca_poly_set/ /res/ /src/ /ctx/ +foreign import ccall "ca_poly.h ca_poly_set"+ ca_poly_set :: Ptr CCaPoly -> Ptr CCaPoly -> Ptr CCaCtx -> IO ()+ +-- | /ca_poly_set_fmpz_poly/ /res/ /src/ /ctx/ +foreign import ccall "ca_poly.h ca_poly_set_fmpz_poly"+ ca_poly_set_fmpz_poly :: Ptr CCaPoly -> Ptr CFmpzPoly -> Ptr CCaCtx -> IO ()+-- | /ca_poly_set_fmpq_poly/ /res/ /src/ /ctx/ +--+-- Sets /poly/ the polynomial /src/.+foreign import ccall "ca_poly.h ca_poly_set_fmpq_poly"+ ca_poly_set_fmpq_poly :: Ptr CCaPoly -> Ptr CFmpqPoly -> Ptr CCaCtx -> IO ()++-- | /ca_poly_set_coeff_ca/ /poly/ /n/ /x/ /ctx/ +--+-- Sets the coefficient at position /n/ in /poly/ to /x/.+foreign import ccall "ca_poly.h ca_poly_set_coeff_ca"+ ca_poly_set_coeff_ca :: Ptr CCaPoly -> CLong -> Ptr CCa -> Ptr CCaCtx -> IO ()++-- | /ca_poly_transfer/ /res/ /res_ctx/ /src/ /src_ctx/ +--+-- Sets /res/ to /src/ where the corresponding context objects /res_ctx/+-- and /src_ctx/ may be different.+-- +-- This operation preserves the mathematical value represented by /src/,+-- but may result in a different internal representation depending on the+-- settings of the context objects.+foreign import ccall "ca_poly.h ca_poly_transfer"+ ca_poly_transfer :: Ptr CCaPoly -> Ptr CCaCtx -> Ptr CCaPoly -> Ptr CCaCtx -> IO ()++-- Random generation -----------------------------------------------------------++-- | /ca_poly_randtest/ /poly/ /state/ /len/ /depth/ /bits/ /ctx/ +--+-- Sets /poly/ to a random polynomial of length up to /len/ and with+-- entries having complexity up to /depth/ and /bits/ (see @ca_randtest@).+foreign import ccall "ca_poly.h ca_poly_randtest"+ ca_poly_randtest :: Ptr CCaPoly -> Ptr CFRandState -> CLong -> CLong -> CLong -> Ptr CCaCtx -> IO ()++-- | /ca_poly_randtest_rational/ /poly/ /state/ /len/ /bits/ /ctx/ +--+-- Sets /poly/ to a random rational polynomial of length up to /len/ and+-- with entries up to /bits/ bits in size.+foreign import ccall "ca_poly.h ca_poly_randtest_rational"+ ca_poly_randtest_rational :: Ptr CCaPoly -> Ptr CFRandState -> CLong -> CLong -> Ptr CCaCtx -> IO ()++-- Input and output ------------------------------------------------------------++-- | /ca_poly_get_str/ /poly/ /ctx/ +--+-- Returns a string representation of /poly/. The coefficients are printed on+-- separate lines.+foreign import ccall "ca_poly.h ca_poly_get_str"+ ca_poly_get_str :: Ptr CCaPoly -> Ptr CCaCtx -> IO CString++-- | /ca_poly_fprint/ /file/ /poly/ /ctx/ +--+-- Prints /poly/ to file. The coefficients are printed on+-- separate lines.+foreign import ccall "ca_poly.h ca_poly_fprint"+ ca_poly_fprint :: Ptr CFile -> Ptr CCaPoly -> Ptr CCaCtx -> IO ()++-- | /ca_poly_print/ /poly/ /ctx/ +--+-- Prints /poly/ to standard output. The coefficients are printed on+-- separate lines.+ca_poly_print :: Ptr CCaPoly -> Ptr CCaCtx -> IO ()+ca_poly_print poly ctx = do+ printCStr (\poly -> ca_poly_get_str poly ctx) poly+ return ()+ +-- | /ca_poly_printn/ /poly/ /digits/ /ctx/ +--+-- Prints a decimal representation of /poly/ with precision specified by+-- /digits/. The coefficients are comma-separated and the whole list is+-- enclosed in square brackets.+foreign import ccall "ca_poly.h ca_poly_printn"+ ca_poly_printn :: Ptr CCaPoly -> CLong -> Ptr CCaCtx -> IO ()++-- Degree and leading coefficient ----------------------------------------------++-- | /ca_poly_is_proper/ /poly/ /ctx/ +--+-- Checks that /poly/ represents an element of \(\mathbb{C}[X]\) with+-- well-defined degree. This returns 1 if the leading coefficient of /poly/+-- is nonzero and all coefficients of /poly/ are numbers (not special+-- values). It returns 0 otherwise. It returns 1 when /poly/ is precisely+-- the zero polynomial (which does not have a leading coefficient).+foreign import ccall "ca_poly.h ca_poly_is_proper"+ ca_poly_is_proper :: Ptr CCaPoly -> Ptr CCaCtx -> IO CInt++-- | /ca_poly_make_monic/ /res/ /poly/ /ctx/ +--+-- Makes /poly/ monic by dividing by the leading coefficient if possible+-- and returns 1. Returns 0 if the leading coefficient cannot be certified+-- to be nonzero, or if /poly/ is the zero polynomial.+foreign import ccall "ca_poly.h ca_poly_make_monic"+ ca_poly_make_monic :: Ptr CCaPoly -> Ptr CCaPoly -> Ptr CCaCtx -> IO CInt++-- | /_ca_poly_reverse/ /res/ /poly/ /len/ /n/ /ctx/ +--+foreign import ccall "ca_poly.h _ca_poly_reverse"+ _ca_poly_reverse :: Ptr CCa -> Ptr CCa -> CLong -> CLong -> Ptr CCaCtx -> IO ()++-- | /ca_poly_reverse/ /res/ /poly/ /n/ /ctx/ +--+-- Sets /res/ to the reversal of /poly/ considered as a polynomial of+-- length /n/, zero-padding if needed. The underscore method assumes that+-- /len/ is positive and less than or equal to /n/.+foreign import ccall "ca_poly.h ca_poly_reverse"+ ca_poly_reverse :: Ptr CCaPoly -> Ptr CCaPoly -> CLong -> Ptr CCaCtx -> IO ()++-- Comparisons -----------------------------------------------------------------++-- | /_ca_poly_check_equal/ /poly1/ /len1/ /poly2/ /len2/ /ctx/ +foreign import ccall "ca_poly.h _ca_poly_check_equal"+ _ca_poly_check_equal :: Ptr CCa -> CLong -> Ptr CCa -> CLong -> Ptr CCaCtx -> IO (Ptr CTruth)+-- | /ca_poly_check_equal/ /poly1/ /poly2/ /ctx/ +--+-- Checks if /poly1/ and /poly2/ represent the same polynomial. The+-- underscore method assumes that /len1/ is at least as large as /len2/.+foreign import ccall "ca_poly.h ca_poly_check_equal"+ ca_poly_check_equal :: Ptr CCaPoly -> Ptr CCaPoly -> Ptr CCaCtx -> IO (Ptr CTruth)++-- | /ca_poly_check_is_zero/ /poly/ /ctx/ +--+-- Checks if /poly/ is the zero polynomial.+foreign import ccall "ca_poly.h ca_poly_check_is_zero"+ ca_poly_check_is_zero :: Ptr CCaPoly -> Ptr CCaCtx -> IO (Ptr CTruth)++-- | /ca_poly_check_is_one/ /poly/ /ctx/ +--+-- Checks if /poly/ is the constant polynomial 1.+foreign import ccall "ca_poly.h ca_poly_check_is_one"+ ca_poly_check_is_one :: Ptr CCaPoly -> Ptr CCaCtx -> IO (Ptr CTruth)++-- Arithmetic ------------------------------------------------------------------++-- | /_ca_poly_shift_left/ /res/ /poly/ /len/ /n/ /ctx/ +foreign import ccall "ca_poly.h _ca_poly_shift_left"+ _ca_poly_shift_left :: Ptr CCa -> Ptr CCa -> CLong -> CLong -> Ptr CCaCtx -> IO ()+-- | /ca_poly_shift_left/ /res/ /poly/ /n/ /ctx/ +--+-- Sets /res/ to /poly/ shifted /n/ coefficients to the left; that is,+-- multiplied by \(x^n\).+foreign import ccall "ca_poly.h ca_poly_shift_left"+ ca_poly_shift_left :: Ptr CCaPoly -> Ptr CCaPoly -> CLong -> Ptr CCaCtx -> IO ()++-- | /_ca_poly_shift_right/ /res/ /poly/ /len/ /n/ /ctx/ +foreign import ccall "ca_poly.h _ca_poly_shift_right"+ _ca_poly_shift_right :: Ptr CCa -> Ptr CCa -> CLong -> CLong -> Ptr CCaCtx -> IO ()+-- | /ca_poly_shift_right/ /res/ /poly/ /n/ /ctx/ +--+-- Sets /res/ to /poly/ shifted /n/ coefficients to the right; that is,+-- divided by \(x^n\).+foreign import ccall "ca_poly.h ca_poly_shift_right"+ ca_poly_shift_right :: Ptr CCaPoly -> Ptr CCaPoly -> CLong -> Ptr CCaCtx -> IO ()++-- | /ca_poly_neg/ /res/ /src/ /ctx/ +--+-- Sets /res/ to the negation of /src/.+foreign import ccall "ca_poly.h ca_poly_neg"+ ca_poly_neg :: Ptr CCaPoly -> Ptr CCaPoly -> Ptr CCaCtx -> IO ()++-- | /_ca_poly_add/ /res/ /poly1/ /len1/ /poly2/ /len2/ /ctx/ +foreign import ccall "ca_poly.h _ca_poly_add"+ _ca_poly_add :: Ptr CCa -> Ptr CCa -> CLong -> Ptr CCa -> CLong -> Ptr CCaCtx -> IO ()+-- | /ca_poly_add/ /res/ /poly1/ /poly2/ /ctx/ +--+-- Sets /res/ to the sum of /poly1/ and /poly2/.+foreign import ccall "ca_poly.h ca_poly_add"+ ca_poly_add :: Ptr CCaPoly -> Ptr CCaPoly -> Ptr CCaPoly -> Ptr CCaCtx -> IO ()++-- | /_ca_poly_sub/ /res/ /poly1/ /len1/ /poly2/ /len2/ /ctx/ +foreign import ccall "ca_poly.h _ca_poly_sub"+ _ca_poly_sub :: Ptr CCa -> Ptr CCa -> CLong -> Ptr CCa -> CLong -> Ptr CCaCtx -> IO ()+-- | /ca_poly_sub/ /res/ /poly1/ /poly2/ /ctx/ +--+-- Sets /res/ to the difference of /poly1/ and /poly2/.+foreign import ccall "ca_poly.h ca_poly_sub"+ ca_poly_sub :: Ptr CCaPoly -> Ptr CCaPoly -> Ptr CCaPoly -> Ptr CCaCtx -> IO ()++-- | /_ca_poly_mul/ /res/ /poly1/ /len1/ /poly2/ /len2/ /ctx/ +foreign import ccall "ca_poly.h _ca_poly_mul"+ _ca_poly_mul :: Ptr CCa -> Ptr CCa -> CLong -> Ptr CCa -> CLong -> Ptr CCaCtx -> IO ()+-- | /ca_poly_mul/ /res/ /poly1/ /poly2/ /ctx/ +--+-- Sets /res/ to the product of /poly1/ and /poly2/.+foreign import ccall "ca_poly.h ca_poly_mul"+ ca_poly_mul :: Ptr CCaPoly -> Ptr CCaPoly -> Ptr CCaPoly -> Ptr CCaCtx -> IO ()++-- | /_ca_poly_mullow/ /C/ /poly1/ /len1/ /poly2/ /len2/ /n/ /ctx/ +foreign import ccall "ca_poly.h _ca_poly_mullow"+ _ca_poly_mullow :: Ptr CCa -> Ptr CCa -> CLong -> Ptr CCa -> CLong -> CLong -> Ptr CCaCtx -> IO ()+-- | /ca_poly_mullow/ /res/ /poly1/ /poly2/ /n/ /ctx/ +--+-- Sets /res/ to the product of /poly1/ and /poly2/ truncated to length+-- /n/.+foreign import ccall "ca_poly.h ca_poly_mullow"+ ca_poly_mullow :: Ptr CCaPoly -> Ptr CCaPoly -> Ptr CCaPoly -> CLong -> Ptr CCaCtx -> IO ()++-- | /ca_poly_mul_ca/ /res/ /poly/ /c/ /ctx/ +--+-- Sets /res/ to /poly/ multiplied by the scalar /c/.+foreign import ccall "ca_poly.h ca_poly_mul_ca"+ ca_poly_mul_ca :: Ptr CCaPoly -> Ptr CCaPoly -> Ptr CCa -> Ptr CCaCtx -> IO ()++-- | /ca_poly_div_ca/ /res/ /poly/ /c/ /ctx/ +--+-- Sets /res/ to /poly/ divided by the scalar /c/.+foreign import ccall "ca_poly.h ca_poly_div_ca"+ ca_poly_div_ca :: Ptr CCaPoly -> Ptr CCaPoly -> Ptr CCa -> Ptr CCaCtx -> IO ()++-- | /_ca_poly_divrem_basecase/ /Q/ /R/ /A/ /lenA/ /B/ /lenB/ /invB/ /ctx/ +foreign import ccall "ca_poly.h _ca_poly_divrem_basecase"+ _ca_poly_divrem_basecase :: Ptr CCa -> Ptr CCa -> Ptr CCa -> CLong -> Ptr CCa -> CLong -> Ptr CCa -> Ptr CCaCtx -> IO ()+-- | /ca_poly_divrem_basecase/ /Q/ /R/ /A/ /B/ /ctx/ +foreign import ccall "ca_poly.h ca_poly_divrem_basecase"+ ca_poly_divrem_basecase :: Ptr CCaPoly -> Ptr CCaPoly -> Ptr CCaPoly -> Ptr CCaPoly -> Ptr CCaCtx -> IO CInt+-- | /_ca_poly_divrem/ /Q/ /R/ /A/ /lenA/ /B/ /lenB/ /invB/ /ctx/ +foreign import ccall "ca_poly.h _ca_poly_divrem"+ _ca_poly_divrem :: Ptr CCa -> Ptr CCa -> Ptr CCa -> CLong -> Ptr CCa -> CLong -> Ptr CCa -> Ptr CCaCtx -> IO ()+-- | /ca_poly_divrem/ /Q/ /R/ /A/ /B/ /ctx/ +foreign import ccall "ca_poly.h ca_poly_divrem"+ ca_poly_divrem :: Ptr CCaPoly -> Ptr CCaPoly -> Ptr CCaPoly -> Ptr CCaPoly -> Ptr CCaCtx -> IO CInt+-- | /ca_poly_div/ /Q/ /A/ /B/ /ctx/ +foreign import ccall "ca_poly.h ca_poly_div"+ ca_poly_div :: Ptr CCaPoly -> Ptr CCaPoly -> Ptr CCaPoly -> Ptr CCaCtx -> IO CInt+-- | /ca_poly_rem/ /R/ /A/ /B/ /ctx/ +--+-- If the leading coefficient of /B/ can be proved invertible, sets /Q/ and+-- /R/ to the quotient and remainder of polynomial division of /A/ by /B/+-- and returns 1. If the leading coefficient cannot be proved invertible,+-- returns 0. The underscore method takes a precomputed inverse of the+-- leading coefficient of /B/.+foreign import ccall "ca_poly.h ca_poly_rem"+ ca_poly_rem :: Ptr CCaPoly -> Ptr CCaPoly -> Ptr CCaPoly -> Ptr CCaCtx -> IO CInt++-- | /_ca_poly_pow_ui_trunc/ /res/ /f/ /flen/ /exp/ /len/ /ctx/ +foreign import ccall "ca_poly.h _ca_poly_pow_ui_trunc"+ _ca_poly_pow_ui_trunc :: Ptr CCa -> Ptr CCa -> CLong -> CULong -> CLong -> Ptr CCaCtx -> IO ()+-- | /ca_poly_pow_ui_trunc/ /res/ /poly/ /exp/ /len/ /ctx/ +--+-- Sets /res/ to /poly/ raised to the power /exp/, truncated to length+-- /len/.+foreign import ccall "ca_poly.h ca_poly_pow_ui_trunc"+ ca_poly_pow_ui_trunc :: Ptr CCaPoly -> Ptr CCaPoly -> CULong -> CLong -> Ptr CCaCtx -> IO ()++-- | /_ca_poly_pow_ui/ /res/ /f/ /flen/ /exp/ /ctx/ +foreign import ccall "ca_poly.h _ca_poly_pow_ui"+ _ca_poly_pow_ui :: Ptr CCa -> Ptr CCa -> CLong -> CULong -> Ptr CCaCtx -> IO ()+-- | /ca_poly_pow_ui/ /res/ /poly/ /exp/ /ctx/ +--+-- Sets /res/ to /poly/ raised to the power /exp/.+foreign import ccall "ca_poly.h ca_poly_pow_ui"+ ca_poly_pow_ui :: Ptr CCaPoly -> Ptr CCaPoly -> CULong -> Ptr CCaCtx -> IO ()++-- Evaluation and composition --------------------------------------------------++-- | /_ca_poly_evaluate_horner/ /res/ /f/ /len/ /x/ /ctx/ +foreign import ccall "ca_poly.h _ca_poly_evaluate_horner"+ _ca_poly_evaluate_horner :: Ptr CCa -> Ptr CCa -> CLong -> Ptr CCa -> Ptr CCaCtx -> IO ()+-- | /ca_poly_evaluate_horner/ /res/ /f/ /a/ /ctx/ +foreign import ccall "ca_poly.h ca_poly_evaluate_horner"+ ca_poly_evaluate_horner :: Ptr CCa -> Ptr CCaPoly -> Ptr CCa -> Ptr CCaCtx -> IO ()+-- | /_ca_poly_evaluate/ /res/ /f/ /len/ /x/ /ctx/ +foreign import ccall "ca_poly.h _ca_poly_evaluate"+ _ca_poly_evaluate :: Ptr CCa -> Ptr CCa -> CLong -> Ptr CCa -> Ptr CCaCtx -> IO ()+-- | /ca_poly_evaluate/ /res/ /f/ /a/ /ctx/ +--+-- Sets /res/ to /f/ evaluated at the point /a/.+foreign import ccall "ca_poly.h ca_poly_evaluate"+ ca_poly_evaluate :: Ptr CCa -> Ptr CCaPoly -> Ptr CCa -> Ptr CCaCtx -> IO ()++-- | /_ca_poly_compose/ /res/ /poly1/ /len1/ /poly2/ /len2/ /ctx/ +foreign import ccall "ca_poly.h _ca_poly_compose"+ _ca_poly_compose :: Ptr CCa -> Ptr CCa -> CLong -> Ptr CCa -> CLong -> Ptr CCaCtx -> IO ()+-- | /ca_poly_compose/ /res/ /poly1/ /poly2/ /ctx/ +--+-- Sets /res/ to the composition of /poly1/ with /poly2/.+foreign import ccall "ca_poly.h ca_poly_compose"+ ca_poly_compose :: Ptr CCaPoly -> Ptr CCaPoly -> Ptr CCaPoly -> Ptr CCaCtx -> IO ()++-- Derivative and integral -----------------------------------------------------++-- | /_ca_poly_derivative/ /res/ /poly/ /len/ /ctx/ +foreign import ccall "ca_poly.h _ca_poly_derivative"+ _ca_poly_derivative :: Ptr CCa -> Ptr CCa -> CLong -> Ptr CCaCtx -> IO ()+-- | /ca_poly_derivative/ /res/ /poly/ /ctx/ +--+-- Sets /res/ to the derivative of /poly/. The underscore method needs one+-- less coefficient than /len/ for the output array.+foreign import ccall "ca_poly.h ca_poly_derivative"+ ca_poly_derivative :: Ptr CCaPoly -> Ptr CCaPoly -> Ptr CCaCtx -> IO ()++-- | /_ca_poly_integral/ /res/ /poly/ /len/ /ctx/ +foreign import ccall "ca_poly.h _ca_poly_integral"+ _ca_poly_integral :: Ptr CCa -> Ptr CCa -> CLong -> Ptr CCaCtx -> IO ()+-- | /ca_poly_integral/ /res/ /poly/ /ctx/ +--+-- Sets /res/ to the integral of /poly/. The underscore method needs one+-- more coefficient than /len/ for the output array.+foreign import ccall "ca_poly.h ca_poly_integral"+ ca_poly_integral :: Ptr CCaPoly -> Ptr CCaPoly -> Ptr CCaCtx -> IO ()++-- Power series division -------------------------------------------------------++-- | /_ca_poly_inv_series/ /res/ /f/ /flen/ /len/ /ctx/ +foreign import ccall "ca_poly.h _ca_poly_inv_series"+ _ca_poly_inv_series :: Ptr CCa -> Ptr CCa -> CLong -> CLong -> Ptr CCaCtx -> IO ()+-- | /ca_poly_inv_series/ /res/ /f/ /len/ /ctx/ +--+-- Sets /res/ to the power series inverse of /f/ truncated to length /len/.+foreign import ccall "ca_poly.h ca_poly_inv_series"+ ca_poly_inv_series :: Ptr CCaPoly -> Ptr CCaPoly -> CLong -> Ptr CCaCtx -> IO ()++-- | /_ca_poly_div_series/ /res/ /f/ /flen/ /g/ /glen/ /len/ /ctx/ +foreign import ccall "ca_poly.h _ca_poly_div_series"+ _ca_poly_div_series :: Ptr CCa -> Ptr CCa -> CLong -> Ptr CCa -> CLong -> CLong -> Ptr CCaCtx -> IO ()+-- | /ca_poly_div_series/ /res/ /f/ /g/ /len/ /ctx/ +--+-- Sets /res/ to the power series quotient of /f/ and /g/ truncated to+-- length /len/. This function divides by zero if /g/ has constant term+-- zero; the user should manually remove initial zeros when an exact+-- cancellation is required.+foreign import ccall "ca_poly.h ca_poly_div_series"+ ca_poly_div_series :: Ptr CCaPoly -> Ptr CCaPoly -> Ptr CCaPoly -> CLong -> Ptr CCaCtx -> IO ()++-- Elementary functions --------------------------------------------------------++-- | /_ca_poly_exp_series/ /res/ /f/ /flen/ /len/ /ctx/ +foreign import ccall "ca_poly.h _ca_poly_exp_series"+ _ca_poly_exp_series :: Ptr CCa -> Ptr CCa -> CLong -> CLong -> Ptr CCaCtx -> IO ()+-- | /ca_poly_exp_series/ /res/ /f/ /len/ /ctx/ +--+-- Sets /res/ to the power series exponential of /f/ truncated to length+-- /len/.+foreign import ccall "ca_poly.h ca_poly_exp_series"+ ca_poly_exp_series :: Ptr CCaPoly -> Ptr CCaPoly -> CLong -> Ptr CCaCtx -> IO ()++-- | /_ca_poly_log_series/ /res/ /f/ /flen/ /len/ /ctx/ +foreign import ccall "ca_poly.h _ca_poly_log_series"+ _ca_poly_log_series :: Ptr CCa -> Ptr CCa -> CLong -> CLong -> Ptr CCaCtx -> IO ()+-- | /ca_poly_log_series/ /res/ /f/ /len/ /ctx/ +--+-- Sets /res/ to the power series logarithm of /f/ truncated to length+-- /len/.+foreign import ccall "ca_poly.h ca_poly_log_series"+ ca_poly_log_series :: Ptr CCaPoly -> Ptr CCaPoly -> CLong -> Ptr CCaCtx -> IO ()++-- Greatest common divisor -----------------------------------------------------++-- | /_ca_poly_gcd_euclidean/ /res/ /A/ /lenA/ /B/ /lenB/ /ctx/ +foreign import ccall "ca_poly.h _ca_poly_gcd_euclidean"+ _ca_poly_gcd_euclidean :: Ptr CCa -> Ptr CCa -> CLong -> Ptr CCa -> CLong -> Ptr CCaCtx -> IO CLong+-- | /ca_poly_gcd_euclidean/ /res/ /A/ /B/ /ctx/ +foreign import ccall "ca_poly.h ca_poly_gcd_euclidean"+ ca_poly_gcd_euclidean :: Ptr CCaPoly -> Ptr CCaPoly -> Ptr CCaPoly -> Ptr CCaCtx -> IO CInt+-- | /_ca_poly_gcd/ /res/ /A/ /lenA/ /B/ /lenB/ /ctx/ +foreign import ccall "ca_poly.h _ca_poly_gcd"+ _ca_poly_gcd :: Ptr CCa -> Ptr CCa -> CLong -> Ptr CCa -> CLong -> Ptr CCaCtx -> IO CLong+-- | /ca_poly_gcd/ /res/ /A/ /g/ /ctx/ +--+-- Sets /res/ to the GCD of /A/ and /B/ and returns 1 on success. On+-- failure, returns 0 leaving the value of /res/ arbitrary. The computation+-- can fail if testing a leading coefficient for zero fails in the+-- execution of the GCD algorithm. The output is normalized to be monic if+-- it is not the zero polynomial.+-- +-- The underscore methods assume \(\text{lenA} \ge \text{lenB} \ge 1\), and+-- that both /A/ and /B/ have nonzero leading coefficient. They return the+-- length of the GCD, or 0 if the computation fails.+-- +-- The /euclidean/ version implements the standard Euclidean algorithm. The+-- default version first checks for rational polynomials or attempts to+-- certify numerically that the polynomials are coprime and otherwise falls+-- back to an automatic choice of algorithm (currently only the Euclidean+-- algorithm).+foreign import ccall "ca_poly.h ca_poly_gcd"+ ca_poly_gcd :: Ptr CCaPoly -> Ptr CCaPoly -> Ptr CCaPoly -> Ptr CCaCtx -> IO CInt++-- Roots and factorization -----------------------------------------------------++-- | /ca_poly_factor_squarefree/ /c/ /fac/ /exp/ /F/ /ctx/ +--+-- Computes the squarefree factorization of /F/, giving a product+-- \(F = c f_1 f_2^2 \ldots f_n^n\) where all \(f_i\) with \(f_i \ne 1\)+-- are squarefree and pairwise coprime. The nontrivial factors \(f_i\) are+-- written to /fac/ and the corresponding exponents are written to /exp/.+-- This algorithm can fail if GCD computation fails internally. Returns 1+-- on success and 0 on failure.+foreign import ccall "ca_poly.h ca_poly_factor_squarefree"+ ca_poly_factor_squarefree :: Ptr CCa -> Ptr CCaPolyVec -> Ptr CULong -> Ptr CCaPoly -> Ptr CCaCtx -> IO CInt++-- | /ca_poly_squarefree_part/ /res/ /poly/ /ctx/ +--+-- Sets /res/ to the squarefree part of /poly/, normalized to be monic.+-- This algorithm can fail if GCD computation fails internally. Returns 1+-- on success and 0 on failure.+foreign import ccall "ca_poly.h ca_poly_squarefree_part"+ ca_poly_squarefree_part :: Ptr CCaPoly -> Ptr CCaPoly -> Ptr CCaCtx -> IO CInt++-- | /_ca_poly_set_roots/ /poly/ /roots/ /exp/ /n/ /ctx/ +foreign import ccall "ca_poly.h _ca_poly_set_roots"+ _ca_poly_set_roots :: Ptr CCa -> Ptr CCa -> Ptr CULong -> CLong -> Ptr CCaCtx -> IO ()+-- | /ca_poly_set_roots/ /poly/ /roots/ /exp/ /ctx/ +--+-- Sets /poly/ to the monic polynomial with the /n/ roots given in the+-- vector /roots/, with multiplicities given in the vector /exp/. In other+-- words, this constructs the polynomial+-- \((x-r_0)^{e_0} (x-r_1)^{e_1} \cdots (x-r_{n-1})^{e_{n-1}}\). Uses+-- binary splitting.+foreign import ccall "ca_poly.h ca_poly_set_roots"+ ca_poly_set_roots :: Ptr CCaPoly -> Ptr CCaVec -> Ptr CULong -> Ptr CCaCtx -> IO ()++-- | /_ca_poly_roots/ /roots/ /poly/ /len/ /ctx/ +foreign import ccall "ca_poly.h _ca_poly_roots"+ _ca_poly_roots :: Ptr CCa -> Ptr CCa -> CLong -> Ptr CCaCtx -> IO CInt+-- | /ca_poly_roots/ /roots/ /exp/ /poly/ /ctx/ +--+-- Attempts to compute all complex roots of the given polynomial /poly/. On+-- success, returns 1 and sets /roots/ to a vector containing all the+-- distinct roots with corresponding multiplicities in /exp/. On failure,+-- returns 0 and leaves the values in /roots/ arbitrary. The roots are+-- returned in arbitrary order.+-- +-- Failure will occur if the leading coefficient of /poly/ cannot be proved+-- to be nonzero, if determining the correct multiplicities fails, or if+-- the builtin algorithms do not have a means to represent the roots+-- symbolically.+-- +-- The underscore method assumes that the polynomial is squarefree. The+-- non-underscore method performs a squarefree factorization.+foreign import ccall "ca_poly.h ca_poly_roots"+ ca_poly_roots :: Ptr CCaVec -> Ptr CULong -> Ptr CCaPoly -> Ptr CCaCtx -> IO CInt++-- Vectors of polynomials ------------------------------------------------------++-- | /_ca_poly_vec_init/ /len/ /ctx/ +foreign import ccall "ca_poly.h _ca_poly_vec_init"+ _ca_poly_vec_init :: CLong -> Ptr CCaCtx -> IO (Ptr CCaPoly)+-- | /ca_poly_vec_init/ /res/ /len/ /ctx/ +--+-- Initializes a vector with /len/ polynomials.+foreign import ccall "ca_poly.h ca_poly_vec_init"+ ca_poly_vec_init :: Ptr CCaPolyVec -> CLong -> Ptr CCaCtx -> IO ()++-- | /_ca_poly_vec_fit_length/ /vec/ /len/ /ctx/ +--+-- Allocates space for /len/ polynomials in /vec/.+foreign import ccall "ca_poly.h _ca_poly_vec_fit_length"+ _ca_poly_vec_fit_length :: Ptr CCaPolyVec -> CLong -> Ptr CCaCtx -> IO ()++-- | /ca_poly_vec_set_length/ /vec/ /len/ /ctx/ +--+-- Resizes /vec/ to length /len/, zero-extending if needed.+foreign import ccall "ca_poly.h ca_poly_vec_set_length"+ ca_poly_vec_set_length :: Ptr CCaPolyVec -> CLong -> Ptr CCaCtx -> IO ()++-- | /_ca_poly_vec_clear/ /vec/ /len/ /ctx/ +foreign import ccall "ca_poly.h _ca_poly_vec_clear"+ _ca_poly_vec_clear :: Ptr CCaPoly -> CLong -> Ptr CCaCtx -> IO ()+-- | /ca_poly_vec_clear/ /vec/ /ctx/ +--+-- Clears the vector /vec/.+foreign import ccall "ca_poly.h ca_poly_vec_clear"+ ca_poly_vec_clear :: Ptr CCaPolyVec -> Ptr CCaCtx -> IO ()++-- | /ca_poly_vec_append/ /vec/ /poly/ /ctx/ +--+-- Appends /poly/ to the end of the vector /vec/.+foreign import ccall "ca_poly.h ca_poly_vec_append"+ ca_poly_vec_append :: Ptr CCaPolyVec -> Ptr CCaPoly -> Ptr CCaCtx -> IO ()++++
+ src/Data/Number/Flint/Calcium/Ca/Types.hs view
@@ -0,0 +1,11 @@+{-|+module : Data.Number.Flint.Calcium.Ca.Types+copyright : (c) 2023 Hartmut Monien+license : GNU GPL, version 2 or above (see LICENSE)+maintainer : hmonien@uni-bonn.de+-}+module Data.Number.Flint.Calcium.Ca.Types (+ module Data.Number.Flint.Calcium.Ca.Types.FFI+ ) where+ +import Data.Number.Flint.Calcium.Ca.Types.FFI
+ src/Data/Number/Flint/Calcium/Ca/Types/FFI.hsc view
@@ -0,0 +1,65 @@+module Data.Number.Flint.Calcium.Ca.Types.FFI (+ Ca (..)+, CCa (..)+, CaVec (..)+, CCaVec (..)+, CaMat (..)+, CCaMat (..)+, CaPoly (..)+, CCaPoly (..)+, CaPolyVec (..)+, CCaPolyVec (..)+, CaFactor (..)+, CCaFactor (..)+, CaCtx (..)+, CCaCtx (..)+, CaField (..)+, CCaField (..)+, CaFieldCache (..)+, CCaFieldCache (..)+, CaExt (..)+, CCaExt (..)+, CaExtCache (..)+, CCaExtCache (..)+, CFexpr+) where++import Foreign.Ptr+import Foreign.ForeignPtr+import Foreign.C.Types+import Data.Number.Flint.Flint++data Ca = Ca {-# UNPACK #-} !(ForeignPtr CCa)+type CCa = CFlint Ca++data CaFactor = CaFactor {-# UNPACK #-} !(ForeignPtr CCaFactor)+type CCaFactor = CFlint CaFactor++data CaCtx = CaCtx {-# UNPACK #-} !(ForeignPtr CCaCtx)+type CCaCtx = CFlint CaCtx++data CaVec = CaVec {-# UNPACK #-} !(ForeignPtr CCaVec)+type CCaVec = CFlint CaVec++data CaMat = CaMat {-# UNPACK #-} !(ForeignPtr CCaMat)+data CCaMat = CCaMat (Ptr CCa) CLong CLong (Ptr CCa)++data CaPoly = CaPoly {-# UNPACK #-} !(ForeignPtr CCaPoly)+type CCaPoly = CFlint CaPoly++data CaPolyVec = CaPolyVec {-# UNPACK #-} !(ForeignPtr CCaPolyVec)+type CCaPolyVec = CFlint CaPolyVec++data CaField = CaField {-# UNPACK #-} !(ForeignPtr CCaField)+type CCaField = CFlint CaField++data CaFieldCache = CaFieldCache {-# UNPACK #-} !(ForeignPtr CCaFieldCache)+type CCaFieldCache = CFlint CaFieldCache++data CaExt = CaExt {-# UNPACK #-} !(ForeignPtr CCaExt)+type CCaExt = CFlint CaExt++data CaExtCache = CaExtCache {-# UNPACK #-} !(ForeignPtr CCaExtCache)+type CCaExtCache = CFlint CaExtCache++data CFexpr
+ src/Data/Number/Flint/Calcium/Ca/Vec.hs view
@@ -0,0 +1,22 @@+{-|+module : Data.Number.Flint.Calcium.Ca.Vec+copyright : (c) 2023 Hartmut Monien+license : GNU GPL, version 2 or above (see LICENSE)+maintainer : hmonien@uni-bonn.de++A @CaVec@ represents a vector of real or complex numbers, implemented+as an array of coefficients of type @CCa@.++Most functions are provided in two versions: an underscore method+which operates directly on pre-allocated arrays of coefficients+(taking @Ptr CCa@ arguments), and a non-underscore method which+takes @CaVec@ input and performs automatic memory management.++Unlike @CaPoly@, a @CaVec@ is not normalised by removing zero+coefficients; it retains the exact length assigned by the user.+-}+module Data.Number.Flint.Calcium.Ca.Vec (+ module Data.Number.Flint.Calcium.Ca.Vec.FFI+ ) where+ +import Data.Number.Flint.Calcium.Ca.Vec.FFI
+ src/Data/Number/Flint/Calcium/Ca/Vec/FFI.hsc view
@@ -0,0 +1,304 @@+module Data.Number.Flint.Calcium.Ca.Vec.FFI (+ -- * Vectors of real and complex numbers+ -- * Types, macros and constants+ CaVec (..)+ , CCaVec (..)+ , newCaVec+ , withCaVec+ , withNewCaVec+ -- * Memory management+ , _ca_vec_init+ , ca_vec_init+ , _ca_vec_clear+ , ca_vec_clear+ , _ca_vec_swap+ , ca_vec_swap+ -- * Entry+ , ca_vec_entry_ptr+ -- * Length+ , ca_vec_length+ , _ca_vec_fit_length+ , ca_vec_set_length+ -- * Assignment+ , _ca_vec_set+ , ca_vec_set+ -- * Special vectors+ , _ca_vec_zero+ , ca_vec_zero+ -- * Input and output+ , ca_vec_print+ , ca_vec_printn+ -- * List operations+ , ca_vec_append+ -- * Arithmetic+ , _ca_vec_neg+ , ca_vec_neg+ , _ca_vec_add+ , _ca_vec_sub+ , _ca_vec_scalar_mul_ca+ , _ca_vec_scalar_div_ca+ , _ca_vec_scalar_addmul_ca+ , _ca_vec_scalar_submul_ca+ -- * Comparisons and properties+ , _ca_vec_check_is_zero+ -- * Internal representation+ , _ca_vec_is_fmpq_vec+ , _ca_vec_fmpq_vec_is_fmpz_vec+ , _ca_vec_fmpq_vec_get_fmpz_vec_den+ , _ca_vec_set_fmpz_vec_div_fmpz+) where++-- Vectors of real and complex numbers -----------------------------------------++import Foreign.Ptr+import Foreign.ForeignPtr+import Foreign.C.Types+import Foreign.Storable+import Foreign.Marshal.Array++import Data.Number.Flint.Flint+import Data.Number.Flint.Fmpz+import Data.Number.Flint.Calcium+import Data.Number.Flint.Calcium.Ca+import Data.Number.Flint.Calcium.Ca.Types++#include <flint/ca_vec.h>++-- ca_vec_t --------------------------------------------------------------------++instance Storable CCaVec where+ {-# INLINE sizeOf #-}+ sizeOf _ = #{size ca_vec_t}+ {-# INLINE alignment #-}+ alignment _ = #{alignment ca_vec_t}+ peek = error "CCaVec.peek: Not defined"+ poke = error "CCaVec.poke: Not defined"++newCaVec len ctx@(CaCtx ctxf) = do+ x <- mallocForeignPtr+ withForeignPtr x $ \x -> do+ withCaCtx ctx $ \ctx -> do+ ca_vec_init x len ctx+ addForeignPtrFinalizerEnv p_ca_vec_clear x ctxf+ return $ CaVec x+ +withCaVec (CaVec x) f = do+ withForeignPtr x $ \px -> f px >>= return . (CaVec x,)++withNewCaVec len ctx f = do+ x <- newCaVec len ctx+ withCaCtx ctx $ \ctx -> do+ withCaVec x $ \x -> do+ f x++-- Memory management -----------------------------------------------------------++-- | /_ca_vec_init/ /len/ /ctx/ +--+-- Returns a pointer to an array of /len/ coefficients initialized to zero.+foreign import ccall "ca_vec.h _ca_vec_init"+ _ca_vec_init :: CLong -> Ptr CCaCtx -> IO (Ptr CCa)++-- | /ca_vec_init/ /vec/ /len/ /ctx/ +--+-- Initializes /vec/ to a length /len/ vector. All entries are set to zero.+foreign import ccall "ca_vec.h ca_vec_init"+ ca_vec_init :: Ptr CCaVec -> CLong -> Ptr CCaCtx -> IO ()++-- | /_ca_vec_clear/ /vec/ /len/ /ctx/ +--+-- Clears all /len/ entries in /vec/ and frees the pointer /vec/ itself.+foreign import ccall "ca_vec.h _ca_vec_clear"+ _ca_vec_clear :: Ptr CCa -> CLong -> Ptr CCaCtx -> IO ()++-- | /ca_vec_clear/ /vec/ /ctx/ +--+-- Clears the vector /vec/.+foreign import ccall "ca_vec.h ca_vec_clear"+ ca_vec_clear :: Ptr CCaVec -> Ptr CCaCtx -> IO ()++foreign import ccall "ca_vec.h &ca_vec_clear"+ p_ca_vec_clear :: FunPtr (Ptr CCaVec -> Ptr CCaCtx -> IO ())++-- | /_ca_vec_swap/ /vec1/ /vec2/ /len/ /ctx/ +--+-- Swaps the entries in /vec1/ and /vec2/ efficiently.+foreign import ccall "ca_vec.h _ca_vec_swap"+ _ca_vec_swap :: Ptr CCa -> Ptr CCa -> CLong -> Ptr CCaCtx -> IO ()++-- | /ca_vec_swap/ /vec1/ /vec2/ /ctx/ +--+-- Swaps the vectors /vec1/ and /vec2/ efficiently.+foreign import ccall "ca_vec.h ca_vec_swap"+ ca_vec_swap :: Ptr CCaVec -> Ptr CCaVec -> Ptr CCaCtx -> IO ()++-- Length ----------------------------------------------------------------------++-- | /ca_vec_length/ /vec/ /ctx/ +--+-- Returns the length of /vec/.+foreign import ccall "ca_vec.h ca_vec_length"+ ca_vec_length :: Ptr CCaVec -> Ptr CCaCtx -> IO CLong++-- | /_ca_vec_fit_length/ /vec/ /len/ /ctx/ +--+-- Allocates space in /vec/ for /len/ elements.+foreign import ccall "ca_vec.h _ca_vec_fit_length"+ _ca_vec_fit_length :: Ptr CCaVec -> CLong -> Ptr CCaCtx -> IO ()++-- | /ca_vec_set_length/ /vec/ /len/ /ctx/ +--+-- Sets the length of /vec/ to /len/. If /vec/ is shorter on input, it will+-- be zero-extended. If /vec/ is longer on input, it will be truncated.+foreign import ccall "ca_vec.h ca_vec_set_length"+ ca_vec_set_length :: Ptr CCaVec -> CLong -> Ptr CCaCtx -> IO ()++-- Entry -----------------------------------------------------------------------++foreign import ccall "ca_vec.h ca_vec_entry_ptr"+ ca_vec_entry_ptr :: Ptr CCaVec -> CLong -> Ptr CCa++-- Assignment ------------------------------------------------------------------++-- | /_ca_vec_set/ /res/ /src/ /len/ /ctx/ +--+-- Sets /res/ to a copy of /src/ of length /len/.+foreign import ccall "ca_vec.h _ca_vec_set"+ _ca_vec_set :: Ptr CCa -> Ptr CCa -> CLong -> Ptr CCaCtx -> IO ()++-- | /ca_vec_set/ /res/ /src/ /ctx/ +--+-- Sets /res/ to a copy of /src/.+foreign import ccall "ca_vec.h ca_vec_set"+ ca_vec_set :: Ptr CCaVec -> Ptr CCaVec -> Ptr CCaCtx -> IO ()++-- Special vectors -------------------------------------------------------------++-- | /_ca_vec_zero/ /res/ /len/ /ctx/ +--+-- Sets the /len/ entries in /res/ to zeros.+foreign import ccall "ca_vec.h _ca_vec_zero"+ _ca_vec_zero :: Ptr CCa -> CLong -> Ptr CCaCtx -> IO ()++-- | /ca_vec_zero/ /res/ /len/ /ctx/ +--+-- Sets /res/ to the length /len/ zero vector.+foreign import ccall "ca_vec.h ca_vec_zero"+ ca_vec_zero :: Ptr CCaVec -> CLong -> Ptr CCaCtx -> IO ()++-- Input and output ------------------------------------------------------------++-- | /ca_vec_print/ /vec/ /ctx/ +--+-- Prints /vec/ to standard output. The coefficients are printed on+-- separate lines.+foreign import ccall "ca_vec.h ca_vec_print"+ ca_vec_print :: Ptr CCaVec -> Ptr CCaCtx -> IO ()++-- | /ca_vec_printn/ /poly/ /digits/ /ctx/ +--+-- Prints a decimal representation of /vec/ with precision specified by+-- /digits/. The coefficients are comma-separated and the whole list is+-- enclosed in square brackets.+foreign import ccall "ca_vec.h ca_vec_printn"+ ca_vec_printn :: Ptr CCaVec -> CLong -> Ptr CCaCtx -> IO ()++-- List operations -------------------------------------------------------------++-- | /ca_vec_append/ /vec/ /f/ /ctx/ +--+-- Appends /f/ to the end of /vec/.+foreign import ccall "ca_vec.h ca_vec_append"+ ca_vec_append :: Ptr CCaVec -> Ptr CCa -> Ptr CCaCtx -> IO ()++-- Arithmetic ------------------------------------------------------------------++-- | /_ca_vec_neg/ /res/ /src/ /len/ /ctx/ +--+foreign import ccall "ca_vec.h _ca_vec_neg"+ _ca_vec_neg :: Ptr CCa -> Ptr CCa -> CLong -> Ptr CCaCtx -> IO ()++-- | /ca_vec_neg/ /res/ /src/ /ctx/ +--+-- Sets /res/ to the negation of /src/.+foreign import ccall "ca_vec.h ca_vec_neg"+ ca_vec_neg :: Ptr CCaVec -> Ptr CCaVec -> Ptr CCaCtx -> IO ()++-- | /_ca_vec_add/ /res/ /vec1/ /vec2/ /len/ /ctx/ +--+foreign import ccall "ca_vec.h _ca_vec_add"+ _ca_vec_add :: Ptr CCa -> Ptr CCa -> Ptr CCa -> CLong -> Ptr CCaCtx -> IO ()++-- | /_ca_vec_sub/ /res/ /vec1/ /vec2/ /len/ /ctx/ +--+-- Sets /res/ to the sum or difference of /vec1/ and /vec2/, all vectors+-- having length /len/.+foreign import ccall "ca_vec.h _ca_vec_sub"+ _ca_vec_sub :: Ptr CCa -> Ptr CCa -> Ptr CCa -> CLong -> Ptr CCaCtx -> IO ()++-- | /_ca_vec_scalar_mul_ca/ /res/ /src/ /len/ /c/ /ctx/ +--+-- Sets /res/ to /src/ multiplied by /c/, all vectors having length /len/.+foreign import ccall "ca_vec.h _ca_vec_scalar_mul_ca"+ _ca_vec_scalar_mul_ca :: Ptr CCa -> Ptr CCa -> CLong -> Ptr CCa -> Ptr CCaCtx -> IO ()++-- | /_ca_vec_scalar_div_ca/ /res/ /src/ /len/ /c/ /ctx/ +--+-- Sets /res/ to /src/ divided by /c/, all vectors having length /len/.+foreign import ccall "ca_vec.h _ca_vec_scalar_div_ca"+ _ca_vec_scalar_div_ca :: Ptr CCa -> Ptr CCa -> CLong -> Ptr CCa -> Ptr CCaCtx -> IO ()++-- | /_ca_vec_scalar_addmul_ca/ /res/ /src/ /len/ /c/ /ctx/ +--+-- Adds /src/ multiplied by /c/ to the vector /res/, all vectors having+-- length /len/.+foreign import ccall "ca_vec.h _ca_vec_scalar_addmul_ca"+ _ca_vec_scalar_addmul_ca :: Ptr CCa -> Ptr CCa -> CLong -> Ptr CCa -> Ptr CCaCtx -> IO ()++-- | /_ca_vec_scalar_submul_ca/ /res/ /src/ /len/ /c/ /ctx/ +--+-- Subtracts /src/ multiplied by /c/ from the vector /res/, all vectors+-- having length /len/.+foreign import ccall "ca_vec.h _ca_vec_scalar_submul_ca"+ _ca_vec_scalar_submul_ca :: Ptr CCa -> Ptr CCa -> CLong -> Ptr CCa -> Ptr CCaCtx -> IO ()++-- Comparisons and properties --------------------------------------------------++-- | /_ca_vec_check_is_zero/ /vec/ /len/ /ctx/ +--+-- Returns whether /vec/ is the zero vector.+foreign import ccall "ca_vec.h _ca_vec_check_is_zero"+ _ca_vec_check_is_zero :: Ptr CCa -> CLong -> Ptr CCaCtx -> IO (Ptr CTruth)++-- Internal representation -----------------------------------------------------++-- | /_ca_vec_is_fmpq_vec/ /vec/ /len/ /ctx/ +--+-- Checks if all elements of /vec/ are structurally rational numbers.+foreign import ccall "ca_vec.h _ca_vec_is_fmpq_vec"+ _ca_vec_is_fmpq_vec :: Ptr CCa -> CLong -> Ptr CCaCtx -> IO CInt++-- | /_ca_vec_fmpq_vec_is_fmpz_vec/ /vec/ /len/ /ctx/ +--+-- Assuming that all elements of /vec/ are structurally rational numbers,+-- checks if all elements are integers.+foreign import ccall "ca_vec.h _ca_vec_fmpq_vec_is_fmpz_vec"+ _ca_vec_fmpq_vec_is_fmpz_vec :: Ptr CCa -> CLong -> Ptr CCaCtx -> IO CInt++-- | /_ca_vec_fmpq_vec_get_fmpz_vec_den/ /c/ /den/ /vec/ /len/ /ctx/ +--+-- Assuming that all elements of /vec/ are structurally rational numbers,+-- converts them to a vector of integers /c/ on a common denominator /den/.+foreign import ccall "ca_vec.h _ca_vec_fmpq_vec_get_fmpz_vec_den"+ _ca_vec_fmpq_vec_get_fmpz_vec_den :: Ptr CFmpz -> Ptr CFmpz -> Ptr CCa -> CLong -> Ptr CCaCtx -> IO ()++-- | /_ca_vec_set_fmpz_vec_div_fmpz/ /res/ /v/ /den/ /len/ /ctx/ +--+-- Sets /res/ to the rational vector given by numerators /v/ and the common+-- denominator /den/.+foreign import ccall "ca_vec.h _ca_vec_set_fmpz_vec_div_fmpz"+ _ca_vec_set_fmpz_vec_div_fmpz :: Ptr CCa -> Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CCaCtx -> IO ()++++
+ src/Data/Number/Flint/Calcium/FFI.hsc view
@@ -0,0 +1,280 @@+{-|+module : Data.Number.Flint.Calcium.FFI+copyright : (c) 2023 Hartmut Monien+license : GNU GPL, version 2 or above (see LICENSE)+maintainer : hmonien@uni-bonn.de+-}+module Data.Number.Flint.Calcium.FFI (+ -- * Calcium+ CalciumStream (..)+ , CCalciumStream (..)+ , newCalciumStreamFile+ , newCalciumStreamStr+ , withCalciumStream+ , CCalciumFunctionCode (..)+ -- * Version+ , calcium_version+ -- * Triple-valued logic+ , t_true+ , t_false+ , t_unknown+ , CTruth (..)+ -- * Flint, Arb and Antic extras+ --, calcium_fmpz_hash+ , calcium_func_name+ -- * Input and output+ , calcium_stream_init_file+ , calcium_stream_init_str+ , calcium_write+ , calcium_write_free+ , calcium_write_si+ , calcium_write_fmpz+ , calcium_write_arb+ , calcium_write_acb+ -- * Function codes+ , ca_QQBar+ , ca_Neg+ , ca_Add+ , ca_Sub+ , ca_Mul+ , ca_Div+ , ca_Sqrt+ , ca_Cbrt+ , ca_Root+ , ca_Floor+ , ca_Ceil+ , ca_Abs+ , ca_Sign+ , ca_Re+ , ca_Im+ , ca_Arg+ , ca_Conjugate+ , ca_Pi+ , ca_Sin+ , ca_Cos+ , ca_Exp+ , ca_Log+ , ca_Pow+ , ca_Tan+ , ca_Cot+ , ca_Cosh+ , ca_Sinh+ , ca_Tanh+ , ca_Coth+ , ca_Atan+ , ca_Acos+ , ca_Asin+ , ca_Acot+ , ca_Atanh+ , ca_Acosh+ , ca_Asinh+ , ca_Acoth+ , ca_Euler+ , ca_Gamma+ , ca_LogGamma+ , ca_Psi+ , ca_Erf+ , ca_Erfc+ , ca_Erfi+ , ca_RiemannZeta+ , ca_HurwitzZeta+ , ca_FUNC_CODE_LENGTH+) where++-- Calcium ---------------------------------------------------------------------++import Foreign.C.Types+import Foreign.C.String+import Foreign.ForeignPtr+import Foreign.Ptr+import Foreign.Storable+import Foreign.Marshal.Alloc (free)++import Data.Number.Flint.Fmpz+import Data.Number.Flint.Arb.Types+import Data.Number.Flint.Acb.Types++#include <flint/flint.h>+#include <flint/calcium.h>++-- calcium_stream_t ------------------------------------------------------------++data CalciumStream = CalciumStream {-# UNPACK #-} !(ForeignPtr CCalciumStream)+data CCalciumStream = CCalciumStream (Ptr CFile) CString CLong CLong++instance Storable CCalciumStream where+ {-# INLINE sizeOf #-}+ sizeOf _ = #{size calcium_stream_t}+ {-# INLINE alignment #-}+ alignment _ = #{alignment calcium_stream_t}+ peek ptr = CCalciumStream+ <$> (return $ castPtr ptr)+ <*> #{peek calcium_stream_struct, s } ptr+ <*> #{peek calcium_stream_struct, len } ptr+ <*> #{peek calcium_stream_struct, alloc} ptr+ poke ptr (CCalciumStream fp s len alloc) = do+ #{poke calcium_stream_struct, fp } ptr fp+ #{poke calcium_stream_struct, s } ptr s+ #{poke calcium_stream_struct, len } ptr len+ #{poke calcium_stream_struct, alloc} ptr alloc+ +newCalciumStreamFile fp = do+ p <- mallocForeignPtr+ withForeignPtr p $ \p -> do+ calcium_stream_init_file p fp+ return $ CalciumStream p++newCalciumStreamStr s = do+ p <- mallocForeignPtr+ withForeignPtr p $ \p -> do+ calcium_stream_init_str p+ return $ CalciumStream p+ +withCalciumStream (CalciumStream p) f = do+ withForeignPtr p $ \fp -> (CalciumStream p,) <$> f fp+ +-- Version ---------------------------------------------------------------------++-- | /calcium_version/ +--+-- Returns a pointer to the version of the library as a string @X.Y.Z@.+foreign import ccall "calcium.h calcium_version"+ calcium_version :: IO CString++-- Triple-valued logic ---------------------------------------------------------++-- | Triple-valued logic+newtype CTruth = CTruth {_CTruth :: CULong} deriving Eq++#{enum CTruth, CTruth+ , t_true = T_TRUE+ , t_false = T_FALSE+ , t_unknown = T_UNKNOWN+ }++instance Show CTruth where+ show x+ | x == t_true = "T_TRUE"+ | x == t_false = "T_FALSE"+ | x == t_unknown = "T_UNKNOWN"+ +newtype CCalciumFunctionCode =+ CCalciumFunctionCode {_CCalciumFunctionCode :: CULong} deriving (Show, Eq)++#{enum CCalciumFunctionCode, CCalciumFunctionCode+ , ca_QQBar = CA_QQBar+ , ca_Neg = CA_Neg+ , ca_Add = CA_Add+ , ca_Sub = CA_Sub+ , ca_Mul = CA_Mul+ , ca_Div = CA_Div+ , ca_Sqrt = CA_Sqrt+ , ca_Cbrt = CA_Cbrt+ , ca_Root = CA_Root+ , ca_Floor = CA_Floor+ , ca_Ceil = CA_Ceil+ , ca_Abs = CA_Abs+ , ca_Sign = CA_Sign+ , ca_Re = CA_Re+ , ca_Im = CA_Im+ , ca_Arg = CA_Arg+ , ca_Conjugate = CA_Conjugate+ , ca_Pi = CA_Pi+ , ca_Sin = CA_Sin+ , ca_Cos = CA_Cos+ , ca_Exp = CA_Exp+ , ca_Log = CA_Log+ , ca_Pow = CA_Pow+ , ca_Tan = CA_Tan+ , ca_Cot = CA_Cot+ , ca_Cosh = CA_Cosh+ , ca_Sinh = CA_Sinh+ , ca_Tanh = CA_Tanh+ , ca_Coth = CA_Coth+ , ca_Atan = CA_Atan+ , ca_Acos = CA_Acos+ , ca_Asin = CA_Asin+ , ca_Acot = CA_Acot+ , ca_Atanh = CA_Atanh+ , ca_Acosh = CA_Acosh+ , ca_Asinh = CA_Asinh+ , ca_Acoth = CA_Acoth+ , ca_Euler = CA_Euler+ , ca_Gamma = CA_Gamma+ , ca_LogGamma = CA_LogGamma+ , ca_Psi = CA_Psi+ , ca_Erf = CA_Erf+ , ca_Erfc = CA_Erfc+ , ca_Erfi = CA_Erfi+ , ca_RiemannZeta = CA_RiemannZeta+ , ca_HurwitzZeta = CA_HurwitzZeta+ , ca_FUNC_CODE_LENGTH = CA_FUNC_CODE_LENGTH+ }++-- Flint, Arb and Antic extras -------------------------------------------------++-- -- | /calcium_fmpz_hash/ /x/ +--+-- -- Hash function for integers. The algorithm may change; presently, this+-- -- simply extracts the low word (with sign).+-- foreign import ccall "calcium.h calcium_fmpz_hash"+-- calcium_fmpz_hash :: Ptr CFmpz -> IO CULong++foreign import ccall "calcium.h calcium_stream_init_file"+ calcium_func_name :: CCalciumFunctionCode -> IO CString++-- Input and output ------------------------------------------------------------++-- | /calcium_stream_init_file/ /out/ /fp/ +--+-- Initializes the stream /out/ for writing to the file /fp/. The file can+-- be /stdout/, /stderr/, or any file opened for writing by the user.+foreign import ccall "calcium.h calcium_stream_init_file"+ calcium_stream_init_file :: Ptr CCalciumStream -> Ptr CFile -> IO ()++-- | /calcium_stream_init_str/ /out/ ++-- Initializes the stream /out/ for writing to a string in memory. When+-- finished, the user should free the string (the /s/ member of /out/ with+-- @flint_free()@).+calcium_stream_init_str out = do+ cs <- newCString (replicate 16 '\0')+ poke out (CCalciumStream nullPtr cs 0 16)+ +-- | /calcium_write/ /out/ /s/ +--+-- Writes the string /s/ to /out/.+foreign import ccall "calcium.h calcium_write"+ calcium_write :: Ptr CCalciumStream -> CString -> IO ()++-- | /calcium_write_free/ /out/ /s/ +--+-- Writes /s/ to /out/ and then frees /s/ by calling @flint_free()@.+calcium_write_free :: Ptr CCalciumStream -> CString -> IO ()+calcium_write_free out s = do+ calcium_write out s+ free s+ +-- | /calcium_write_si/ /out/ /x/ +foreign import ccall "calcium.h calcium_write_si"+ calcium_write_si :: Ptr CCalciumStream -> CLong -> IO ()+ +-- | /calcium_write_fmpz/ /out/ /x/ +--+-- Writes the integer /x/ to /out/.+foreign import ccall "calcium.h calcium_write_fmpz"+ calcium_write_fmpz :: Ptr CCalciumStream+ -> Ptr CFmpz -> IO ()++-- | /calcium_write_arb/ /out/ /z/ /digits/ /flags/ +foreign import ccall "calcium.h calcium_write_arb"+ calcium_write_arb :: Ptr CCalciumStream+ -> Ptr CArb -> CLong -> CULong -> IO ()+ +-- | /calcium_write_acb/ /out/ /z/ /digits/ /flags/ +--+-- Writes the Arb number /z/ to /out/, showing /digits/ digits and with the+-- display style specified by /flags/ (@ARB_STR_NO_RADIUS@, etc.).+foreign import ccall "calcium.h calcium_write_acb"+ calcium_write_acb :: Ptr CCalciumStream+ -> Ptr CAcb -> CLong -> CULong -> IO ()
+ src/Data/Number/Flint/Calcium/Fexpr.hs view
@@ -0,0 +1,114 @@+{-|+module : Data.Number.Flint.Calcium.Fexpr+copyright : (c) 2023 Hartmut Monien+license : GNU GPL, version 2 or above (see LICENSE)+maintainer : hmonien@uni-bonn.de++This module supports working with symbolic expressions.++== Introduction++Formally, a symbolic expression is either:++* An atom being one of ++ * An integer, for example 0 or -34.+ * A symbol, for example x, Mul, SomeUserNamedSymbol. + Symbols should be valid C identifiers (containing + only the characters A-Z, a-z, 0-9, _, and not starting with a digit).++ * A string, for example "Hello, world!". For the moment, we only + consider ASCII strings, but there is no obstacle in principle + to supporting UTF-8.++* A non-atomic expression, \(e_0(e_1,e_2,\ldots e_n)\) +representing a function call where \((e_1,\ldots,e_n)\) are +symbolic expressions.++The meaning of an expression depends on the interpretation of symbols+in a given context. For example, with a standard interpretation (used+within Calcium) of the symbols @Mul@, @Add@ and @Neg@, the expression+@Mul(3, Add(Neg(x), y))@ encodes the formula \(3 \cdot ((-x)+y)\)+where @x@ and @y@ are symbolic variables. See @fexpr-builtin@ for+documentation of builtin symbols.++== Computing and embedding data ++Symbolic expressions are usually not the best data structure to use+directly for heavy-duty computations. Functions acting on symbolic+expressions will typically convert to a dedicated data structure (e.g.+polynomials) internally and (optionally) convert the final result back+to a symbolic expression.++Symbolic expressions do not allow embedding arbitrary binary objects+such as Flint\/Arb\/Antic\/Calcium types as atoms. This is done on+purpose to make symbolic expressions easy to use as a data exchange+format. To embed an object in an expression, one has the following+options:++* Represent the object structurally using atoms supported natively by+symbolic expressions (for example, an integer polynomial can be+represented as a list of coefficients or as an arithmetic expression+tree).++* Introduce a dummy symbol to represent the object, maintaining an+external translation table mapping this symbol to the intended value.++* Encode the object using a string or symbol name. This is generally+not recommended, as it requires parsing; properly used, symbolic+expressions have the benefit of being able to represent the parsed+structure.++== Flat-packed representation++Symbolic expressions are often implemented using trees of pointers+(often together with hash tables for uniqueness), requiring some form of+memory management. The @fexpr_t@ type, by contrast, stores a symbolic+expression using a \"flat-packed\" representation without internal+pointers. The expression data is just an array of words (@ulong@). The+first word is a header encoding type information (whether the expression+is a function call or an atom, and the type of the atom) and the total+number of words in the expression. For atoms, the data is stored either+in the header word itself (small integers and short symbols\/strings) or+in the following words. For function calls, the header is followed by+the expressions \(e_0\), ..., \(e_n\) packed contiguously in memory.++Pros:++* Memory management is trivial.++* Copying an expression is just copying an array of words.++* Comparing expressions for equality is just comparing arrays of words.++* Merging expressions is basically just concatenating arrays of words.++*Expression data can be shared freely in binary form between threads+and even between machines (as long as all machines have the same word+size and endianness). ++Cons:++* Repeated instances of the same subexpression cannot share memory (a+workaround is to introduce local dummy symbols for repeated+subexpressions).++* Extracting a subexpression for modification generally requires+making a complete copy of that subxepression (however, for read-only+access to subexpressions, one can use “view” expressions which have+zero overhead).++* Manipulating a part of an expression generally requires rebuilding the whole expression.++* Building an expression incrementally is typically+ \(O\left(n^2\right)\). As a workaround, it is a good idea to work with+balanced (low-depth) expressions and try to construct an expression in+one go (for example, to create a sum, create a single Add expression+with many arguments instead of chaining binary Add operations).++-}+module Data.Number.Flint.Calcium.Fexpr (+ module Data.Number.Flint.Calcium.Fexpr.FFI+ ) where+ +import Data.Number.Flint.Calcium.Fexpr.FFI
+ src/Data/Number/Flint/Calcium/Fexpr/Builtin.hs view
@@ -0,0 +1,543 @@+{-|+module : Data.Number.Flint.Calcium.Fexpr.Builtin+copyright : (c) 2023 Hartmut Monien+license : GNU GPL, version 2 or above (see LICENSE)+maintainer : hmonien@uni-bonn.de++This module defines symbol names with a predefined meaning for use in symbolic expressions. These symbols will eventually all support LaTeX rendering as well as symbolic and numerical evaluation (where applicable).++By convention, all builtin symbol names are at least two characters long and start with an uppercase letter. Single-letter symbol names and symbol names beginning with a lowercase letter are reserved for variables.++Here we define a data type FEXR_Builtin where all the C macros are map to +constructors. See the instances of Fexpr on how to use the maps.+-}+module Data.Number.Flint.Calcium.Fexpr.Builtin (+ fexpr_builtin_name+ , fexpr_builtin_lookup+ , fexpr_builtin_length+ -- * Hash maps+ , fexpr_builtin_hash+ , fexpr_builtin_hash_name+ -- * Built in tags+ , FEXR_Builtin (..)+) where++import Foreign.C.Types+import Foreign.C.String++import qualified Data.Map as Map+import Data.Map (Map, (!), (!?))++-- | /fexpr_builtin_lookup/ /s/+--+-- Returns the internal index used to encode the builtin symbol with+-- name s in expressions. If s is not the name of a builtin symbol,+-- returns -1+fexpr_builtin_lookup :: CString -> IO CLong+fexpr_builtin_lookup s = do+ name <- peekCString s+ case fexpr_builtin_hash_name !? name of+ Just n -> return n+ _ -> return (-1)++-- | /fexpr_builtin_name/ /n/+--+-- Returns a pointer for a string giving the name of the+-- builtin symbol with index n+fexpr_builtin_name :: CLong -> IO CString+fexpr_builtin_name n = newCString $ fexpr_builtin_names !! (fromIntegral n)++-- | /fexpr_builtin_length/+--+-- Returns the number of builtin symbols.+fexpr_builtin_length = fromIntegral $ length fexpr_builtins++-- maps ------------------------------------------------------------------------++fexpr_builtin_hash :: Map FEXR_Builtin CLong+fexpr_builtin_hash = Map.fromList $ zip fexpr_builtins [0..]++fexpr_builtin_hash_name :: Map String CLong +fexpr_builtin_hash_name = Map.fromList $ zip fexpr_builtin_names [0..]++--------------------------------------------------------------------------------++fexpr_builtin_names = map show fexpr_builtins+fexpr_builtins = [FEXPR_AGM .. FEXPR_zeta_]++data FEXR_Builtin+ = FEXPR_AGM+ | FEXPR_AGMSequence+ | FEXPR_Abs+ | FEXPR_Acos+ | FEXPR_Acosh+ | FEXPR_Acot+ | FEXPR_Acoth+ | FEXPR_Acsc+ | FEXPR_Acsch+ | FEXPR_Add+ | FEXPR_AiryAi+ | FEXPR_AiryAiZero+ | FEXPR_AiryBi+ | FEXPR_AiryBiZero+ | FEXPR_AlgebraicNumberSerialized+ | FEXPR_AlgebraicNumbers+ | FEXPR_All+ | FEXPR_AnalyticContinuation+ | FEXPR_And+ | FEXPR_AngleBrackets+ | FEXPR_Approximation+ | FEXPR_Arg+ | FEXPR_ArgMax+ | FEXPR_ArgMaxUnique+ | FEXPR_ArgMin+ | FEXPR_ArgMinUnique+ | FEXPR_Asec+ | FEXPR_Asech+ | FEXPR_Asin+ | FEXPR_Asinh+ | FEXPR_AsymptoticTo+ | FEXPR_Atan+ | FEXPR_Atan2+ | FEXPR_Atanh+ | FEXPR_BarnesG+ | FEXPR_BellNumber+ | FEXPR_BernoulliB+ | FEXPR_BernoulliPolynomial+ | FEXPR_BernsteinEllipse+ | FEXPR_BesselI+ | FEXPR_BesselJ+ | FEXPR_BesselJZero+ | FEXPR_BesselK+ | FEXPR_BesselY+ | FEXPR_BesselYZero+ | FEXPR_BetaFunction+ | FEXPR_Binomial+ | FEXPR_Braces+ | FEXPR_Brackets+ | FEXPR_CC+ | FEXPR_Call+ | FEXPR_CallIndeterminate+ | FEXPR_Cardinality+ | FEXPR_CarlsonHypergeometricR+ | FEXPR_CarlsonHypergeometricT+ | FEXPR_CarlsonRC+ | FEXPR_CarlsonRD+ | FEXPR_CarlsonRF+ | FEXPR_CarlsonRG+ | FEXPR_CarlsonRJ+ | FEXPR_CartesianPower+ | FEXPR_CartesianProduct+ | FEXPR_Case+ | FEXPR_Cases+ | FEXPR_CatalanConstant+ | FEXPR_Ceil+ | FEXPR_Characteristic+ | FEXPR_ChebyshevT+ | FEXPR_ChebyshevU+ | FEXPR_ClosedComplexDisk+ | FEXPR_ClosedOpenInterval+ | FEXPR_Coefficient+ | FEXPR_Column+ | FEXPR_ColumnMatrix+ | FEXPR_CommutativeRings+ | FEXPR_ComplexBranchDerivative+ | FEXPR_ComplexDerivative+ | FEXPR_ComplexInfinities+ | FEXPR_ComplexLimit+ | FEXPR_ComplexSignedInfinities+ | FEXPR_ComplexSingularityClosure+ | FEXPR_ComplexZeroMultiplicity+ | FEXPR_Concatenation+ | FEXPR_CongruentMod+ | FEXPR_Conjugate+ | FEXPR_ConreyGenerator+ | FEXPR_Cos+ | FEXPR_CosIntegral+ | FEXPR_Cosh+ | FEXPR_CoshIntegral+ | FEXPR_Cot+ | FEXPR_Coth+ | FEXPR_CoulombC+ | FEXPR_CoulombF+ | FEXPR_CoulombG+ | FEXPR_CoulombH+ | FEXPR_CoulombSigma+ | FEXPR_Csc+ | FEXPR_Csch+ | FEXPR_Csgn+ | FEXPR_CurvePath+ | FEXPR_Cyclotomic+ | FEXPR_Decimal+ | FEXPR_DedekindEta+ | FEXPR_DedekindEtaEpsilon+ | FEXPR_DedekindSum+ | FEXPR_Def+ | FEXPR_Delta+ | FEXPR_Delta_+ | FEXPR_Derivative+ | FEXPR_Det+ | FEXPR_DiagonalMatrix+ | FEXPR_DigammaFunction+ | FEXPR_DigammaFunctionZero+ | FEXPR_DirichletCharacter+ | FEXPR_DirichletGroup+ | FEXPR_DirichletL+ | FEXPR_DirichletLZero+ | FEXPR_DirichletLambda+ | FEXPR_DiscreteLog+ | FEXPR_Div+ | FEXPR_Divides+ | FEXPR_DivisorProduct+ | FEXPR_DivisorSigma+ | FEXPR_DivisorSum+ | FEXPR_DoubleFactorial+ | FEXPR_EisensteinE+ | FEXPR_EisensteinG+ | FEXPR_Element+ | FEXPR_Ellipsis+ | FEXPR_EllipticE+ | FEXPR_EllipticK+ | FEXPR_EllipticPi+ | FEXPR_EllipticRootE+ | FEXPR_Enclosure+ | FEXPR_Equal+ | FEXPR_EqualAndElement+ | FEXPR_EqualNearestDecimal+ | FEXPR_EqualQSeriesEllipsis+ | FEXPR_Equivalent+ | FEXPR_Erf+ | FEXPR_Erfc+ | FEXPR_Erfi+ | FEXPR_Euler+ | FEXPR_EulerE+ | FEXPR_EulerPhi+ | FEXPR_EulerPolynomial+ | FEXPR_EulerQSeries+ | FEXPR_Exists+ | FEXPR_Exp+ | FEXPR_ExpIntegralE+ | FEXPR_ExpIntegralEi+ | FEXPR_ExtendedRealNumbers+ | FEXPR_Factorial+ | FEXPR_FallingFactorial+ | FEXPR_False+ | FEXPR_Fibonacci+ | FEXPR_Fields+ | FEXPR_FiniteField+ | FEXPR_Floor+ | FEXPR_For+ | FEXPR_FormalLaurentSeries+ | FEXPR_FormalPowerSeries+ | FEXPR_FormalPuiseuxSeries+ | FEXPR_FresnelC+ | FEXPR_FresnelS+ | FEXPR_Fun+ | FEXPR_GCD+ | FEXPR_Gamma+ | FEXPR_GaussLegendreWeight+ | FEXPR_GaussSum+ | FEXPR_GegenbauerC+ | FEXPR_GeneralLinearGroup+ | FEXPR_GeneralizedBernoulliB+ | FEXPR_GeneralizedRiemannHypothesis+ | FEXPR_GlaisherConstant+ | FEXPR_GoldenRatio+ | FEXPR_Greater+ | FEXPR_GreaterEqual+ | FEXPR_GreekGamma+ | FEXPR_GreekGamma_+ | FEXPR_GreekPi+ | FEXPR_GreekPi_+ | FEXPR_Guess+ | FEXPR_HankelH1+ | FEXPR_HankelH2+ | FEXPR_HarmonicNumber+ | FEXPR_HermiteH+ | FEXPR_HilbertClassPolynomial+ | FEXPR_HilbertMatrix+ | FEXPR_HurwitzZeta+ | FEXPR_Hypergeometric0F1+ | FEXPR_Hypergeometric0F1Regularized+ | FEXPR_Hypergeometric1F1+ | FEXPR_Hypergeometric1F1Regularized+ | FEXPR_Hypergeometric1F2+ | FEXPR_Hypergeometric1F2Regularized+ | FEXPR_Hypergeometric2F0+ | FEXPR_Hypergeometric2F1+ | FEXPR_Hypergeometric2F1Regularized+ | FEXPR_Hypergeometric2F2+ | FEXPR_Hypergeometric2F2Regularized+ | FEXPR_Hypergeometric3F2+ | FEXPR_Hypergeometric3F2Regularized+ | FEXPR_HypergeometricU+ | FEXPR_HypergeometricUStar+ | FEXPR_HypergeometricUStarRemainder+ | FEXPR_IdentityMatrix+ | FEXPR_Im+ | FEXPR_Implies+ | FEXPR_IncompleteBeta+ | FEXPR_IncompleteBetaRegularized+ | FEXPR_IncompleteEllipticE+ | FEXPR_IncompleteEllipticF+ | FEXPR_IncompleteEllipticPi+ | FEXPR_IndefiniteIntegralEqual+ | FEXPR_Infimum+ | FEXPR_Infinity+ | FEXPR_IntegersGreaterEqual+ | FEXPR_IntegersLessEqual+ | FEXPR_Integral+ | FEXPR_Intersection+ | FEXPR_Interval+ | FEXPR_IsEven+ | FEXPR_IsHolomorphicOn+ | FEXPR_IsMeromorphicOn+ | FEXPR_IsOdd+ | FEXPR_IsPrime+ | FEXPR_Item+ | FEXPR_JacobiP+ | FEXPR_JacobiSymbol+ | FEXPR_JacobiTheta+ | FEXPR_JacobiThetaEpsilon+ | FEXPR_JacobiThetaPermutation+ | FEXPR_JacobiThetaQ+ | FEXPR_KeiperLiLambda+ | FEXPR_KhinchinConstant+ | FEXPR_KroneckerDelta+ | FEXPR_KroneckerSymbol+ | FEXPR_LCM+ | FEXPR_LaguerreL+ | FEXPR_LambertW+ | FEXPR_Lamda+ | FEXPR_Lamda_+ | FEXPR_LandauG+ | FEXPR_Lattice+ | FEXPR_LeftLimit+ | FEXPR_LegendreP+ | FEXPR_LegendrePolynomialZero+ | FEXPR_LegendreSymbol+ | FEXPR_Length+ | FEXPR_LerchPhi+ | FEXPR_Less+ | FEXPR_LessEqual+ | FEXPR_Limit+ | FEXPR_LiouvilleLambda+ | FEXPR_List+ | FEXPR_Log+ | FEXPR_LogBarnesG+ | FEXPR_LogBarnesGRemainder+ | FEXPR_LogGamma+ | FEXPR_LogIntegral+ | FEXPR_Logic+ | FEXPR_LowerGamma+ | FEXPR_Matrices+ | FEXPR_Matrix+ | FEXPR_Matrix2x2+ | FEXPR_Max+ | FEXPR_Maximum+ | FEXPR_MeromorphicDerivative+ | FEXPR_MeromorphicLimit+ | FEXPR_Min+ | FEXPR_Minimum+ | FEXPR_Mod+ | FEXPR_ModularGroupAction+ | FEXPR_ModularGroupFundamentalDomain+ | FEXPR_ModularJ+ | FEXPR_ModularLambda+ | FEXPR_ModularLambdaFundamentalDomain+ | FEXPR_MoebiusMu+ | FEXPR_Mul+ | FEXPR_MultiZetaValue+ | FEXPR_NN+ | FEXPR_Neg+ | FEXPR_Not+ | FEXPR_NotElement+ | FEXPR_NotEqual+ | FEXPR_NumberE+ | FEXPR_NumberI+ | FEXPR_Omega+ | FEXPR_Omega_+ | FEXPR_One+ | FEXPR_OpenClosedInterval+ | FEXPR_OpenComplexDisk+ | FEXPR_OpenInterval+ | FEXPR_OpenRealBall+ | FEXPR_Or+ | FEXPR_Otherwise+ | FEXPR_PSL2Z+ | FEXPR_Parentheses+ | FEXPR_PartitionsP+ | FEXPR_Path+ | FEXPR_Phi+ | FEXPR_Phi_+ | FEXPR_Pi+ | FEXPR_Pol+ | FEXPR_Poles+ | FEXPR_PolyLog+ | FEXPR_Polynomial+ | FEXPR_PolynomialDegree+ | FEXPR_PolynomialFractions+ | FEXPR_PolynomialRootIndexed+ | FEXPR_PolynomialRootNearest+ | FEXPR_Polynomials+ | FEXPR_Pos+ | FEXPR_Pow+ | FEXPR_Prime+ | FEXPR_PrimePi+ | FEXPR_PrimeProduct+ | FEXPR_PrimeSum+ | FEXPR_Primes+ | FEXPR_PrimitiveDirichletCharacters+ | FEXPR_PrimitiveReducedPositiveIntegralBinaryQuadraticForms+ | FEXPR_Product+ | FEXPR_ProjectiveComplexNumbers+ | FEXPR_ProjectiveRealNumbers+ | FEXPR_Psi+ | FEXPR_Psi_+ | FEXPR_QQ+ | FEXPR_QSeriesCoefficient+ | FEXPR_QuotientRing+ | FEXPR_RR+ | FEXPR_Range+ | FEXPR_Re+ | FEXPR_RealAbs+ | FEXPR_RealAlgebraicNumbers+ | FEXPR_RealBall+ | FEXPR_RealDerivative+ | FEXPR_RealInfinities+ | FEXPR_RealLimit+ | FEXPR_RealSignedInfinities+ | FEXPR_RealSingularityClosure+ | FEXPR_Repeat+ | FEXPR_Residue+ | FEXPR_RiemannHypothesis+ | FEXPR_RiemannXi+ | FEXPR_RiemannZeta+ | FEXPR_RiemannZetaZero+ | FEXPR_RightLimit+ | FEXPR_Rings+ | FEXPR_RisingFactorial+ | FEXPR_Root+ | FEXPR_RootOfUnity+ | FEXPR_Row+ | FEXPR_RowMatrix+ | FEXPR_SL2Z+ | FEXPR_Same+ | FEXPR_Sec+ | FEXPR_Sech+ | FEXPR_SequenceLimit+ | FEXPR_SequenceLimitInferior+ | FEXPR_SequenceLimitSuperior+ | FEXPR_Ser+ | FEXPR_Set+ | FEXPR_SetMinus+ | FEXPR_Sets+ | FEXPR_ShowExpandedNormalForm+ | FEXPR_Sigma+ | FEXPR_Sigma_+ | FEXPR_Sign+ | FEXPR_SignExtendedComplexNumbers+ | FEXPR_Sin+ | FEXPR_SinIntegral+ | FEXPR_Sinc+ | FEXPR_SingularValues+ | FEXPR_Sinh+ | FEXPR_SinhIntegral+ | FEXPR_SloaneA+ | FEXPR_Solutions+ | FEXPR_SpecialLinearGroup+ | FEXPR_Spectrum+ | FEXPR_SphericalHarmonicY+ | FEXPR_Sqrt+ | FEXPR_SquaresR+ | FEXPR_Step+ | FEXPR_StieltjesGamma+ | FEXPR_StirlingCycle+ | FEXPR_StirlingS1+ | FEXPR_StirlingS2+ | FEXPR_StirlingSeriesRemainder+ | FEXPR_Sub+ | FEXPR_Subscript+ | FEXPR_Subset+ | FEXPR_SubsetEqual+ | FEXPR_Subsets+ | FEXPR_Sum+ | FEXPR_Supremum+ | FEXPR_SymmetricPolynomial+ | FEXPR_Tan+ | FEXPR_Tanh+ | FEXPR_Theta+ | FEXPR_Theta_+ | FEXPR_True+ | FEXPR_Tuple+ | FEXPR_Tuples+ | FEXPR_Undefined+ | FEXPR_Union+ | FEXPR_UniqueSolution+ | FEXPR_UniqueZero+ | FEXPR_UnitCircle+ | FEXPR_Unknown+ | FEXPR_UnsignedInfinity+ | FEXPR_UpperGamma+ | FEXPR_UpperHalfPlane+ | FEXPR_WeierstrassP+ | FEXPR_WeierstrassSigma+ | FEXPR_WeierstrassZeta+ | FEXPR_Where+ | FEXPR_XGCD+ | FEXPR_XX+ | FEXPR_Xi+ | FEXPR_Xi_+ | FEXPR_ZZ+ | FEXPR_Zero+ | FEXPR_ZeroMatrix+ | FEXPR_Zeros+ | FEXPR_alpha+ | FEXPR_alpha_+ | FEXPR_beta+ | FEXPR_beta_+ | FEXPR_chi+ | FEXPR_chi_+ | FEXPR_delta+ | FEXPR_delta_+ | FEXPR_ell+ | FEXPR_ell_+ | FEXPR_epsilon+ | FEXPR_epsilon_+ | FEXPR_eta+ | FEXPR_eta_+ | FEXPR_gamma+ | FEXPR_gamma_+ | FEXPR_iota+ | FEXPR_iota_+ | FEXPR_kappa+ | FEXPR_kappa_+ | FEXPR_lamda+ | FEXPR_lamda_+ | FEXPR_mu+ | FEXPR_mu_+ | FEXPR_nu+ | FEXPR_nu_+ | FEXPR_omega+ | FEXPR_omega_+ | FEXPR_phi+ | FEXPR_phi_+ | FEXPR_pi+ | FEXPR_pi_+ | FEXPR_rho+ | FEXPR_rho_+ | FEXPR_sigma+ | FEXPR_sigma_+ | FEXPR_tau+ | FEXPR_tau_+ | FEXPR_theta+ | FEXPR_theta_+ | FEXPR_varphi+ | FEXPR_varphi_+ | FEXPR_vartheta+ | FEXPR_vartheta_+ | FEXPR_xi+ | FEXPR_xi_+ | FEXPR_zeta+ | FEXPR_zeta_+ deriving (Show, Eq, Enum, Ord)
+ src/Data/Number/Flint/Calcium/Fexpr/FFI.hsc view
@@ -0,0 +1,863 @@+{-|+module : Data.Number.Flint.Hypgeom.FFI+copyright : (c) 2022 Hartmut Monien+license : GNU GPL, version 2 or above (see LICENSE)+maintainer : hmonien@uni-bonn.de+-}+module Data.Number.Flint.Calcium.Fexpr.FFI (+ -- * Flat-packed symbolic expressions+ -- * Introduction+ -- * Computing and embedding data+ -- * Flat-packed representation+ -- * Memory management+ Fexpr (..)+ , CFexpr ()+ , newFexpr+ , withFexpr+ , withNewFexpr+ , fexpr_init+ , fexpr_clear+ , _fexpr_vec_init+ , _fexpr_vec_clear+ , fexpr_fit_size+ , fexpr_set+ , fexpr_swap+ -- * Types+ , fexpr_type_small_int+ , fexpr_type_small_symbol+ , fexpr_type_small_string+ , fexpr_type_big_int_pos+ , fexpr_type_big_int_neg+ , fexpr_type_big_symbol+ , fexpr_type_big_string+ , fexpr_type_call0+ , fexpr_type_call1+ , fexpr_type_call2+ , fexpr_type_call3+ , fexpr_type_call4+ , fexpr_type_calln+ -- * Size information+ , fexpr_depth+ , fexpr_num_leaves+ , fexpr_size+ , fexpr_size_bytes+ , fexpr_allocated_bytes+ -- * Comparisons+ , fexpr_equal+ , fexpr_equal_si+ , fexpr_equal_ui+ , fexpr_hash+ , fexpr_cmp_fast+ -- * Atoms+ , fexpr_is_integer+ , fexpr_is_symbol+ , fexpr_is_string+ , fexpr_is_atom+ , fexpr_zero+ , fexpr_is_zero+ , fexpr_is_neg_integer+ , fexpr_set_si+ , fexpr_set_ui+ , fexpr_set_fmpz+ , fexpr_get_fmpz+ , fexpr_set_symbol_builtin+ , fexpr_is_builtin_symbol+ , fexpr_is_any_builtin_symbol+ , fexpr_set_symbol_str+ , fexpr_get_symbol_str+ , fexpr_set_string+ , fexpr_get_string+ -- * Input and output+ , fexpr_write+ , fexpr_print+ , fexpr_get_str+ -- * LaTeX output+ , fexpr_write_latex+ , fexpr_print_latex+ , fexpr_get_str_latex+ -- | The /flags/ parameter allows specifying options for LaTeX+ -- output. The following flags are supported:+ , fexpr_latex_small+ , fexpr_latex_logic + -- * Function call structure+ , fexpr_nargs+ , fexpr_func+ , fexpr_view_func+ , fexpr_arg+ , fexpr_view_arg+ , fexpr_view_next+ , fexpr_is_builtin_call+ , fexpr_is_any_builtin_call+ -- * Composition+ , fexpr_call0+ , fexpr_call1+ , fexpr_call2+ , fexpr_call3+ , fexpr_call4+ , fexpr_call_vec+ , fexpr_call_builtin1+ , fexpr_call_builtin2+ -- * Subexpressions and replacement+ , fexpr_contains+ , fexpr_replace+ , fexpr_replace2+ , fexpr_replace_vec+ -- * Arithmetic expressions+ , fexpr_set_fmpq+ , fexpr_set_arf+ , fexpr_set_d+ , fexpr_set_re_im_d+ , fexpr_neg+ , fexpr_add+ , fexpr_sub+ , fexpr_mul+ , fexpr_div+ , fexpr_pow+ , fexpr_is_arithmetic_operation+ , fexpr_arithmetic_nodes+ , fexpr_get_fmpz_mpoly_q+ , fexpr_set_fmpz_mpoly+ , fexpr_set_fmpz_mpoly_q+ , fexpr_expanded_normal_form+ -- * Vectors+ , newFexprVec+ , withFexprVec+ , withNewFexprVec+ , fexpr_vec_init+ , fexpr_vec_clear+ , fexpr_vec_print+ , fexpr_vec_swap+ , fexpr_vec_fit_length+ , fexpr_vec_set+ , fexpr_vec_append+ , fexpr_vec_insert_unique+ , fexpr_vec_set_length+ , _fexpr_vec_sort_fast+) where ++-- Flat-packed symbolic expressions --------------------------------------------++import Foreign.Ptr+import Foreign.ForeignPtr+import Foreign.C.Types+import Foreign.C.String+import Foreign.Storable++import Data.Word+import Data.Number.Flint.Flint+import Data.Number.Flint.Fmpz+import Data.Number.Flint.Fmpz.MPoly+import Data.Number.Flint.Fmpz.MPoly.Q+import Data.Number.Flint.Fmpq+import Data.Number.Flint.Arb.Types+import Data.Number.Flint.Calcium++#include <flint/fexpr.h>++-- fexpr_t ---------------------------------------------------------------------++data Fexpr = Fexpr {-# UNPACK #-} !(ForeignPtr CFexpr)+data CFexpr = CFexpr (Ptr CULong) CLong++instance Storable CFexpr where+ {-# INLINE sizeOf #-}+ sizeOf _ = #{size fexpr_t}+ {-# INLINE alignment #-}+ alignment _ = #{alignment fexpr_t}+ peek ptr = CFexpr+ <$> #{peek fexpr_struct, data } ptr+ <*> #{peek fexpr_struct, alloc} ptr+ poke ptr (CFexpr d a) = do+ #{poke fexpr_struct, data } ptr d+ #{poke fexpr_struct, alloc} ptr a++newFexpr = do+ p <- mallocForeignPtr+ withForeignPtr p fexpr_init+ addForeignPtrFinalizer p_fexpr_clear p+ return $ Fexpr p++withFexpr (Fexpr p) f = do+ withForeignPtr p $ \fp -> (Fexpr p,) <$> f fp++withNewFexpr f = do+ x <- newFexpr+ withFexpr x f++type FexprType = CULong++fexpr_type_small_int = (#const FEXPR_TYPE_SMALL_INT ) :: FexprType+fexpr_type_small_symbol = (#const FEXPR_TYPE_SMALL_SYMBOL) :: FexprType+fexpr_type_small_string = (#const FEXPR_TYPE_SMALL_STRING) :: FexprType+fexpr_type_big_int_pos = (#const FEXPR_TYPE_BIG_INT_POS ) :: FexprType+fexpr_type_big_int_neg = (#const FEXPR_TYPE_BIG_INT_NEG ) :: FexprType+fexpr_type_big_symbol = (#const FEXPR_TYPE_BIG_SYMBOL ) :: FexprType+fexpr_type_big_string = (#const FEXPR_TYPE_BIG_STRING ) :: FexprType+fexpr_type_call0 = (#const FEXPR_TYPE_CALL0 ) :: FexprType+fexpr_type_call1 = (#const FEXPR_TYPE_CALL1 ) :: FexprType+fexpr_type_call2 = (#const FEXPR_TYPE_CALL2 ) :: FexprType+fexpr_type_call3 = (#const FEXPR_TYPE_CALL3 ) :: FexprType+fexpr_type_call4 = (#const FEXPR_TYPE_CALL4 ) :: FexprType+fexpr_type_calln = (#const FEXPR_TYPE_CALLN ) :: FexprType+ +-- Memory management -----------------------------------------------------------++-- | /fexpr_init/ /expr/ +--+-- Initializes /expr/ for use. Its value is set to the atomic integer 0.+foreign import ccall "fexpr.h fexpr_init"+ fexpr_init :: Ptr CFexpr -> IO ()++-- | /fexpr_clear/ /expr/ +--+-- Clears /expr/, freeing its allocated memory.+foreign import ccall "fexpr.h fexpr_clear"+ fexpr_clear :: Ptr CFexpr -> IO ()++foreign import ccall "fexpr.h &fexpr_clear"+ p_fexpr_clear :: FunPtr (Ptr CFexpr -> IO ())++-- | /_fexpr_vec_init/ /len/ +--+-- Returns a heap-allocated vector of /len/ initialized expressions.+foreign import ccall "fexpr.h _fexpr_vec_init"+ _fexpr_vec_init :: CLong -> IO (Ptr Fexpr)++-- | /_fexpr_vec_clear/ /vec/ /len/ +--+-- Clears the /len/ expressions in /vec/ and frees /vec/ itself.+foreign import ccall "fexpr.h _fexpr_vec_clear"+ _fexpr_vec_clear :: Ptr Fexpr -> CLong -> IO ()++-- | /fexpr_fit_size/ /expr/ /size/ +--+-- Ensures that /expr/ has room for /size/ words.+foreign import ccall "fexpr.h fexpr_fit_size"+ fexpr_fit_size :: Ptr CFexpr -> CLong -> IO ()++-- | /fexpr_set/ /res/ /expr/ +--+-- Sets /res/ to the a copy of /expr/.+foreign import ccall "fexpr.h fexpr_set"+ fexpr_set :: Ptr CFexpr -> Ptr CFexpr -> IO ()++-- | /fexpr_swap/ /a/ /b/ +--+-- Swaps /a/ and /b/ efficiently.+foreign import ccall "fexpr.h fexpr_swap"+ fexpr_swap :: Ptr CFexpr -> Ptr CFexpr -> IO ()++-- Size information ------------------------------------------------------------++-- | /fexpr_depth/ /expr/ +--+-- Returns the depth of /expr/ as a symbolic expression tree.+foreign import ccall "fexpr.h fexpr_depth"+ fexpr_depth :: Ptr CFexpr -> IO CLong++-- | /fexpr_num_leaves/ /expr/ +--+-- Returns the number of leaves (atoms, counted with repetition) in the+-- expression /expr/.+foreign import ccall "fexpr.h fexpr_num_leaves"+ fexpr_num_leaves :: Ptr CFexpr -> IO CLong++-- | /fexpr_size/ /expr/ +--+-- Returns the number of words in the internal representation of /expr/.+foreign import ccall "fexpr.h fexpr_size"+ fexpr_size :: Ptr CFexpr -> IO CLong++-- | /fexpr_size_bytes/ /expr/ +--+-- Returns the number of bytes in the internal representation of /expr/.+-- The count excludes the size of the structure itself. Add+-- @sizeof(fexpr_struct)@ to get the size of the object as a whole.+foreign import ccall "fexpr.h fexpr_size_bytes"+ fexpr_size_bytes :: Ptr CFexpr -> IO CLong++-- | /fexpr_allocated_bytes/ /expr/ +--+-- Returns the number of allocated bytes in the internal representation of+-- /expr/. The count excludes the size of the structure itself. Add+-- @sizeof(fexpr_struct)@ to get the size of the object as a whole.+foreign import ccall "fexpr.h fexpr_allocated_bytes"+ fexpr_allocated_bytes :: Ptr CFexpr -> IO CLong++-- Comparisons -----------------------------------------------------------------++-- | /fexpr_equal/ /a/ /b/ +--+-- Checks if /a/ and /b/ are exactly equal as expressions.+foreign import ccall "fexpr.h fexpr_equal"+ fexpr_equal :: Ptr CFexpr -> Ptr CFexpr -> IO CInt++-- | /fexpr_equal_si/ /expr/ /c/ +--+foreign import ccall "fexpr.h fexpr_equal_si"+ fexpr_equal_si :: Ptr CFexpr -> CLong -> IO CInt++-- | /fexpr_equal_ui/ /expr/ /c/ +--+-- Checks if /expr/ is an atomic integer exactly equal to /c/.+foreign import ccall "fexpr.h fexpr_equal_ui"+ fexpr_equal_ui :: Ptr CFexpr -> CULong -> IO CInt++-- | /fexpr_hash/ /expr/ +--+-- Returns a hash of the expression /expr/.+foreign import ccall "fexpr.h fexpr_hash"+ fexpr_hash :: Ptr CFexpr -> IO CULong++-- | /fexpr_cmp_fast/ /a/ /b/ +--+-- Compares /a/ and /b/ using an ordering based on the internal+-- representation, returning -1, 0 or 1. This can be used, for instance, to+-- maintain sorted arrays of expressions for binary search; the sort order+-- has no mathematical significance.+foreign import ccall "fexpr.h fexpr_cmp_fast"+ fexpr_cmp_fast :: Ptr CFexpr -> Ptr CFexpr -> IO CInt++-- Atoms -----------------------------------------------------------------------++-- | /fexpr_is_integer/ /expr/ +--+-- Returns whether /expr/ is an atomic integer+foreign import ccall "fexpr.h fexpr_is_integer"+ fexpr_is_integer :: Ptr CFexpr -> IO CInt++-- | /fexpr_is_symbol/ /expr/ +--+-- Returns whether /expr/ is an atomic symbol.+foreign import ccall "fexpr.h fexpr_is_symbol"+ fexpr_is_symbol :: Ptr CFexpr -> IO CInt++-- | /fexpr_is_string/ /expr/ +--+-- Returns whether /expr/ is an atomic string.+foreign import ccall "fexpr.h fexpr_is_string"+ fexpr_is_string :: Ptr CFexpr -> IO CInt++-- | /fexpr_is_atom/ /expr/ +--+-- Returns whether /expr/ is any atom.+foreign import ccall "fexpr.h fexpr_is_atom"+ fexpr_is_atom :: Ptr CFexpr -> IO CInt++-- | /fexpr_zero/ /res/ +--+-- Sets /res/ to the atomic integer 0.+foreign import ccall "fexpr.h fexpr_zero"+ fexpr_zero :: Ptr CFexpr -> IO ()++-- | /fexpr_is_zero/ /expr/ +--+-- Returns whether /expr/ is the atomic integer 0.+foreign import ccall "fexpr.h fexpr_is_zero"+ fexpr_is_zero :: Ptr CFexpr -> IO CInt++-- | /fexpr_is_neg_integer/ /expr/ +--+-- Returns whether /expr/ is any negative atomic integer.+foreign import ccall "fexpr.h fexpr_is_neg_integer"+ fexpr_is_neg_integer :: Ptr CFexpr -> IO CInt++-- | /fexpr_set_si/ /res/ /c/ +foreign import ccall "fexpr.h fexpr_set_si"+ fexpr_set_si :: Ptr CFexpr -> CLong -> IO ()+-- | /fexpr_set_ui/ /res/ /c/ +foreign import ccall "fexpr.h fexpr_set_ui"+ fexpr_set_ui :: Ptr CFexpr -> CULong -> IO ()+-- | /fexpr_set_fmpz/ /res/ /c/ +--+-- Sets /res/ to the atomic integer /c/.+foreign import ccall "fexpr.h fexpr_set_fmpz"+ fexpr_set_fmpz :: Ptr CFexpr -> Ptr CFmpz -> IO ()++-- | /fexpr_get_fmpz/ /res/ /expr/ +--+-- Sets /res/ to the atomic integer in /expr/. This aborts if /expr/ is not+-- an atomic integer.+foreign import ccall "fexpr.h fexpr_get_fmpz"+ fexpr_get_fmpz :: Ptr CFmpz -> Ptr CFexpr -> IO CInt++-- | /fexpr_set_symbol_builtin/ /res/ /id/ +--+-- Sets /res/ to the builtin symbol with internal index /id/ (see+-- @fexpr-builtin@).+foreign import ccall "fexpr.h fexpr_set_symbol_builtin"+ fexpr_set_symbol_builtin :: Ptr CFexpr -> CLong -> IO ()++-- | /fexpr_is_builtin_symbol/ /expr/ /id/ +--+-- Returns whether /expr/ is the builtin symbol with index /id/ (see+-- @fexpr-builtin@).+foreign import ccall "fexpr.h fexpr_is_builtin_symbol"+ fexpr_is_builtin_symbol :: Ptr CFexpr -> CLong -> IO CInt++-- | /fexpr_is_any_builtin_symbol/ /expr/ +--+-- Returns whether /expr/ is any builtin symbol (see @fexpr-builtin@).+foreign import ccall "fexpr.h fexpr_is_any_builtin_symbol"+ fexpr_is_any_builtin_symbol :: Ptr CFexpr -> IO CInt++-- | /fexpr_set_symbol_str/ /res/ /s/ +--+-- Sets /res/ to the symbol given by /s/.+foreign import ccall "fexpr.h fexpr_set_symbol_str"+ fexpr_set_symbol_str :: Ptr CFexpr -> CString -> IO ()++-- | /fexpr_get_symbol_str/ /expr/ +--+-- Returns the symbol in /expr/ as a string. The string must be freed with+-- @flint_free@. This aborts if /expr/ is not an atomic symbol.+foreign import ccall "fexpr.h fexpr_get_symbol_str"+ fexpr_get_symbol_str :: Ptr CFexpr -> IO CString++-- | /fexpr_set_string/ /res/ /s/ +--+-- Sets /res/ to the atomic string /s/.+foreign import ccall "fexpr.h fexpr_set_string"+ fexpr_set_string :: Ptr CFexpr -> CString -> IO ()++-- | /fexpr_get_string/ /expr/ +--+-- Assuming that /expr/ is an atomic string, returns a copy of this string.+-- The string must be freed with @flint_free@.+foreign import ccall "fexpr.h fexpr_get_string"+ fexpr_get_string :: Ptr CFexpr -> IO CString++-- Input and output ------------------------------------------------------------++-- | /fexpr_write/ /stream/ /expr/ +--+-- Writes /expr/ to /stream/.+foreign import ccall "fexpr.h fexpr_write"+ fexpr_write :: Ptr CCalciumStream -> Ptr CFexpr -> IO ()++-- | /fexpr_print/ /expr/ +--+-- Prints /expr/ to standard output.+fexpr_print :: Ptr CFexpr -> IO ()+fexpr_print expr = do+ printCStr fexpr_get_str expr+ return ()+ +-- | /fexpr_get_str/ /expr/ +--+-- Returns a string representation of /expr/. The string must be freed with+-- @flint_free@.+-- +-- Warning: string literals appearing in expressions are currently not+-- escaped.+foreign import ccall "fexpr.h fexpr_get_str"+ fexpr_get_str :: Ptr CFexpr -> IO CString++-- LaTeX output ----------------------------------------------------------------++-- | /fexpr_write_latex/ /stream/ /expr/ /flags/ +--+-- Writes the LaTeX representation of /expr/ to /stream/.+foreign import ccall "fexpr.h fexpr_write_latex"+ fexpr_write_latex :: Ptr CCalciumStream -> Ptr CFexpr -> CULong -> IO ()++-- | /fexpr_print_latex/ /expr/ /flags/ +--+-- Prints the LaTeX representation of /expr/ to standard output.+fexpr_print_latex :: Ptr CFexpr -> CULong -> IO ()+fexpr_print_latex expr flags = do+ printCStr (flip fexpr_get_str_latex flags) expr+ return ()+ +-- | /fexpr_get_str_latex/ /expr/ /flags/ +--+-- Returns a string of the LaTeX representation of /expr/. The string must+-- be freed with @flint_free@.+-- +-- Warning: string literals appearing in expressions are currently not+-- escaped.+foreign import ccall "fexpr.h fexpr_get_str_latex"+ fexpr_get_str_latex :: Ptr CFexpr -> CULong -> IO CString++type FexprLatexFlag = CULong++fexpr_latex_small, fexpr_latex_logic :: FexprLatexFlag++-- | /fexpr_latex_small/+--+-- Generate more compact formulas, most importantly by printing+-- fractions inline as \(p/q\) instead of as \(\frac{p}{q}\). This+-- flag is automatically activated within subscripts and superscripts+-- and in certain other parts of formulas.+fexpr_latex_small = #const FEXPR_LATEX_SMALL++-- | /fexpr_latex_logic/+--+-- Use symbols for logical operators such as Not, And, Or, which by+-- default are rendered as words for legibility.+fexpr_latex_logic = #const FEXPR_LATEX_LOGIC++-- Function call structure -----------------------------------------------------++-- | /fexpr_nargs/ /expr/ +--+-- Returns the number of arguments /n/ in the function call+-- \(f(e_1,\ldots,e_n)\) represented by /expr/. If /expr/ is an atom,+-- returns -1.+foreign import ccall "fexpr.h fexpr_nargs"+ fexpr_nargs :: Ptr CFexpr -> IO CLong++-- | /fexpr_func/ /res/ /expr/ +--+-- Assuming that /expr/ represents a function call \(f(e_1,\ldots,e_n)\),+-- sets /res/ to the function expression /f/.+foreign import ccall "fexpr.h fexpr_func"+ fexpr_func :: Ptr CFexpr -> Ptr CFexpr -> IO ()++-- | /fexpr_view_func/ /view/ /expr/ +--+-- As @fexpr_func@, but sets /view/ to a shallow view instead of copying+-- the expression. The variable /view/ must not be initialized before use+-- or cleared after use, and /expr/ must not be modified or cleared as long+-- as /view/ is in use.+foreign import ccall "fexpr.h fexpr_view_func"+ fexpr_view_func :: Ptr CFexpr -> Ptr CFexpr -> IO ()++-- | /fexpr_arg/ /res/ /expr/ /i/ +--+-- Assuming that /expr/ represents a function call \(f(e_1,\ldots,e_n)\),+-- sets /res/ to the argument \(e_{i+1}\). Note that indexing starts from+-- 0. The index must be in bounds, with \(0 \le i < n\).+foreign import ccall "fexpr.h fexpr_arg"+ fexpr_arg :: Ptr CFexpr -> Ptr CFexpr -> CLong -> IO ()++-- | /fexpr_view_arg/ /view/ /expr/ /i/ +--+-- As @fexpr_arg@, but sets /view/ to a shallow view instead of copying the+-- expression. The variable /view/ must not be initialized before use or+-- cleared after use, and /expr/ must not be modified or cleared as long as+-- /view/ is in use.+foreign import ccall "fexpr.h fexpr_view_arg"+ fexpr_view_arg :: Ptr CFexpr -> Ptr CFexpr -> CLong -> IO ()++-- | /fexpr_view_next/ /view/ +--+-- Assuming that /view/ is a shallow view of a function argument \(e_i\) in+-- a function call \(f(e_1,\ldots,e_n)\), sets /view/ to a view of the next+-- argument \(e_{i+1}\). This function can be called when /view/ refers to+-- the last argument \(e_n\), provided that /view/ is not used afterwards.+-- This function can also be called when /view/ refers to the function /f/,+-- in which case it will make /view/ point to \(e_1\).+foreign import ccall "fexpr.h fexpr_view_next"+ fexpr_view_next :: Ptr CFexpr -> IO ()++-- | /fexpr_is_builtin_call/ /expr/ /id/ +--+-- Returns whether /expr/ has the form \(f(\ldots)\) where /f/ is a builtin+-- function defined by /id/ (see @fexpr-builtin@).+foreign import ccall "fexpr.h fexpr_is_builtin_call"+ fexpr_is_builtin_call :: Ptr CFexpr -> CLong -> IO CInt++-- | /fexpr_is_any_builtin_call/ /expr/ +--+-- Returns whether /expr/ has the form \(f(\ldots)\) where /f/ is any+-- builtin function (see @fexpr-builtin@).+foreign import ccall "fexpr.h fexpr_is_any_builtin_call"+ fexpr_is_any_builtin_call :: Ptr CFexpr -> IO CInt++-- Composition -----------------------------------------------------------------++-- | /fexpr_call0/ /res/ /f/ +foreign import ccall "fexpr.h fexpr_call0"+ fexpr_call0 :: Ptr CFexpr -> Ptr CFexpr -> IO ()+-- | /fexpr_call1/ /res/ /f/ /x1/ +foreign import ccall "fexpr.h fexpr_call1"+ fexpr_call1 :: Ptr CFexpr -> Ptr CFexpr -> Ptr CFexpr -> IO ()+-- | /fexpr_call2/ /res/ /f/ /x1/ /x2/ +foreign import ccall "fexpr.h fexpr_call2"+ fexpr_call2 :: Ptr CFexpr -> Ptr CFexpr -> Ptr CFexpr -> Ptr CFexpr -> IO ()+-- | /fexpr_call3/ /res/ /f/ /x1/ /x2/ /x3/ +foreign import ccall "fexpr.h fexpr_call3"+ fexpr_call3 :: Ptr CFexpr -> Ptr CFexpr -> Ptr CFexpr -> Ptr CFexpr -> Ptr CFexpr -> IO ()+-- | /fexpr_call4/ /res/ /f/ /x1/ /x2/ /x3/ /x4/ +foreign import ccall "fexpr.h fexpr_call4"+ fexpr_call4 :: Ptr CFexpr -> Ptr CFexpr -> Ptr CFexpr -> Ptr CFexpr -> Ptr CFexpr -> Ptr CFexpr -> IO ()+-- | /fexpr_call_vec/ /res/ /f/ /args/ /len/ +--+-- Creates the function call \(f(x_1,\ldots,x_n)\). The /vec/ version takes+-- the arguments as an array /args/ and /n/ is given by /len/. Warning:+-- aliasing between inputs and outputs is not implemented.+foreign import ccall "fexpr.h fexpr_call_vec"+ fexpr_call_vec :: Ptr CFexpr -> Ptr CFexpr -> Ptr Fexpr -> CLong -> IO ()++-- | /fexpr_call_builtin1/ /res/ /f/ /x1/ +foreign import ccall "fexpr.h fexpr_call_builtin1"+ fexpr_call_builtin1 :: Ptr CFexpr -> CLong -> Ptr CFexpr -> IO ()+-- | /fexpr_call_builtin2/ /res/ /f/ /x1/ /x2/ +--+-- Creates the function call \(f(x_1,\ldots,x_n)\), where /f/ defines a+-- builtin symbol.+foreign import ccall "fexpr.h fexpr_call_builtin2"+ fexpr_call_builtin2 :: Ptr CFexpr -> CLong -> Ptr CFexpr -> Ptr CFexpr -> IO ()++-- Subexpressions and replacement ----------------------------------------------++-- | /fexpr_contains/ /expr/ /x/ +--+-- Returns whether /expr/ contains the expression /x/ as a subexpression+-- (this includes the case where /expr/ and /x/ are equal).+foreign import ccall "fexpr.h fexpr_contains"+ fexpr_contains :: Ptr CFexpr -> Ptr CFexpr -> IO CInt++-- | /fexpr_replace/ /res/ /expr/ /x/ /y/ +--+-- Sets /res/ to the expression /expr/ with all occurrences of the+-- subexpression /x/ replaced by the expression /y/. Returns a boolean+-- value indicating whether any replacements have been performed. Aliasing+-- is allowed between /res/ and /expr/ but not between /res/ and /x/ or+-- /y/.+foreign import ccall "fexpr.h fexpr_replace"+ fexpr_replace :: Ptr CFexpr -> Ptr CFexpr -> Ptr CFexpr -> Ptr CFexpr -> IO CInt++-- | /fexpr_replace2/ /res/ /expr/ /x1/ /y1/ /x2/ /y2/ +--+-- Like @fexpr_replace@, but simultaneously replaces /x1/ by /y1/ and /x2/+-- by /y2/.+foreign import ccall "fexpr.h fexpr_replace2"+ fexpr_replace2 :: Ptr CFexpr -> Ptr CFexpr -> Ptr CFexpr -> Ptr CFexpr -> Ptr CFexpr -> Ptr CFexpr -> IO CInt++-- | /fexpr_replace_vec/ /res/ /expr/ /xs/ /ys/ +--+-- Sets /res/ to the expression /expr/ with all occurrences of the+-- subexpressions given by entries in /xs/ replaced by the corresponding+-- expressions in /ys/. It is required that /xs/ and /ys/ have the same+-- length. Returns a boolean value indicating whether any replacements have+-- been performed. Aliasing is allowed between /res/ and /expr/ but not+-- between /res/ and the entries of /xs/ or /ys/.+foreign import ccall "fexpr.h fexpr_replace_vec"+ fexpr_replace_vec :: Ptr CFexpr -> Ptr CFexpr -> Ptr CFexprVec -> Ptr CFexprVec -> IO CInt++-- Arithmetic expressions ------------------------------------------------------++-- | /fexpr_set_fmpq/ /res/ /x/ +--+-- Sets /res/ to the rational number /x/. This creates an atomic integer if+-- the denominator of /x/ is one, and otherwise creates a division+-- expression.+foreign import ccall "fexpr.h fexpr_set_fmpq"+ fexpr_set_fmpq :: Ptr CFexpr -> Ptr CFmpq -> IO ()++-- | /fexpr_set_arf/ /res/ /x/ +foreign import ccall "fexpr.h fexpr_set_arf"+ fexpr_set_arf :: Ptr CFexpr -> Ptr CArf -> IO ()+-- | /fexpr_set_d/ /res/ /x/ +--+-- Sets /res/ to an expression for the value of the floating-point number+-- /x/. NaN is represented as @Undefined@. For a regular value, this+-- creates an atomic integer or a rational fraction if the exponent is+-- small, and otherwise creates an expression of the form+-- @Mul(m, Pow(2, e))@.+foreign import ccall "fexpr.h fexpr_set_d"+ fexpr_set_d :: Ptr CFexpr -> CDouble -> IO ()++-- | /fexpr_set_re_im_d/ /res/ /x/ /y/ +--+-- Sets /res/ to an expression for the complex number with real part /x/+-- and imaginary part /y/.+foreign import ccall "fexpr.h fexpr_set_re_im_d"+ fexpr_set_re_im_d :: Ptr CFexpr -> CDouble -> CDouble -> IO ()++-- | /fexpr_neg/ /res/ /a/ +foreign import ccall "fexpr.h fexpr_neg"+ fexpr_neg :: Ptr CFexpr -> Ptr CFexpr -> IO ()+-- | /fexpr_add/ /res/ /a/ /b/ +foreign import ccall "fexpr.h fexpr_add"+ fexpr_add :: Ptr CFexpr -> Ptr CFexpr -> Ptr CFexpr -> IO ()+-- | /fexpr_sub/ /res/ /a/ /b/ +foreign import ccall "fexpr.h fexpr_sub"+ fexpr_sub :: Ptr CFexpr -> Ptr CFexpr -> Ptr CFexpr -> IO ()+-- | /fexpr_mul/ /res/ /a/ /b/ +foreign import ccall "fexpr.h fexpr_mul"+ fexpr_mul :: Ptr CFexpr -> Ptr CFexpr -> Ptr CFexpr -> IO ()+-- | /fexpr_div/ /res/ /a/ /b/ +foreign import ccall "fexpr.h fexpr_div"+ fexpr_div :: Ptr CFexpr -> Ptr CFexpr -> Ptr CFexpr -> IO ()+-- | /fexpr_pow/ /res/ /a/ /b/ +--+-- Constructs an arithmetic expression with given arguments. No+-- simplifications whatsoever are performed.+foreign import ccall "fexpr.h fexpr_pow"+ fexpr_pow :: Ptr CFexpr -> Ptr CFexpr -> Ptr CFexpr -> IO ()++-- | /fexpr_is_arithmetic_operation/ /expr/ +--+-- Returns whether /expr/ is of the form \(f(e_1,\ldots,e_n)\) where /f/ is+-- one of the arithmetic operators @Pos@, @Neg@, @Add@, @Sub@, @Mul@,+-- @Div@.+foreign import ccall "fexpr.h fexpr_is_arithmetic_operation"+ fexpr_is_arithmetic_operation :: Ptr CFexpr -> IO CInt++-- | /fexpr_arithmetic_nodes/ /nodes/ /expr/ +--+-- Sets /nodes/ to a vector of subexpressions of /expr/ such that /expr/ is+-- an arithmetic expression with /nodes/ as leaves. More precisely, /expr/+-- will be constructed out of nested application the arithmetic operators+-- @Pos@, @Neg@, @Add@, @Sub@, @Mul@, @Div@ with integers and expressions+-- in /nodes/ as leaves. Powers @Pow@ with an atomic integer exponent are+-- also allowed. The nodes are output without repetition but are not+-- automatically sorted in a canonical order.+foreign import ccall "fexpr.h fexpr_arithmetic_nodes"+ fexpr_arithmetic_nodes :: Ptr CFexprVec -> Ptr CFexpr -> IO ()++-- | /fexpr_get_fmpz_mpoly_q/ /res/ /expr/ /vars/ /ctx/ +--+-- Sets /res/ to the expression /expr/ as a formal rational function of the+-- subexpressions in /vars/. The vector /vars/ must have the same length as+-- the number of variables specified in /ctx/. To build /vars/+-- automatically for a given expression, @fexpr_arithmetic_nodes@ may be+-- used.+-- +-- Returns 1 on success and 0 on failure. Failure can occur for the+-- following reasons:+-- +-- - A subexpression is encountered that cannot be interpreted as an+-- arithmetic operation and does not appear (exactly) in /vars/.+-- - Overflow (too many terms or too large exponent).+-- - Division by zero (a zero denominator is encountered).+-- +-- It is important to note that this function views /expr/ as a formal+-- rational function with /vars/ as formal indeterminates. It does thus not+-- check for algebraic relations between /vars/ and can implicitly divide+-- by zero if /vars/ are not algebraically independent.+foreign import ccall "fexpr.h fexpr_get_fmpz_mpoly_q"+ fexpr_get_fmpz_mpoly_q :: Ptr CFmpzMPolyQ -> Ptr CFexpr -> Ptr CFexprVec -> Ptr CFmpzMPolyCtx -> IO CInt++-- | /fexpr_set_fmpz_mpoly/ /res/ /poly/ /vars/ /ctx/ +foreign import ccall "fexpr.h fexpr_set_fmpz_mpoly"+ fexpr_set_fmpz_mpoly :: Ptr CFexpr -> Ptr CFmpzMPoly -> Ptr CFexprVec -> Ptr CFmpzMPolyCtx -> IO ()+-- | /fexpr_set_fmpz_mpoly_q/ /res/ /frac/ /vars/ /ctx/ +--+-- Sets /res/ to an expression for the multivariate polynomial /poly/ (or+-- rational function /frac/), using the expressions in /vars/ as the+-- variables. The length of /vars/ must agree with the number of variables+-- in /ctx/. If /NULL/ is passed for /vars/, a default choice of symbols is+-- used.+foreign import ccall "fexpr.h fexpr_set_fmpz_mpoly_q"+ fexpr_set_fmpz_mpoly_q :: Ptr CFexpr -> Ptr CFmpzMPolyQ -> Ptr CFexprVec -> Ptr CFmpzMPolyCtx -> IO ()++-- | /fexpr_expanded_normal_form/ /res/ /expr/ /flags/ +--+-- Sets /res/ to /expr/ converted to expanded normal form viewed as a+-- formal rational function with its non-arithmetic subexpressions as+-- terminal nodes. This function first computes nodes with+-- @fexpr_arithmetic_nodes@, sorts the nodes, evaluates to a rational+-- function with @fexpr_get_fmpz_mpoly_q@, and then converts back to an+-- expression with @fexpr_set_fmpz_mpoly_q@. Optional /flags/ are reserved+-- for future use.+foreign import ccall "fexpr.h fexpr_expanded_normal_form"+ fexpr_expanded_normal_form :: Ptr CFexpr -> Ptr CFexpr -> CULong -> IO CInt++-- Vectors ---------------------------------------------------------------------++data FexprVec = FexprVec {-# UNPACK #-} !(ForeignPtr CFexprVec)+data CFexprVec = CFexprVec (Ptr Fexpr) CLong CLong++instance Storable CFexprVec where+ {-# INLINE sizeOf #-}+ sizeOf _ = #{size fexpr_vec_t}+ {-# INLINE alignment #-}+ alignment _ = #{alignment fexpr_vec_t}+ peek ptr = CFexprVec+ <$> #{peek fexpr_vec_struct, entries} ptr+ <*> #{peek fexpr_vec_struct, alloc } ptr+ <*> #{peek fexpr_vec_struct, length } ptr+ poke ptr (CFexprVec entries alloc length) = do+ #{poke fexpr_vec_struct, entries } ptr entries+ #{poke fexpr_vec_struct, alloc } ptr alloc+ #{poke fexpr_vec_struct, length } ptr length++newFexprVec n = do+ p <- mallocForeignPtr+ withForeignPtr p $ \p -> do+ fexpr_vec_init p n+ addForeignPtrFinalizer p_fexpr_vec_clear p+ return $ FexprVec p++withFexprVec (FexprVec p) f = do+ withForeignPtr p $ \fp -> (FexprVec p,) <$> f fp++withNewFexprVec n f = do+ x <- newFexprVec n+ withFexprVec x f++-- | /fexpr_vec_init/ /vec/ /len/ +--+-- Initializes /vec/ to a vector of length /len/. All entries are set to+-- the atomic integer 0.+foreign import ccall "fexpr.h fexpr_vec_init"+ fexpr_vec_init :: Ptr CFexprVec -> CLong -> IO ()++-- | /fexpr_vec_clear/ /vec/ +--+-- Clears the vector /vec/.+foreign import ccall "fexpr.h fexpr_vec_clear"+ fexpr_vec_clear :: Ptr CFexprVec -> IO ()++foreign import ccall "fexpr.h &fexpr_vec_clear"+ p_fexpr_vec_clear :: FunPtr (Ptr CFexprVec -> IO ())++-- | /fexpr_vec_print/ /vec/ +--+-- Prints /vec/ to standard output.+foreign import ccall "fexpr.h fexpr_vec_print"+ fexpr_vec_print :: Ptr CFexprVec -> IO ()++-- | /fexpr_vec_swap/ /x/ /y/ +--+-- Swaps /x/ and /y/ efficiently.+foreign import ccall "fexpr.h fexpr_vec_swap"+ fexpr_vec_swap :: Ptr CFexprVec -> Ptr CFexprVec -> IO ()++-- | /fexpr_vec_fit_length/ /vec/ /len/ +--+-- Ensures that /vec/ has space for /len/ entries.+foreign import ccall "fexpr.h fexpr_vec_fit_length"+ fexpr_vec_fit_length :: Ptr CFexprVec -> CLong -> IO ()++-- | /fexpr_vec_set/ /dest/ /src/ +--+-- Sets /dest/ to a copy of /src/.+foreign import ccall "fexpr.h fexpr_vec_set"+ fexpr_vec_set :: Ptr CFexprVec -> Ptr CFexprVec -> IO ()++-- | /fexpr_vec_append/ /vec/ /expr/ +--+-- Appends /expr/ to the end of the vector /vec/.+foreign import ccall "fexpr.h fexpr_vec_append"+ fexpr_vec_append :: Ptr CFexprVec -> Ptr CFexpr -> IO ()++-- | /fexpr_vec_insert_unique/ /vec/ /expr/ +--+-- Inserts /expr/ without duplication into vec, returning its position. If+-- this expression already exists, /vec/ is unchanged. If this expression+-- does not exist in /vec/, it is appended.+foreign import ccall "fexpr.h fexpr_vec_insert_unique"+ fexpr_vec_insert_unique :: Ptr CFexprVec -> Ptr CFexpr -> IO CLong++-- | /fexpr_vec_set_length/ /vec/ /len/ +--+-- Sets the length of /vec/ to /len/, truncating or zero-extending as+-- needed.+foreign import ccall "fexpr.h fexpr_vec_set_length"+ fexpr_vec_set_length :: Ptr CFexprVec -> CLong -> IO ()++-- | /_fexpr_vec_sort_fast/ /vec/ /len/ +--+-- Sorts the /len/ entries in /vec/ using the comparison function+-- @fexpr_cmp_fast@.+foreign import ccall "fexpr.h _fexpr_vec_sort_fast"+ _fexpr_vec_sort_fast :: Ptr Fexpr -> CLong -> IO ()++++
+ src/Data/Number/Flint/Calcium/Fexpr/Instances.hs view
@@ -0,0 +1,117 @@+module Data.Number.Flint.Calcium.Fexpr.Instances where++import System.IO.Unsafe++import Foreign.Ptr+import Foreign.C.Types+import Foreign.C.String+import Foreign.Storable+import Foreign.Marshal.Alloc (free)+import Foreign.Marshal.Array (advancePtr)++import qualified Data.Map as Map+import Data.Map (Map, (!), (!?))++import Data.Number.Flint.Fmpz+import Data.Number.Flint.Fmpq+import Data.Number.Flint.Fmpz.Instances+import Data.Number.Flint.Arb.Arf+import Data.Number.Flint.Calcium.Fexpr+import Data.Number.Flint.Calcium.Fexpr.Builtin++instance Show Fexpr where+ show x = snd $ unsafePerformIO $ do+ withFexpr x $ \x -> do+ cs <- fexpr_get_str x+ s <- peekCString cs+ free cs+ return s++instance Num Fexpr where+ {-# INLINE (+) #-}+ (+) = lift2 fexpr_add+ {-# INLINE (-) #-}+ (-) = lift2 fexpr_sub+ {-# INLINE (*) #-}+ (*) = lift2 fexpr_mul+ negate = lift1 fexpr_neg+ abs = undefined+ fromInteger x = unsafePerformIO $ do+ expr <- newFexpr+ withFexpr expr $ \expr -> do+ withFmpz (fromInteger x) $ \tmp -> do+ fexpr_set_fmpz expr tmp+ return expr+ signum = undefined++class FlintExpression a where+ toFexpr :: a -> IO Fexpr++instance FlintExpression FEXR_Builtin where+ toFexpr x = do+ result <- newFexpr+ withFexpr result $ \result -> do+ fexpr_set_symbol_builtin result (fexpr_builtin_hash ! x)+ return result++instance FlintExpression Fmpz where+ toFexpr x = do+ result <- newFexpr+ withFexpr result $ \expr -> do+ withFmpz x $ \x -> do+ fexpr_set_fmpz expr x+ return result++instance FlintExpression Fmpq where+ toFexpr x = do+ result <- newFexpr+ withFexpr result $ \expr -> do+ withFmpq x $ \x -> do+ fexpr_set_fmpq expr x+ return result++instance FlintExpression CDouble where+ toFexpr = liftTo fexpr_set_d++instance FlintExpression CLong where+ toFexpr = liftTo fexpr_set_si++instance FlintExpression CULong where+ toFexpr = liftTo fexpr_set_ui++instance FlintExpression Arf where+ toFexpr x = do+ result <- newFexpr+ withFexpr result $ \expr -> do+ withArf x $ \x -> do+ fexpr_set_arf expr x+ return result++instance FlintExpression String where+ toFexpr name = do+ result <- newFexpr+ withFexpr result $ \result -> do+ withCString name $ \name -> do+ fexpr_set_symbol_str result name+ return result++--------------------------------------------------------------------------------++lift1 f x = unsafePerformIO $ do+ z <- newFexpr+ withFexpr x $ \x ->+ withFexpr z $ \z -> f z x+ return z+ +lift2 f x y = unsafePerformIO $ do+ z <- newFexpr+ withFexpr x $ \x ->+ withFexpr y $ \y ->+ withFexpr z $ \z -> f z x y+ return z++liftTo f x = do+ result <- newFexpr+ withFexpr result $ \expr -> f expr x+ return result+
src/Data/Number/Flint/Flint.hs view
@@ -1,4 +1,3 @@-{-# OPTIONS_HADDOCK hide, prune, ignore-exports #-} {-| module : Data.Number.Flint.Flint copyright : (c) 2022 Hartmut Monien
src/Data/Number/Flint/Flint/External.hs view
@@ -1,4 +1,3 @@-{-# OPTIONS_HADDOCK hide, prune, ignore-exports #-} module Data.Number.Flint.Flint.External ( module Data.Number.Flint.Flint.External.GMP.FFI
src/Data/Number/Flint/Flint/Internal.hs view
@@ -1,4 +1,3 @@-{-# OPTIONS_HADDOCK hide, prune, ignore-exports #-} module Data.Number.Flint.Flint.Internal ( module Data.Number.Flint.Flint.Internal.FFI
src/Data/Number/Flint/Fmpq/Instances.hs view
@@ -1,4 +1,3 @@-{-# OPTIONS_HADDOCK hide, prune, ignore-exports #-} module Data.Number.Flint.Fmpq.Instances ( Fmpq (..) ) where@@ -21,6 +20,7 @@ import Data.Number.Flint.Fmpz import Data.Number.Flint.Fmpz.Instances import Data.Number.Flint.Fmpq+import Data.Number.Flint.Quotient ((//)) instance Show Fmpq where show x = snd $ unsafePerformIO $ do@@ -32,16 +32,18 @@ return s instance Read Fmpq where- readsPrec _ r = unsafePerformIO $ do- result <- newFmpq- (_, flag) <- withFmpq result $ \result ->- withCString r $ \r ->- fmpq_set_str result r 10- if flag == 0 then - return [(result, drop (length (show result)) r)]- else- return []- + readPrec = parens $+ (prec app_prec $ do+ x <- step readPrec+ Symbol "/" <- lexP+ y <- step readPrec+ return (x // y))+ +++ (prec up_prec $ do+ x <- step readPrec+ return (x // 1))+ where app_prec = 10+ up_prec = 5+ instance Eq Fmpq where (==) x y = snd $ snd $ unsafePerformIO $ withFmpq x $ \x ->
src/Data/Number/Flint/Fmpq/Mat/Instances.hs view
@@ -1,4 +1,3 @@-{-# OPTIONS_HADDOCK hide, prune, ignore-exports #-} module Data.Number.Flint.Fmpq.Mat.Instances where import System.IO.Unsafe
src/Data/Number/Flint/Fmpq/Poly/Instances.hs view
@@ -1,4 +1,3 @@-{-# OPTIONS_HADDOCK hide, prune, ignore-exports #-} module Data.Number.Flint.Fmpq.Poly.Instances ( FmpqPoly (..) ) where@@ -8,12 +7,15 @@ import Control.Monad import Foreign.C.String import Foreign.Marshal.Alloc+import Text.ParserCombinators.ReadP import Data.Ratio hiding (numerator, denominator)+import Data.Char import Data.Number.Flint.Fmpz import Data.Number.Flint.Fmpz.Instances import Data.Number.Flint.Fmpq+import Data.Number.Flint.Fmpq.Instances import Data.Number.Flint.Fmpq.Poly instance IsList FmpqPoly where@@ -42,6 +44,9 @@ free cs return s +instance Read FmpqPoly where+ readsPrec _ = readP_to_S parseFmpqPoly+ instance Num FmpqPoly where (*) = lift2 fmpq_poly_mul (+) = lift2 fmpq_poly_add@@ -61,3 +66,17 @@ withFmpqPoly y $ \y -> do f result x y return result++parseFmpqPoly :: ReadP FmpqPoly+parseFmpqPoly = do+ n <- parseItemNumber+ v <- count n parseItem+ return $ fromList v+ where+ parseItemNumber = read <$> munch1 isNumber <* char ' '+ parseItem = read <$> (char ' ' *> parseFrac)+ parseFrac = parseFraction <++ parseNumber+ parseFraction = fst <$> gather (parseNumber *> char '/' *> parsePositive)+ parseNumber = parseNegative <++ parsePositive+ parseNegative = fst <$> gather (char '-' *> munch1 isNumber)+ parsePositive = munch1 isNumber
src/Data/Number/Flint/Fmpz/FFI.hsc view
@@ -177,6 +177,7 @@ , fmpz_powm_ui , fmpz_powm , fmpz_clog+ , fmpz_clog_ui , fmpz_flog , fmpz_dlog , fmpz_sqrtmod@@ -1459,6 +1460,9 @@ -- fits into a signed @slong@. foreign import ccall "fmpz.h fmpz_clog" fmpz_clog :: Ptr CFmpz -> Ptr CFmpz -> IO CLong++foreign import ccall "fmpz.h fmpz_clog_ui"+ fmpz_clog_ui :: Ptr CFmpz -> CULong -> IO CLong -- | /fmpz_flog/ /x/ /b/ --
src/Data/Number/Flint/Fmpz/Instances.hs view
@@ -1,4 +1,3 @@-{-# OPTIONS_HADDOCK hide, prune, ignore-exports #-} module Data.Number.Flint.Fmpz.Instances ( Fmpz (..) , UFD (..)
src/Data/Number/Flint/Fmpz/MPoly/FFI.hsc view
@@ -11,11 +11,13 @@ -- * Constructor , newFmpzMPoly , withFmpzMPoly+ , withNewFmpzMPoly -- * Context object , FmpzMPolyCtx (..) , CFmpzMPolyCtx (..) , newFmpzMPolyCtx , withFmpzMPolyCtx+ , withNewFmpzMPolyCtx , fmpz_mpoly_ctx_init , fmpz_mpoly_ctx_nvars , fmpz_mpoly_ctx_ord@@ -306,6 +308,10 @@ withFmpzMPolyCtx (FmpzMPolyCtx p) f = do withForeignPtr p $ \fp -> f fp >>= return . (FmpzMPolyCtx p,) +withNewFmpzMPolyCtx nvars ord f = do+ mctx <- newFmpzMPolyCtx nvars ord+ withFmpzMPolyCtx mctx f+ -- fmpz_mpoly_vec_t ------------------------------------------------------------ data FmpzMPolyVec = FmpzMPolyVec {-# UNPACK #-} !(ForeignPtr CFmpzMPolyVec)
src/Data/Number/Flint/Fmpz/MPoly/Factor/FFI.hsc view
@@ -11,9 +11,14 @@ , CFmpzMPolyFactor (..) , newFmpzMPolyFactor , withFmpzMPolyFactor+ , withNewFmpzMPolyFactor -- * Memory management , fmpz_mpoly_factor_init , fmpz_mpoly_factor_clear+ -- * Input and Output+ , fmpz_mpoly_get_str_pretty+ , fmpz_mpoly_factor_print_pretty+ , fmpz_mpoly_factor_fprint_pretty -- * Basic manipulation , fmpz_mpoly_factor_swap , fmpz_mpoly_factor_length@@ -82,6 +87,10 @@ withFmpzMPolyFactor (FmpzMPolyFactor p) f = do withForeignPtr p $ \fp -> f fp >>= return . (FmpzMPolyFactor p,)++withNewFmpzMPolyFactor ctx f = do+ x <- newFmpzMPolyFactor ctx+ withFmpzMPolyFactor x f -- Memory management ----------------------------------------------------------- @@ -100,6 +109,19 @@ foreign import ccall "fmpz_mpoly_factor.h &fmpz_mpoly_factor_clear" p_fmpz_mpoly_factor_clear :: FunPtr (Ptr CFmpzMPolyFactor -> Ptr CFmpzMPolyCtx -> IO ()) +-- Input and Output ------------------------------------------------------------++foreign import ccall "fmpz_mpoly_factor.h fmpz_mpoly_factor_get_str_pretty"+ fmpz_mpoly_factor_get_str_pretty :: Ptr CFmpzMPolyFactor -> Ptr (Ptr CChar) -> Ptr CFmpzMPolyCtx -> IO CString++fmpz_mpoly_factor_print_pretty :: Ptr CFmpzMPolyFactor -> Ptr (Ptr CChar) -> Ptr CFmpzMPolyCtx -> IO ()+fmpz_mpoly_factor_print_pretty fac vars ctx = do+ flag <- printCStr (\fac -> fmpz_mpoly_factor_get_str_pretty fac vars ctx) fac+ return ()+ +foreign import ccall "fmpz_mpoly_factor.h fmpz_mpoly_factor_print_pretty"+ fmpz_mpoly_factor_fprint_pretty :: Ptr CFile -> Ptr CFmpzMPolyFactor -> Ptr (Ptr CChar) -> Ptr CFmpzMPolyCtx -> IO ()+ -- Basic manipulation ---------------------------------------------------------- -- | /fmpz_mpoly_factor_swap/ /f/ /g/ /ctx/
src/Data/Number/Flint/Fmpz/Mat.hs view
@@ -1,8 +1,8 @@ {- | -module : Data.Number.Flint.Fmpz.Mat-copyright : (c) 2022 Hartmut Monien-license : MIT-style (see LICENSE)-maintainer : hmonien@uni-bonn.de+module : Data.Number.Flint.Fmpz.Mat+copyright : (c) 2022 Hartmut Monien+license : GNU GPL, version 2 or above (see LICENSE)+maintainer : hmonien@uni-bonn.de An @FmpzMat@ represents an matrix over integer. This module implements operations on matrices over integers.
src/Data/Number/Flint/Fmpz/Mat/Instances.hs view
@@ -1,4 +1,3 @@-{-# OPTIONS_HADDOCK hide, prune, ignore-exports #-} module Data.Number.Flint.Fmpz.Mat.Instances where import System.IO.Unsafe
src/Data/Number/Flint/Fmpz/Mod/Poly/FFI.hsc view
@@ -273,8 +273,13 @@ , _fmpz_mod_poly_tree_free , _fmpz_mod_poly_tree_build -- * Radix conversion+ , FmpzModPolyRadix (..)+ , CFmpzModPolyRadix (..)+ , newFmpzModPolyRadix+ , withFmpzModPolyRadix , _fmpz_mod_poly_radix_init , fmpz_mod_poly_radix_init+ , fmpz_mod_poly_radix_clear , _fmpz_mod_poly_radix , fmpz_mod_poly_radix -- * Input and output@@ -359,15 +364,39 @@ `ap` #{peek fmpz_mod_poly_struct, alloc } ptr `ap` #{peek fmpz_mod_poly_struct, length} ptr poke = error "poke undefined for CFmpzModPoly"- ++-- fmpz_mod_poly_radix_t -------------------------------------------------------++data FmpzModPolyRadix =+ FmpzModPolyRadix {-# UNPACK #-} !(ForeignPtr CFmpzModPolyRadix)+type CFmpzModPolyRadix = CFlint FmpzModPolyRadix++instance Storable CFmpzModPolyRadix where+ {-# INLINE sizeOf #-}+ sizeOf _ = #{size fmpz_mod_poly_radix_t}+ {-# INLINE alignment #-}+ alignment _ = #{alignment fmpz_mod_poly_radix_t}+ peek = error "peek undefined for CFmpzModPolyRadix"+ poke = error "poke undefined for CFmpzModPolyRadix"++newFmpzModPolyRadix r degF ctx = do+ x <- mallocForeignPtr+ withForeignPtr x $ \x -> do+ withFmpzModPoly r $ \r -> do+ withFmpzModCtx ctx $ \ctx -> do+ fmpz_mod_poly_radix_init x r degF ctx+ addForeignPtrFinalizer p_fmpz_mod_poly_radix_clear x+ return $ FmpzModPolyRadix x++{-# INLINE withFmpzModPolyRadix #-}+withFmpzModPolyRadix (FmpzModPolyRadix x) f = do+ withForeignPtr x $ \px -> f px >>= return . (FmpzModPolyRadix x,)+ -- various other structures ---------------------------------------------------- data FmpzModBerlekampMassey = FmpzModBerlekampMassey {-# UNPACK #-} !(ForeignPtr CFmpzModBerlekampMassey) type CFmpzModBerlekampMassey = CFlint FmpzModBerlekampMassey -data FmpzModPolyRadix = FmpzModPolyRadix {-# UNPACK #-} !(ForeignPtr CFmpzModPolyRadix)-type CFmpzModPolyRadix = CFlint FmpzModPolyRadix- data FmpzModPolyFrobeniusPowers = FmpzModPolyFrobeniusPowers {-# UNPACK #-} !(ForeignPtr CFmpzModPolyFrobeniusPowers) type CFmpzModPolyFrobeniusPowers = CFlint FmpzModPolyFrobeniusPowers @@ -2719,9 +2748,6 @@ -- conversion problems for polynomials, which is to express a polynomial -- \(f(X)\) with respect to a given radix \(r(X)\) as ----- -- where \(N = \lfloor\deg(f) / \deg(r)\rfloor\). The algorithm implemented -- here is a recursive one, which performs Euclidean divisions by powers of -- \(r\) of the form \(r^{2^i}\), and it has time complexity@@ -2731,6 +2757,7 @@ -- and it is computed using the function @fmpz_mod_poly_radix_init@, which -- only depends on~\`r\` and an upper bound on the degree of~\`f\`. --+ -- | /_fmpz_mod_poly_radix_init/ /Rpow/ /Rinv/ /R/ /lenR/ /k/ /invL/ /p/ -- -- Computes powers of \(R\) of the form \(R^{2^i}\) and their Newton@@ -2754,6 +2781,7 @@ foreign import ccall "fmpz_mod_poly.h _fmpz_mod_poly_radix_init" _fmpz_mod_poly_radix_init :: Ptr (Ptr CFmpz) -> Ptr (Ptr CFmpz) -> Ptr CFmpz -> CLong -> CLong -> Ptr CFmpz -> Ptr CFmpz -> IO () + -- | /fmpz_mod_poly_radix_init/ /D/ /R/ /degF/ /ctx/ -- -- Carries out the precomputation necessary to perform radix conversion to@@ -2764,6 +2792,12 @@ foreign import ccall "fmpz_mod_poly.h fmpz_mod_poly_radix_init" fmpz_mod_poly_radix_init :: Ptr CFmpzModPolyRadix -> Ptr CFmpzModPoly -> CLong -> Ptr CFmpzModCtx -> IO () +foreign import ccall "fmpz_mod_poly.h fmpz_mod_poly_radix_clear"+ fmpz_mod_poly_radix_clear :: Ptr CFmpzModPolyRadix -> IO ()++foreign import ccall "fmpz_mod_poly.h &fmpz_mod_poly_radix_clear"+ p_fmpz_mod_poly_radix_clear :: FunPtr (Ptr CFmpzModPolyRadix -> IO ())+ -- | /_fmpz_mod_poly_radix/ /B/ /F/ /Rpow/ /Rinv/ /degR/ /k/ /i/ /W/ /p/ -- -- This is the main recursive function used by the function@@ -2892,9 +2926,6 @@ fmpz_mod_poly_deflation :: Ptr CFmpzModPoly -> Ptr CFmpzModCtx -> IO CULong -- Berlekamp-Massey Algorithm ----------------------------------------------------- -- | /fmpz_mod_berlekamp_massey_init/ /B/ /ctx/ --
src/Data/Number/Flint/Fmpz/Poly/FFI.hsc view
@@ -30,4488 +30,4522 @@ , fmpz_poly_set_si , fmpz_poly_set_ui , fmpz_poly_set_fmpz- -- , fmpz_poly_set_mpz- , _fmpz_poly_set_str- , fmpz_poly_set_str- , _fmpz_poly_get_str- , fmpz_poly_get_str- , _fmpz_poly_get_str_pretty- , fmpz_poly_get_str_pretty- , fmpz_poly_zero- , fmpz_poly_one- , fmpz_poly_zero_coeffs- , fmpz_poly_swap- , _fmpz_poly_reverse- , fmpz_poly_reverse- , fmpz_poly_truncate- , fmpz_poly_set_trunc- -- * Randomisation- , fmpz_poly_randtest- , fmpz_poly_randtest_unsigned- , fmpz_poly_randtest_not_zero- , fmpz_poly_randtest_no_real_root- -- * Getting and setting coefficients- , fmpz_poly_get_coeff_fmpz- , fmpz_poly_get_coeff_si- , fmpz_poly_get_coeff_ui- , fmpz_poly_get_coeff_ptr- , fmpz_poly_lead- , fmpz_poly_set_coeff_fmpz- , fmpz_poly_set_coeff_si- , fmpz_poly_set_coeff_ui- -- * Comparison- , fmpz_poly_equal- , fmpz_poly_equal_trunc- , fmpz_poly_is_zero- , fmpz_poly_is_one- , fmpz_poly_is_unit- , fmpz_poly_is_gen- -- * Addition and subtraction- , _fmpz_poly_add- , fmpz_poly_add- , fmpz_poly_add_series- , _fmpz_poly_sub- , fmpz_poly_sub- , fmpz_poly_sub_series- , fmpz_poly_neg- -- * Scalar absolute value, multiplication and division- , fmpz_poly_scalar_abs- , fmpz_poly_scalar_mul_fmpz- --, fmpz_poly_scalar_mul_mpz- , fmpz_poly_scalar_mul_si- , fmpz_poly_scalar_mul_ui- , fmpz_poly_scalar_mul_2exp- , fmpz_poly_scalar_addmul_si- , fmpz_poly_scalar_addmul_ui- , fmpz_poly_scalar_addmul_fmpz- , fmpz_poly_scalar_submul_fmpz- , fmpz_poly_scalar_fdiv_fmpz- --, fmpz_poly_scalar_fdiv_mpz- , fmpz_poly_scalar_fdiv_si- , fmpz_poly_scalar_fdiv_ui- , fmpz_poly_scalar_fdiv_2exp- , fmpz_poly_scalar_tdiv_fmpz- , fmpz_poly_scalar_tdiv_si- , fmpz_poly_scalar_tdiv_ui- , fmpz_poly_scalar_tdiv_2exp- , fmpz_poly_scalar_divexact_fmpz- --, fmpz_poly_scalar_divexact_mpz- , fmpz_poly_scalar_divexact_si- , fmpz_poly_scalar_divexact_ui- , fmpz_poly_scalar_mod_fmpz- , fmpz_poly_scalar_smod_fmpz- , _fmpz_poly_remove_content_2exp- , _fmpz_poly_scale_2exp- -- * Bit packing- , _fmpz_poly_bit_pack- , _fmpz_poly_bit_unpack- , _fmpz_poly_bit_unpack_unsigned- , fmpz_poly_bit_pack- , fmpz_poly_bit_unpack- , fmpz_poly_bit_unpack_unsigned- -- * Multiplication- , _fmpz_poly_mul_classical- , fmpz_poly_mul_classical- , _fmpz_poly_mullow_classical- , fmpz_poly_mullow_classical- , _fmpz_poly_mulhigh_classical- , fmpz_poly_mulhigh_classical- , _fmpz_poly_mulmid_classical- , fmpz_poly_mulmid_classical- , _fmpz_poly_mul_karatsuba- , fmpz_poly_mul_karatsuba- , _fmpz_poly_mullow_karatsuba_n- , fmpz_poly_mullow_karatsuba_n- , _fmpz_poly_mulhigh_karatsuba_n- , fmpz_poly_mulhigh_karatsuba_n- , _fmpz_poly_mul_KS- , fmpz_poly_mul_KS- , _fmpz_poly_mullow_KS- , fmpz_poly_mullow_KS- , _fmpz_poly_mul_SS- , fmpz_poly_mul_SS- , _fmpz_poly_mullow_SS- , fmpz_poly_mullow_SS- , _fmpz_poly_mul- , fmpz_poly_mul- , _fmpz_poly_mullow- , fmpz_poly_mullow- , fmpz_poly_mulhigh_n- , _fmpz_poly_mulhigh- -- * FFT precached multiplication- , fmpz_poly_mul_SS_precache_init- , fmpz_poly_mul_precache_clear- , _fmpz_poly_mullow_SS_precache- , fmpz_poly_mullow_SS_precache- , fmpz_poly_mul_SS_precache- -- * Squaring- , _fmpz_poly_sqr_KS- , fmpz_poly_sqr_KS- , _fmpz_poly_sqr_karatsuba- , fmpz_poly_sqr_karatsuba- , _fmpz_poly_sqr_classical- , fmpz_poly_sqr_classical- , _fmpz_poly_sqr- , fmpz_poly_sqr- , _fmpz_poly_sqrlow_KS- , fmpz_poly_sqrlow_KS- , _fmpz_poly_sqrlow_karatsuba_n- , fmpz_poly_sqrlow_karatsuba_n- , _fmpz_poly_sqrlow_classical- , fmpz_poly_sqrlow_classical- , _fmpz_poly_sqrlow- , fmpz_poly_sqrlow- -- * Powering- , _fmpz_poly_pow_multinomial- , fmpz_poly_pow_multinomial- , _fmpz_poly_pow_binomial- , fmpz_poly_pow_binomial- , _fmpz_poly_pow_addchains- , fmpz_poly_pow_addchains- , _fmpz_poly_pow_binexp- , fmpz_poly_pow_binexp- , _fmpz_poly_pow_small- , _fmpz_poly_pow- , fmpz_poly_pow- , _fmpz_poly_pow_trunc- , fmpz_poly_pow_trunc- -- * Shifting- , _fmpz_poly_shift_left- , fmpz_poly_shift_left- , _fmpz_poly_shift_right- , fmpz_poly_shift_right- -- * Bit sizes and norms- , fmpz_poly_max_limbs- , fmpz_poly_max_bits- , fmpz_poly_height- , _fmpz_poly_2norm- , fmpz_poly_2norm- , _fmpz_poly_2norm_normalised_bits- -- * Greatest common divisor- , _fmpz_poly_gcd_subresultant- , fmpz_poly_gcd_subresultant- , _fmpz_poly_gcd_heuristic- , fmpz_poly_gcd_heuristic- , _fmpz_poly_gcd_modular- , fmpz_poly_gcd_modular- , _fmpz_poly_gcd- , fmpz_poly_gcd- , _fmpz_poly_xgcd_modular- , fmpz_poly_xgcd_modular- , _fmpz_poly_xgcd- , fmpz_poly_xgcd- , _fmpz_poly_lcm- , fmpz_poly_lcm- , _fmpz_poly_resultant_modular- , fmpz_poly_resultant_modular- , fmpz_poly_resultant_modular_div- , _fmpz_poly_resultant_euclidean- , fmpz_poly_resultant_euclidean- , _fmpz_poly_resultant- , fmpz_poly_resultant- -- * Discriminant- , _fmpz_poly_discriminant- , fmpz_poly_discriminant- -- * Gaussian content- , _fmpz_poly_content- , fmpz_poly_content- , _fmpz_poly_primitive_part- , fmpz_poly_primitive_part- -- * Square-free- , _fmpz_poly_is_squarefree- , fmpz_poly_is_squarefree- -- * Euclidean division- , _fmpz_poly_divrem_basecase- , fmpz_poly_divrem_basecase- , _fmpz_poly_divrem_divconquer_recursive- , _fmpz_poly_divrem_divconquer- , fmpz_poly_divrem_divconquer- , _fmpz_poly_divrem- , fmpz_poly_divrem- , _fmpz_poly_div_basecase- , fmpz_poly_div_basecase- , _fmpz_poly_divremlow_divconquer_recursive- , _fmpz_poly_div_divconquer_recursive- , _fmpz_poly_div_divconquer- , fmpz_poly_div_divconquer- , _fmpz_poly_div- , fmpz_poly_div- , _fmpz_poly_rem_basecase- , fmpz_poly_rem_basecase- , _fmpz_poly_rem- , fmpz_poly_rem- , _fmpz_poly_div_root- , fmpz_poly_div_root- -- * Division with precomputed inverse- , _fmpz_poly_preinvert- , fmpz_poly_preinvert- , _fmpz_poly_div_preinv- , fmpz_poly_div_preinv- , _fmpz_poly_divrem_preinv- , fmpz_poly_divrem_preinv- , _fmpz_poly_powers_precompute- , fmpz_poly_powers_precompute- , _fmpz_poly_powers_clear- , fmpz_poly_powers_clear- , _fmpz_poly_rem_powers_precomp- , fmpz_poly_rem_powers_precomp- -- * Divisibility testing- , _fmpz_poly_divides- , fmpz_poly_divides- , fmpz_poly_remove- -- * Division mod p- , fmpz_poly_divlow_smodp- , fmpz_poly_divhigh_smodp- -- * Power series division- , _fmpz_poly_inv_series_basecase- , fmpz_poly_inv_series_basecase- , _fmpz_poly_inv_series_newton- , fmpz_poly_inv_series_newton- , _fmpz_poly_inv_series- , fmpz_poly_inv_series- , _fmpz_poly_div_series_basecase- , _fmpz_poly_div_series_divconquer- , _fmpz_poly_div_series- , fmpz_poly_div_series_basecase- , fmpz_poly_div_series_divconquer- , fmpz_poly_div_series- -- * Pseudo division- , _fmpz_poly_pseudo_divrem_basecase- , fmpz_poly_pseudo_divrem_basecase- , _fmpz_poly_pseudo_divrem_divconquer- , fmpz_poly_pseudo_divrem_divconquer- , _fmpz_poly_pseudo_divrem_cohen- , fmpz_poly_pseudo_divrem_cohen- , _fmpz_poly_pseudo_rem_cohen- , fmpz_poly_pseudo_rem_cohen- --, _fmpz_poly_pseudo_divrem- --, fmpz_poly_pseudo_divrem- , _fmpz_poly_pseudo_div- , fmpz_poly_pseudo_div- , _fmpz_poly_pseudo_rem- , fmpz_poly_pseudo_rem- -- * Derivative- , _fmpz_poly_derivative- , fmpz_poly_derivative- , _fmpz_poly_nth_derivative- , fmpz_poly_nth_derivative- -- * Evaluation- , _fmpz_poly_evaluate_divconquer_fmpz- , fmpz_poly_evaluate_divconquer_fmpz- , _fmpz_poly_evaluate_horner_fmpz- , fmpz_poly_evaluate_horner_fmpz- , _fmpz_poly_evaluate_fmpz- , fmpz_poly_evaluate_fmpz- , _fmpz_poly_evaluate_divconquer_fmpq- , fmpz_poly_evaluate_divconquer_fmpq- , _fmpz_poly_evaluate_horner_fmpq- , fmpz_poly_evaluate_horner_fmpq- , _fmpz_poly_evaluate_fmpq- , fmpz_poly_evaluate_fmpq- -- , fmpz_poly_evaluate_mpq- , _fmpz_poly_evaluate_mod- , fmpz_poly_evaluate_mod- , fmpz_poly_evaluate_fmpz_vec- , _fmpz_poly_evaluate_horner_d- , fmpz_poly_evaluate_horner_d- , _fmpz_poly_evaluate_horner_d_2exp- , fmpz_poly_evaluate_horner_d_2exp- , _fmpz_poly_evaluate_horner_d_2exp2- -- * Newton basis- , _fmpz_poly_monomial_to_newton- , _fmpz_poly_newton_to_monomial- -- * Interpolation- , fmpz_poly_interpolate_fmpz_vec- -- * Composition- , _fmpz_poly_compose_horner- , fmpz_poly_compose_horner- , _fmpz_poly_compose_divconquer- , fmpz_poly_compose_divconquer- , _fmpz_poly_compose- , fmpz_poly_compose- -- * Inflation and deflation- , fmpz_poly_inflate- , fmpz_poly_deflate- , fmpz_poly_deflation- -- * Taylor shift- , _fmpz_poly_taylor_shift_horner- , fmpz_poly_taylor_shift_horner- , _fmpz_poly_taylor_shift_divconquer- , fmpz_poly_taylor_shift_divconquer- , _fmpz_poly_taylor_shift_multi_mod- , fmpz_poly_taylor_shift_multi_mod- , _fmpz_poly_taylor_shift- , fmpz_poly_taylor_shift- -- * Power series composition- , _fmpz_poly_compose_series_horner- , fmpz_poly_compose_series_horner- , _fmpz_poly_compose_series_brent_kung- , fmpz_poly_compose_series_brent_kung- , _fmpz_poly_compose_series- , fmpz_poly_compose_series- -- * Power series reversion- , _fmpz_poly_revert_series_lagrange- , fmpz_poly_revert_series_lagrange- , _fmpz_poly_revert_series_lagrange_fast- , fmpz_poly_revert_series_lagrange_fast- , _fmpz_poly_revert_series_newton- , fmpz_poly_revert_series_newton- , _fmpz_poly_revert_series- , fmpz_poly_revert_series- -- * Square root- , _fmpz_poly_sqrtrem_classical- , fmpz_poly_sqrtrem_classical- , _fmpz_poly_sqrtrem_divconquer- , fmpz_poly_sqrtrem_divconquer- , _fmpz_poly_sqrt_classical- , fmpz_poly_sqrt_classical- , _fmpz_poly_sqrt_KS- , fmpz_poly_sqrt_KS- , _fmpz_poly_sqrt_divconquer- , fmpz_poly_sqrt_divconquer- , _fmpz_poly_sqrt- , fmpz_poly_sqrt- , _fmpz_poly_sqrt_series- , fmpz_poly_sqrt_series- -- * Power sums- , _fmpz_poly_power_sums_naive- , fmpz_poly_power_sums_naive- , fmpz_poly_power_sums- , _fmpz_poly_power_sums_to_poly- , fmpz_poly_power_sums_to_poly- -- * Signature- , _fmpz_poly_signature- , fmpz_poly_signature- -- * Hensel lifting- , fmpz_poly_hensel_build_tree- , fmpz_poly_hensel_lift- , fmpz_poly_hensel_lift_without_inverse- , fmpz_poly_hensel_lift_only_inverse- , fmpz_poly_hensel_lift_tree_recursive- , fmpz_poly_hensel_lift_tree- , _fmpz_poly_hensel_start_lift- , _fmpz_poly_hensel_continue_lift- , fmpz_poly_hensel_lift_once- -- * Input and output- , _fmpz_poly_print- , fmpz_poly_print- , _fmpz_poly_print_pretty- , fmpz_poly_print_pretty- , _fmpz_poly_fprint- , fmpz_poly_fprint- , _fmpz_poly_fprint_pretty- , fmpz_poly_fprint_pretty- , fmpz_poly_read- , fmpz_poly_read_pretty- , fmpz_poly_fread- , fmpz_poly_fread_pretty- -- * Modular reduction and reconstruction- , fmpz_poly_get_nmod_poly- , fmpz_poly_set_nmod_poly- , fmpz_poly_set_nmod_poly_unsigned- , _fmpz_poly_CRT_ui_precomp- , _fmpz_poly_CRT_ui- , fmpz_poly_CRT_ui- -- * Products- , _fmpz_poly_product_roots_fmpz_vec- , fmpz_poly_product_roots_fmpz_vec- , _fmpz_poly_product_roots_fmpq_vec- , fmpz_poly_product_roots_fmpq_vec- -- * Roots- , _fmpz_poly_bound_roots- , _fmpz_poly_num_real_roots_sturm- , fmpz_poly_num_real_roots_sturm- , _fmpz_poly_num_real_roots- , fmpz_poly_num_real_roots- -- * Minimal polynomials- , _fmpz_poly_cyclotomic- , fmpz_poly_cyclotomic- , _fmpz_poly_is_cyclotomic- , _fmpz_poly_cos_minpoly- , _fmpz_poly_swinnerton_dyer- -- * Orthogonal polynomials- , _fmpz_poly_chebyshev_t- , _fmpz_poly_chebyshev_u- , _fmpz_poly_legendre_pt- , fmpz_poly_legendre_pt- , _fmpz_poly_hermite_h- , fmpz_poly_hermite_h- , _fmpz_poly_hermite_he- , fmpz_poly_hermite_he- -- * Fibonacci polynomials- , _fmpz_poly_fibonacci- , fmpz_poly_fibonacci- -- THIS DOES NOT SEEM TO EXIST IN THE ACTUAL IMPLEMENTATION- -- -- * Eulerian numbers and polynomials- -- , arith_eulerian_polynomial- -- * Modular forms and q-series- , _fmpz_poly_eta_qexp- , _fmpz_poly_theta_qexp- -- * CLD bounds- , fmpz_poly_CLD_bound-) where ---- univariate polynomials over the integers --------------------------------------import Control.Monad--import Foreign.C.String-import Foreign.C.Types-import Foreign.ForeignPtr-import Foreign.Ptr ( Ptr, FunPtr, nullPtr, plusPtr )-import Foreign.Storable-import Foreign.Marshal ( free )-import Foreign.Marshal.Array ( advancePtr )--import Data.Number.Flint.Flint-import Data.Number.Flint.Fmpz-import Data.Number.Flint.Fmpq-import Data.Number.Flint.NMod.Types--#include <flint/flint.h>-#include <flint/fmpz.h>-#include <flint/fmpq.h>-#include <flint/fmpz_poly.h>---- fmpz_poly_t -------------------------------------------------------------------data FmpzPoly = FmpzPoly {-# UNPACK #-} !(ForeignPtr CFmpzPoly)-data CFmpzPoly = CFmpzPoly (Ptr CFmpz) CLong CLong--instance Storable CFmpzPoly where- {-# INLINE sizeOf #-}- sizeOf _ = #{size fmpz_poly_t}- {-# INLINE alignment #-}- alignment _ = #{alignment fmpz_poly_t}- peek ptr = do- coeffs <- #{peek fmpz_poly_struct, coeffs} ptr- alloc <- #{peek fmpz_poly_struct, alloc } ptr- length <- #{peek fmpz_poly_struct, length} ptr- return $ CFmpzPoly coeffs alloc length- poke = error "CFmpzPoly.poke: Not defined"---- | /newFmpzPoly/------ Construct a new `FmpzPoly`-newFmpzPoly = do- p <- mallocForeignPtr- withForeignPtr p fmpz_poly_init- addForeignPtrFinalizer p_fmpz_poly_clear p- return $ FmpzPoly p---- | /withFmpzPoly/ /poly/ /f/--- --- Execute /f/ on /poly/-{-# INLINE withFmpzPoly #-}-withFmpzPoly (FmpzPoly p) f = do- withForeignPtr p $ \fp -> f fp >>= return . (FmpzPoly p,)---- | /withNewFmpzPoly/ /poly/ /f/--- --- Execute /f/ on a new `FmpzPoly`-withNewFmpzPoly f = do- x <- newFmpzPoly- withFmpzPoly x $ \x -> f x---- fmpz_poly_powers_precomp_t ------------------------------------------------------ | Data structure containing the /CFmpzPolyPowersPrecomp/ pointer-data FmpzPolyPowersPrecomp = FmpzPolyPowersPrecomp- {-# UNPACK #-} !(ForeignPtr CFmpzPolyPowersPrecomp) -type CFmpzPolyPowersPrecomp = CFlint FmpzPolyPowersPrecomp---- fmpz_poly_factor_t -------------------------------------------------------------- | Data structure containing the /CFmpzPolyFactor/ pointer-data FmpzPolyFactor = FmpzPolyFactor- {-# UNPACK #-} !(ForeignPtr CFmpzPolyFactor) -type CFmpzPolyFactor = CFlint FmpzPolyFactor---- fmpz_poly_mul_precache_t -------------------------------------------------------- | Data structure containing the /CFmpzPolyMulPrecache/ pointer-data FmpzPolyMulPrecache = FmpzPolyMulPrecache- {-# UNPACK #-} !(ForeignPtr CFmpzPolyMulPrecache) -type CFmpzPolyMulPrecache = CFlint FmpzPolyMulPrecache---- Memory management --------------------------------------------------------------- | /fmpz_poly_init/ /poly/ --- --- Initialises @poly@ for use, setting its length to zero. A corresponding--- call to @fmpz_poly_clear@ must be made after finishing with the--- @fmpz_poly_t@ to free the memory used by the polynomial.-foreign import ccall "fmpz_poly.h fmpz_poly_init"- fmpz_poly_init :: Ptr CFmpzPoly -> IO ()---- | /fmpz_poly_init2/ /poly/ /alloc/ --- --- Initialises @poly@ with space for at least @alloc@ coefficients and sets--- the length to zero. The allocated coefficients are all set to zero.-foreign import ccall "fmpz_poly.h fmpz_poly_init2"- fmpz_poly_init2 :: Ptr CFmpzPoly -> CLong -> IO ()---- | /fmpz_poly_realloc/ /poly/ /alloc/ --- --- Reallocates the given polynomial to have space for @alloc@ coefficients.--- If @alloc@ is zero the polynomial is cleared and then reinitialised. If--- the current length is greater than @alloc@ the polynomial is first--- truncated to length @alloc@.-foreign import ccall "fmpz_poly.h fmpz_poly_realloc"- fmpz_poly_realloc :: Ptr CFmpzPoly -> CLong -> IO ()---- | /fmpz_poly_fit_length/ /poly/ /len/ --- --- If @len@ is greater than the number of coefficients currently allocated,--- then the polynomial is reallocated to have space for at least @len@--- coefficients. No data is lost when calling this function.--- --- The function efficiently deals with the case where @fit_length@ is--- called many times in small increments by at least doubling the number of--- allocated coefficients when length is larger than the number of--- coefficients currently allocated.-foreign import ccall "fmpz_poly.h fmpz_poly_fit_length"- fmpz_poly_fit_length :: Ptr CFmpzPoly -> CLong -> IO ()---- | /fmpz_poly_clear/ /poly/ --- --- Clears the given polynomial, releasing any memory used. It must be--- reinitialised in order to be used again.-foreign import ccall "fmpz_poly.h fmpz_poly_clear"- fmpz_poly_clear :: Ptr CFmpzPoly -> IO ()--foreign import ccall "fmpz_poly.h &fmpz_poly_clear"- p_fmpz_poly_clear :: FunPtr (Ptr CFmpzPoly -> IO ())---- | /_fmpz_poly_normalise/ /poly/ --- --- Sets the length of @poly@ so that the top coefficient is non-zero. If--- all coefficients are zero, the length is set to zero. This function is--- mainly used internally, as all functions guarantee normalisation.-foreign import ccall "fmpz_poly.h _fmpz_poly_normalise"- _fmpz_poly_normalise :: Ptr CFmpzPoly -> IO ()---- | /_fmpz_poly_set_length/ /poly/ /newlen/ --- --- Demotes the coefficients of @poly@ beyond @newlen@ and sets the length--- of @poly@ to @newlen@.-foreign import ccall "fmpz_poly.h _fmpz_poly_set_length"- _fmpz_poly_set_length :: Ptr CFmpzPoly -> CLong -> IO ()---- | /fmpz_poly_attach_truncate/ /trunc/ /poly/ /n/ --- --- This function sets the uninitialised polynomial @trunc@ to the low \(n\)--- coefficients of @poly@, or to @poly@ if the latter doesn\'t have \(n\)--- coefficients. The polynomial @trunc@ not be cleared or used as the--- output of any Flint functions.-foreign import ccall "fmpz_poly.h fmpz_poly_attach_truncate"- fmpz_poly_attach_truncate :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()---- | /fmpz_poly_attach_shift/ /trunc/ /poly/ /n/ --- --- This function sets the uninitialised polynomial @trunc@ to the high--- coefficients of @poly@, i.e. the coefficients not among the low \(n\)--- coefficients of @poly@. If the latter doesn\'t have \(n\) coefficients--- @trunc@ is set to the zero polynomial. The polynomial @trunc@ not be--- cleared or used as the output of any Flint functions.-foreign import ccall "fmpz_poly.h fmpz_poly_attach_shift"- fmpz_poly_attach_shift :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()---- Polynomial parameters ----------------------------------------------------------- | /fmpz_poly_length/ /poly/ --- --- Returns the length of @poly@. The zero polynomial has length zero.-foreign import ccall "fmpz_poly.h fmpz_poly_length"- fmpz_poly_length :: Ptr CFmpzPoly -> IO CLong---- | /fmpz_poly_degree/ /poly/ --- --- Returns the degree of @poly@, which is one less than its length.-foreign import ccall "fmpz_poly.h fmpz_poly_degree"- fmpz_poly_degree :: Ptr CFmpzPoly -> IO CLong---- Assignment and basic manipulation ----------------------------------------------- | /fmpz_poly_set/ /poly1/ /poly2/ --- --- Sets @poly1@ to equal @poly2@.-foreign import ccall "fmpz_poly.h fmpz_poly_set"- fmpz_poly_set :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()---- | /fmpz_poly_set_si/ /poly/ /c/ --- --- Sets @poly@ to the signed integer @c@.-foreign import ccall "fmpz_poly.h fmpz_poly_set_si"- fmpz_poly_set_si :: Ptr CFmpzPoly -> CLong -> IO ()---- | /fmpz_poly_set_ui/ /poly/ /c/ --- --- Sets @poly@ to the unsigned integer @c@.-foreign import ccall "fmpz_poly.h fmpz_poly_set_ui"- fmpz_poly_set_ui :: Ptr CFmpzPoly -> CULong -> IO ()---- | /fmpz_poly_set_fmpz/ /poly/ /c/ --- --- Sets @poly@ to the integer @c@.-foreign import ccall "fmpz_poly.h fmpz_poly_set_fmpz"- fmpz_poly_set_fmpz :: Ptr CFmpzPoly -> Ptr CFmpz -> IO ()---- -- | /fmpz_poly_set_mpz/ /poly/ /c/ --- -- --- -- Sets @poly@ to the integer @c@.--- foreign import ccall "fmpz_poly.h fmpz_poly_set_mpz"--- fmpz_poly_set_mpz :: Ptr CFmpzPoly -> Ptr CMpz -> IO ()---- | /_fmpz_poly_set_str/ /poly/ /str/ --- --- Sets @poly@ to the polynomial encoded in the null-terminated string--- @str@. Assumes that @poly@ is allocated as a sufficiently large array--- suitable for the number of coefficients present in @str@.--- --- Returns \(0\) if no error occurred. Otherwise, returns a non-zero value,--- in which case the resulting value of @poly@ is undefined. If @str@ is--- not null-terminated, calling this method might result in a segmentation--- fault.-foreign import ccall "fmpz_poly.h _fmpz_poly_set_str"- _fmpz_poly_set_str :: Ptr CFmpz -> CString -> IO CInt---- | /fmpz_poly_set_str/ /poly/ /str/ --- --- Imports a polynomial from a null-terminated string. If the string @str@--- represents a valid polynomial returns \(0\), otherwise returns \(1\).--- --- Returns \(0\) if no error occurred. Otherwise, returns a non-zero value,--- in which case the resulting value of @poly@ is undefined. If @str@ is--- not null-terminated, calling this method might result in a segmentation--- fault.-foreign import ccall "fmpz_poly.h fmpz_poly_set_str"- fmpz_poly_set_str :: Ptr CFmpzPoly -> CString -> IO CInt---- | /_fmpz_poly_get_str/ /poly/ /len/ --- --- Returns the plain FLINT string representation of the polynomial--- @(poly, len)@.-foreign import ccall "fmpz_poly.h _fmpz_poly_get_str"- _fmpz_poly_get_str :: Ptr CFmpz -> CLong -> IO CString---- | /fmpz_poly_get_str/ /poly/ --- --- Returns the plain FLINT string representation of the polynomial @poly@.-foreign import ccall "fmpz_poly.h fmpz_poly_get_str"- fmpz_poly_get_str :: Ptr CFmpzPoly -> IO CString---- | /_fmpz_poly_get_str_pretty/ /poly/ /len/ /x/ --- --- Returns a pretty representation of the polynomial @(poly, len)@ using--- the null-terminated string @x@ as the variable name.-foreign import ccall "fmpz_poly.h _fmpz_poly_get_str_pretty"- _fmpz_poly_get_str_pretty :: Ptr CFmpz -> CLong -> CString -> IO CString---- | /fmpz_poly_get_str_pretty/ /poly/ /x/ --- --- Returns a pretty representation of the polynomial @poly@ using the--- null-terminated string @x@ as the variable name.-foreign import ccall "fmpz_poly.h fmpz_poly_get_str_pretty"- fmpz_poly_get_str_pretty :: Ptr CFmpzPoly -> CString -> IO CString---- | /fmpz_poly_zero/ /poly/ --- --- Sets @poly@ to the zero polynomial.-foreign import ccall "fmpz_poly.h fmpz_poly_zero"- fmpz_poly_zero :: Ptr CFmpzPoly -> IO ()---- | /fmpz_poly_one/ /poly/ --- --- Sets @poly@ to the constant polynomial one.-foreign import ccall "fmpz_poly.h fmpz_poly_one"- fmpz_poly_one :: Ptr CFmpzPoly -> IO ()---- | /fmpz_poly_zero_coeffs/ /poly/ /i/ /j/ --- --- Sets the coefficients of \(x^i, \dotsc, x^{j-1}\) to zero.-foreign import ccall "fmpz_poly.h fmpz_poly_zero_coeffs"- fmpz_poly_zero_coeffs :: Ptr CFmpzPoly -> CLong -> CLong -> IO ()---- | /fmpz_poly_swap/ /poly1/ /poly2/ --- --- Swaps @poly1@ and @poly2@. This is done efficiently without copying data--- by swapping pointers, etc.-foreign import ccall "fmpz_poly.h fmpz_poly_swap"- fmpz_poly_swap :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()---- | /_fmpz_poly_reverse/ /res/ /poly/ /len/ /n/ --- --- Sets @(res, n)@ to the reverse of @(poly, n)@, where @poly@ is in fact--- an array of length @len@. Assumes that @0 \< len \<= n@. Supports--- aliasing of @res@ and @poly@, but the behaviour is undefined in case of--- partial overlap.-foreign import ccall "fmpz_poly.h _fmpz_poly_reverse"- _fmpz_poly_reverse :: Ptr CFmpz -> Ptr CFmpz -> CLong -> CLong -> IO ()---- | /fmpz_poly_reverse/ /res/ /poly/ /n/ --- --- This function considers the polynomial @poly@ to be of length \(n\),--- notionally truncating and zero padding if required, and reverses the--- result. Since the function normalises its result @res@ may be of length--- less than \(n\).-foreign import ccall "fmpz_poly.h fmpz_poly_reverse"- fmpz_poly_reverse :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()---- | /fmpz_poly_truncate/ /poly/ /newlen/ --- --- If the current length of @poly@ is greater than @newlen@, it is--- truncated to have the given length. Discarded coefficients are not--- necessarily set to zero.-foreign import ccall "fmpz_poly.h fmpz_poly_truncate"- fmpz_poly_truncate :: Ptr CFmpzPoly -> CLong -> IO ()---- | /fmpz_poly_set_trunc/ /res/ /poly/ /n/ --- --- Sets @res@ to a copy of @poly@, truncated to length @n@.-foreign import ccall "fmpz_poly.h fmpz_poly_set_trunc"- fmpz_poly_set_trunc :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()---- Randomisation ------------------------------------------------------------------- | /fmpz_poly_randtest/ /f/ /state/ /len/ /bits/ --- --- Sets \(f\) to a random polynomial with up to the given length and where--- each coefficient has up to the given number of bits. The coefficients--- are signed randomly. One must call @flint_randinit@ before calling this--- function.-foreign import ccall "fmpz_poly.h fmpz_poly_randtest"- fmpz_poly_randtest :: Ptr CFmpzPoly -> Ptr CFRandState -> CLong -> CFBitCnt -> IO ()---- | /fmpz_poly_randtest_unsigned/ /f/ /state/ /len/ /bits/ --- --- Sets \(f\) to a random polynomial with up to the given length and where--- each coefficient has up to the given number of bits. One must call--- @flint_randinit@ before calling this function.-foreign import ccall "fmpz_poly.h fmpz_poly_randtest_unsigned"- fmpz_poly_randtest_unsigned :: Ptr CFmpzPoly -> Ptr CFRandState -> CLong -> CFBitCnt -> IO ()---- | /fmpz_poly_randtest_not_zero/ /f/ /state/ /len/ /bits/ --- --- As for @fmpz_poly_randtest@ except that @len@ and bits may not be zero--- and the polynomial generated is guaranteed not to be the zero--- polynomial. One must call @flint_randinit@ before calling this function.-foreign import ccall "fmpz_poly.h fmpz_poly_randtest_not_zero"- fmpz_poly_randtest_not_zero :: Ptr CFmpzPoly -> Ptr CFRandState -> CLong -> CFBitCnt -> IO ()---- | /fmpz_poly_randtest_no_real_root/ /p/ /state/ /len/ /bits/ --- --- Sets @p@ to a random polynomial without any real root, whose length is--- up to @len@ and where each coefficient has up to the given number of--- bits. One must call @flint_randinit@ before calling this function.-foreign import ccall "fmpz_poly.h fmpz_poly_randtest_no_real_root"- fmpz_poly_randtest_no_real_root :: Ptr CFmpzPoly -> Ptr CFRandState -> CLong -> CFBitCnt -> IO ()---- Getting and setting coefficients ------------------------------------------------ | /fmpz_poly_get_coeff_fmpz/ /x/ /poly/ /n/ --- --- Sets \(x\) to the \(n\)-th coefficient of @poly@. Coefficient numbering--- is from zero and if \(n\) is set to a value beyond the end of the--- polynomial, zero is returned.-foreign import ccall "fmpz_poly.h fmpz_poly_get_coeff_fmpz"- fmpz_poly_get_coeff_fmpz :: Ptr CFmpz -> Ptr CFmpzPoly -> CLong -> IO ()---- | /fmpz_poly_get_coeff_si/ /poly/ /n/ --- --- Returns coefficient \(n\) of @poly@ as a @slong@. The result is--- undefined if the value does not fit into a @slong@. Coefficient--- numbering is from zero and if \(n\) is set to a value beyond the end of--- the polynomial, zero is returned.-foreign import ccall "fmpz_poly.h fmpz_poly_get_coeff_si"- fmpz_poly_get_coeff_si :: Ptr CFmpzPoly -> CLong -> IO CLong---- | /fmpz_poly_get_coeff_ui/ /poly/ /n/ --- --- Returns coefficient \(n\) of @poly@ as a @ulong@. The result is--- undefined if the value does not fit into a @ulong@. Coefficient--- numbering is from zero and if \(n\) is set to a value beyond the end of--- the polynomial, zero is returned.-foreign import ccall "fmpz_poly.h fmpz_poly_get_coeff_ui"- fmpz_poly_get_coeff_ui :: Ptr CFmpzPoly -> CLong -> IO CULong---- | /fmpz_poly_get_coeff_ptr/ /poly/ /n/ --- --- Returns a reference to the coefficient of \(x^n\) in the polynomial, as--- an @fmpz *@. This function is provided so that individual coefficients--- can be accessed and operated on by functions in the @fmpz@ module. This--- function does not make a copy of the data, but returns a reference to--- the actual coefficient.--- --- Returns @NULL@ when \(n\) exceeds the degree of the polynomial.--- --- This function is implemented as a macro.-fmpz_poly_get_coeff_ptr :: Ptr CFmpzPoly -> CLong -> IO (Ptr CFmpz)-fmpz_poly_get_coeff_ptr poly j = do- CFmpzPoly coeffs _ n <- peek poly- return $ if 0 <= j && j < n then- (coeffs `advancePtr` (fromIntegral j))- else- nullPtr--- | /fmpz_poly_lead/ /poly/ --- --- Returns a reference to the leading coefficient of the polynomial, as an--- @fmpz *@. This function is provided so that the leading coefficient can--- be easily accessed and operated on by functions in the @fmpz@ module.--- This function does not make a copy of the data, but returns a reference--- to the actual coefficient.--- --- Returns @NULL@ when the polynomial is zero.--- --- This function is implemented as a macro.-fmpz_poly_lead :: Ptr CFmpzPoly -> IO (Ptr CFmpz)-fmpz_poly_lead poly = do- CFmpzPoly coeffs _ n <- peek poly- return $ coeffs `advancePtr` (fromIntegral $ pred $ n)---- | /fmpz_poly_set_coeff_fmpz/ /poly/ /n/ /x/ --- --- Sets coefficient \(n\) of @poly@ to the @fmpz@ value @x@. Coefficient--- numbering starts from zero and if \(n\) is beyond the current length of--- @poly@ then the polynomial is extended and zero coefficients inserted if--- necessary.-foreign import ccall "fmpz_poly.h fmpz_poly_set_coeff_fmpz"- fmpz_poly_set_coeff_fmpz :: Ptr CFmpzPoly -> CLong -> Ptr CFmpz -> IO ()---- | /fmpz_poly_set_coeff_si/ /poly/ /n/ /x/ --- --- Sets coefficient \(n\) of @poly@ to the @slong@ value @x@. Coefficient--- numbering starts from zero and if \(n\) is beyond the current length of--- @poly@ then the polynomial is extended and zero coefficients inserted if--- necessary.-foreign import ccall "fmpz_poly.h fmpz_poly_set_coeff_si"- fmpz_poly_set_coeff_si :: Ptr CFmpzPoly -> CLong -> CLong -> IO ()---- | /fmpz_poly_set_coeff_ui/ /poly/ /n/ /x/ --- --- Sets coefficient \(n\) of @poly@ to the @ulong@ value @x@. Coefficient--- numbering starts from zero and if \(n\) is beyond the current length of--- @poly@ then the polynomial is extended and zero coefficients inserted if--- necessary.-foreign import ccall "fmpz_poly.h fmpz_poly_set_coeff_ui"- fmpz_poly_set_coeff_ui :: Ptr CFmpzPoly -> CLong -> CULong -> IO ()---- Comparison ---------------------------------------------------------------------- | /fmpz_poly_equal/ /poly1/ /poly2/ --- --- Returns \(1\) if @poly1@ is equal to @poly2@, otherwise returns \(0\).--- The polynomials are assumed to be normalised.-foreign import ccall "fmpz_poly.h fmpz_poly_equal"- fmpz_poly_equal :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO CInt---- | /fmpz_poly_equal_trunc/ /poly1/ /poly2/ /n/ --- --- Return \(1\) if @poly1@ and @poly2@, notionally truncated to length--- \(n\) are equal, otherwise return \(0\).-foreign import ccall "fmpz_poly.h fmpz_poly_equal_trunc"- fmpz_poly_equal_trunc :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO CInt---- | /fmpz_poly_is_zero/ /poly/ --- --- Returns \(1\) if the polynomial is zero and \(0\) otherwise.--- --- This function is implemented as a macro.-fmpz_poly_is_zero :: Ptr CFmpzPoly -> IO CInt-fmpz_poly_is_zero poly = do- CFmpzPoly _ _ n <- peek poly- return $ if n == 0 then 1 else 0- --- | /fmpz_poly_is_one/ /poly/ --- --- Returns \(1\) if the polynomial is one and \(0\) otherwise.-foreign import ccall "fmpz_poly.h fmpz_poly_is_one"- fmpz_poly_is_one :: Ptr CFmpzPoly -> IO CInt---- | /fmpz_poly_is_unit/ /poly/ --- --- Returns \(1\) is the polynomial is the constant polynomial \(\pm 1\),--- and \(0\) otherwise.-foreign import ccall "fmpz_poly.h fmpz_poly_is_unit"- fmpz_poly_is_unit :: Ptr CFmpzPoly -> IO CInt---- | /fmpz_poly_is_gen/ /poly/ --- --- Returns \(1\) if the polynomial is the degree \(1\) polynomial \(x\),--- and \(0\) otherwise.-foreign import ccall "fmpz_poly.h fmpz_poly_is_gen"- fmpz_poly_is_gen :: Ptr CFmpzPoly -> IO CInt---- Addition and subtraction -------------------------------------------------------- | /_fmpz_poly_add/ /res/ /poly1/ /len1/ /poly2/ /len2/ --- --- Sets @res@ to the sum of @(poly1, len1)@ and @(poly2, len2)@. It is--- assumed that @res@ has sufficient space for the longer of the two--- polynomials.-foreign import ccall "fmpz_poly.h _fmpz_poly_add"- _fmpz_poly_add :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> IO ()---- | /fmpz_poly_add/ /res/ /poly1/ /poly2/ --- --- Sets @res@ to the sum of @poly1@ and @poly2@.-foreign import ccall "fmpz_poly.h fmpz_poly_add"- fmpz_poly_add :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()---- | /fmpz_poly_add_series/ /res/ /poly1/ /poly2/ /n/ --- --- Notionally truncate @poly1@ and @poly2@ to length \(n\) and then set--- @res@ to the sum.-foreign import ccall "fmpz_poly.h fmpz_poly_add_series"- fmpz_poly_add_series :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> CULong -> IO ()---- | /_fmpz_poly_sub/ /res/ /poly1/ /len1/ /poly2/ /len2/ --- --- Sets @res@ to @(poly1, len1)@ minus @(poly2, len2)@. It is assumed that--- @res@ has sufficient space for the longer of the two polynomials.-foreign import ccall "fmpz_poly.h _fmpz_poly_sub"- _fmpz_poly_sub :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> IO ()---- | /fmpz_poly_sub/ /res/ /poly1/ /poly2/ --- --- Sets @res@ to @poly1@ minus @poly2@.-foreign import ccall "fmpz_poly.h fmpz_poly_sub"- fmpz_poly_sub :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()---- | /fmpz_poly_sub_series/ /res/ /poly1/ /poly2/ /n/ --- --- Notionally truncate @poly1@ and @poly2@ to length \(n\) and then set--- @res@ to the sum.-foreign import ccall "fmpz_poly.h fmpz_poly_sub_series"- fmpz_poly_sub_series :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> CULong -> IO ()---- | /fmpz_poly_neg/ /res/ /poly/ --- --- Sets @res@ to @-poly@.-foreign import ccall "fmpz_poly.h fmpz_poly_neg"- fmpz_poly_neg :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()---- Scalar absolute value, multiplication and division ------------------------------ | /fmpz_poly_scalar_abs/ /res/ /poly/ --- --- Sets @poly1@ to the polynomial whose coefficients are the absolute value--- of those of @poly2@.-foreign import ccall "fmpz_poly.h fmpz_poly_scalar_abs"- fmpz_poly_scalar_abs :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()---- | /fmpz_poly_scalar_mul_fmpz/ /poly1/ /poly2/ /x/ --- --- Sets @poly1@ to @poly2@ times \(x\).-foreign import ccall "fmpz_poly.h fmpz_poly_scalar_mul_fmpz"- fmpz_poly_scalar_mul_fmpz :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpz -> IO ()---- -- | /fmpz_poly_scalar_mul_mpz/ /poly1/ /poly2/ /x/ --- -- --- -- Sets @poly1@ to @poly2@ times the @mpz_t@ \(x\).--- foreign import ccall "fmpz_poly.h fmpz_poly_scalar_mul_mpz"--- fmpz_poly_scalar_mul_mpz :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CMpz -> IO ()---- | /fmpz_poly_scalar_mul_si/ /poly1/ /poly2/ /x/ --- --- Sets @poly1@ to @poly2@ times the signed @slong x@.-foreign import ccall "fmpz_poly.h fmpz_poly_scalar_mul_si"- fmpz_poly_scalar_mul_si :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()---- | /fmpz_poly_scalar_mul_ui/ /poly1/ /poly2/ /x/ --- --- Sets @poly1@ to @poly2@ times the @ulong x@.-foreign import ccall "fmpz_poly.h fmpz_poly_scalar_mul_ui"- fmpz_poly_scalar_mul_ui :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CULong -> IO ()---- | /fmpz_poly_scalar_mul_2exp/ /poly1/ /poly2/ /exp/ --- --- Sets @poly1@ to @poly2@ times @2^exp@.-foreign import ccall "fmpz_poly.h fmpz_poly_scalar_mul_2exp"- fmpz_poly_scalar_mul_2exp :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CULong -> IO ()--foreign import ccall "fmpz_poly.h fmpz_poly_scalar_addmul_si"- fmpz_poly_scalar_addmul_si :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()--foreign import ccall "fmpz_poly.h fmpz_poly_scalar_addmul_ui"- fmpz_poly_scalar_addmul_ui :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CULong -> IO ()---- | /fmpz_poly_scalar_addmul_fmpz/ /poly1/ /poly2/ /x/ --- --- Sets @poly1@ to @poly1 + x * poly2@.-foreign import ccall "fmpz_poly.h fmpz_poly_scalar_addmul_fmpz"- fmpz_poly_scalar_addmul_fmpz :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpz -> IO ()---- | /fmpz_poly_scalar_submul_fmpz/ /poly1/ /poly2/ /x/ --- --- Sets @poly1@ to @poly1 - x * poly2@.-foreign import ccall "fmpz_poly.h fmpz_poly_scalar_submul_fmpz"- fmpz_poly_scalar_submul_fmpz :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpz -> IO ()---- | /fmpz_poly_scalar_fdiv_fmpz/ /poly1/ /poly2/ /x/ --- --- Sets @poly1@ to @poly2@ divided by the @fmpz_t x@, rounding coefficients--- down toward \(- \infty\).-foreign import ccall "fmpz_poly.h fmpz_poly_scalar_fdiv_fmpz"- fmpz_poly_scalar_fdiv_fmpz :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpz -> IO ()---- -- | /fmpz_poly_scalar_fdiv_mpz/ /poly1/ /poly2/ /x/ --- -- --- -- Sets @poly1@ to @poly2@ divided by the @mpz_t x@, rounding coefficients--- -- down toward \(- \infty\).--- foreign import ccall "fmpz_poly.h fmpz_poly_scalar_fdiv_mpz"--- fmpz_poly_scalar_fdiv_mpz :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CMpz -> IO ()---- | /fmpz_poly_scalar_fdiv_si/ /poly1/ /poly2/ /x/ --- --- Sets @poly1@ to @poly2@ divided by the @slong x@, rounding coefficients--- down toward \(- \infty\).-foreign import ccall "fmpz_poly.h fmpz_poly_scalar_fdiv_si"- fmpz_poly_scalar_fdiv_si :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()---- | /fmpz_poly_scalar_fdiv_ui/ /poly1/ /poly2/ /x/ --- --- Sets @poly1@ to @poly2@ divided by the @ulong x@, rounding coefficients--- down toward \(- \infty\).-foreign import ccall "fmpz_poly.h fmpz_poly_scalar_fdiv_ui"- fmpz_poly_scalar_fdiv_ui :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CULong -> IO ()---- | /fmpz_poly_scalar_fdiv_2exp/ /poly1/ /poly2/ /x/ --- --- Sets @poly1@ to @poly2@ divided by @2^x@, rounding coefficients down--- toward \(- \infty\).-foreign import ccall "fmpz_poly.h fmpz_poly_scalar_fdiv_2exp"- fmpz_poly_scalar_fdiv_2exp :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CULong -> IO ()---- | /fmpz_poly_scalar_tdiv_fmpz/ /poly1/ /poly2/ /x/ --- --- Sets @poly1@ to @poly2@ divided by the @fmpz_t x@, rounding coefficients--- toward \(0\).-foreign import ccall "fmpz_poly.h fmpz_poly_scalar_tdiv_fmpz"- fmpz_poly_scalar_tdiv_fmpz :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpz -> IO ()---- | /fmpz_poly_scalar_tdiv_si/ /poly1/ /poly2/ /x/ --- --- Sets @poly1@ to @poly2@ divided by the @slong x@, rounding coefficients--- toward \(0\).-foreign import ccall "fmpz_poly.h fmpz_poly_scalar_tdiv_si"- fmpz_poly_scalar_tdiv_si :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()---- | /fmpz_poly_scalar_tdiv_ui/ /poly1/ /poly2/ /x/ --- --- Sets @poly1@ to @poly2@ divided by the @ulong x@, rounding coefficients--- toward \(0\).-foreign import ccall "fmpz_poly.h fmpz_poly_scalar_tdiv_ui"- fmpz_poly_scalar_tdiv_ui :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CULong -> IO ()---- | /fmpz_poly_scalar_tdiv_2exp/ /poly1/ /poly2/ /x/ --- --- Sets @poly1@ to @poly2@ divided by @2^x@, rounding coefficients toward--- \(0\).-foreign import ccall "fmpz_poly.h fmpz_poly_scalar_tdiv_2exp"- fmpz_poly_scalar_tdiv_2exp :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CULong -> IO ()---- | /fmpz_poly_scalar_divexact_fmpz/ /poly1/ /poly2/ /x/ --- --- Sets @poly1@ to @poly2@ divided by the @fmpz_t x@, assuming the division--- is exact for every coefficient.-foreign import ccall "fmpz_poly.h fmpz_poly_scalar_divexact_fmpz"- fmpz_poly_scalar_divexact_fmpz :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpz -> IO ()---- -- | /fmpz_poly_scalar_divexact_mpz/ /poly1/ /poly2/ /x/ --- -- --- -- Sets @poly1@ to @poly2@ divided by the @mpz_t x@, assuming the--- -- coefficient is exact for every coefficient.--- foreign import ccall "fmpz_poly.h fmpz_poly_scalar_divexact_mpz"--- fmpz_poly_scalar_divexact_mpz :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CMpz -> IO ()---- | /fmpz_poly_scalar_divexact_si/ /poly1/ /poly2/ /x/ --- --- Sets @poly1@ to @poly2@ divided by the @slong x@, assuming the--- coefficient is exact for every coefficient.-foreign import ccall "fmpz_poly.h fmpz_poly_scalar_divexact_si"- fmpz_poly_scalar_divexact_si :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()---- | /fmpz_poly_scalar_divexact_ui/ /poly1/ /poly2/ /x/ --- --- Sets @poly1@ to @poly2@ divided by the @ulong x@, assuming the--- coefficient is exact for every coefficient.-foreign import ccall "fmpz_poly.h fmpz_poly_scalar_divexact_ui"- fmpz_poly_scalar_divexact_ui :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CULong -> IO ()---- | /fmpz_poly_scalar_mod_fmpz/ /poly1/ /poly2/ /p/ --- --- Sets @poly1@ to @poly2@, reducing each coefficient modulo \(p > 0\).-foreign import ccall "fmpz_poly.h fmpz_poly_scalar_mod_fmpz"- fmpz_poly_scalar_mod_fmpz :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpz -> IO ()---- | /fmpz_poly_scalar_smod_fmpz/ /poly1/ /poly2/ /p/ --- --- Sets @poly1@ to @poly2@, symmetrically reducing each coefficient modulo--- \(p > 0\), that is, choosing the unique representative in the interval--- \((-p/2, p/2]\).-foreign import ccall "fmpz_poly.h fmpz_poly_scalar_smod_fmpz"- fmpz_poly_scalar_smod_fmpz :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpz -> IO ()---- | /_fmpz_poly_remove_content_2exp/ /pol/ /len/ --- --- Remove the 2-content of @pol@ and return the number \(k\) that is the--- maximal non-negative integer so that \(2^k\) divides all coefficients of--- the polynomial. For the zero polynomial, \(0\) is returned.-foreign import ccall "fmpz_poly.h _fmpz_poly_remove_content_2exp"- _fmpz_poly_remove_content_2exp :: Ptr CFmpz -> CLong -> IO CLong---- | /_fmpz_poly_scale_2exp/ /pol/ /len/ /k/ --- --- Scale @(pol, len)@ to \(p(2^k X)\) in-place and divide by the 2-content--- (so that the gcd of coefficients is odd). If @k@ is negative the--- polynomial is multiplied by \(2^{kd}\).-foreign import ccall "fmpz_poly.h _fmpz_poly_scale_2exp"- _fmpz_poly_scale_2exp :: Ptr CFmpz -> CLong -> CLong -> IO ()---- Bit packing --------------------------------------------------------------------- | /_fmpz_poly_bit_pack/ /arr/ /poly/ /len/ /bit_size/ /negate/ --- --- Packs the coefficients of @poly@ into bitfields of the given @bit_size@,--- negating the coefficients before packing if @negate@ is set to \(-1\).-foreign import ccall "fmpz_poly.h _fmpz_poly_bit_pack"- _fmpz_poly_bit_pack :: Ptr CMp -> Ptr CFmpz -> CLong -> CFBitCnt -> CInt -> IO ()---- | /_fmpz_poly_bit_unpack/ /poly/ /len/ /arr/ /bit_size/ /negate/ --- --- Unpacks the polynomial of given length from the array as packed into--- fields of the given @bit_size@, finally negating the coefficients if--- @negate@ is set to \(-1\). Returns borrow, which is nonzero if a leading--- term with coefficient \(\pm1\) should be added at position @len@ of--- @poly@.-foreign import ccall "fmpz_poly.h _fmpz_poly_bit_unpack"- _fmpz_poly_bit_unpack :: Ptr CFmpz -> CLong -> Ptr CMp -> CFBitCnt -> CInt -> IO CInt---- | /_fmpz_poly_bit_unpack_unsigned/ /poly/ /len/ /arr/ /bit_size/ --- --- Unpacks the polynomial of given length from the array as packed into--- fields of the given @bit_size@. The coefficients are assumed to be--- unsigned.-foreign import ccall "fmpz_poly.h _fmpz_poly_bit_unpack_unsigned"- _fmpz_poly_bit_unpack_unsigned :: Ptr CFmpz -> CLong -> Ptr CMp -> CFBitCnt -> IO ()---- | /fmpz_poly_bit_pack/ /f/ /poly/ /bit_size/ --- --- Packs @poly@ into bitfields of size @bit_size@, writing the result to--- @f@. The sign of @f@ will be the same as that of the leading coefficient--- of @poly@.-foreign import ccall "fmpz_poly.h fmpz_poly_bit_pack"- fmpz_poly_bit_pack :: Ptr CFmpz -> Ptr CFmpzPoly -> CFBitCnt -> IO ()---- | /fmpz_poly_bit_unpack/ /poly/ /f/ /bit_size/ --- --- Unpacks the polynomial with signed coefficients packed into fields of--- size @bit_size@ as represented by the integer @f@.-foreign import ccall "fmpz_poly.h fmpz_poly_bit_unpack"- fmpz_poly_bit_unpack :: Ptr CFmpzPoly -> Ptr CFmpz -> CFBitCnt -> IO ()---- | /fmpz_poly_bit_unpack_unsigned/ /poly/ /f/ /bit_size/ --- --- Unpacks the polynomial with unsigned coefficients packed into fields of--- size @bit_size@ as represented by the integer @f@. It is required that--- @f@ is nonnegative.-foreign import ccall "fmpz_poly.h fmpz_poly_bit_unpack_unsigned"- fmpz_poly_bit_unpack_unsigned :: Ptr CFmpzPoly -> Ptr CFmpz -> CFBitCnt -> IO ()---- Multiplication ------------------------------------------------------------------ | /_fmpz_poly_mul_classical/ /res/ /poly1/ /len1/ /poly2/ /len2/ --- --- Sets @(res, len1 + len2 - 1)@ to the product of @(poly1, len1)@ and--- @(poly2, len2)@.--- --- Assumes @len1@ and @len2@ are positive. Allows zero-padding of the two--- input polynomials. No aliasing of inputs with outputs is allowed.-foreign import ccall "fmpz_poly.h _fmpz_poly_mul_classical"- _fmpz_poly_mul_classical :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> IO ()---- | /fmpz_poly_mul_classical/ /res/ /poly1/ /poly2/ --- --- Sets @res@ to the product of @poly1@ and @poly2@, computed using the--- classical or schoolbook method.-foreign import ccall "fmpz_poly.h fmpz_poly_mul_classical"- fmpz_poly_mul_classical :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()---- | /_fmpz_poly_mullow_classical/ /res/ /poly1/ /len1/ /poly2/ /len2/ /n/ --- --- Sets @(res, n)@ to the first \(n\) coefficients of @(poly1, len1)@--- multiplied by @(poly2, len2)@.--- --- Assumes @0 \< n \<= len1 + len2 - 1@. Assumes neither @len1@ nor @len2@--- is zero.-foreign import ccall "fmpz_poly.h _fmpz_poly_mullow_classical"- _fmpz_poly_mullow_classical :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> CLong -> IO ()---- | /fmpz_poly_mullow_classical/ /res/ /poly1/ /poly2/ /n/ --- --- Sets @res@ to the first \(n\) coefficients of @poly1 * poly2@.-foreign import ccall "fmpz_poly.h fmpz_poly_mullow_classical"- fmpz_poly_mullow_classical :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()---- | /_fmpz_poly_mulhigh_classical/ /res/ /poly1/ /len1/ /poly2/ /len2/ /start/ --- --- Sets the first @start@ coefficients of @res@ to zero and the remainder--- to the corresponding coefficients of @(poly1, len1) * (poly2, len2)@.--- --- Assumes @start \<= len1 + len2 - 1@. Assumes neither @len1@ nor @len2@--- is zero.-foreign import ccall "fmpz_poly.h _fmpz_poly_mulhigh_classical"- _fmpz_poly_mulhigh_classical :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> CLong -> IO ()---- | /fmpz_poly_mulhigh_classical/ /res/ /poly1/ /poly2/ /start/ --- --- Sets the first @start@ coefficients of @res@ to zero and the remainder--- to the corresponding coefficients of the product of @poly1@ and @poly2@.-foreign import ccall "fmpz_poly.h fmpz_poly_mulhigh_classical"- fmpz_poly_mulhigh_classical :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()---- | /_fmpz_poly_mulmid_classical/ /res/ /poly1/ /len1/ /poly2/ /len2/ --- --- Sets @res@ to the middle @len1 - len2 + 1@ coefficients of the product--- of @(poly1, len1)@ and @(poly2, len2)@, i.e.the coefficients from degree--- @len2 - 1@ to @len1 - 1@ inclusive. Assumes that @len1 >= len2 > 0@.-foreign import ccall "fmpz_poly.h _fmpz_poly_mulmid_classical"- _fmpz_poly_mulmid_classical :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> IO ()---- | /fmpz_poly_mulmid_classical/ /res/ /poly1/ /poly2/ --- --- Sets @res@ to the middle @len(poly1) - len(poly2) + 1@ coefficients of--- @poly1 * poly2@, i.e.the coefficient from degree @len2 - 1@ to--- @len1 - 1@ inclusive. Assumes that @len1 >= len2@.-foreign import ccall "fmpz_poly.h fmpz_poly_mulmid_classical"- fmpz_poly_mulmid_classical :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()---- | /_fmpz_poly_mul_karatsuba/ /res/ /poly1/ /len1/ /poly2/ /len2/ --- --- Sets @(res, len1 + len2 - 1)@ to the product of @(poly1, len1)@ and--- @(poly2, len2)@. Assumes @len1 >= len2 > 0@. Allows zero-padding of the--- two input polynomials. No aliasing of inputs with outputs is allowed.-foreign import ccall "fmpz_poly.h _fmpz_poly_mul_karatsuba"- _fmpz_poly_mul_karatsuba :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> IO ()---- | /fmpz_poly_mul_karatsuba/ /res/ /poly1/ /poly2/ --- --- Sets @res@ to the product of @poly1@ and @poly2@.-foreign import ccall "fmpz_poly.h fmpz_poly_mul_karatsuba"- fmpz_poly_mul_karatsuba :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()---- | /_fmpz_poly_mullow_karatsuba_n/ /res/ /poly1/ /poly2/ /n/ --- --- Sets @res@ to the product of @poly1@ and @poly2@ and truncates to the--- given length. It is assumed that @poly1@ and @poly2@ are precisely the--- given length, possibly zero padded. Assumes \(n\) is not zero.-foreign import ccall "fmpz_poly.h _fmpz_poly_mullow_karatsuba_n"- _fmpz_poly_mullow_karatsuba_n :: Ptr CFmpz -> Ptr CFmpz -> Ptr CFmpz -> CLong -> IO ()---- | /fmpz_poly_mullow_karatsuba_n/ /res/ /poly1/ /poly2/ /n/ --- --- Sets @res@ to the product of @poly1@ and @poly2@ and truncates to the--- given length.-foreign import ccall "fmpz_poly.h fmpz_poly_mullow_karatsuba_n"- fmpz_poly_mullow_karatsuba_n :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()---- | /_fmpz_poly_mulhigh_karatsuba_n/ /res/ /poly1/ /poly2/ /len/ --- --- Sets @res@ to the product of @poly1@ and @poly2@ and truncates at the--- top to the given length. The first @len - 1@ coefficients are set to--- zero. It is assumed that @poly1@ and @poly2@ are precisely the given--- length, possibly zero padded. Assumes @len@ is not zero.-foreign import ccall "fmpz_poly.h _fmpz_poly_mulhigh_karatsuba_n"- _fmpz_poly_mulhigh_karatsuba_n :: Ptr CFmpz -> Ptr CFmpz -> Ptr CFmpz -> CLong -> IO ()---- | /fmpz_poly_mulhigh_karatsuba_n/ /res/ /poly1/ /poly2/ /len/ --- --- Sets the first @len - 1@ coefficients of the result to zero and the--- remaining coefficients to the corresponding coefficients of the product--- of @poly1@ and @poly2@. Assumes @poly1@ and @poly2@ are at most of the--- given length.-foreign import ccall "fmpz_poly.h fmpz_poly_mulhigh_karatsuba_n"- fmpz_poly_mulhigh_karatsuba_n :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()---- | /_fmpz_poly_mul_KS/ /res/ /poly1/ /len1/ /poly2/ /len2/ --- --- Sets @(res, len1 + len2 - 1)@ to the product of @(poly1, len1)@ and--- @(poly2, len2)@.--- --- Places no assumptions on @len1@ and @len2@. Allows zero-padding of the--- two input polynomials. Supports aliasing of inputs and outputs.-foreign import ccall "fmpz_poly.h _fmpz_poly_mul_KS"- _fmpz_poly_mul_KS :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> IO ()---- | /fmpz_poly_mul_KS/ /res/ /poly1/ /poly2/ --- --- Sets @res@ to the product of @poly1@ and @poly2@.-foreign import ccall "fmpz_poly.h fmpz_poly_mul_KS"- fmpz_poly_mul_KS :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()---- | /_fmpz_poly_mullow_KS/ /res/ /poly1/ /len1/ /poly2/ /len2/ /n/ --- --- Sets @(res, n)@ to the lowest \(n\) coefficients of the product of--- @(poly1, len1)@ and @(poly2, len2)@.--- --- Assumes that @len1@ and @len2@ are positive, but does allow for the--- polynomials to be zero-padded. The polynomials may be zero, too. Assumes--- \(n\) is positive. Supports aliasing between @res@, @poly1@ and @poly2@.-foreign import ccall "fmpz_poly.h _fmpz_poly_mullow_KS"- _fmpz_poly_mullow_KS :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> CLong -> IO ()---- | /fmpz_poly_mullow_KS/ /res/ /poly1/ /poly2/ /n/ --- --- Sets @res@ to the lowest \(n\) coefficients of the product of @poly1@--- and @poly2@.-foreign import ccall "fmpz_poly.h fmpz_poly_mullow_KS"- fmpz_poly_mullow_KS :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()---- | /_fmpz_poly_mul_SS/ /output/ /input1/ /length1/ /input2/ /length2/ --- --- Sets @(output, length1 + length2 - 1)@ to the product of--- @(input1, length1)@ and @(input2, length2)@.--- --- We must have @len1 > 1@ and @len2 > 1@. Allows zero-padding of the two--- input polynomials. Supports aliasing of inputs and outputs.-foreign import ccall "fmpz_poly.h _fmpz_poly_mul_SS"- _fmpz_poly_mul_SS :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> IO ()---- | /fmpz_poly_mul_SS/ /res/ /poly1/ /poly2/ --- --- Sets @res@ to the product of @poly1@ and @poly2@. Uses the--- Sch\"{o}nhage-Strassen algorithm.-foreign import ccall "fmpz_poly.h fmpz_poly_mul_SS"- fmpz_poly_mul_SS :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()---- | /_fmpz_poly_mullow_SS/ /output/ /input1/ /length1/ /input2/ /length2/ /n/ --- --- Sets @(res, n)@ to the lowest \(n\) coefficients of the product of--- @(poly1, len1)@ and @(poly2, len2)@.--- --- Assumes that @len1@ and @len2@ are positive, but does allow for the--- polynomials to be zero-padded. We must have @len1 > 1@ and @len2 > 1@.--- Assumes \(n\) is positive. Supports aliasing between @res@, @poly1@ and--- @poly2@.-foreign import ccall "fmpz_poly.h _fmpz_poly_mullow_SS"- _fmpz_poly_mullow_SS :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> CLong -> IO ()---- | /fmpz_poly_mullow_SS/ /res/ /poly1/ /poly2/ /n/ --- --- Sets @res@ to the lowest \(n\) coefficients of the product of @poly1@--- and @poly2@.-foreign import ccall "fmpz_poly.h fmpz_poly_mullow_SS"- fmpz_poly_mullow_SS :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()---- | /_fmpz_poly_mul/ /res/ /poly1/ /len1/ /poly2/ /len2/ --- --- Sets @(res, len1 + len2 - 1)@ to the product of @(poly1, len1)@ and--- @(poly2, len2)@. Assumes @len1 >= len2 > 0@. Allows zero-padding of the--- two input polynomials. Does not support aliasing between the inputs and--- the output.-foreign import ccall "fmpz_poly.h _fmpz_poly_mul"- _fmpz_poly_mul :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> IO ()---- | /fmpz_poly_mul/ /res/ /poly1/ /poly2/ --- --- Sets @res@ to the product of @poly1@ and @poly2@. Chooses an optimal--- algorithm from the choices above.-foreign import ccall "fmpz_poly.h fmpz_poly_mul"- fmpz_poly_mul :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()---- | /_fmpz_poly_mullow/ /res/ /poly1/ /len1/ /poly2/ /len2/ /n/ --- --- Sets @(res, n)@ to the lowest \(n\) coefficients of the product of--- @(poly1, len1)@ and @(poly2, len2)@.--- --- Assumes @len1 >= len2 > 0@ and @0 \< n \<= len1 + len2 - 1@. Allows for--- zero-padding in the inputs. Does not support aliasing between the inputs--- and the output.-foreign import ccall "fmpz_poly.h _fmpz_poly_mullow"- _fmpz_poly_mullow :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> CLong -> IO ()---- | /fmpz_poly_mullow/ /res/ /poly1/ /poly2/ /n/ --- --- Sets @res@ to the lowest \(n\) coefficients of the product of @poly1@--- and @poly2@.-foreign import ccall "fmpz_poly.h fmpz_poly_mullow"- fmpz_poly_mullow :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()---- | /fmpz_poly_mulhigh_n/ /res/ /poly1/ /poly2/ /n/ --- --- Sets the high \(n\) coefficients of @res@ to the high \(n\) coefficients--- of the product of @poly1@ and @poly2@, assuming the latter are precisely--- \(n\) coefficients in length, zero padded if necessary. The remaining--- \(n - 1\) coefficients may be arbitrary.-foreign import ccall "fmpz_poly.h fmpz_poly_mulhigh_n"- fmpz_poly_mulhigh_n :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()---- | /_fmpz_poly_mulhigh/ /res/ /poly1/ /len1/ /poly2/ /len2/ /start/ --- --- Sets all but the low \(n\) coefficients of \(res\) to the corresponding--- coefficients of the product of \(poly1\) of length \(len1\) and--- \(poly2\) of length \(len2\), the remaining coefficients being--- arbitrary. It is assumed that \(len1 >= len2 > 0\) and that--- \(0 < n < len1 + len2 - 1\). Aliasing of inputs is not permitted.-foreign import ccall "fmpz_poly.h _fmpz_poly_mulhigh"- _fmpz_poly_mulhigh :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> CLong -> IO ()---- FFT precached multiplication ---------------------------------------------------- | /fmpz_poly_mul_SS_precache_init/ /pre/ /len1/ /bits1/ /poly2/ --- --- Precompute the FFT of @poly2@ to enable repeated multiplication of--- @poly2@ by polynomials whose length does not exceed @len1@ and whose--- number of bits per coefficient does not exceed @bits1@.--- --- The value @bits1@ may be negative, i.e. it may be the result of calling--- @fmpz_poly_max_bits@. The function only considers the absolute value of--- @bits1@.--- --- Suppose @len2@ is the length of @poly2@ and @len = len1 + len2 - 1@ is--- the maximum output length of a polynomial multiplication using @pre@.--- Then internally @len@ is rounded up to a power of two, \(2^n\) say. The--- truncated FFT algorithm is used to smooth performance but note that it--- can only do this in the range \((2^{n-1}, 2^n]\). Therefore, it may be--- more efficient to recompute \(pre\) for cases where the output length--- will fall below \(2^{n-1} + 1\). Otherwise the implementation will zero--- pad them up to that length.--- --- Note that the Schoenhage-Strassen algorithm is only efficient for--- polynomials with relatively large coefficients relative to the length of--- the polynomials.--- --- Also note that there are no restrictions on the polynomials. In--- particular the polynomial whose FFT is being precached does not have to--- be either longer or shorter than the polynomials it is to be multiplied--- by.-foreign import ccall "fmpz_poly.h fmpz_poly_mul_SS_precache_init"- fmpz_poly_mul_SS_precache_init :: Ptr CFmpzPolyMulPrecache -> CLong -> CLong -> Ptr CFmpzPoly -> IO ()---- | /fmpz_poly_mul_precache_clear/ /pre/ --- --- Clear the space allocated by @fmpz_poly_mul_SS_precache_init@.-foreign import ccall "fmpz_poly.h fmpz_poly_mul_precache_clear"- fmpz_poly_mul_precache_clear :: Ptr CFmpzPolyMulPrecache -> IO ()---- | /_fmpz_poly_mullow_SS_precache/ /output/ /input1/ /len1/ /pre/ /trunc/ --- --- Write into @output@ the first @trunc@ coefficients of the polynomial--- @(input1, len1)@ by the polynomial whose FFT was precached by--- @fmpz_poly_mul_SS_precache_init@ and stored in @pre@.--- --- For performance reasons it is recommended that all polynomials be--- truncated to at most @trunc@ coefficients if possible.-foreign import ccall "fmpz_poly.h _fmpz_poly_mullow_SS_precache"- _fmpz_poly_mullow_SS_precache :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpzPolyMulPrecache -> CLong -> IO ()---- | /fmpz_poly_mullow_SS_precache/ /res/ /poly1/ /pre/ /n/ --- --- Set @res@ to the product of @poly1@ by the polynomial whose FFT was--- precached by @fmpz_poly_mul_SS_precache_init@ (and stored in pre). The--- result is truncated to \(n\) coefficients (and normalised).--- --- There are no restrictions on the length of @poly1@ other than those--- given in the call to @fmpz_poly_mul_SS_precache_init@.-foreign import ccall "fmpz_poly.h fmpz_poly_mullow_SS_precache"- fmpz_poly_mullow_SS_precache :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPolyMulPrecache -> CLong -> IO ()---- | /fmpz_poly_mul_SS_precache/ /res/ /poly1/ /pre/ --- --- Set @res@ to the product of @poly1@ by the polynomial whose FFT was--- precached by @fmpz_poly_mul_SS_precache_init@ (and stored in pre).--- --- There are no restrictions on the length of @poly1@ other than those--- given in the call to @fmpz_poly_mul_SS_precache_init@.-foreign import ccall "fmpz_poly.h fmpz_poly_mul_SS_precache"- fmpz_poly_mul_SS_precache :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPolyMulPrecache -> IO ()---- Squaring ------------------------------------------------------------------------ | /_fmpz_poly_sqr_KS/ /rop/ /op/ /len/ --- --- Sets @(rop, 2*len - 1)@ to the square of @(op, len)@, assuming that--- @len > 0@.--- --- Supports zero-padding in @(op, len)@. Does not support aliasing.-foreign import ccall "fmpz_poly.h _fmpz_poly_sqr_KS"- _fmpz_poly_sqr_KS :: Ptr CFmpz -> Ptr CFmpz -> CLong -> IO ()---- | /fmpz_poly_sqr_KS/ /rop/ /op/ --- --- Sets @rop@ to the square of the polynomial @op@ using Kronecker--- segmentation.-foreign import ccall "fmpz_poly.h fmpz_poly_sqr_KS"- fmpz_poly_sqr_KS :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()---- | /_fmpz_poly_sqr_karatsuba/ /rop/ /op/ /len/ --- --- Sets @(rop, 2*len - 1)@ to the square of @(op, len)@, assuming that--- @len > 0@.--- --- Supports zero-padding in @(op, len)@. Does not support aliasing.-foreign import ccall "fmpz_poly.h _fmpz_poly_sqr_karatsuba"- _fmpz_poly_sqr_karatsuba :: Ptr CFmpz -> Ptr CFmpz -> CLong -> IO ()---- | /fmpz_poly_sqr_karatsuba/ /rop/ /op/ --- --- Sets @rop@ to the square of the polynomial @op@ using the Karatsuba--- multiplication algorithm.-foreign import ccall "fmpz_poly.h fmpz_poly_sqr_karatsuba"- fmpz_poly_sqr_karatsuba :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()---- | /_fmpz_poly_sqr_classical/ /rop/ /op/ /len/ --- --- Sets @(rop, 2*len - 1)@ to the square of @(op, len)@, assuming that--- @len > 0@.--- --- Supports zero-padding in @(op, len)@. Does not support aliasing.-foreign import ccall "fmpz_poly.h _fmpz_poly_sqr_classical"- _fmpz_poly_sqr_classical :: Ptr CFmpz -> Ptr CFmpz -> CLong -> IO ()---- | /fmpz_poly_sqr_classical/ /rop/ /op/ --- --- Sets @rop@ to the square of the polynomial @op@ using the classical or--- schoolbook method.-foreign import ccall "fmpz_poly.h fmpz_poly_sqr_classical"- fmpz_poly_sqr_classical :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()---- | /_fmpz_poly_sqr/ /rop/ /op/ /len/ --- --- Sets @(rop, 2*len - 1)@ to the square of @(op, len)@, assuming that--- @len > 0@.--- --- Supports zero-padding in @(op, len)@. Does not support aliasing.-foreign import ccall "fmpz_poly.h _fmpz_poly_sqr"- _fmpz_poly_sqr :: Ptr CFmpz -> Ptr CFmpz -> CLong -> IO ()---- | /fmpz_poly_sqr/ /rop/ /op/ --- --- Sets @rop@ to the square of the polynomial @op@.-foreign import ccall "fmpz_poly.h fmpz_poly_sqr"- fmpz_poly_sqr :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()---- | /_fmpz_poly_sqrlow_KS/ /res/ /poly/ /len/ /n/ --- --- Sets @(res, n)@ to the lowest \(n\) coefficients of the square of--- @(poly, len)@.--- --- Assumes that @len@ is positive, but does allow for the polynomial to be--- zero-padded. The polynomial may be zero, too. Assumes \(n\) is positive.--- Supports aliasing between @res@ and @poly@.-foreign import ccall "fmpz_poly.h _fmpz_poly_sqrlow_KS"- _fmpz_poly_sqrlow_KS :: Ptr CFmpz -> Ptr CFmpz -> CLong -> CLong -> IO ()---- | /fmpz_poly_sqrlow_KS/ /res/ /poly/ /n/ --- --- Sets @res@ to the lowest \(n\) coefficients of the square of @poly@.-foreign import ccall "fmpz_poly.h fmpz_poly_sqrlow_KS"- fmpz_poly_sqrlow_KS :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()---- | /_fmpz_poly_sqrlow_karatsuba_n/ /res/ /poly/ /n/ --- --- Sets @(res, n)@ to the square of @(poly, n)@ truncated to length \(n\),--- which is assumed to be positive. Allows for @poly@ to be zero-oadded.-foreign import ccall "fmpz_poly.h _fmpz_poly_sqrlow_karatsuba_n"- _fmpz_poly_sqrlow_karatsuba_n :: Ptr CFmpz -> Ptr CFmpz -> CLong -> IO ()---- | /fmpz_poly_sqrlow_karatsuba_n/ /res/ /poly/ /n/ --- --- Sets @res@ to the square of @poly@ and truncates to the given length.-foreign import ccall "fmpz_poly.h fmpz_poly_sqrlow_karatsuba_n"- fmpz_poly_sqrlow_karatsuba_n :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()---- | /_fmpz_poly_sqrlow_classical/ /res/ /poly/ /len/ /n/ --- --- Sets @(res, n)@ to the first \(n\) coefficients of the square of--- @(poly, len)@.--- --- Assumes that @0 \< n \<= 2 * len - 1@.-foreign import ccall "fmpz_poly.h _fmpz_poly_sqrlow_classical"- _fmpz_poly_sqrlow_classical :: Ptr CFmpz -> Ptr CFmpz -> CLong -> CLong -> IO ()---- | /fmpz_poly_sqrlow_classical/ /res/ /poly/ /n/ --- --- Sets @res@ to the first \(n\) coefficients of the square of @poly@.-foreign import ccall "fmpz_poly.h fmpz_poly_sqrlow_classical"- fmpz_poly_sqrlow_classical :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()---- | /_fmpz_poly_sqrlow/ /res/ /poly/ /len/ /n/ --- --- Sets @(res, n)@ to the lowest \(n\) coefficients of the square of--- @(poly, len)@.--- --- Assumes @len1 >= len2 > 0@ and @0 \< n \<= 2 * len - 1@. Allows for--- zero-padding in the input. Does not support aliasing between the input--- and the output.-foreign import ccall "fmpz_poly.h _fmpz_poly_sqrlow"- _fmpz_poly_sqrlow :: Ptr CFmpz -> Ptr CFmpz -> CLong -> CLong -> IO ()---- | /fmpz_poly_sqrlow/ /res/ /poly/ /n/ --- --- Sets @res@ to the lowest \(n\) coefficients of the square of @poly@.-foreign import ccall "fmpz_poly.h fmpz_poly_sqrlow"- fmpz_poly_sqrlow :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()---- Powering ------------------------------------------------------------------------ | /_fmpz_poly_pow_multinomial/ /res/ /poly/ /len/ /e/ --- --- Computes @res = poly^e@. This uses the J.C.P. Miller pure recurrence as--- follows:--- --- If \(\ell\) is the index of the lowest non-zero coefficient in @poly@,--- as a first step this method zeros out the lowest \(e \ell\) coefficients--- of @res@. The recurrence above is then used to compute the remaining--- coefficients.--- --- Assumes @len > 0@, @e > 0@. Does not support aliasing.-foreign import ccall "fmpz_poly.h _fmpz_poly_pow_multinomial"- _fmpz_poly_pow_multinomial :: Ptr CFmpz -> Ptr CFmpz -> CLong -> CULong -> IO ()---- | /fmpz_poly_pow_multinomial/ /res/ /poly/ /e/ --- --- Computes @res = poly^e@ using a generalisation of binomial expansion--- called the J.C.P. Miller pure recurrence [1], [2]. If \(e\) is zero,--- returns one, so that in particular @0^0 = 1@.--- --- The formal statement of the recurrence is as follows. Write the input--- polynomial as \(P(x) = p_0 + p_1 x + \dotsb + p_m x^m\) with--- \(p_0 \neq 0\) and let--- --- \[`\]--- \[P(x)^n = a(n, 0) + a(n, 1) x + \dotsb + a(n, mn) x^{mn}.\]--- --- Then \(a(n, 0) = p_0^n\) and, for all \(1 \leq k \leq mn\),--- --- \[`\]--- \[a(n, k) = --- (k p_0)^{-1} \sum_{i = 1}^m p_i \bigl( (n + 1) i - k \bigr) a(n, k-i).\]--- --- [1] D. Knuth, The Art of Computer Programming Vol. 2, Seminumerical--- Algorithms, Third Edition (Reading, Massachusetts: Addison-Wesley, 1997)--- --- [2] D. Zeilberger, The J.C.P. Miller Recurrence for Exponentiating a--- Polynomial, and its q-Analog, Journal of Difference Equations and--- Applications, 1995, Vol. 1, pp. 57--60-foreign import ccall "fmpz_poly.h fmpz_poly_pow_multinomial"- fmpz_poly_pow_multinomial :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CULong -> IO ()---- | /_fmpz_poly_pow_binomial/ /res/ /poly/ /e/ --- --- Computes @res = poly^e@ when poly is of length 2, using binomial--- expansion.--- --- Assumes \(e > 0\). Does not support aliasing.-foreign import ccall "fmpz_poly.h _fmpz_poly_pow_binomial"- _fmpz_poly_pow_binomial :: Ptr CFmpz -> Ptr CFmpz -> CULong -> IO ()---- | /fmpz_poly_pow_binomial/ /res/ /poly/ /e/ --- --- Computes @res = poly^e@ when @poly@ is of length \(2\), using binomial--- expansion.--- --- If the length of @poly@ is not \(2\), raises an exception and aborts.-foreign import ccall "fmpz_poly.h fmpz_poly_pow_binomial"- fmpz_poly_pow_binomial :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CULong -> IO ()---- | /_fmpz_poly_pow_addchains/ /res/ /poly/ /len/ /a/ /n/ --- --- Given a star chain \(1 = a_0 < a_1 < \dotsb < a_n = e\) computes--- @res = poly^e@.--- --- A star chain is an addition chain \(1 = a_0 < a_1 < \dotsb < a_n\) such--- that, for all \(i > 0\), \(a_i = a_{i-1} + a_j\) for some \(j < i\).--- --- Assumes that \(e > 2\), or equivalently \(n > 1\), and @len > 0@. Does--- not support aliasing.-foreign import ccall "fmpz_poly.h _fmpz_poly_pow_addchains"- _fmpz_poly_pow_addchains :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CInt -> CInt -> IO ()---- | /fmpz_poly_pow_addchains/ /res/ /poly/ /e/ --- --- Computes @res = poly^e@ using addition chains whenever--- \(0 \leq e \leq 148\).--- --- If \(e > 148\), raises an exception and aborts.-foreign import ccall "fmpz_poly.h fmpz_poly_pow_addchains"- fmpz_poly_pow_addchains :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CULong -> IO ()---- | /_fmpz_poly_pow_binexp/ /res/ /poly/ /len/ /e/ --- --- Sets @res = poly^e@ using left-to-right binary exponentiation as--- described in [p. 461]< [Knu1997]>.--- --- Assumes that @len > 0@, @e > 1@. Assumes that @res@ is an array of--- length at least @e*(len - 1) + 1@. Does not support aliasing.-foreign import ccall "fmpz_poly.h _fmpz_poly_pow_binexp"- _fmpz_poly_pow_binexp :: Ptr CFmpz -> Ptr CFmpz -> CLong -> CULong -> IO ()---- | /fmpz_poly_pow_binexp/ /res/ /poly/ /e/ --- --- Computes @res = poly^e@ using the binary exponentiation algorithm. If--- \(e\) is zero, returns one, so that in particular @0^0 = 1@.-foreign import ccall "fmpz_poly.h fmpz_poly_pow_binexp"- fmpz_poly_pow_binexp :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CULong -> IO ()---- | /_fmpz_poly_pow_small/ /res/ /poly/ /len/ /e/ --- --- Sets @res = poly^e@ whenever \(0 \leq e \leq 4\).--- --- Assumes that @len > 0@ and that @res@ is an array of length at least--- @e*(len - 1) + 1@. Does not support aliasing.-foreign import ccall "fmpz_poly.h _fmpz_poly_pow_small"- _fmpz_poly_pow_small :: Ptr CFmpz -> Ptr CFmpz -> CLong -> CULong -> IO ()---- | /_fmpz_poly_pow/ /res/ /poly/ /len/ /e/ --- --- Sets @res = poly^e@, assuming that @e, len > 0@ and that @res@ has space--- for @e*(len - 1) + 1@ coefficients. Does not support aliasing.-foreign import ccall "fmpz_poly.h _fmpz_poly_pow"- _fmpz_poly_pow :: Ptr CFmpz -> Ptr CFmpz -> CLong -> CULong -> IO ()---- | /fmpz_poly_pow/ /res/ /poly/ /e/ --- --- Computes @res = poly^e@. If \(e\) is zero, returns one, so that in--- particular @0^0 = 1@.-foreign import ccall "fmpz_poly.h fmpz_poly_pow"- fmpz_poly_pow :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CULong -> IO ()---- | /_fmpz_poly_pow_trunc/ /res/ /poly/ /e/ /n/ --- --- Sets @(res, n)@ to @(poly, n)@ raised to the power \(e\) and truncated--- to length \(n\).--- --- Assumes that \(e, n > 0\). Allows zero-padding of @(poly, n)@. Does not--- support aliasing of any inputs and outputs.-foreign import ccall "fmpz_poly.h _fmpz_poly_pow_trunc"- _fmpz_poly_pow_trunc :: Ptr CFmpz -> Ptr CFmpz -> CULong -> CLong -> IO ()---- | /fmpz_poly_pow_trunc/ /res/ /poly/ /e/ /n/ --- --- Notationally raises @poly@ to the power \(e\), truncates the result to--- length \(n\) and writes the result in @res@. This is computed much more--- efficiently than simply powering the polynomial and truncating.--- --- Thus, if \(n = 0\) the result is zero. Otherwise, whenever \(e = 0\) the--- result will be the constant polynomial equal to \(1\).--- --- This function can be used to raise power series to a power in an--- efficient way.-foreign import ccall "fmpz_poly.h fmpz_poly_pow_trunc"- fmpz_poly_pow_trunc :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CULong -> CLong -> IO ()---- Shifting ------------------------------------------------------------------------ | /_fmpz_poly_shift_left/ /res/ /poly/ /len/ /n/ --- --- Sets @(res, len + n)@ to @(poly, len)@ shifted left by \(n\)--- coefficients.--- --- Inserts zero coefficients at the lower end. Assumes that @len@ and \(n\)--- are positive, and that @res@ fits @len + n@ elements. Supports aliasing--- between @res@ and @poly@.-foreign import ccall "fmpz_poly.h _fmpz_poly_shift_left"- _fmpz_poly_shift_left :: Ptr CFmpz -> Ptr CFmpz -> CLong -> CLong -> IO ()---- | /fmpz_poly_shift_left/ /res/ /poly/ /n/ --- --- Sets @res@ to @poly@ shifted left by \(n\) coeffs. Zero coefficients are--- inserted.-foreign import ccall "fmpz_poly.h fmpz_poly_shift_left"- fmpz_poly_shift_left :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()---- | /_fmpz_poly_shift_right/ /res/ /poly/ /len/ /n/ --- --- Sets @(res, len - n)@ to @(poly, len)@ shifted right by \(n\)--- coefficients.--- --- Assumes that @len@ and \(n\) are positive, that @len > n@, and that--- @res@ fits @len - n@ elements. Supports aliasing between @res@ and--- @poly@, although in this case the top coefficients of @poly@ are not set--- to zero.-foreign import ccall "fmpz_poly.h _fmpz_poly_shift_right"- _fmpz_poly_shift_right :: Ptr CFmpz -> Ptr CFmpz -> CLong -> CLong -> IO ()---- | /fmpz_poly_shift_right/ /res/ /poly/ /n/ --- --- Sets @res@ to @poly@ shifted right by \(n\) coefficients. If \(n\) is--- equal to or greater than the current length of @poly@, @res@ is set to--- the zero polynomial.-foreign import ccall "fmpz_poly.h fmpz_poly_shift_right"- fmpz_poly_shift_right :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()---- Bit sizes and norms ------------------------------------------------------------- | /fmpz_poly_max_limbs/ /poly/ --- --- Returns the maximum number of limbs required to store the absolute value--- of coefficients of @poly@. If @poly@ is zero, returns \(0\).-foreign import ccall "fmpz_poly.h fmpz_poly_max_limbs"- fmpz_poly_max_limbs :: Ptr CFmpzPoly -> IO CULong---- | /fmpz_poly_max_bits/ /poly/ --- --- Computes the maximum number of bits \(b\) required to store the absolute--- value of coefficients of @poly@. If all the coefficients of @poly@ are--- non-negative, \(b\) is returned, otherwise \(-b\) is returned.-foreign import ccall "fmpz_poly.h fmpz_poly_max_bits"- fmpz_poly_max_bits :: Ptr CFmpzPoly -> IO CLong---- | /fmpz_poly_height/ /height/ /poly/ --- --- Computes the height of @poly@, defined as the largest of the absolute--- values the coefficients of @poly@. Equivalently, this gives the infinity--- norm of the coefficients. If @poly@ is zero, the height is \(0\).-foreign import ccall "fmpz_poly.h fmpz_poly_height"- fmpz_poly_height :: Ptr CFmpz -> Ptr CFmpzPoly -> IO ()---- | /_fmpz_poly_2norm/ /res/ /poly/ /len/ --- --- Sets @res@ to the Euclidean norm of @(poly, len)@, that is, the integer--- square root of the sum of the squares of the coefficients of @poly@.-foreign import ccall "fmpz_poly.h _fmpz_poly_2norm"- _fmpz_poly_2norm :: Ptr CFmpz -> Ptr CFmpz -> CLong -> IO ()---- | /fmpz_poly_2norm/ /res/ /poly/ --- --- Sets @res@ to the Euclidean norm of @poly@, that is, the integer square--- root of the sum of the squares of the coefficients of @poly@.-foreign import ccall "fmpz_poly.h fmpz_poly_2norm"- fmpz_poly_2norm :: Ptr CFmpz -> Ptr CFmpzPoly -> IO ()---- | /_fmpz_poly_2norm_normalised_bits/ /poly/ /len/ --- --- Returns an upper bound on the number of bits of the normalised Euclidean--- norm of @(poly, len)@, i.e. the number of bits of the Euclidean norm--- divided by the absolute value of the leading coefficient. The returned--- value will be no more than 1 bit too large.--- --- This is used in the computation of the Landau-Mignotte bound.--- --- It is assumed that @len > 0@. The result only makes sense if the leading--- coefficient is nonzero.-foreign import ccall "fmpz_poly.h _fmpz_poly_2norm_normalised_bits"- _fmpz_poly_2norm_normalised_bits :: Ptr CFmpz -> CLong -> IO CMpLimb---- Greatest common divisor --------------------------------------------------------- | /_fmpz_poly_gcd_subresultant/ /res/ /poly1/ /len1/ /poly2/ /len2/ --- --- Computes the greatest common divisor @(res, len2)@ of @(poly1, len1)@--- and @(poly2, len2)@, assuming @len1 >= len2 > 0@. The result is--- normalised to have positive leading coefficient. Aliasing between @res@,--- @poly1@ and @poly2@ is supported.-foreign import ccall "fmpz_poly.h _fmpz_poly_gcd_subresultant"- _fmpz_poly_gcd_subresultant :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> IO ()---- | /fmpz_poly_gcd_subresultant/ /res/ /poly1/ /poly2/ --- --- Computes the greatest common divisor @res@ of @poly1@ and @poly2@,--- normalised to have non-negative leading coefficient.--- --- This function uses the subresultant algorithm as described in [Algorithm--- 3.3.1]< [Coh1996]>.-foreign import ccall "fmpz_poly.h fmpz_poly_gcd_subresultant"- fmpz_poly_gcd_subresultant :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()---- | /_fmpz_poly_gcd_heuristic/ /res/ /poly1/ /len1/ /poly2/ /len2/ --- --- Computes the greatest common divisor @(res, len2)@ of @(poly1, len1)@--- and @(poly2, len2)@, assuming @len1 >= len2 > 0@. The result is--- normalised to have positive leading coefficient. Aliasing between @res@,--- @poly1@ and @poly2@ is not supported. The function may not always--- succeed in finding the GCD. If it fails, the function returns 0,--- otherwise it returns 1.-foreign import ccall "fmpz_poly.h _fmpz_poly_gcd_heuristic"- _fmpz_poly_gcd_heuristic :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> IO CInt---- | /fmpz_poly_gcd_heuristic/ /res/ /poly1/ /poly2/ --- --- Computes the greatest common divisor @res@ of @poly1@ and @poly2@,--- normalised to have non-negative leading coefficient.--- --- The function may not always succeed in finding the GCD. If it fails, the--- function returns 0, otherwise it returns 1.--- --- This function uses the heuristic GCD algorithm (GCDHEU). The basic--- strategy is to remove the content of the polynomials, pack them using--- Kronecker segmentation (given a bound on the size of the coefficients of--- the GCD) and take the integer GCD. Unpack the result and test--- divisibility.-foreign import ccall "fmpz_poly.h fmpz_poly_gcd_heuristic"- fmpz_poly_gcd_heuristic :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO CInt---- | /_fmpz_poly_gcd_modular/ /res/ /poly1/ /len1/ /poly2/ /len2/ --- --- Computes the greatest common divisor @(res, len2)@ of @(poly1, len1)@--- and @(poly2, len2)@, assuming @len1 >= len2 > 0@. The result is--- normalised to have positive leading coefficient. Aliasing between @res@,--- @poly1@ and @poly2@ is not supported.-foreign import ccall "fmpz_poly.h _fmpz_poly_gcd_modular"- _fmpz_poly_gcd_modular :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> IO ()---- | /fmpz_poly_gcd_modular/ /res/ /poly1/ /poly2/ --- --- Computes the greatest common divisor @res@ of @poly1@ and @poly2@,--- normalised to have non-negative leading coefficient.--- --- This function uses the modular GCD algorithm. The basic strategy is to--- remove the content of the polynomials, reduce them modulo sufficiently--- many primes and do CRT reconstruction until some bound is reached (or we--- can prove with trial division that we have the GCD).-foreign import ccall "fmpz_poly.h fmpz_poly_gcd_modular"- fmpz_poly_gcd_modular :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()---- | /_fmpz_poly_gcd/ /res/ /poly1/ /len1/ /poly2/ /len2/ --- --- Computes the greatest common divisor @res@ of @(poly1, len1)@ and--- @(poly2, len2)@, assuming @len1 >= len2 > 0@. The result is normalised--- to have positive leading coefficient.--- --- Assumes that @res@ has space for @len2@ coefficients. Aliasing between--- @res@, @poly1@ and @poly2@ is not supported.-foreign import ccall "fmpz_poly.h _fmpz_poly_gcd"- _fmpz_poly_gcd :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> IO ()---- | /fmpz_poly_gcd/ /res/ /poly1/ /poly2/ --- --- Computes the greatest common divisor @res@ of @poly1@ and @poly2@,--- normalised to have non-negative leading coefficient.-foreign import ccall "fmpz_poly.h fmpz_poly_gcd"- fmpz_poly_gcd :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()---- | /_fmpz_poly_xgcd_modular/ /r/ /s/ /t/ /f/ /len1/ /g/ /len2/ --- --- Set \(r\) to the resultant of @(f, len1)@ and @(g, len2)@. If the--- resultant is zero, the function returns immediately. Otherwise it finds--- polynomials \(s\) and \(t\) such that @s*f + t*g = r@. The length of--- \(s\) will be no greater than @len2@ and the length of \(t\) will be no--- greater than @len1@ (both are zero padded if necessary).--- --- It is assumed that @len1 >= len2 > 0@. No aliasing of inputs and outputs--- is permitted.--- --- The function assumes that \(f\) and \(g\) are primitive (have Gaussian--- content equal to 1). The result is undefined otherwise.--- --- Uses a multimodular algorithm. The resultant is first computed and--- extended GCD\'s modulo various primes \(p\) are computed and combined--- using CRT. When the CRT stabilises the resulting polynomials are simply--- reduced modulo further primes until a proven bound is reached.-foreign import ccall "fmpz_poly.h _fmpz_poly_xgcd_modular"- _fmpz_poly_xgcd_modular :: Ptr CFmpz -> Ptr CFmpz -> Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> IO ()---- | /fmpz_poly_xgcd_modular/ /r/ /s/ /t/ /f/ /g/ --- --- Set \(r\) to the resultant of \(f\) and \(g\). If the resultant is zero,--- the function then returns immediately, otherwise \(s\) and \(t\) are--- found such that @s*f + t*g = r@.--- --- The function assumes that \(f\) and \(g\) are primitive (have Gaussian--- content equal to 1). The result is undefined otherwise.--- --- Uses the multimodular algorithm.-foreign import ccall "fmpz_poly.h fmpz_poly_xgcd_modular"- fmpz_poly_xgcd_modular :: Ptr CFmpz -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()---- | /_fmpz_poly_xgcd/ /r/ /s/ /t/ /f/ /len1/ /g/ /len2/ --- --- Set \(r\) to the resultant of @(f, len1)@ and @(g, len2)@. If the--- resultant is zero, the function returns immediately. Otherwise it finds--- polynomials \(s\) and \(t\) such that @s*f + t*g = r@. The length of--- \(s\) will be no greater than @len2@ and the length of \(t\) will be no--- greater than @len1@ (both are zero padded if necessary).--- --- The function assumes that \(f\) and \(g\) are primitive (have Gaussian--- content equal to 1). The result is undefined otherwise.--- --- It is assumed that @len1 >= len2 > 0@. No aliasing of inputs and outputs--- is permitted.-foreign import ccall "fmpz_poly.h _fmpz_poly_xgcd"- _fmpz_poly_xgcd :: Ptr CFmpz -> Ptr CFmpz -> Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> IO ()---- | /fmpz_poly_xgcd/ /r/ /s/ /t/ /f/ /g/ --- --- Set \(r\) to the resultant of \(f\) and \(g\). If the resultant is zero,--- the function then returns immediately, otherwise \(s\) and \(t\) are--- found such that @s*f + t*g = r@.--- --- The function assumes that \(f\) and \(g\) are primitive (have Gaussian--- content equal to 1). The result is undefined otherwise.-foreign import ccall "fmpz_poly.h fmpz_poly_xgcd"- fmpz_poly_xgcd :: Ptr CFmpz -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()---- | /_fmpz_poly_lcm/ /res/ /poly1/ /len1/ /poly2/ /len2/ --- --- Sets @(res, len1 + len2 - 1)@ to the least common multiple of the two--- polynomials @(poly1, len1)@ and @(poly2, len2)@, normalised to have--- non-negative leading coefficient.--- --- Assumes that @len1 >= len2 > 0@.--- --- Does not support aliasing.-foreign import ccall "fmpz_poly.h _fmpz_poly_lcm"- _fmpz_poly_lcm :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> IO ()---- | /fmpz_poly_lcm/ /res/ /poly1/ /poly2/ --- --- Sets @res@ to the least common multiple of the two polynomials @poly1@--- and @poly2@, normalised to have non-negative leading coefficient.--- --- If either of the two polynomials is zero, sets @res@ to zero.--- --- This ensures that the equality--- --- \[`\]--- \[f g = \gcd(f, g) \operatorname{lcm}(f, g)\]--- --- holds up to sign.-foreign import ccall "fmpz_poly.h fmpz_poly_lcm"- fmpz_poly_lcm :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()---- | /_fmpz_poly_resultant_modular/ /res/ /poly1/ /len1/ /poly2/ /len2/ --- --- Sets @res@ to the resultant of @(poly1, len1)@ and @(poly2, len2)@,--- assuming that @len1 >= len2 > 0@.-foreign import ccall "fmpz_poly.h _fmpz_poly_resultant_modular"- _fmpz_poly_resultant_modular :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> IO ()---- | /fmpz_poly_resultant_modular/ /res/ /poly1/ /poly2/ --- --- Computes the resultant of @poly1@ and @poly2@.--- --- For two non-zero polynomials \(f(x) = a_m x^m + \dotsb + a_0\) and--- \(g(x) = b_n x^n + \dotsb + b_0\) of degrees \(m\) and \(n\), the--- resultant is defined to be--- --- \[`\]--- \[a_m^n b_n^m \prod_{(x, y) : f(x) = g(y) = 0} (x - y).\]--- --- For convenience, we define the resultant to be equal to zero if either--- of the two polynomials is zero.--- --- This function uses the modular algorithm described in < [Col1971]>.-foreign import ccall "fmpz_poly.h fmpz_poly_resultant_modular"- fmpz_poly_resultant_modular :: Ptr CFmpz -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()---- | /fmpz_poly_resultant_modular_div/ /res/ /poly1/ /poly2/ /div/ /nbits/ --- --- Computes the resultant of @poly1@ and @poly2@ divided by @div@ using a--- slight modification of the above function. It is assumed that the--- resultant is exactly divisible by @div@ and the result @res@ has at most--- @nbits@ bits. This bypasses the computation of general bounds.-foreign import ccall "fmpz_poly.h fmpz_poly_resultant_modular_div"- fmpz_poly_resultant_modular_div :: Ptr CFmpz -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpz -> CLong -> IO ()---- | /_fmpz_poly_resultant_euclidean/ /res/ /poly1/ /len1/ /poly2/ /len2/ --- --- Sets @res@ to the resultant of @(poly1, len1)@ and @(poly2, len2)@,--- assuming that @len1 >= len2 > 0@.-foreign import ccall "fmpz_poly.h _fmpz_poly_resultant_euclidean"- _fmpz_poly_resultant_euclidean :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> IO ()---- | /fmpz_poly_resultant_euclidean/ /res/ /poly1/ /poly2/ --- --- Computes the resultant of @poly1@ and @poly2@.--- --- For two non-zero polynomials \(f(x) = a_m x^m + \dotsb + a_0\) and--- \(g(x) = b_n x^n + \dotsb + b_0\) of degrees \(m\) and \(n\), the--- resultant is defined to be--- --- \[`\]--- \[a_m^n b_n^m \prod_{(x, y) : f(x) = g(y) = 0} (x - y).\]--- --- For convenience, we define the resultant to be equal to zero if either--- of the two polynomials is zero.--- --- This function uses the algorithm described in [Algorithm--- 3.3.7]< [Coh1996]>.-foreign import ccall "fmpz_poly.h fmpz_poly_resultant_euclidean"- fmpz_poly_resultant_euclidean :: Ptr CFmpz -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()---- | /_fmpz_poly_resultant/ /res/ /poly1/ /len1/ /poly2/ /len2/ --- --- Sets @res@ to the resultant of @(poly1, len1)@ and @(poly2, len2)@,--- assuming that @len1 >= len2 > 0@.-foreign import ccall "fmpz_poly.h _fmpz_poly_resultant"- _fmpz_poly_resultant :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> IO ()---- | /fmpz_poly_resultant/ /res/ /poly1/ /poly2/ --- --- Computes the resultant of @poly1@ and @poly2@.--- --- For two non-zero polynomials \(f(x) = a_m x^m + \dotsb + a_0\) and--- \(g(x) = b_n x^n + \dotsb + b_0\) of degrees \(m\) and \(n\), the--- resultant is defined to be--- --- \[`\]--- \[a_m^n b_n^m \prod_{(x, y) : f(x) = g(y) = 0} (x - y).\]--- --- For convenience, we define the resultant to be equal to zero if either--- of the two polynomials is zero.-foreign import ccall "fmpz_poly.h fmpz_poly_resultant"- fmpz_poly_resultant :: Ptr CFmpz -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()---- Discriminant -------------------------------------------------------------------- | /_fmpz_poly_discriminant/ /res/ /poly/ /len/ --- --- Set @res@ to the discriminant of @(poly, len)@. Assumes @len > 1@.-foreign import ccall "fmpz_poly.h _fmpz_poly_discriminant"- _fmpz_poly_discriminant :: Ptr CFmpz -> Ptr CFmpz -> CLong -> IO ()---- | /fmpz_poly_discriminant/ /res/ /poly/ --- --- Set @res@ to the discriminant of @poly@. We normalise the discriminant--- so that \(\operatorname{disc}(f) = (-1)^{(n(n-1)/2)}--- \operatorname{res}(f, f')/\operatorname{lc}(f)\), thus--- \(\operatorname{disc}(f) = \operatorname{lc}(f)^{(2n - 2)} \prod_{i < j} (r_i--- - r_j)^2\), where \(\operatorname{lc}(f)\) is the leading coefficient of--- \(f\), \(n\) is the degree of \(f\) and \(r_i\) are the roots of \(f\).-foreign import ccall "fmpz_poly.h fmpz_poly_discriminant"- fmpz_poly_discriminant :: Ptr CFmpz -> Ptr CFmpzPoly -> IO ()---- Gaussian content ---------------------------------------------------------------- | /_fmpz_poly_content/ /res/ /poly/ /len/ --- --- Sets @res@ to the non-negative content of @(poly, len)@. Aliasing--- between @res@ and the coefficients of @poly@ is not supported.-foreign import ccall "fmpz_poly.h _fmpz_poly_content"- _fmpz_poly_content :: Ptr CFmpz -> Ptr CFmpz -> CLong -> IO ()---- | /fmpz_poly_content/ /res/ /poly/ --- --- Sets @res@ to the non-negative content of @poly@. The content of the--- zero polynomial is defined to be zero. Supports aliasing, that is, @res@--- is allowed to be one of the coefficients of @poly@.-foreign import ccall "fmpz_poly.h fmpz_poly_content"- fmpz_poly_content :: Ptr CFmpz -> Ptr CFmpzPoly -> IO ()---- | /_fmpz_poly_primitive_part/ /res/ /poly/ /len/ --- --- Sets @(res, len)@ to @(poly, len)@ divided by the content of--- @(poly, len)@, and normalises the result to have non-negative leading--- coefficient.--- --- Assumes that @(poly, len)@ is non-zero. Supports aliasing of @res@ and--- @poly@.-foreign import ccall "fmpz_poly.h _fmpz_poly_primitive_part"- _fmpz_poly_primitive_part :: Ptr CFmpz -> Ptr CFmpz -> CLong -> IO ()---- | /fmpz_poly_primitive_part/ /res/ /poly/ --- --- Sets @res@ to @poly@ divided by the content of @poly@, and normalises--- the result to have non-negative leading coefficient. If @poly@ is zero,--- sets @res@ to zero.-foreign import ccall "fmpz_poly.h fmpz_poly_primitive_part"- fmpz_poly_primitive_part :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()---- Square-free --------------------------------------------------------------------- | /_fmpz_poly_is_squarefree/ /poly/ /len/ --- --- Returns whether the polynomial @(poly, len)@ is square-free.-foreign import ccall "fmpz_poly.h _fmpz_poly_is_squarefree"- _fmpz_poly_is_squarefree :: Ptr CFmpz -> CLong -> IO CInt---- | /fmpz_poly_is_squarefree/ /poly/ --- --- Returns whether the polynomial @poly@ is square-free. A non-zero--- polynomial is defined to be square-free if it has no non-unit square--- factors. We also define the zero polynomial to be square-free.--- --- Returns \(1\) if the length of @poly@ is at most \(2\). Returns whether--- the discriminant is zero for quadratic polynomials. Otherwise, returns--- whether the greatest common divisor of @poly@ and its derivative has--- length \(1\).-foreign import ccall "fmpz_poly.h fmpz_poly_is_squarefree"- fmpz_poly_is_squarefree :: Ptr CFmpzPoly -> IO CInt---- Euclidean division -------------------------------------------------------------- | /_fmpz_poly_divrem_basecase/ /Q/ /R/ /A/ /lenA/ /B/ /lenB/ /exact/ --- --- Computes @(Q, lenA - lenB + 1)@, @(R, lenA)@ such that \(A = B Q + R\)--- and each coefficient of \(R\) beyond @lenB@ is reduced modulo the--- leading coefficient of \(B\). If the leading coefficient of \(B\) is--- \(\pm 1\) or the division is exact, this is the same thing as division--- over \(\mathbb{Q}\).--- --- Assumes that \(\operatorname{len}(A), \operatorname{len}(B) > 0\).--- Allows zero-padding in @(A, lenA)@. \(R\) and \(A\) may be aliased, but--- apart from this no aliasing of input and output operands is allowed.--- --- If the flag @exact@ is \(1\), the function stops if an inexact division--- is encountered, upon which the function will return \(0\). If no inexact--- division is encountered, the function returns \(1\). Note that this does--- not guarantee the remainder of the polynomial division is zero, merely--- that its length is less than that of B. This feature is useful for--- series division and for divisibility testing (upon testing the--- remainder).--- --- For ordinary use set the flag @exact@ to \(0\). In this case, no checks--- or early aborts occur and the function always returns \(1\).-foreign import ccall "fmpz_poly.h _fmpz_poly_divrem_basecase"- _fmpz_poly_divrem_basecase :: Ptr CFmpz -> Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> CInt -> IO CInt---- | /fmpz_poly_divrem_basecase/ /Q/ /R/ /A/ /B/ --- --- Computes \(Q\), \(R\) such that \(A = B Q + R\) and each coefficient of--- \(R\) beyond \(\operatorname{len}(B) - 1\) is reduced modulo the leading--- coefficient of \(B\). If the leading coefficient of \(B\) is \(\pm 1\)--- or the division is exact, this is the same thing as division over--- \(\mathbb{Q}\). An exception is raised if \(B\) is zero.-foreign import ccall "fmpz_poly.h fmpz_poly_divrem_basecase"- fmpz_poly_divrem_basecase :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()---- | /_fmpz_poly_divrem_divconquer_recursive/ /Q/ /BQ/ /W/ /A/ /B/ /lenB/ /exact/ --- --- Computes @(Q, lenB)@, @(BQ, 2 lenB - 1)@ such that \(BQ = B \times Q\)--- and \(A = B Q + R\) where each coefficient of \(R\) beyond--- \(\operatorname{len}(B) - 1\) is reduced modulo the leading coefficient--- of \(B\). We assume that--- \(\operatorname{len}(A) = 2 \operatorname{len}(B) - 1\). If the leading--- coefficient of \(B\) is \(\pm 1\) or the division is exact, this is the--- same as division over \(\mathbb{Q}\).--- --- Assumes \(\operatorname{len}(B) > 0\). Allows zero-padding in--- @(A, lenA)@. Requires a temporary array @(W, 2 lenB - 1)@. No aliasing--- of input and output operands is allowed.--- --- This function does not read the bottom \(\operatorname{len}(B) - 1\)--- coefficients from \(A\), which means that they might not even need to--- exist in allocated memory.--- --- If the flag @exact@ is \(1\), the function stops if an inexact division--- is encountered, upon which the function will return \(0\). If no inexact--- division is encountered, the function returns \(1\). Note that this does--- not guarantee the remainder of the polynomial division is zero, merely--- that its length is less than that of B. This feature is useful for--- series division and for divisibility testing (upon testing the--- remainder).--- --- For ordinary use set the flag @exact@ to \(0\). In this case, no checks--- or early aborts occur and the function always returns \(1\).-foreign import ccall "fmpz_poly.h _fmpz_poly_divrem_divconquer_recursive"- _fmpz_poly_divrem_divconquer_recursive :: Ptr CFmpz -> Ptr CFmpz -> Ptr CFmpz -> Ptr CFmpz -> Ptr CFmpz -> CLong -> CInt -> IO CInt---- | /_fmpz_poly_divrem_divconquer/ /Q/ /R/ /A/ /lenA/ /B/ /lenB/ /exact/ --- --- Computes @(Q, lenA - lenB + 1)@, @(R, lenA)@ such that \(A = B Q + R\)--- and each coefficient of \(R\) beyond \(\operatorname{len}(B) - 1\) is--- reduced modulo the leading coefficient of \(B\). If the leading--- coefficient of \(B\) is \(\pm 1\) or the division is exact, this is the--- same as division over \(\mathbb{Q}\).--- --- Assumes \(\operatorname{len}(A) \geq \operatorname{len}(B) > 0\). Allows--- zero-padding in @(A, lenA)@. No aliasing of input and output operands is--- allowed.--- --- If the flag @exact@ is \(1\), the function stops if an inexact division--- is encountered, upon which the function will return \(0\). If no inexact--- division is encountered, the function returns \(1\). Note that this does--- not guarantee the remainder of the polynomial division is zero, merely--- that its length is less than that of B. This feature is useful for--- series division and for divisibility testing (upon testing the--- remainder).--- --- For ordinary use set the flag @exact@ to \(0\). In this case, no checks--- or early aborts occur and the function always returns \(1\).-foreign import ccall "fmpz_poly.h _fmpz_poly_divrem_divconquer"- _fmpz_poly_divrem_divconquer :: Ptr CFmpz -> Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> CInt -> IO CInt---- | /fmpz_poly_divrem_divconquer/ /Q/ /R/ /A/ /B/ --- --- Computes \(Q\), \(R\) such that \(A = B Q + R\) and each coefficient of--- \(R\) beyond \(\operatorname{len}(B) - 1\) is reduced modulo the leading--- coefficient of \(B\). If the leading coefficient of \(B\) is \(\pm 1\)--- or the division is exact, this is the same as division over--- \(\mathbb{Q}\). An exception is raised if \(B\) is zero.-foreign import ccall "fmpz_poly.h fmpz_poly_divrem_divconquer"- fmpz_poly_divrem_divconquer :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()---- | /_fmpz_poly_divrem/ /Q/ /R/ /A/ /lenA/ /B/ /lenB/ /exact/ --- --- Computes @(Q, lenA - lenB + 1)@, @(R, lenA)@ such that \(A = B Q + R\)--- and each coefficient of \(R\) beyond \(\operatorname{len}(B) - 1\) is--- reduced modulo the leading coefficient of \(B\). If the leading--- coefficient of \(B\) is \(\pm 1\) or the division is exact, this is the--- same thing as division over \(\mathbb{Q}\).--- --- Assumes \(\operatorname{len}(A) \geq \operatorname{len}(B) > 0\). Allows--- zero-padding in @(A, lenA)@. No aliasing of input and output operands is--- allowed.--- --- If the flag @exact@ is \(1\), the function stops if an inexact division--- is encountered, upon which the function will return \(0\). If no inexact--- division is encountered, the function returns \(1\). Note that this does--- not guarantee the remainder of the polynomial division is zero, merely--- that its length is less than that of B. This feature is useful for--- series division and for divisibility testing (upon testing the--- remainder).--- --- For ordinary use set the flag @exact@ to \(0\). In this case, no checks--- or early aborts occur and the function always returns \(1\).-foreign import ccall "fmpz_poly.h _fmpz_poly_divrem"- _fmpz_poly_divrem :: Ptr CFmpz -> Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> CInt -> IO CInt---- | /fmpz_poly_divrem/ /Q/ /R/ /A/ /B/ --- --- Computes \(Q\), \(R\) such that \(A = B Q + R\) and each coefficient of--- \(R\) beyond \(\operatorname{len}(B) - 1\) is reduced modulo the leading--- coefficient of \(B\). If the leading coefficient of \(B\) is \(\pm 1\)--- or the division is exact, this is the same as division over--- \(\mathbb{Q}\). An exception is raised if \(B\) is zero.-foreign import ccall "fmpz_poly.h fmpz_poly_divrem"- fmpz_poly_divrem :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()---- | /_fmpz_poly_div_basecase/ /Q/ /R/ /A/ /lenA/ /B/ /lenB/ /exact/ --- --- Computes the quotient @(Q, lenA - lenB + 1)@ of @(A, lenA)@ divided by--- @(B, lenB)@.--- --- Notationally, computes \(Q\), \(R\) such that \(A = B Q + R\) and each--- coefficient of \(R\) beyond \(\operatorname{len}(B) - 1\) is reduced--- modulo the leading coefficient of \(B\).--- --- If the leading coefficient of \(B\) is \(\pm 1\) or the division is--- exact, this is the same as division over \(\mathbb{Q}\).--- --- Assumes \(\operatorname{len}(A), \operatorname{len}(B) > 0\). Allows--- zero-padding in @(A, lenA)@. Requires a temporary array \(R\) of size at--- least the (actual) length of \(A\). For convenience, \(R\) may be--- @NULL@. \(R\) and \(A\) may be aliased, but apart from this no aliasing--- of input and output operands is allowed.--- --- If the flag @exact@ is \(1\), the function stops if an inexact division--- is encountered, upon which the function will return \(0\). If no inexact--- division is encountered, the function returns \(1\). Note that this does--- not guarantee the remainder of the polynomial division is zero, merely--- that its length is less than that of B. This feature is useful for--- series division and for divisibility testing (upon testing the--- remainder).--- --- For ordinary use set the flag @exact@ to \(0\). In this case, no checks--- or early aborts occur and the function always returns \(1\).-foreign import ccall "fmpz_poly.h _fmpz_poly_div_basecase"- _fmpz_poly_div_basecase :: Ptr CFmpz -> Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> CInt -> IO CInt---- | /fmpz_poly_div_basecase/ /Q/ /A/ /B/ --- --- Computes the quotient \(Q\) of \(A\) divided by \(Q\).--- --- Notationally, computes \(Q\), \(R\) such that \(A = B Q + R\) and each--- coefficient of \(R\) beyond \(\operatorname{len}(B) - 1\) is reduced--- modulo the leading coefficient of \(B\).--- --- If the leading coefficient of \(B\) is \(\pm 1\) or the division is--- exact, this is the same as division over \(\mathbb{Q}\). An exception is--- raised if \(B\) is zero.-foreign import ccall "fmpz_poly.h fmpz_poly_div_basecase"- fmpz_poly_div_basecase :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()---- | /_fmpz_poly_divremlow_divconquer_recursive/ /Q/ /BQ/ /A/ /B/ /lenB/ /exact/ --- --- Divide and conquer division of @(A, 2 lenB - 1)@ by @(B, lenB)@,--- computing only the bottom \(\operatorname{len}(B) - 1\) coefficients of--- \(B Q\).--- --- Assumes \(\operatorname{len}(B) > 0\). Requires \(B Q\) to have length--- at least \(2 \operatorname{len}(B) - 1\), although only the bottom--- \(\operatorname{len}(B) - 1\) coefficients will carry meaningful output.--- Does not support any aliasing. Allows zero-padding in \(A\), but not in--- \(B\).--- --- If the flag @exact@ is \(1\), the function stops if an inexact division--- is encountered, upon which the function will return \(0\). If no inexact--- division is encountered, the function returns \(1\). Note that this does--- not guarantee the remainder of the polynomial division is zero, merely--- that its length is less than that of B. This feature is useful for--- series division and for divisibility testing (upon testing the--- remainder).--- --- For ordinary use set the flag @exact@ to \(0\). In this case, no checks--- or early aborts occur and the function always returns \(1\).-foreign import ccall "fmpz_poly.h _fmpz_poly_divremlow_divconquer_recursive"- _fmpz_poly_divremlow_divconquer_recursive :: Ptr CFmpz -> Ptr CFmpz -> Ptr CFmpz -> Ptr CFmpz -> CLong -> CInt -> IO CInt---- | /_fmpz_poly_div_divconquer_recursive/ /Q/ /temp/ /A/ /B/ /lenB/ /exact/ --- --- Recursive short division in the balanced case.--- --- Computes the quotient @(Q, lenB)@ of @(A, 2 lenB - 1)@ upon division by--- @(B, lenB)@. Requires \(\operatorname{len}(B) > 0\). Needs a temporary--- array @temp@ of length \(2 \operatorname{len}(B) - 1\). Does not support--- any aliasing.--- --- For further details, see < [Mul2000]>.--- --- If the flag @exact@ is \(1\), the function stops if an inexact division--- is encountered, upon which the function will return \(0\). If no inexact--- division is encountered, the function returns \(1\). Note that this does--- not guarantee the remainder of the polynomial division is zero, merely--- that its length is less than that of B. This feature is useful for--- series division and for divisibility testing (upon testing the--- remainder).--- --- For ordinary use set the flag @exact@ to \(0\). In this case, no checks--- or early aborts occur and the function always returns \(1\).-foreign import ccall "fmpz_poly.h _fmpz_poly_div_divconquer_recursive"- _fmpz_poly_div_divconquer_recursive :: Ptr CFmpz -> Ptr CFmpz -> Ptr CFmpz -> Ptr CFmpz -> CLong -> CInt -> IO CInt---- | /_fmpz_poly_div_divconquer/ /Q/ /A/ /lenA/ /B/ /lenB/ /exact/ --- --- Computes the quotient @(Q, lenA - lenB + 1)@ of @(A, lenA)@ upon--- division by @(B, lenB)@. Assumes that--- \(\operatorname{len}(A) \geq \operatorname{len}(B) > 0\). Does not--- support aliasing.--- --- If the flag @exact@ is \(1\), the function stops if an inexact division--- is encountered, upon which the function will return \(0\). If no inexact--- division is encountered, the function returns \(1\). Note that this does--- not guarantee the remainder of the polynomial division is zero, merely--- that its length is less than that of B. This feature is useful for--- series division and for divisibility testing (upon testing the--- remainder).--- --- For ordinary use set the flag @exact@ to \(0\). In this case, no checks--- or early aborts occur and the function always returns \(1\).-foreign import ccall "fmpz_poly.h _fmpz_poly_div_divconquer"- _fmpz_poly_div_divconquer :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> CInt -> IO CInt---- | /fmpz_poly_div_divconquer/ /Q/ /A/ /B/ --- --- Computes the quotient \(Q\) of \(A\) divided by \(B\).--- --- Notationally, computes \(Q\), \(R\) such that \(A = B Q + R\) and each--- coefficient of \(R\) beyond \(\operatorname{len}(B) - 1\) is reduced--- modulo the leading coefficient of \(B\).--- --- If the leading coefficient of \(B\) is \(\pm 1\) or the division is--- exact, this is the same as division over \(\mathbb{Q}\). An exception is--- raised if \(B\) is zero.-foreign import ccall "fmpz_poly.h fmpz_poly_div_divconquer"- fmpz_poly_div_divconquer :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()---- | /_fmpz_poly_div/ /Q/ /A/ /lenA/ /B/ /lenB/ /exact/ --- --- Computes the quotient @(Q, lenA - lenB + 1)@ of @(A, lenA)@ divided by--- @(B, lenB)@.--- --- Notationally, computes \(Q\), \(R\) such that \(A = B Q + R\) and each--- coefficient of \(R\) beyond \(\operatorname{len}(B) - 1\) is reduced--- modulo the leading coefficient of \(B\). If the leading coefficient of--- \(B\) is \(\pm 1\) or the division is exact, this is the same as--- division over \(\mathbb{Q}\).--- --- Assumes \(\operatorname{len}(A) \geq \operatorname{len}(B) > 0\). Allows--- zero-padding in @(A, lenA)@. Aliasing of input and output operands is--- not allowed.--- --- If the flag @exact@ is \(1\), the function stops if an inexact division--- is encountered, upon which the function will return \(0\). If no inexact--- division is encountered, the function returns \(1\). Note that this does--- not guarantee the remainder of the polynomial division is zero, merely--- that its length is less than that of B. This feature is useful for--- series division and for divisibility testing (upon testing the--- remainder).--- --- For ordinary use set the flag @exact@ to \(0\). In this case, no checks--- or early aborts occur and the function always returns \(1\).-foreign import ccall "fmpz_poly.h _fmpz_poly_div"- _fmpz_poly_div :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> CInt -> IO CInt---- | /fmpz_poly_div/ /Q/ /A/ /B/ --- --- Computes the quotient \(Q\) of \(A\) divided by \(B\).--- --- Notationally, computes \(Q\), \(R\) such that \(A = B Q + R\) and each--- coefficient of \(R\) beyond \(\operatorname{len}(B) - 1\) is reduced--- modulo the leading coefficient of \(B\). If the leading coefficient of--- \(B\) is \(\pm 1\) or the division is exact, this is the same as--- division over \(Q\). An exception is raised if \(B\) is zero.-foreign import ccall "fmpz_poly.h fmpz_poly_div"- fmpz_poly_div :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()---- | /_fmpz_poly_rem_basecase/ /R/ /A/ /lenA/ /B/ /lenB/ --- --- Computes the remainder @(R, lenA)@ of @(A, lenA)@ upon division by--- @(B, lenB)@.--- --- Notationally, computes \(Q\), \(R\) such that \(A = B Q + R\) and each--- coefficient of \(R\) beyond \(\operatorname{len}(B) - 1\) is reduced--- modulo the leading coefficient of \(B\). If the leading coefficient of--- \(B\) is \(\pm 1\) or the division is exact, this is the same thing as--- division over \(\mathbb{Q}\).--- --- Assumes that \(\operatorname{len}(A), \operatorname{len}(B) > 0\).--- Allows zero-padding in @(A, lenA)@. \(R\) and \(A\) may be aliased, but--- apart from this no aliasing of input and output operands is allowed.-foreign import ccall "fmpz_poly.h _fmpz_poly_rem_basecase"- _fmpz_poly_rem_basecase :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> IO ()---- | /fmpz_poly_rem_basecase/ /R/ /A/ /B/ --- --- Computes the remainder \(R\) of \(A\) upon division by \(B\).--- --- Notationally, computes \(Q\), \(R\) such that \(A = B Q + R\) and each--- coefficient of \(R\) beyond \(\operatorname{len}(B) - 1\) is reduced--- modulo the leading coefficient of \(B\). If the leading coefficient of--- \(B\) is \(\pm 1\) or the division is exact, this is the same as--- division over \(\mathbb{Q}\). An exception is raised if \(B\) is zero.-foreign import ccall "fmpz_poly.h fmpz_poly_rem_basecase"- fmpz_poly_rem_basecase :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()---- | /_fmpz_poly_rem/ /R/ /A/ /lenA/ /B/ /lenB/ --- --- Computes the remainder @(R, lenA)@ of @(A, lenA)@ upon division by--- @(B, lenB)@.--- --- Notationally, computes \(Q\), \(R\) such that \(A = B Q + R\) and each--- coefficient of \(R\) beyond \(\operatorname{len}(B) - 1\) is reduced--- modulo the leading coefficient of \(B\). If the leading coefficient of--- \(B\) is \(\pm 1\) or the division is exact, this is the same thing as--- division over \(\mathbb{Q}\).--- --- Assumes that \(\operatorname{len}(A) \geq \operatorname{len}(B) > 0\).--- Allows zero-padding in @(A, lenA)@. Aliasing of input and output--- operands is not allowed.-foreign import ccall "fmpz_poly.h _fmpz_poly_rem"- _fmpz_poly_rem :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> IO ()---- | /fmpz_poly_rem/ /R/ /A/ /B/ --- --- Computes the remainder \(R\) of \(A\) upon division by \(B\).--- --- Notationally, computes \(Q\), \(R\) such that \(A = B Q + R\) and each--- coefficient of \(R\) beyond \(\operatorname{len}(B) - 1\) is reduced--- modulo the leading coefficient of \(B\). If the leading coefficient of--- \(B\) is \(\pm 1\) or the division is exact, this is the same as--- division over \(\mathbb{Q}\). An exception is raised if \(B\) is zero.-foreign import ccall "fmpz_poly.h fmpz_poly_rem"- fmpz_poly_rem :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()---- | /_fmpz_poly_div_root/ /Q/ /A/ /len/ /c/ --- --- Computes the quotient @(Q, len-1)@ of @(A, len)@ upon division by--- \(x - c\).--- --- Supports aliasing of @Q@ and @A@, but the result is undefined in case of--- partial overlap.-foreign import ccall "fmpz_poly.h _fmpz_poly_div_root"- _fmpz_poly_div_root :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> IO ()---- | /fmpz_poly_div_root/ /Q/ /A/ /c/ --- --- Computes the quotient @(Q, len-1)@ of @(A, len)@ upon division by--- \(x - c\).-foreign import ccall "fmpz_poly.h fmpz_poly_div_root"- fmpz_poly_div_root :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpz -> IO ()---- Division with precomputed inverse ----------------------------------------------- | /_fmpz_poly_preinvert/ /B_inv/ /B/ /n/ --- --- Given a monic polynomial @B@ of length @n@, compute a precomputed--- inverse @B_inv@ of length @n@ for use in the functions below. No--- aliasing of @B@ and @B_inv@ is permitted. We assume @n@ is not zero.-foreign import ccall "fmpz_poly.h _fmpz_poly_preinvert"- _fmpz_poly_preinvert :: Ptr CFmpz -> Ptr CFmpz -> CLong -> IO ()---- | /fmpz_poly_preinvert/ /B_inv/ /B/ --- --- Given a monic polynomial @B@, compute a precomputed inverse @B_inv@ for--- use in the functions below. An exception is raised if @B@ is zero.-foreign import ccall "fmpz_poly.h fmpz_poly_preinvert"- fmpz_poly_preinvert :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()---- | /_fmpz_poly_div_preinv/ /Q/ /A/ /len1/ /B/ /B_inv/ /len2/ --- --- Given a precomputed inverse @B_inv@ of the polynomial @B@ of length--- @len2@, compute the quotient @Q@ of @A@ by @B@. We assume the length--- @len1@ of @A@ is at least @len2@. The polynomial @Q@ must have space for--- @len1 - len2 + 1@ coefficients. No aliasing of operands is permitted.-foreign import ccall "fmpz_poly.h _fmpz_poly_div_preinv"- _fmpz_poly_div_preinv :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> Ptr CFmpz -> CLong -> IO ()---- | /fmpz_poly_div_preinv/ /Q/ /A/ /B/ /B_inv/ --- --- Given a precomputed inverse @B_inv@ of the polynomial @B@, compute the--- quotient @Q@ of @A@ by @B@. Aliasing of @B@ and @B_inv@ is not--- permitted.-foreign import ccall "fmpz_poly.h fmpz_poly_div_preinv"- fmpz_poly_div_preinv :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()---- | /_fmpz_poly_divrem_preinv/ /Q/ /A/ /len1/ /B/ /B_inv/ /len2/ --- --- Given a precomputed inverse @B_inv@ of the polynomial @B@ of length--- @len2@, compute the quotient @Q@ of @A@ by @B@. The remainder is then--- placed in @A@. We assume the length @len1@ of @A@ is at least @len2@.--- The polynomial @Q@ must have space for @len1 - len2 + 1@ coefficients.--- No aliasing of operands is permitted.-foreign import ccall "fmpz_poly.h _fmpz_poly_divrem_preinv"- _fmpz_poly_divrem_preinv :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> Ptr CFmpz -> CLong -> IO ()---- | /fmpz_poly_divrem_preinv/ /Q/ /R/ /A/ /B/ /B_inv/ --- --- Given a precomputed inverse @B_inv@ of the polynomial @B@, compute the--- quotient @Q@ of @A@ by @B@ and the remainder @R@. Aliasing of @B@ and--- @B_inv@ is not permitted.-foreign import ccall "fmpz_poly.h fmpz_poly_divrem_preinv"- fmpz_poly_divrem_preinv :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()---- | /_fmpz_poly_powers_precompute/ /B/ /len/ --- --- Computes @2*len - 1@ powers of \(x\) modulo the polynomial \(B\) of the--- given length. This is used as a kind of precomputed inverse in the--- remainder routine below.-foreign import ccall "fmpz_poly.h _fmpz_poly_powers_precompute"- _fmpz_poly_powers_precompute :: Ptr CFmpz -> CLong -> IO (Ptr (Ptr CFmpz))---- | /fmpz_poly_powers_precompute/ /pinv/ /poly/ --- --- Computes @2*len - 1@ powers of \(x\) modulo the polynomial \(B\) of the--- given length. This is used as a kind of precomputed inverse in the--- remainder routine below.-foreign import ccall "fmpz_poly.h fmpz_poly_powers_precompute"- fmpz_poly_powers_precompute :: Ptr CFmpzPolyPowersPrecomp -> Ptr CFmpzPoly -> IO ()---- | /_fmpz_poly_powers_clear/ /powers/ /len/ --- --- Clean up resources used by precomputed powers which have been computed--- by @_fmpz_poly_powers_precompute@.-foreign import ccall "fmpz_poly.h _fmpz_poly_powers_clear"- _fmpz_poly_powers_clear :: Ptr (Ptr CFmpz) -> CLong -> IO ()---- | /fmpz_poly_powers_clear/ /pinv/ --- --- Clean up resources used by precomputed powers which have been computed--- by @fmpz_poly_powers_precompute@.-foreign import ccall "fmpz_poly.h fmpz_poly_powers_clear"- fmpz_poly_powers_clear :: Ptr CFmpzPolyPowersPrecomp -> IO ()---- | /_fmpz_poly_rem_powers_precomp/ /A/ /m/ /B/ /n/ /powers/ --- --- Set \(A\) to the remainder of \(A\) divide \(B\) given precomputed--- powers mod \(B\) provided by @_fmpz_poly_powers_precompute@. No aliasing--- is allowed.-foreign import ccall "fmpz_poly.h _fmpz_poly_rem_powers_precomp"- _fmpz_poly_rem_powers_precomp :: Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> Ptr (Ptr CFmpz) -> IO ()---- | /fmpz_poly_rem_powers_precomp/ /R/ /A/ /B/ /B_inv/ --- --- Set \(R\) to the remainder of \(A\) divide \(B\) given precomputed--- powers mod \(B\) provided by @fmpz_poly_powers_precompute@.-foreign import ccall "fmpz_poly.h fmpz_poly_rem_powers_precomp"- fmpz_poly_rem_powers_precomp :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPolyPowersPrecomp -> IO ()---- Divisibility testing ------------------------------------------------------------ | /_fmpz_poly_divides/ /Q/ /A/ /lenA/ /B/ /lenB/ --- --- Returns 1 if @(B, lenB)@ divides @(A, lenA)@ exactly and sets \(Q\) to--- the quotient, otherwise returns 0.--- --- It is assumed that--- \(\operatorname{len}(A) \geq \operatorname{len}(B) > 0\) and that \(Q\)--- has space for \(\operatorname{len}(A) - \operatorname{len}(B) + 1\)--- coefficients.--- --- Aliasing of \(Q\) with either of the inputs is not permitted.--- --- This function is currently unoptimised and provided for convenience--- only.-foreign import ccall "fmpz_poly.h _fmpz_poly_divides"- _fmpz_poly_divides :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> IO CInt---- | /fmpz_poly_divides/ /Q/ /A/ /B/ --- --- Returns 1 if \(B\) divides \(A\) exactly and sets \(Q\) to the quotient,--- otherwise returns 0.--- --- This function is currently unoptimised and provided for convenience--- only.-foreign import ccall "fmpz_poly.h fmpz_poly_divides"- fmpz_poly_divides :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO CInt---- | /fmpz_poly_remove/ /res/ /poly1/ /poly2/ --- --- Set @res@ to @poly1@ divided by the highest power of @poly2@ that--- divides it and return the power. The divisor @poly2@ must not be zero or--- \(\pm 1\), otherwise an exception is raised.-foreign import ccall "fmpz_poly.h fmpz_poly_remove"- fmpz_poly_remove :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO CLong---- Division mod p ------------------------------------------------------------------ | /fmpz_poly_divlow_smodp/ /res/ /f/ /g/ /p/ /n/ --- --- Compute the \(n\) lowest coefficients of \(f\) divided by \(g\),--- assuming the division is exact modulo \(p\). The computed coefficients--- are reduced modulo \(p\) using the symmetric remainder system. We--- require \(f\) to be at least \(n\) in length. The function can handle--- trailing zeroes, but the low nonzero coefficient of \(g\) must be--- coprime to \(p\). This is a bespoke function used by factoring.-foreign import ccall "fmpz_poly.h fmpz_poly_divlow_smodp"- fmpz_poly_divlow_smodp :: Ptr CFmpz -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpz -> CLong -> IO ()---- | /fmpz_poly_divhigh_smodp/ /res/ /f/ /g/ /p/ /n/ --- --- Compute the \(n\) highest coefficients of \(f\) divided by \(g\),--- assuming the division is exact modulo \(p\). The computed coefficients--- are reduced modulo \(p\) using the symmetric remainder system. We--- require \(f\) to be as output by @fmpz_poly_mulhigh_n@ given polynomials--- \(g\) and a polynomial of length \(n\) as inputs. The leading--- coefficient of \(g\) must be coprime to \(p\). This is a bespoke--- function used by factoring.-foreign import ccall "fmpz_poly.h fmpz_poly_divhigh_smodp"- fmpz_poly_divhigh_smodp :: Ptr CFmpz -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpz -> CLong -> IO ()---- Power series division ----------------------------------------------------------- | /_fmpz_poly_inv_series_basecase/ /Qinv/ /Q/ /Qlen/ /n/ --- --- Computes the first \(n\) terms of the inverse power series of--- @(Q, lenQ)@ using a recurrence.--- --- Assumes that \(n \geq 1\) and that \(Q\) has constant term \(\pm 1\).--- Does not support aliasing.-foreign import ccall "fmpz_poly.h _fmpz_poly_inv_series_basecase"- _fmpz_poly_inv_series_basecase :: Ptr CFmpz -> Ptr CFmpz -> CLong -> CLong -> IO ()---- | /fmpz_poly_inv_series_basecase/ /Qinv/ /Q/ /n/ --- --- Computes the first \(n\) terms of the inverse power series of \(Q\)--- using a recurrence, assuming that \(Q\) has constant term \(\pm 1\) and--- \(n \geq 1\).-foreign import ccall "fmpz_poly.h fmpz_poly_inv_series_basecase"- fmpz_poly_inv_series_basecase :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()---- | /_fmpz_poly_inv_series_newton/ /Qinv/ /Q/ /n/ --- --- Computes the first \(n\) terms of the inverse power series of--- @(Q, lenQ)@ using Newton iteration.--- --- Assumes that \(n \geq 1\) and that \(Q\) has constant term \(\pm 1\).--- Does not support aliasing.-foreign import ccall "fmpz_poly.h _fmpz_poly_inv_series_newton"- _fmpz_poly_inv_series_newton :: Ptr CFmpz -> Ptr CFmpz -> CLong -> IO ()---- | /fmpz_poly_inv_series_newton/ /Qinv/ /Q/ /Qlen/ /n/ --- --- Computes the first \(n\) terms of the inverse power series of \(Q\)--- using Newton iteration, assuming \(Q\) has constant term \(\pm 1\) and--- \(n \geq 1\).-foreign import ccall "fmpz_poly.h fmpz_poly_inv_series_newton"- fmpz_poly_inv_series_newton :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> CLong -> IO ()---- | /_fmpz_poly_inv_series/ /Qinv/ /Q/ /n/ --- --- Computes the first \(n\) terms of the inverse power series of--- @(Q, lenQ)@.--- --- Assumes that \(n \geq 1\) and that \(Q\) has constant term \(\pm 1\).--- Does not support aliasing.-foreign import ccall "fmpz_poly.h _fmpz_poly_inv_series"- _fmpz_poly_inv_series :: Ptr CFmpz -> Ptr CFmpz -> CLong -> IO ()---- | /fmpz_poly_inv_series/ /Qinv/ /Q/ /n/ --- --- Computes the first \(n\) terms of the inverse power series of \(Q\),--- assuming \(Q\) has constant term \(\pm 1\) and \(n \geq 1\).-foreign import ccall "fmpz_poly.h fmpz_poly_inv_series"- fmpz_poly_inv_series :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()--foreign import ccall "fmpz_poly.h _fmpz_poly_div_series_basecase"- _fmpz_poly_div_series_basecase :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> CLong -> IO ()--foreign import ccall "fmpz_poly.h _fmpz_poly_div_series_divconquer"- _fmpz_poly_div_series_divconquer :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> CLong -> IO ()---- | /_fmpz_poly_div_series/ /Q/ /A/ /Alen/ /B/ /Blen/ /n/ --- --- Divides @(A, Alen)@ by @(B, Blen)@ as power series over \(\mathbb{Z}\),--- assuming \(B\) has constant term \(\pm 1\) and \(n \geq 1\). Aliasing is--- not supported.-foreign import ccall "fmpz_poly.h _fmpz_poly_div_series"- _fmpz_poly_div_series :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> CLong -> IO ()--foreign import ccall "fmpz_poly.h fmpz_poly_div_series_basecase"- fmpz_poly_div_series_basecase :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()--foreign import ccall "fmpz_poly.h fmpz_poly_div_series_divconquer"- fmpz_poly_div_series_divconquer :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()---- | /fmpz_poly_div_series/ /Q/ /A/ /B/ /n/ --- --- Performs power series division in \(\mathbb{Z}[[x]] / (x^n)\). The--- function considers the polynomials \(A\) and \(B\) as power series of--- length \(n\) starting with the constant terms. The function assumes that--- \(B\) has constant term \(\pm 1\) and \(n \geq 1\).-foreign import ccall "fmpz_poly.h fmpz_poly_div_series"- fmpz_poly_div_series :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()---- Pseudo division ----------------------------------------------------------------- | /_fmpz_poly_pseudo_divrem_basecase/ /Q/ /R/ /d/ /A/ /lenA/ /B/ /lenB/ /inv/ --- --- If \(\ell\) is the leading coefficient of \(B\), then computes \(Q\),--- \(R\) such that \(\ell^d A = Q B + R\). This function is used for--- simulating division over \(\mathbb{Q}\).--- --- Assumes that \(\operatorname{len}(A) \geq \operatorname{len}(B) > 0\).--- Assumes that \(Q\) can fit--- \(\operatorname{len}(A) - \operatorname{len}(B) + 1\) coefficients, and--- that \(R\) can fit \(\operatorname{len}(A)\) coefficients. Supports--- aliasing of @(R, lenA)@ and @(A, lenA)@. But other than this, no--- aliasing of the inputs and outputs is supported.--- --- An optional precomputed inverse of the leading coefficient of \(B\) from--- @fmpz_preinvn_init@ can be supplied. Otherwise @inv@ should be @NULL@.-foreign import ccall "fmpz_poly.h _fmpz_poly_pseudo_divrem_basecase"- _fmpz_poly_pseudo_divrem_basecase :: Ptr CFmpz -> Ptr CFmpz -> Ptr CULong -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> Ptr CFmpzPreInvN -> IO ()---- | /fmpz_poly_pseudo_divrem_basecase/ /Q/ /R/ /d/ /A/ /B/ --- --- If \(\ell\) is the leading coefficient of \(B\), then computes \(Q\),--- \(R\) such that \(\ell^d A = Q B + R\). This function is used for--- simulating division over \(\mathbb{Q}\).-foreign import ccall "fmpz_poly.h fmpz_poly_pseudo_divrem_basecase"- fmpz_poly_pseudo_divrem_basecase :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CULong -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()---- | /_fmpz_poly_pseudo_divrem_divconquer/ /Q/ /R/ /d/ /A/ /lenA/ /B/ /lenB/ /inv/ --- --- Computes @(Q, lenA - lenB + 1)@, @(R, lenA)@ such that--- \(\ell^d A = B Q + R\), only setting the bottom--- \(\operatorname{len}(B) - 1\) coefficients of \(R\) to their correct--- values. The remaining top coefficients of @(R, lenA)@ may be arbitrary.--- --- Assumes \(\operatorname{len}(A) \geq \operatorname{len}(B) > 0\). Allows--- zero-padding in @(A, lenA)@. No aliasing of input and output operands is--- allowed.--- --- An optional precomputed inverse of the leading coefficient of \(B\) from--- @fmpz_preinvn_init@ can be supplied. Otherwise @inv@ should be @NULL@.-foreign import ccall "fmpz_poly.h _fmpz_poly_pseudo_divrem_divconquer"- _fmpz_poly_pseudo_divrem_divconquer :: Ptr CFmpz -> Ptr CFmpz -> Ptr CULong -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> Ptr CFmpzPreInvN -> IO ()---- | /fmpz_poly_pseudo_divrem_divconquer/ /Q/ /R/ /d/ /A/ /B/ --- --- Computes \(Q\), \(R\), and \(d\) such that \(\ell^d A = B Q + R\), where--- \(R\) has length less than the length of \(B\) and \(\ell\) is the--- leading coefficient of \(B\). An exception is raised if \(B\) is zero.-foreign import ccall "fmpz_poly.h fmpz_poly_pseudo_divrem_divconquer"- fmpz_poly_pseudo_divrem_divconquer :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CULong -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()---- | /_fmpz_poly_pseudo_divrem_cohen/ /Q/ /R/ /A/ /lenA/ /B/ /lenB/ --- --- Assumes that \(\operatorname{len}(A) \geq \operatorname{len}(B) > 0\).--- Assumes that \(Q\) can fit--- \(\operatorname{len}(A) - \operatorname{len}(B) + 1\) coefficients, and--- that \(R\) can fit \(\operatorname{len}(A)\) coefficients. Supports--- aliasing of @(R, lenA)@ and @(A, lenA)@. But other than this, no--- aliasing of the inputs and outputs is supported.-foreign import ccall "fmpz_poly.h _fmpz_poly_pseudo_divrem_cohen"- _fmpz_poly_pseudo_divrem_cohen :: Ptr CFmpz -> Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> IO ()---- | /fmpz_poly_pseudo_divrem_cohen/ /Q/ /R/ /A/ /B/ --- --- This is a variant of @fmpz_poly_pseudo_divrem@ which computes--- polynomials \(Q\) and \(R\) such that \(\ell^d A = B Q + R\). However,--- the value of \(d\) is fixed at--- \(\max{\{0, \operatorname{len}(A) - \operatorname{len}(B) + 1\}}\).--- --- This function is faster when the remainder is not well behaved, i.e.--- where it is not expected to be close to zero. Note that this function is--- not asymptotically fast. It is efficient only for short polynomials,--- e.g.when \(\operatorname{len}(B) < 32\).-foreign import ccall "fmpz_poly.h fmpz_poly_pseudo_divrem_cohen"- fmpz_poly_pseudo_divrem_cohen :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()---- | /_fmpz_poly_pseudo_rem_cohen/ /R/ /A/ /lenA/ /B/ /lenB/ --- --- Assumes that \(\operatorname{len}(A) \geq \operatorname{len}(B) > 0\).--- Assumes that \(R\) can fit \(\operatorname{len}(A)\) coefficients.--- Supports aliasing of @(R, lenA)@ and @(A, lenA)@. But other than this,--- no aliasing of the inputs and outputs is supported.-foreign import ccall "fmpz_poly.h _fmpz_poly_pseudo_rem_cohen"- _fmpz_poly_pseudo_rem_cohen :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> IO ()---- | /fmpz_poly_pseudo_rem_cohen/ /R/ /A/ /B/ --- --- This is a variant of @fmpz_poly_pseudo_rem@ which computes polynomials--- \(Q\) and \(R\) such that \(\ell^d A = B Q + R\), but only returns--- \(R\). However, the value of \(d\) is fixed at--- \(\max{\{0, \operatorname{len}(A) - \operatorname{len}(B) + 1\}}\).--- --- This function is faster when the remainder is not well behaved, i.e.--- where it is not expected to be close to zero. Note that this function is--- not asymptotically fast. It is efficient only for short polynomials,--- e.g.when \(\operatorname{len}(B) < 32\).--- --- This function uses the algorithm described in [Algorithm--- 3.1.2]< [Coh1996]>.-foreign import ccall "fmpz_poly.h fmpz_poly_pseudo_rem_cohen"- fmpz_poly_pseudo_rem_cohen :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()---- -- | /_fmpz_poly_pseudo_divrem/ /Q/ /R/ /d/ /A/ /lenA/ /B/ /lenB/ /inv/ --- -- --- -- If \(\ell\) is the leading coefficient of \(B\), then computes--- -- @(Q, lenA - lenB + 1)@, @(R, lenB - 1)@ and \(d\) such that--- -- \(\ell^d A = B Q + R\). This function is used for simulating division--- -- over \(\mathbb{Q}\).--- -- --- -- Assumes that \(\operatorname{len}(A) \geq \operatorname{len}(B) > 0\).--- -- Assumes that \(Q\) can fit--- -- \(\operatorname{len}(A) - \operatorname{len}(B) + 1\) coefficients, and--- -- that \(R\) can fit \(\operatorname{len}(A)\) coefficients, although on--- -- exit only the bottom \(\operatorname{len}(B)\) coefficients will carry--- -- meaningful data.--- -- --- -- Supports aliasing of @(R, lenA)@ and @(A, lenA)@. But other than this,--- -- no aliasing of the inputs and outputs is supported.--- -- --- -- An optional precomputed inverse of the leading coefficient of \(B\) from--- -- @fmpz_preinvn_init@ can be supplied. Otherwise @inv@ should be @NULL@.--- foreign import ccall "fmpz_poly.h _fmpz_poly_pseudo_divrem"--- _fmpz_poly_pseudo_divrem :: Ptr CFmpz -> Ptr CFmpz -> Ptr CULong -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> Ptr CFmpzPreInvN -> IO ()---- -- | /fmpz_poly_pseudo_divrem/ /Q/ /R/ /d/ /A/ /B/ --- -- --- -- Computes \(Q\), \(R\), and \(d\) such that \(\ell^d A = B Q + R\).--- foreign import ccall "fmpz_poly.h fmpz_poly_pseudo_divrem"--- fmpz_poly_pseudo_divrem :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CULong -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()---- | /_fmpz_poly_pseudo_div/ /Q/ /d/ /A/ /lenA/ /B/ /lenB/ /inv/ --- --- Pseudo-division, only returning the quotient.-foreign import ccall "fmpz_poly.h _fmpz_poly_pseudo_div"- _fmpz_poly_pseudo_div :: Ptr CFmpz -> Ptr CULong -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> Ptr CFmpzPreInvN -> IO ()---- | /fmpz_poly_pseudo_div/ /Q/ /d/ /A/ /B/ --- --- Pseudo-division, only returning the quotient.-foreign import ccall "fmpz_poly.h fmpz_poly_pseudo_div"- fmpz_poly_pseudo_div :: Ptr CFmpzPoly -> Ptr CULong -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()---- | /_fmpz_poly_pseudo_rem/ /R/ /d/ /A/ /lenA/ /B/ /lenB/ /inv/ --- --- Pseudo-division, only returning the remainder.-foreign import ccall "fmpz_poly.h _fmpz_poly_pseudo_rem"- _fmpz_poly_pseudo_rem :: Ptr CFmpz -> Ptr CULong -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> Ptr CFmpzPreInvN -> IO ()---- | /fmpz_poly_pseudo_rem/ /R/ /d/ /A/ /B/ --- --- Pseudo-division, only returning the remainder.-foreign import ccall "fmpz_poly.h fmpz_poly_pseudo_rem"- fmpz_poly_pseudo_rem :: Ptr CFmpzPoly -> Ptr CULong -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()---- Derivative ---------------------------------------------------------------------- | /_fmpz_poly_derivative/ /rpoly/ /poly/ /len/ --- --- Sets @(rpoly, len - 1)@ to the derivative of @(poly, len)@. Also handles--- the cases where @len@ is \(0\) or \(1\) correctly. Supports aliasing of--- @rpoly@ and @poly@.-foreign import ccall "fmpz_poly.h _fmpz_poly_derivative"- _fmpz_poly_derivative :: Ptr CFmpz -> Ptr CFmpz -> CLong -> IO ()---- | /fmpz_poly_derivative/ /res/ /poly/ --- --- Sets @res@ to the derivative of @poly@.-foreign import ccall "fmpz_poly.h fmpz_poly_derivative"- fmpz_poly_derivative :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()---- | /_fmpz_poly_nth_derivative/ /rpoly/ /poly/ /n/ /len/ --- --- Sets @(rpoly, len - n)@ to the nth derivative of @(poly, len)@. Also--- handles the cases where @len \<= n@ correctly. Supports aliasing of--- @rpoly@ and @poly@.-foreign import ccall "fmpz_poly.h _fmpz_poly_nth_derivative"- _fmpz_poly_nth_derivative :: Ptr CFmpz -> Ptr CFmpz -> CULong -> CLong -> IO ()---- | /fmpz_poly_nth_derivative/ /res/ /poly/ /n/ --- --- Sets @res@ to the nth derivative of @poly@.-foreign import ccall "fmpz_poly.h fmpz_poly_nth_derivative"- fmpz_poly_nth_derivative :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CULong -> IO ()---- Evaluation ---------------------------------------------------------------------- | /_fmpz_poly_evaluate_divconquer_fmpz/ /res/ /poly/ /len/ /a/ --- --- Evaluates the polynomial @(poly, len)@ at the integer \(a\) using a--- divide and conquer approach. Assumes that the length of the polynomial--- is at least one. Allows zero padding. Does not allow aliasing between--- @res@ and @x@.-foreign import ccall "fmpz_poly.h _fmpz_poly_evaluate_divconquer_fmpz"- _fmpz_poly_evaluate_divconquer_fmpz :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> IO ()---- | /fmpz_poly_evaluate_divconquer_fmpz/ /res/ /poly/ /a/ --- --- Evaluates the polynomial @poly@ at the integer \(a\) using a divide and--- conquer approach.--- --- Aliasing between @res@ and @a@ is supported, however, @res@ may not be--- part of @poly@.-foreign import ccall "fmpz_poly.h fmpz_poly_evaluate_divconquer_fmpz"- fmpz_poly_evaluate_divconquer_fmpz :: Ptr CFmpz -> Ptr CFmpzPoly -> Ptr CFmpz -> IO ()---- | /_fmpz_poly_evaluate_horner_fmpz/ /res/ /f/ /len/ /a/ --- --- Evaluates the polynomial @(f, len)@ at the integer \(a\) using Horner\'s--- rule, and sets @res@ to the result. Aliasing between @res@ and \(a\) or--- any of the coefficients of \(f\) is not supported.-foreign import ccall "fmpz_poly.h _fmpz_poly_evaluate_horner_fmpz"- _fmpz_poly_evaluate_horner_fmpz :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> IO ()---- | /fmpz_poly_evaluate_horner_fmpz/ /res/ /f/ /a/ --- --- Evaluates the polynomial \(f\) at the integer \(a\) using Horner\'s--- rule, and sets @res@ to the result.--- --- As expected, aliasing between @res@ and @a@ is supported. However, @res@--- may not be aliased with a coefficient of \(f\).-foreign import ccall "fmpz_poly.h fmpz_poly_evaluate_horner_fmpz"- fmpz_poly_evaluate_horner_fmpz :: Ptr CFmpz -> Ptr CFmpzPoly -> Ptr CFmpz -> IO ()---- | /_fmpz_poly_evaluate_fmpz/ /res/ /f/ /len/ /a/ --- --- Evaluates the polynomial @(f, len)@ at the integer \(a\) and sets @res@--- to the result. Aliasing between @res@ and \(a\) or any of the--- coefficients of \(f\) is not supported.-foreign import ccall "fmpz_poly.h _fmpz_poly_evaluate_fmpz"- _fmpz_poly_evaluate_fmpz :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> IO ()---- | /fmpz_poly_evaluate_fmpz/ /res/ /f/ /a/ --- --- Evaluates the polynomial \(f\) at the integer \(a\) and sets @res@ to--- the result.--- --- As expected, aliasing between @res@ and \(a\) is supported. However,--- @res@ may not be aliased with a coefficient of \(f\).-foreign import ccall "fmpz_poly.h fmpz_poly_evaluate_fmpz"- fmpz_poly_evaluate_fmpz :: Ptr CFmpz -> Ptr CFmpzPoly -> Ptr CFmpz -> IO ()---- | /_fmpz_poly_evaluate_divconquer_fmpq/ /rnum/ /rden/ /f/ /len/ /anum/ /aden/ --- --- Evaluates the polynomial @(f, len)@ at the rational @(anum, aden)@ using--- a divide and conquer approach, and sets @(rnum, rden)@ to the result in--- lowest terms. Assumes that the length of the polynomial is at least one.--- --- Aliasing between @(rnum, rden)@ and @(anum, aden)@ or any of the--- coefficients of \(f\) is not supported.-foreign import ccall "fmpz_poly.h _fmpz_poly_evaluate_divconquer_fmpq"- _fmpz_poly_evaluate_divconquer_fmpq :: Ptr CFmpz -> Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> Ptr CFmpz -> IO ()---- | /fmpz_poly_evaluate_divconquer_fmpq/ /res/ /f/ /a/ --- --- Evaluates the polynomial \(f\) at the rational \(a\) using a divide and--- conquer approach, and sets @res@ to the result.-foreign import ccall "fmpz_poly.h fmpz_poly_evaluate_divconquer_fmpq"- fmpz_poly_evaluate_divconquer_fmpq :: Ptr CFmpq -> Ptr CFmpzPoly -> Ptr CFmpq -> IO ()---- | /_fmpz_poly_evaluate_horner_fmpq/ /rnum/ /rden/ /f/ /len/ /anum/ /aden/ --- --- Evaluates the polynomial @(f, len)@ at the rational @(anum, aden)@ using--- Horner\'s rule, and sets @(rnum, rden)@ to the result in lowest terms.--- --- Aliasing between @(rnum, rden)@ and @(anum, aden)@ or any of the--- coefficients of \(f\) is not supported.-foreign import ccall "fmpz_poly.h _fmpz_poly_evaluate_horner_fmpq"- _fmpz_poly_evaluate_horner_fmpq :: Ptr CFmpz -> Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> Ptr CFmpz -> IO ()---- | /fmpz_poly_evaluate_horner_fmpq/ /res/ /f/ /a/ --- --- Evaluates the polynomial \(f\) at the rational \(a\) using Horner\'s--- rule, and sets @res@ to the result.-foreign import ccall "fmpz_poly.h fmpz_poly_evaluate_horner_fmpq"- fmpz_poly_evaluate_horner_fmpq :: Ptr CFmpq -> Ptr CFmpzPoly -> Ptr CFmpq -> IO ()---- | /_fmpz_poly_evaluate_fmpq/ /rnum/ /rden/ /f/ /len/ /anum/ /aden/ --- --- Evaluates the polynomial @(f, len)@ at the rational @(anum, aden)@ and--- sets @(rnum, rden)@ to the result in lowest terms.--- --- Aliasing between @(rnum, rden)@ and @(anum, aden)@ or any of the--- coefficients of \(f\) is not supported.-foreign import ccall "fmpz_poly.h _fmpz_poly_evaluate_fmpq"- _fmpz_poly_evaluate_fmpq :: Ptr CFmpz -> Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> Ptr CFmpz -> IO ()---- | /fmpz_poly_evaluate_fmpq/ /res/ /f/ /a/ --- --- Evaluates the polynomial \(f\) at the rational \(a\), and sets @res@ to--- the result.-foreign import ccall "fmpz_poly.h fmpz_poly_evaluate_fmpq"- fmpz_poly_evaluate_fmpq :: Ptr CFmpq -> Ptr CFmpzPoly -> Ptr CFmpq -> IO ()---- -- | /fmpz_poly_evaluate_mpq/ /res/ /f/ /a/ --- -- --- -- Evaluates the polynomial \(f\) at the rational \(a\) and sets @res@ to--- -- the result.--- foreign import ccall "fmpz_poly.h fmpz_poly_evaluate_mpq"--- fmpz_poly_evaluate_mpq :: Ptr CMpq -> Ptr CFmpzPoly -> Ptr CMpq -> IO ()---- | /_fmpz_poly_evaluate_mod/ /poly/ /len/ /a/ /n/ /ninv/ --- --- Evaluates @(poly, len)@ at the value \(a\) modulo \(n\) and returns the--- result. The last argument @ninv@ must be set to the precomputed inverse--- of \(n\), which can be obtained using the function @n_preinvert_limb@.-foreign import ccall "fmpz_poly.h _fmpz_poly_evaluate_mod"- _fmpz_poly_evaluate_mod :: Ptr CFmpz -> CLong -> CMpLimb -> CMpLimb -> CMpLimb -> IO CMpLimb---- | /fmpz_poly_evaluate_mod/ /poly/ /a/ /n/ --- --- Evaluates @poly@ at the value \(a\) modulo \(n\) and returns the result.-foreign import ccall "fmpz_poly.h fmpz_poly_evaluate_mod"- fmpz_poly_evaluate_mod :: Ptr CFmpzPoly -> CMpLimb -> CMpLimb -> IO CMpLimb---- | /fmpz_poly_evaluate_fmpz_vec/ /res/ /f/ /a/ /n/ --- --- Evaluates @f@ at the \(n\) values given in the vector @f@, writing the--- results to @res@.-foreign import ccall "fmpz_poly.h fmpz_poly_evaluate_fmpz_vec"- fmpz_poly_evaluate_fmpz_vec :: Ptr CFmpz -> Ptr CFmpzPoly -> Ptr CFmpz -> CLong -> IO ()---- | /_fmpz_poly_evaluate_horner_d/ /poly/ /n/ /d/ --- --- Evaluate @(poly, n)@ at the double \(d\). No attempt is made to do this--- efficiently or in a numerically stable way. It is currently only used in--- Flint for quick and dirty evaluations of polynomials with all--- coefficients positive.-foreign import ccall "fmpz_poly.h _fmpz_poly_evaluate_horner_d"- _fmpz_poly_evaluate_horner_d :: Ptr CFmpz -> CLong -> CDouble -> IO CDouble---- | /fmpz_poly_evaluate_horner_d/ /poly/ /d/ --- --- Evaluate @poly@ at the double \(d\). No attempt is made to do this--- efficiently or in a numerically stable way. It is currently only used in--- Flint for quick and dirty evaluations of polynomials with all--- coefficients positive.-foreign import ccall "fmpz_poly.h fmpz_poly_evaluate_horner_d"- fmpz_poly_evaluate_horner_d :: Ptr CFmpzPoly -> CDouble -> IO CDouble---- | /_fmpz_poly_evaluate_horner_d_2exp/ /exp/ /poly/ /n/ /d/ --- --- Evaluate @(poly, n)@ at the double \(d\). Return the result as a double--- and an exponent @exp@ combination. No attempt is made to do this--- efficiently or in a numerically stable way. It is currently only used in--- Flint for quick and dirty evaluations of polynomials with all--- coefficients positive.-foreign import ccall "fmpz_poly.h _fmpz_poly_evaluate_horner_d_2exp"- _fmpz_poly_evaluate_horner_d_2exp :: Ptr CLong -> Ptr CFmpz -> CLong -> CDouble -> IO CDouble---- | /fmpz_poly_evaluate_horner_d_2exp/ /exp/ /poly/ /d/ --- --- Evaluate @poly@ at the double \(d\). Return the result as a double and--- an exponent @exp@ combination. No attempt is made to do this efficiently--- or in a numerically stable way. It is currently only used in Flint for--- quick and dirty evaluations of polynomials with all coefficients--- positive.-foreign import ccall "fmpz_poly.h fmpz_poly_evaluate_horner_d_2exp"- fmpz_poly_evaluate_horner_d_2exp :: Ptr CLong -> Ptr CFmpzPoly -> CDouble -> IO CDouble---- | /_fmpz_poly_evaluate_horner_d_2exp2/ /exp/ /poly/ /n/ /d/ /dexp/ --- --- Evaluate @poly@ at @d*2^dexp@. Return the result as a double and an--- exponent @exp@ combination. No attempt is made to do this efficiently or--- in a numerically stable way. It is currently only used in Flint for--- quick and dirty evaluations of polynomials with all coefficients--- positive.-foreign import ccall "fmpz_poly.h _fmpz_poly_evaluate_horner_d_2exp2"- _fmpz_poly_evaluate_horner_d_2exp2 :: Ptr CLong -> Ptr CFmpz -> CLong -> CDouble -> CLong -> IO CDouble---- Newton basis -------------------------------------------------------------------- | /_fmpz_poly_monomial_to_newton/ /poly/ /roots/ /n/ --- --- Converts @(poly, n)@ in-place from its coefficients given in the--- standard monomial basis to the Newton basis for the roots--- \(r_0, r_1, \ldots, r_{n-2}\). In other words, this determines output--- coefficients \(c_i\) such that--- \(c_0 + c_1(x-r_0) + c_2(x-r_0)(x-r_1) + \ldots + c_{n-1}(x-r_0)(x-r_1)\cdots(x-r_{n-2})\)--- is equal to the input polynomial. Uses repeated polynomial division.-foreign import ccall "fmpz_poly.h _fmpz_poly_monomial_to_newton"- _fmpz_poly_monomial_to_newton :: Ptr CFmpz -> Ptr CFmpz -> CLong -> IO ()---- | /_fmpz_poly_newton_to_monomial/ /poly/ /roots/ /n/ --- --- Converts @(poly, n)@ in-place from its coefficients given in the Newton--- basis for the roots \(r_0, r_1, \ldots, r_{n-2}\) to the standard--- monomial basis. In other words, this evaluates--- \(c_0 + c_1(x-r_0) + c_2(x-r_0)(x-r_1) + \ldots + c_{n-1}(x-r_0)(x-r_1)\cdots(x-r_{n-2})\)--- where \(c_i\) are the input coefficients for @poly@. Uses Horner\'s--- rule.-foreign import ccall "fmpz_poly.h _fmpz_poly_newton_to_monomial"- _fmpz_poly_newton_to_monomial :: Ptr CFmpz -> Ptr CFmpz -> CLong -> IO ()---- Interpolation ------------------------------------------------------------------- | /fmpz_poly_interpolate_fmpz_vec/ /poly/ /xs/ /ys/ /n/ --- --- Sets @poly@ to the unique interpolating polynomial of degree at most--- \(n - 1\) satisfying \(f(x_i) = y_i\) for every pair \(x_i, y_u\) in--- @xs@ and @ys@, assuming that this polynomial has integer coefficients.--- --- If an interpolating polynomial with integer coefficients does not exist,--- a @FLINT_INEXACT@ exception is thrown.--- --- It is assumed that the \(x\) values are distinct.-foreign import ccall "fmpz_poly.h fmpz_poly_interpolate_fmpz_vec"- fmpz_poly_interpolate_fmpz_vec :: Ptr CFmpzPoly -> Ptr CFmpz -> Ptr CFmpz -> CLong -> IO ()---- Composition --------------------------------------------------------------------- | /_fmpz_poly_compose_horner/ /res/ /poly1/ /len1/ /poly2/ /len2/ --- --- Sets @res@ to the composition of @(poly1, len1)@ and @(poly2, len2)@.--- --- Assumes that @res@ has space for @(len1-1)*(len2-1) + 1@ coefficients.--- Assumes that @poly1@ and @poly2@ are non-zero polynomials. Does not--- support aliasing between any of the inputs and the output.-foreign import ccall "fmpz_poly.h _fmpz_poly_compose_horner"- _fmpz_poly_compose_horner :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> IO ()---- | /fmpz_poly_compose_horner/ /res/ /poly1/ /poly2/ --- --- Sets @res@ to the composition of @poly1@ and @poly2@. To be more--- precise, denoting @res@, @poly1@, and @poly2@ by \(f\), \(g\), and--- \(h\), sets \(f(t) = g(h(t))\).--- --- This implementation uses Horner\'s method.-foreign import ccall "fmpz_poly.h fmpz_poly_compose_horner"- fmpz_poly_compose_horner :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()---- | /_fmpz_poly_compose_divconquer/ /res/ /poly1/ /len1/ /poly2/ /len2/ --- --- Computes the composition of @(poly1, len1)@ and @(poly2, len2)@ using a--- divide and conquer approach and places the result into @res@, assuming--- @res@ can hold the output of length @(len1 - 1) * (len2 - 1) + 1@.--- --- Assumes @len1, len2 > 0@. Does not support aliasing between @res@ and--- any of @(poly1, len1)@ and @(poly2, len2)@.-foreign import ccall "fmpz_poly.h _fmpz_poly_compose_divconquer"- _fmpz_poly_compose_divconquer :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> IO ()---- | /fmpz_poly_compose_divconquer/ /res/ /poly1/ /poly2/ --- --- Sets @res@ to the composition of @poly1@ and @poly2@. To be precise--- about the order of composition, denoting @res@, @poly1@, and @poly2@ by--- \(f\), \(g\), and \(h\), respectively, sets \(f(t) = g(h(t))\).-foreign import ccall "fmpz_poly.h fmpz_poly_compose_divconquer"- fmpz_poly_compose_divconquer :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()---- | /_fmpz_poly_compose/ /res/ /poly1/ /len1/ /poly2/ /len2/ --- --- Sets @res@ to the composition of @(poly1, len1)@ and @(poly2, len2)@.--- --- Assumes that @res@ has space for @(len1-1)*(len2-1) + 1@ coefficients.--- Assumes that @poly1@ and @poly2@ are non-zero polynomials. Does not--- support aliasing between any of the inputs and the output.-foreign import ccall "fmpz_poly.h _fmpz_poly_compose"- _fmpz_poly_compose :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> IO ()---- | /fmpz_poly_compose/ /res/ /poly1/ /poly2/ --- --- Sets @res@ to the composition of @poly1@ and @poly2@. To be precise--- about the order of composition, denoting @res@, @poly1@, and @poly2@ by--- \(f\), \(g\), and \(h\), respectively, sets \(f(t) = g(h(t))\).-foreign import ccall "fmpz_poly.h fmpz_poly_compose"- fmpz_poly_compose :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()---- Inflation and deflation --------------------------------------------------------- | /fmpz_poly_inflate/ /result/ /input/ /inflation/ --- --- Sets @result@ to the inflated polynomial \(p(x^n)\) where \(p\) is given--- by @input@ and \(n\) is given by @inflation@.-foreign import ccall "fmpz_poly.h fmpz_poly_inflate"- fmpz_poly_inflate :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CULong -> IO ()---- | /fmpz_poly_deflate/ /result/ /input/ /deflation/ --- --- Sets @result@ to the deflated polynomial \(p(x^{1/n})\) where \(p\) is--- given by @input@ and \(n\) is given by @deflation@. Requires \(n > 0\).-foreign import ccall "fmpz_poly.h fmpz_poly_deflate"- fmpz_poly_deflate :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CULong -> IO ()---- | /fmpz_poly_deflation/ /input/ --- --- Returns the largest integer by which @input@ can be deflated. As special--- cases, returns 0 if @input@ is the zero polynomial and 1 of @input@ is a--- constant polynomial.-foreign import ccall "fmpz_poly.h fmpz_poly_deflation"- fmpz_poly_deflation :: Ptr CFmpzPoly -> IO CULong---- Taylor shift -------------------------------------------------------------------- | /_fmpz_poly_taylor_shift_horner/ /poly/ /c/ /n/ --- --- Performs the Taylor shift composing @poly@ by \(x+c\) in-place. Uses an--- efficient version Horner\'s rule.-foreign import ccall "fmpz_poly.h _fmpz_poly_taylor_shift_horner"- _fmpz_poly_taylor_shift_horner :: Ptr CFmpz -> Ptr CFmpz -> CLong -> IO ()---- | /fmpz_poly_taylor_shift_horner/ /g/ /f/ /c/ --- --- Performs the Taylor shift composing @f@ by \(x+c\).-foreign import ccall "fmpz_poly.h fmpz_poly_taylor_shift_horner"- fmpz_poly_taylor_shift_horner :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpz -> IO ()---- | /_fmpz_poly_taylor_shift_divconquer/ /poly/ /c/ /n/ --- --- Performs the Taylor shift composing @poly@ by \(x+c\) in-place. Uses the--- divide-and-conquer polynomial composition algorithm.-foreign import ccall "fmpz_poly.h _fmpz_poly_taylor_shift_divconquer"- _fmpz_poly_taylor_shift_divconquer :: Ptr CFmpz -> Ptr CFmpz -> CLong -> IO ()---- | /fmpz_poly_taylor_shift_divconquer/ /g/ /f/ /c/ --- --- Performs the Taylor shift composing @f@ by \(x+c\). Uses the--- divide-and-conquer polynomial composition algorithm.-foreign import ccall "fmpz_poly.h fmpz_poly_taylor_shift_divconquer"- fmpz_poly_taylor_shift_divconquer :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpz -> IO ()---- | /_fmpz_poly_taylor_shift_multi_mod/ /poly/ /c/ /n/ --- --- Performs the Taylor shift composing @poly@ by \(x+c\) in-place. Uses a--- multimodular algorithm, distributing the computation across--- @flint_get_num_threads@ threads.-foreign import ccall "fmpz_poly.h _fmpz_poly_taylor_shift_multi_mod"- _fmpz_poly_taylor_shift_multi_mod :: Ptr CFmpz -> Ptr CFmpz -> CLong -> IO ()---- | /fmpz_poly_taylor_shift_multi_mod/ /g/ /f/ /c/ --- --- Performs the Taylor shift composing @f@ by \(x+c\). Uses a multimodular--- algorithm, distributing the computation across @flint_get_num_threads@--- threads.-foreign import ccall "fmpz_poly.h fmpz_poly_taylor_shift_multi_mod"- fmpz_poly_taylor_shift_multi_mod :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpz -> IO ()---- | /_fmpz_poly_taylor_shift/ /poly/ /c/ /n/ --- --- Performs the Taylor shift composing @poly@ by \(x+c\) in-place.-foreign import ccall "fmpz_poly.h _fmpz_poly_taylor_shift"- _fmpz_poly_taylor_shift :: Ptr CFmpz -> Ptr CFmpz -> CLong -> IO ()---- | /fmpz_poly_taylor_shift/ /g/ /f/ /c/ --- --- Performs the Taylor shift composing @f@ by \(x+c\).-foreign import ccall "fmpz_poly.h fmpz_poly_taylor_shift"- fmpz_poly_taylor_shift :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpz -> IO ()---- Power series composition -------------------------------------------------------- | /_fmpz_poly_compose_series_horner/ /res/ /poly1/ /len1/ /poly2/ /len2/ /n/ --- --- Sets @res@ to the composition of @poly1@ and @poly2@ modulo \(x^n\),--- where the constant term of @poly2@ is required to be zero.--- --- Assumes that @len1, len2, n > 0@, that @len1, len2 \<= n@, and that--- @(len1-1) * (len2-1) + 1 \<= n@, and that @res@ has space for @n@--- coefficients. Does not support aliasing between any of the inputs and--- the output.--- --- This implementation uses the Horner scheme.-foreign import ccall "fmpz_poly.h _fmpz_poly_compose_series_horner"- _fmpz_poly_compose_series_horner :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> CLong -> IO ()---- | /fmpz_poly_compose_series_horner/ /res/ /poly1/ /poly2/ /n/ --- --- Sets @res@ to the composition of @poly1@ and @poly2@ modulo \(x^n\),--- where the constant term of @poly2@ is required to be zero.--- --- This implementation uses the Horner scheme.-foreign import ccall "fmpz_poly.h fmpz_poly_compose_series_horner"- fmpz_poly_compose_series_horner :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()---- | /_fmpz_poly_compose_series_brent_kung/ /res/ /poly1/ /len1/ /poly2/ /len2/ /n/ --- --- Sets @res@ to the composition of @poly1@ and @poly2@ modulo \(x^n\),--- where the constant term of @poly2@ is required to be zero.--- --- Assumes that @len1, len2, n > 0@, that @len1, len2 \<= n@, and that--- @(len1-1) * (len2-1) + 1 \<= n@, and that @res@ has space for @n@--- coefficients. Does not support aliasing between any of the inputs and--- the output.--- --- This implementation uses Brent-Kung algorithm 2.1 < [BrentKung1978]>.-foreign import ccall "fmpz_poly.h _fmpz_poly_compose_series_brent_kung"- _fmpz_poly_compose_series_brent_kung :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> CLong -> IO ()---- | /fmpz_poly_compose_series_brent_kung/ /res/ /poly1/ /poly2/ /n/ --- --- Sets @res@ to the composition of @poly1@ and @poly2@ modulo \(x^n\),--- where the constant term of @poly2@ is required to be zero.--- --- This implementation uses Brent-Kung algorithm 2.1 < [BrentKung1978]>.-foreign import ccall "fmpz_poly.h fmpz_poly_compose_series_brent_kung"- fmpz_poly_compose_series_brent_kung :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()---- | /_fmpz_poly_compose_series/ /res/ /poly1/ /len1/ /poly2/ /len2/ /n/ --- --- Sets @res@ to the composition of @poly1@ and @poly2@ modulo \(x^n\),--- where the constant term of @poly2@ is required to be zero.--- --- Assumes that @len1, len2, n > 0@, that @len1, len2 \<= n@, and that--- @(len1-1) * (len2-1) + 1 \<= n@, and that @res@ has space for @n@--- coefficients. Does not support aliasing between any of the inputs and--- the output.--- --- This implementation automatically switches between the Horner scheme and--- Brent-Kung algorithm 2.1 depending on the size of the inputs.-foreign import ccall "fmpz_poly.h _fmpz_poly_compose_series"- _fmpz_poly_compose_series :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> CLong -> IO ()---- | /fmpz_poly_compose_series/ /res/ /poly1/ /poly2/ /n/ --- --- Sets @res@ to the composition of @poly1@ and @poly2@ modulo \(x^n\),--- where the constant term of @poly2@ is required to be zero.--- --- This implementation automatically switches between the Horner scheme and--- Brent-Kung algorithm 2.1 depending on the size of the inputs.-foreign import ccall "fmpz_poly.h fmpz_poly_compose_series"- fmpz_poly_compose_series :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()---- Power series reversion ---------------------------------------------------------- | /_fmpz_poly_revert_series_lagrange/ /Qinv/ /Q/ /Qlen/ /n/ --- --- Sets @Qinv@ to the compositional inverse or reversion of @(Q, Qlen)@ as--- a power series, i.e. computes \(Q^{-1}\) such that--- \(Q(Q^{-1}(x)) = Q^{-1}(Q(x)) = x \bmod x^n\). The arguments may not be--- aliased, and @Qlen@ must be at least 2. It is required that \(Q_0 = 0\)--- and \(Q_1 = \pm 1\).--- --- This implementation uses the Lagrange inversion formula.-foreign import ccall "fmpz_poly.h _fmpz_poly_revert_series_lagrange"- _fmpz_poly_revert_series_lagrange :: Ptr CFmpz -> Ptr CFmpz -> CLong -> CLong -> IO ()---- | /fmpz_poly_revert_series_lagrange/ /Qinv/ /Q/ /n/ --- --- Sets @Qinv@ to the compositional inverse or reversion of @Q@ as a power--- series, i.e. computes \(Q^{-1}\) such that--- \(Q(Q^{-1}(x)) = Q^{-1}(Q(x)) = x \bmod x^n\). It is required that--- \(Q_0 = 0\) and \(Q_1 = \pm 1\).--- --- This implementation uses the Lagrange inversion formula.-foreign import ccall "fmpz_poly.h fmpz_poly_revert_series_lagrange"- fmpz_poly_revert_series_lagrange :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()---- | /_fmpz_poly_revert_series_lagrange_fast/ /Qinv/ /Q/ /Qlen/ /n/ --- --- Sets @Qinv@ to the compositional inverse or reversion of @(Q, Qlen)@ as--- a power series, i.e. computes \(Q^{-1}\) such that--- \(Q(Q^{-1}(x)) = Q^{-1}(Q(x)) = x \bmod x^n\). The arguments may not be--- aliased, and @Qlen@ must be at least 2. It is required that \(Q_0 = 0\)--- and \(Q_1 = \pm 1\).--- --- This implementation uses a reduced-complexity implementation of the--- Lagrange inversion formula.-foreign import ccall "fmpz_poly.h _fmpz_poly_revert_series_lagrange_fast"- _fmpz_poly_revert_series_lagrange_fast :: Ptr CFmpz -> Ptr CFmpz -> CLong -> CLong -> IO ()---- | /fmpz_poly_revert_series_lagrange_fast/ /Qinv/ /Q/ /n/ --- --- Sets @Qinv@ to the compositional inverse or reversion of @Q@ as a power--- series, i.e. computes \(Q^{-1}\) such that--- \(Q(Q^{-1}(x)) = Q^{-1}(Q(x)) = x \bmod x^n\). It is required that--- \(Q_0 = 0\) and \(Q_1 = \pm 1\).--- --- This implementation uses a reduced-complexity implementation of the--- Lagrange inversion formula.-foreign import ccall "fmpz_poly.h fmpz_poly_revert_series_lagrange_fast"- fmpz_poly_revert_series_lagrange_fast :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()---- | /_fmpz_poly_revert_series_newton/ /Qinv/ /Q/ /Qlen/ /n/ --- --- Sets @Qinv@ to the compositional inverse or reversion of @Q@ as a power--- series, i.e. computes \(Q^{-1}\) such that--- \(Q(Q^{-1}(x)) = Q^{-1}(Q(x)) = x \bmod x^n\). The arguments may not be--- aliased, and @Qlen@ must be at least 2. It is required that \(Q_0 = 0\)--- and \(Q_1 = \pm 1\).--- --- This implementation uses Newton iteration < [BrentKung1978]>.-foreign import ccall "fmpz_poly.h _fmpz_poly_revert_series_newton"- _fmpz_poly_revert_series_newton :: Ptr CFmpz -> Ptr CFmpz -> CLong -> CLong -> IO ()---- | /fmpz_poly_revert_series_newton/ /Qinv/ /Q/ /n/ --- --- Sets @Qinv@ to the compositional inverse or reversion of @Q@ as a power--- series, i.e. computes \(Q^{-1}\) such that--- \(Q(Q^{-1}(x)) = Q^{-1}(Q(x)) = x \bmod x^n\). It is required that--- \(Q_0 = 0\) and \(Q_1 = \pm 1\).--- --- This implementation uses Newton iteration < [BrentKung1978]>.-foreign import ccall "fmpz_poly.h fmpz_poly_revert_series_newton"- fmpz_poly_revert_series_newton :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()---- | /_fmpz_poly_revert_series/ /Qinv/ /Q/ /Qlen/ /n/ --- --- Sets @Qinv@ to the compositional inverse or reversion of @Q@ as a power--- series, i.e. computes \(Q^{-1}\) such that--- \(Q(Q^{-1}(x)) = Q^{-1}(Q(x)) = x \bmod x^n\). The arguments may not be--- aliased, and @Qlen@ must be at least 2. It is required that \(Q_0 = 0\)--- and \(Q_1 = \pm 1\).--- --- This implementation defaults to the fast version of Lagrange--- interpolation.-foreign import ccall "fmpz_poly.h _fmpz_poly_revert_series"- _fmpz_poly_revert_series :: Ptr CFmpz -> Ptr CFmpz -> CLong -> CLong -> IO ()---- | /fmpz_poly_revert_series/ /Qinv/ /Q/ /n/ --- --- Sets @Qinv@ to the compositional inverse or reversion of @Q@ as a power--- series, i.e. computes \(Q^{-1}\) such that--- \(Q(Q^{-1}(x)) = Q^{-1}(Q(x)) = x \bmod x^n\). It is required that--- \(Q_0 = 0\) and \(Q_1 = \pm 1\).--- --- This implementation defaults to the fast version of Lagrange--- interpolation.-foreign import ccall "fmpz_poly.h fmpz_poly_revert_series"- fmpz_poly_revert_series :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()---- Square root --------------------------------------------------------------------- | /_fmpz_poly_sqrtrem_classical/ /res/ /r/ /poly/ /len/ --- --- Returns 1 if @(poly, len)@ can be written in the form \(A^2 + R\) where--- deg\`(R) \< deg(@\`poly@), otherwise returns \(0\). If it can be so--- written, @(res, m - 1)@ is set to \(A\) and @(res, m)@ is set to \(R\),--- where \(m =\) deg\`(@\`poly@)\/2 + 1.--- --- For efficiency reasons, @r@ must have room for @len@ coefficients, and--- may alias @poly@.-foreign import ccall "fmpz_poly.h _fmpz_poly_sqrtrem_classical"- _fmpz_poly_sqrtrem_classical :: Ptr CFmpz -> Ptr CFmpz -> Ptr CFmpz -> CLong -> IO CInt---- | /fmpz_poly_sqrtrem_classical/ /b/ /r/ /a/ --- --- If \(a\) can be written as \(b^2 + r\) with deg\`(r) \< deg(a)\/2\`,--- return \(1\) and set \(b\) and \(r\) appropriately. Otherwise return--- \(0\).-foreign import ccall "fmpz_poly.h fmpz_poly_sqrtrem_classical"- fmpz_poly_sqrtrem_classical :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO CInt---- | /_fmpz_poly_sqrtrem_divconquer/ /res/ /r/ /poly/ /len/ /temp/ --- --- Returns 1 if @(poly, len)@ can be written in the form \(A^2 + R\) where--- deg\`(R) \< deg(@\`poly@), otherwise returns \(0\). If it can be so--- written, @(res, m - 1)@ is set to \(A\) and @(res, m)@ is set to \(R\),--- where \(m =\) deg\`(@\`poly@)\/2 + 1.--- --- For efficiency reasons, @r@ must have room for @len@ coefficients, and--- may alias @poly@. Temporary space of @len@ coefficients is required.-foreign import ccall "fmpz_poly.h _fmpz_poly_sqrtrem_divconquer"- _fmpz_poly_sqrtrem_divconquer :: Ptr CFmpz -> Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> IO CInt---- | /fmpz_poly_sqrtrem_divconquer/ /b/ /r/ /a/ --- --- If \(a\) can be written as \(b^2 + r\) with deg\`(r) \< deg(a)\/2\`,--- return \(1\) and set \(b\) and \(r\) appropriately. Otherwise return--- \(0\).-foreign import ccall "fmpz_poly.h fmpz_poly_sqrtrem_divconquer"- fmpz_poly_sqrtrem_divconquer :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO CInt---- | /_fmpz_poly_sqrt_classical/ /res/ /poly/ /len/ /exact/ --- --- If @exact@ is \(1\) and @(poly, len)@ is a perfect square, sets--- @(res, len \/ 2 + 1)@ to the square root of @poly@ with positive leading--- coefficient and returns 1. Otherwise returns 0.--- --- If @exact@ is \(0\), allows a remainder after the square root, which is--- not computed.--- --- This function first uses various tests to detect nonsquares quickly.--- Then, it computes the square root iteratively from top to bottom,--- requiring \(O(n^2)\) coefficient operations.-foreign import ccall "fmpz_poly.h _fmpz_poly_sqrt_classical"- _fmpz_poly_sqrt_classical :: Ptr CFmpz -> Ptr CFmpz -> CLong -> CInt -> IO CInt---- | /fmpz_poly_sqrt_classical/ /b/ /a/ --- --- If @a@ is a perfect square, sets @b@ to the square root of @a@ with--- positive leading coefficient and returns 1. Otherwise returns 0.-foreign import ccall "fmpz_poly.h fmpz_poly_sqrt_classical"- fmpz_poly_sqrt_classical :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO CInt---- | /_fmpz_poly_sqrt_KS/ /res/ /poly/ /len/ --- --- Heuristic square root. If the return value is \(-1\), the function--- failed, otherwise it succeeded and the following applies.--- --- If @(poly, len)@ is a perfect square, sets @(res, len \/ 2 + 1)@ to the--- square root of @poly@ with positive leading coefficient and returns 1.--- Otherwise returns 0.--- --- This function first uses various tests to detect nonsquares quickly.--- Then, it computes the square root iteratively from top to bottom.-foreign import ccall "fmpz_poly.h _fmpz_poly_sqrt_KS"- _fmpz_poly_sqrt_KS :: Ptr CFmpz -> Ptr CFmpz -> CLong -> IO CInt---- | /fmpz_poly_sqrt_KS/ /b/ /a/ --- --- Heuristic square root. If the return value is \(-1\), the function--- failed, otherwise it succeeded and the following applies.--- --- If @a@ is a perfect square, sets @b@ to the square root of @a@ with--- positive leading coefficient and returns 1. Otherwise returns 0.-foreign import ccall "fmpz_poly.h fmpz_poly_sqrt_KS"- fmpz_poly_sqrt_KS :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO CInt---- | /_fmpz_poly_sqrt_divconquer/ /res/ /poly/ /len/ /exact/ --- --- If @exact@ is \(1\) and @(poly, len)@ is a perfect square, sets--- @(res, len \/ 2 + 1)@ to the square root of @poly@ with positive leading--- coefficient and returns 1. Otherwise returns 0.--- --- If @exact@ is \(0\), allows a remainder after the square root, which is--- not computed.--- --- This function first uses various tests to detect nonsquares quickly.--- Then, it computes the square root iteratively from top to bottom.-foreign import ccall "fmpz_poly.h _fmpz_poly_sqrt_divconquer"- _fmpz_poly_sqrt_divconquer :: Ptr CFmpz -> Ptr CFmpz -> CLong -> CInt -> IO CInt---- | /fmpz_poly_sqrt_divconquer/ /b/ /a/ --- --- If @a@ is a perfect square, sets @b@ to the square root of @a@ with--- positive leading coefficient and returns 1. Otherwise returns 0.-foreign import ccall "fmpz_poly.h fmpz_poly_sqrt_divconquer"- fmpz_poly_sqrt_divconquer :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO CInt---- | /_fmpz_poly_sqrt/ /res/ /poly/ /len/ --- --- If @(poly, len)@ is a perfect square, sets @(res, len \/ 2 + 1)@ to the--- square root of @poly@ with positive leading coefficient and returns 1.--- Otherwise returns 0.-foreign import ccall "fmpz_poly.h _fmpz_poly_sqrt"- _fmpz_poly_sqrt :: Ptr CFmpz -> Ptr CFmpz -> CLong -> IO CInt---- | /fmpz_poly_sqrt/ /b/ /a/ --- --- If @a@ is a perfect square, sets @b@ to the square root of @a@ with--- positive leading coefficient and returns 1. Otherwise returns 0.-foreign import ccall "fmpz_poly.h fmpz_poly_sqrt"- fmpz_poly_sqrt :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO CInt---- | /_fmpz_poly_sqrt_series/ /res/ /poly/ /len/ /n/ --- --- Set @(res, n)@ to the square root of the series @(poly, n)@, if it--- exists, and return \(1\), otherwise, return \(0\).--- --- If the valuation of @poly@ is not zero, @res@ is zero padded to make up--- for the fact that the square root may not be known to precision \(n\).-foreign import ccall "fmpz_poly.h _fmpz_poly_sqrt_series"- _fmpz_poly_sqrt_series :: Ptr CFmpz -> Ptr CFmpz -> CLong -> CLong -> IO CInt---- | /fmpz_poly_sqrt_series/ /b/ /a/ /n/ --- --- Set @b@ to the square root of the series @a@, where the latter is taken--- to be a series of precision \(n\). If such a square root exists, return--- \(1\), otherwise, return \(0\).--- --- Note that if the valuation of @a@ is not zero, @b@ will not have--- precision @n@. It is given only to the precision to which the square--- root can be computed.-foreign import ccall "fmpz_poly.h fmpz_poly_sqrt_series"- fmpz_poly_sqrt_series :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO CInt---- Power sums ---------------------------------------------------------------------- | /_fmpz_poly_power_sums_naive/ /res/ /poly/ /len/ /n/ --- --- Compute the (truncated) power sums series of the monic polynomial--- @(poly,len)@ up to length \(n\) using Newton identities.-foreign import ccall "fmpz_poly.h _fmpz_poly_power_sums_naive"- _fmpz_poly_power_sums_naive :: Ptr CFmpz -> Ptr CFmpz -> CLong -> CLong -> IO ()---- | /fmpz_poly_power_sums_naive/ /res/ /poly/ /n/ --- --- Compute the (truncated) power sum series of the monic polynomial @poly@--- up to length \(n\) using Newton identities.-foreign import ccall "fmpz_poly.h fmpz_poly_power_sums_naive"- fmpz_poly_power_sums_naive :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()---- | /fmpz_poly_power_sums/ /res/ /poly/ /n/ --- --- Compute the (truncated) power sums series of the monic polynomial @poly@--- up to length \(n\). That is the power series whose coefficient of degree--- \(i\) is the sum of the \(i\)-th power of all (complex) roots of the--- polynomial @poly@.-foreign import ccall "fmpz_poly.h fmpz_poly_power_sums"- fmpz_poly_power_sums :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()---- | /_fmpz_poly_power_sums_to_poly/ /res/ /poly/ /len/ --- --- Compute the (monic) polynomial given by its power sums series--- @(poly,len)@.-foreign import ccall "fmpz_poly.h _fmpz_poly_power_sums_to_poly"- _fmpz_poly_power_sums_to_poly :: Ptr CFmpz -> Ptr CFmpz -> CLong -> IO ()---- | /fmpz_poly_power_sums_to_poly/ /res/ /Q/ --- --- Compute the (monic) polynomial given its power sums series @(Q)@.-foreign import ccall "fmpz_poly.h fmpz_poly_power_sums_to_poly"- fmpz_poly_power_sums_to_poly :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()---- Signature ----------------------------------------------------------------------- | /_fmpz_poly_signature/ /r1/ /r2/ /poly/ /len/ --- --- Computes the signature \((r_1, r_2)\) of the polynomial @(poly, len)@.--- Assumes that the polynomial is squarefree over \(\mathbb{Q}\).-foreign import ccall "fmpz_poly.h _fmpz_poly_signature"- _fmpz_poly_signature :: Ptr CLong -> Ptr CLong -> Ptr CFmpz -> CLong -> IO ()---- | /fmpz_poly_signature/ /r1/ /r2/ /poly/ --- --- Computes the signature \((r_1, r_2)\) of the polynomial @poly@, which is--- assumed to be square-free over \(\mathbb{Q}\). The values of \(r_1\) and--- \(2 r_2\) are the number of real and complex roots of the polynomial,--- respectively. For convenience, the zero polynomial is allowed, in which--- case the output is \((0, 0)\).--- --- If the polynomial is not square-free, the behaviour is undefined and an--- exception may be raised.--- --- This function uses the algorithm described in [Algorithm--- 4.1.11]< [Coh1996]>.-foreign import ccall "fmpz_poly.h fmpz_poly_signature"- fmpz_poly_signature :: Ptr CLong -> Ptr CLong -> Ptr CFmpzPoly -> IO ()---- Hensel lifting ------------------------------------------------------------------ | /fmpz_poly_hensel_build_tree/ /link/ /v/ /w/ /fac/ --- --- Initialises and builds a Hensel tree consisting of two arrays \(v\),--- \(w\) of polynomials an array of links, called @link@.--- --- The caller supplies a set of \(r\) local factors (in the factor--- structure @fac@) of some polynomial \(F\) over \(\mathbf{Z}\). They also--- supply two arrays of initialised polynomials \(v\) and \(w\), each of--- length \(2r - 2\) and an array @link@, also of length \(2r - 2\).--- --- We will have five arrays: a \(v\) of @fmpz_poly_t@\'s and a \(V\) of--- @nmod_poly_t@\'s and also a \(w\) and a \(W\) and @link@. Here\'s the--- idea: we sort each leaf and node of a factor tree by degree, in fact--- choosing to multiply the two smallest factors, then the next two--- smallest (factors or products) etc.until a tree is made. The tree will--- be stored in the \(v\)\'s. The first two elements of \(v\) will be the--- smallest modular factors, the last two elements of \(v\) will multiply--- to form \(F\) itself. Since \(v\) will be rearranging the original--- factors we will need to be able to recover the original order. For this--- we use the array @link@ which has nonnegative even numbers and negative--- numbers. It is an array of @slong@\'s which aligns with \(V\) and \(v\)--- if @link@ has a negative number in spot \(j\) that means \(V_j\) is an--- original modular factor which has been lifted, if @link[j]@ is a--- nonnegative even number then \(V_j\) stores a product of the two entries--- at @V[link[j]]@ and @V[link[j]+1]@. \(W\) and \(w\) play the role of the--- extended GCD, at \(V_0\), \(V_2\), \(V_4\), etc.we have a new product,--- \(W_0\), \(W_2\), \(W_4\), etc.are the XGCD cofactors of the \(V\)\'s.--- For example, \(V_0 W_0 + V_1 W_1 \equiv 1 \pmod{p^{\ell}}\) for some--- \(\ell\). These will be lifted along with the entries in \(V\). It is--- not enough to just lift each factor, we have to lift the entire tree and--- the tree of XGCD cofactors.-foreign import ccall "fmpz_poly.h fmpz_poly_hensel_build_tree"- fmpz_poly_hensel_build_tree :: Ptr CLong -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CNModPolyFactor -> IO ()---- | /fmpz_poly_hensel_lift/ /G/ /H/ /A/ /B/ /f/ /g/ /h/ /a/ /b/ /p/ /p1/ --- --- This is the main Hensel lifting routine, which performs a Hensel step--- from polynomials mod \(p\) to polynomials mod \(P = p p_1\). One starts--- with polynomials \(f\), \(g\), \(h\) such that \(f = gh \pmod p\). The--- polynomials \(a\), \(b\) satisfy \(ag + bh = 1 \pmod p\).--- --- The lifting formulae are--- --- \[`\]--- \[G = \biggl( \bigl( \frac{f-gh}{p} \bigr) b \bmod g \biggr) p + g\]--- \[H = \biggl( \bigl( \frac{f-gh}{p} \bigr) a \bmod h \biggr) p + h\]--- \[B = \biggl( \bigl( \frac{1-aG-bH}{p} \bigr) b \bmod g \biggr) p + b\]--- \[A = \biggl( \bigl( \frac{1-aG-bH}{p} \bigr) a \bmod h \biggr) p + a\]--- --- Upon return we have \(A G + B H = 1 \pmod P\) and \(f = G H \pmod P\),--- where \(G = g \pmod p\) etc.--- --- We require that \(1 < p_1 \leq p\) and that the input polynomials--- \(f, g, h\) have degree at least \(1\) and that the input polynomials--- \(a\) and \(b\) are non-zero.--- --- The output arguments \(G, H, A, B\) may only be aliased with the input--- arguments \(g, h, a, b\), respectively.-foreign import ccall "fmpz_poly.h fmpz_poly_hensel_lift"- fmpz_poly_hensel_lift :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpz -> Ptr CFmpz -> IO ()---- | /fmpz_poly_hensel_lift_without_inverse/ /Gout/ /Hout/ /f/ /g/ /h/ /a/ /b/ /p/ /p1/ --- --- Given polynomials such that \(f = gh \pmod p\) and--- \(ag + bh = 1 \pmod p\), lifts only the factors \(g\) and \(h\) modulo--- \(P = p p_1\).--- --- See @fmpz_poly_hensel_lift@.-foreign import ccall "fmpz_poly.h fmpz_poly_hensel_lift_without_inverse"- fmpz_poly_hensel_lift_without_inverse :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpz -> Ptr CFmpz -> IO ()---- | /fmpz_poly_hensel_lift_only_inverse/ /Aout/ /Bout/ /G/ /H/ /a/ /b/ /p/ /p1/ --- --- Given polynomials such that \(f = gh \pmod p\) and--- \(ag + bh = 1 \pmod p\), lifts only the cofactors \(a\) and \(b\) modulo--- \(P = p p_1\).--- --- See @fmpz_poly_hensel_lift@.-foreign import ccall "fmpz_poly.h fmpz_poly_hensel_lift_only_inverse"- fmpz_poly_hensel_lift_only_inverse :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpz -> Ptr CFmpz -> IO ()---- | /fmpz_poly_hensel_lift_tree_recursive/ /link/ /v/ /w/ /f/ /j/ /inv/ /p0/ /p1/ --- --- Takes a current Hensel tree @(link, v, w)@ and a pair \((j,j+1)\) of--- entries in the tree and lifts the tree from mod \(p_0\) to mod--- \(P = p_0 p_1\), where \(1 < p_1 \leq p_0\).--- --- Set @inv@ to \(-1\) if restarting Hensel lifting, \(0\) if stopping and--- \(1\) otherwise.--- --- Here \(f = g h\) is the polynomial whose factors we are trying to lift.--- We will have that @v[j]@ is the product of @v[link[j]]@ and--- @v[link[j] + 1]@ as described above.--- --- Does support aliasing of \(f\) with one of the polynomials in the lists--- \(v\) and \(w\). But the polynomials in these two lists are not allowed--- to be aliases of each other.-foreign import ccall "fmpz_poly.h fmpz_poly_hensel_lift_tree_recursive"- fmpz_poly_hensel_lift_tree_recursive :: Ptr CLong -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> CLong -> Ptr CFmpz -> Ptr CFmpz -> IO ()---- | /fmpz_poly_hensel_lift_tree/ /link/ /v/ /w/ /f/ /r/ /p/ /e0/ /e1/ /inv/ --- --- Computes \(p_0 = p^{e_0}\) and \(p_1 = p^{e_1 - e_0}\) for a small prime--- \(p\) and \(P = p^{e_1}\).--- --- If we aim to lift to \(p^b\) then \(f\) is the polynomial whose factors--- we wish to lift, made monic mod \(p^b\). As usual, @(link, v, w)@ is an--- initialised tree.--- --- This starts the recursion on lifting the /product tree/ for lifting from--- \(p^{e_0}\) to \(p^{e_1}\). The value of @inv@ corresponds to that given--- for the function @fmpz_poly_hensel_lift_tree_recursive@. We set \(r\) to--- the number of local factors of \(f\).--- --- In terms of the notation, above \(P = p^{e_1}\), \(p_0 = p^{e_0}\) and--- \(p_1 = p^{e_1-e_0}\).--- --- Assumes that \(f\) is monic.--- --- Assumes that \(1 < p_1 \leq p_0\), that is, \(0 < e_1 \leq e_0\).-foreign import ccall "fmpz_poly.h fmpz_poly_hensel_lift_tree"- fmpz_poly_hensel_lift_tree :: Ptr CLong -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> Ptr CFmpz -> CLong -> CLong -> CLong -> IO ()---- | /_fmpz_poly_hensel_start_lift/ /lifted_fac/ /link/ /v/ /w/ /f/ /local_fac/ /N/ --- --- This function takes the local factors in @local_fac@ and Hensel lifts--- them until they are known mod \(p^N\), where \(N \geq 1\).--- --- These lifted factors will be stored (in the same ordering) in--- @lifted_fac@. It is assumed that @link@, @v@, and @w@ are initialized--- arrays @fmpz_poly_t@\'s with at least \(2*r - 2\) entries and that--- \(r \geq 2\). This is done outside of this function so that you can keep--- them for restarting Hensel lifting later. The product of local factors--- must be squarefree.--- --- The return value is an exponent which must be passed to the function--- @_fmpz_poly_hensel_continue_lift@ as @prev_exp@ if the Hensel lifting is--- to be resumed.--- --- Currently, supports the case when \(N = 1\) for convenience, although it--- is preferable in this case to simple iterate over the local factors and--- convert them to polynomials over \(\mathbf{Z}\).-foreign import ccall "fmpz_poly.h _fmpz_poly_hensel_start_lift"- _fmpz_poly_hensel_start_lift :: Ptr CFmpzPolyFactor -> Ptr CLong -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CNModPolyFactor -> CLong -> IO CLong---- | /_fmpz_poly_hensel_continue_lift/ /lifted_fac/ /link/ /v/ /w/ /f/ /prev/ /curr/ /N/ /p/ --- --- This function restarts a stopped Hensel lift.--- --- It lifts from @curr@ to \(N\). It also requires @prev@ (to lift the--- cofactors) given as the return value of the function--- @_fmpz_poly_hensel_start_lift@ or the function--- @_fmpz_poly_hensel_continue_lift@. The current lifted factors are--- supplied in @lifted_fac@ and upon return are updated there. As usual--- @link@, @v@, and @w@ describe the current Hensel tree, \(r\) is the--- number of local factors and \(p\) is the small prime modulo whose power--- we are lifting to. It is required that @curr@ be at least \(1\) and that--- @N > curr@.--- --- Currently, supports the case when @prev@ and @curr@ are equal.-foreign import ccall "fmpz_poly.h _fmpz_poly_hensel_continue_lift"- _fmpz_poly_hensel_continue_lift :: Ptr CFmpzPolyFactor -> Ptr CLong -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> CLong -> CLong -> Ptr CFmpz -> IO CLong---- | /fmpz_poly_hensel_lift_once/ /lifted_fac/ /f/ /local_fac/ /N/ --- --- This function does a Hensel lift.--- --- It lifts local factors stored in @local_fac@ of \(f\) to \(p^N\), where--- \(N \geq 2\). The lifted factors will be stored in @lifted_fac@. This--- lift cannot be restarted. This function is a convenience function--- intended for end users. The product of local factors must be squarefree.-foreign import ccall "fmpz_poly.h fmpz_poly_hensel_lift_once"- fmpz_poly_hensel_lift_once :: Ptr CFmpzPolyFactor -> Ptr CFmpzPoly -> Ptr CNModPolyFactor -> CLong -> IO ()---- Input and output ---------------------------------------------------------------- The functions in this section are not intended to be particularly fast.--- They are intended mainly as a debugging aid.------ For the string output functions there are two variants. The first uses a--- simple string representation of polynomials which prints only the length--- of the polynomial and the integer coefficients, whilst the latter--- variant, appended with @_pretty@, uses a more traditional string--- representation of polynomials which prints a variable name as part of--- the representation.------ The first string representation is given by a sequence of integers, in--- decimal notation, separated by white space. The first integer gives the--- length of the polynomial; the remaining integers are the coefficients.--- For example \(5x^3 - x + 1\) is represented by the string--- @\"4 1 -1 0 5\"@, and the zero polynomial is represented by @\"0\"@.--- The coefficients may be signed and arbitrary precision.------ The string representation of the functions appended by @_pretty@--- includes only the non-zero terms of the polynomial, starting with the--- one of highest degree. Each term starts with a coefficient, prepended--- with a sign, followed by the character @*@, followed by a variable name,--- which must be passed as a string parameter to the function, followed by--- a caret @^@ followed by a non-negative exponent.------ If the sign of the leading coefficient is positive, it is omitted. Also--- the exponents of the degree 1 and 0 terms are omitted, as is the--- variable and the @*@ character in the case of the degree 0 coefficient.--- If the coefficient is plus or minus one, the coefficient is omitted,--- except for the sign.------ Some examples of the @_pretty@ representation are:--------- | /_fmpz_poly_print/ /poly/ /len/ --- --- Prints the polynomial @(poly, len)@ to @stdout@.--- --- In case of success, returns a positive value. In case of failure,--- returns a non-positive value.-foreign import ccall "fmpz_poly.h _fmpz_poly_print"- _fmpz_poly_print :: Ptr CFmpz -> CLong -> IO CInt---- | /fmpz_poly_print/ /poly/ --- --- Prints the polynomial to @stdout@.--- --- In case of success, returns a positive value. In case of failure,--- returns a non-positive value.-fmpz_poly_print :: Ptr CFmpzPoly -> IO CInt-fmpz_poly_print poly = printCStr fmpz_poly_get_str poly---- | /_fmpz_poly_print_pretty/ /poly/ /len/ /x/ --- --- Prints the pretty representation of @(poly, len)@ to @stdout@, using the--- string @x@ to represent the indeterminate.--- --- In case of success, returns a positive value. In case of failure,--- returns a non-positive value.-foreign import ccall "fmpz_poly.h _fmpz_poly_print_pretty"- _fmpz_poly_print_pretty :: Ptr CFmpz -> CLong -> CString -> IO CInt---- | /fmpz_poly_print_pretty/ /poly/ /x/ --- --- Prints the pretty representation of @poly@ to @stdout@, using the string--- @x@ to represent the indeterminate.--- --- In case of success, returns a positive value. In case of failure,--- returns a non-positive value.-fmpz_poly_print_pretty poly var =- printCStr (flip fmpz_poly_get_str_pretty var) poly---- | /_fmpz_poly_fprint/ /file/ /poly/ /len/ --- --- Prints the polynomial @(poly, len)@ to the stream @file@.--- --- In case of success, returns a positive value. In case of failure,--- returns a non-positive value.-foreign import ccall "fmpz_poly.h _fmpz_poly_fprint"- _fmpz_poly_fprint :: Ptr CFile -> Ptr CFmpz -> CLong -> IO CInt---- | /fmpz_poly_fprint/ /file/ /poly/ --- --- Prints the polynomial to the stream @file@.--- --- In case of success, returns a positive value. In case of failure,--- returns a non-positive value.-foreign import ccall "fmpz_poly.h fmpz_poly_fprint"- fmpz_poly_fprint :: Ptr CFile -> Ptr CFmpzPoly -> IO CInt---- | /_fmpz_poly_fprint_pretty/ /file/ /poly/ /len/ /x/ --- --- Prints the pretty representation of @(poly, len)@ to the stream @file@,--- using the string @x@ to represent the indeterminate.--- --- In case of success, returns a positive value. In case of failure,--- returns a non-positive value.-foreign import ccall "fmpz_poly.h _fmpz_poly_fprint_pretty"- _fmpz_poly_fprint_pretty :: Ptr CFile -> Ptr CFmpz -> CLong -> CString -> IO CInt---- | /fmpz_poly_fprint_pretty/ /file/ /poly/ /x/ --- --- Prints the pretty representation of @poly@ to the stream @file@, using--- the string @x@ to represent the indeterminate.--- --- In case of success, returns a positive value. In case of failure,--- returns a non-positive value.-foreign import ccall "fmpz_poly.h fmpz_poly_fprint_pretty"- fmpz_poly_fprint_pretty :: Ptr CFile -> Ptr CFmpzPoly -> CString -> IO CInt---- | /fmpz_poly_read/ /poly/ --- --- Reads a polynomial from @stdin@, storing the result in @poly@.--- --- In case of success, returns a positive number. In case of failure,--- returns a non-positive value.-foreign import ccall "fmpz_poly.h fmpz_poly_read"- fmpz_poly_read :: Ptr CFmpzPoly -> IO CInt---- | /fmpz_poly_read_pretty/ /poly/ /x/ --- --- Reads a polynomial in pretty format from @stdin@.--- --- For further details, see the documentation for the function--- @fmpz_poly_fread_pretty@.-foreign import ccall "fmpz_poly.h fmpz_poly_read_pretty"- fmpz_poly_read_pretty :: Ptr CFmpzPoly -> Ptr (Ptr CChar) -> IO CInt---- | /fmpz_poly_fread/ /file/ /poly/ --- --- Reads a polynomial from the stream @file@, storing the result in @poly@.--- --- In case of success, returns a positive number. In case of failure,--- returns a non-positive value.-foreign import ccall "fmpz_poly.h fmpz_poly_fread"- fmpz_poly_fread :: Ptr CFile -> Ptr CFmpzPoly -> IO CInt---- | /fmpz_poly_fread_pretty/ /file/ /poly/ /x/ --- --- Reads a polynomial from the file @file@ and sets @poly@ to this--- polynomial. The string @*x@ is set to the variable name that is used in--- the input.--- --- Returns a positive value, equal to the number of characters read from--- the file, in case of success. Returns a non-positive value in case of--- failure, which could either be a read error or the indicator of a--- malformed input.-foreign import ccall "fmpz_poly.h fmpz_poly_fread_pretty"- fmpz_poly_fread_pretty :: Ptr CFile -> Ptr CFmpzPoly -> Ptr (Ptr CChar) -> IO CInt---- Modular reduction and reconstruction -------------------------------------------- | /fmpz_poly_get_nmod_poly/ /Amod/ /A/ --- --- Sets the coefficients of @Amod@ to the coefficients in @A@, reduced by--- the modulus of @Amod@.-foreign import ccall "fmpz_poly.h fmpz_poly_get_nmod_poly"- fmpz_poly_get_nmod_poly :: Ptr CNModPoly -> Ptr CFmpzPoly -> IO ()---- | /fmpz_poly_set_nmod_poly/ /A/ /Amod/ --- --- Sets the coefficients of @A@ to the residues in @Amod@, normalised to--- the interval \(-m/2 \le r < m/2\) where \(m\) is the modulus.-foreign import ccall "fmpz_poly.h fmpz_poly_set_nmod_poly"- fmpz_poly_set_nmod_poly :: Ptr CFmpzPoly -> Ptr CNModPoly -> IO ()---- | /fmpz_poly_set_nmod_poly_unsigned/ /A/ /Amod/ --- --- Sets the coefficients of @A@ to the residues in @Amod@, normalised to--- the interval \(0 \le r < m\) where \(m\) is the modulus.-foreign import ccall "fmpz_poly.h fmpz_poly_set_nmod_poly_unsigned"- fmpz_poly_set_nmod_poly_unsigned :: Ptr CFmpzPoly -> Ptr CNModPoly -> IO ()---- | /_fmpz_poly_CRT_ui_precomp/ /res/ /poly1/ /len1/ /m1/ /poly2/ /len2/ /m2/ /m2inv/ /m1m2/ /c/ /sign/ --- --- Sets the coefficients in @res@ to the CRT reconstruction modulo--- \(m_1m_2\) of the residues @(poly1, len1)@ and @(poly2, len2)@ which are--- images modulo \(m_1\) and \(m_2\) respectively. The caller must supply--- the precomputed product of the input moduli as \(m_1m_2\), the inverse--- of \(m_1\) modulo \(m_2\) as \(c\), and the precomputed inverse of--- \(m_2\) (in the form computed by @n_preinvert_limb@) as @m2inv@.--- --- If @sign@ = 0, residues \(0 <= r < m_1 m_2\) are computed, while if--- @sign@ = 1, residues \(-m_1 m_2/2 <= r < m_1 m_2/2\) are computed.--- --- Coefficients of @res@ are written up to the maximum of @len1@ and--- @len2@.-foreign import ccall "fmpz_poly.h _fmpz_poly_CRT_ui_precomp"- _fmpz_poly_CRT_ui_precomp :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> Ptr CMp -> CLong -> CMpLimb -> CMpLimb -> Ptr CFmpz -> CMpLimb -> CInt -> IO ()---- | /_fmpz_poly_CRT_ui/ /res/ /poly1/ /len1/ /m1/ /poly2/ /len2/ /m2/ /m2inv/ /sign/ --- --- This function is identical to @_fmpz_poly_CRT_ui_precomp@, apart from--- automatically computing \(m_1m_2\) and \(c\). It also aborts if \(c\)--- cannot be computed.-foreign import ccall "fmpz_poly.h _fmpz_poly_CRT_ui"- _fmpz_poly_CRT_ui :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> Ptr CMp -> CLong -> CMpLimb -> CMpLimb -> CInt -> IO ()---- | /fmpz_poly_CRT_ui/ /res/ /poly1/ /m/ /poly2/ /sign/ --- --- Given @poly1@ with coefficients modulo @m@ and @poly2@ with modulus--- \(n\), sets @res@ to the CRT reconstruction modulo \(mn\) with--- coefficients satisfying \(-mn/2 \le c < mn/2\) (if sign = 1) or--- \(0 \le c < mn\) (if sign = 0).-foreign import ccall "fmpz_poly.h fmpz_poly_CRT_ui"- fmpz_poly_CRT_ui :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpz -> Ptr CNModPoly -> CInt -> IO ()---- Products ------------------------------------------------------------------------ | /_fmpz_poly_product_roots_fmpz_vec/ /poly/ /xs/ /n/ --- --- Sets @(poly, n + 1)@ to the monic polynomial which is the product of--- \((x - x_0)(x - x_1) \cdots (x - x_{n-1})\), the roots \(x_i\) being--- given by @xs@.--- --- Aliasing of the input and output is not allowed.-foreign import ccall "fmpz_poly.h _fmpz_poly_product_roots_fmpz_vec"- _fmpz_poly_product_roots_fmpz_vec :: Ptr CFmpz -> Ptr CFmpz -> CLong -> IO ()---- | /fmpz_poly_product_roots_fmpz_vec/ /poly/ /xs/ /n/ --- --- Sets @poly@ to the monic polynomial which is the product of--- \((x - x_0)(x - x_1) \cdots (x - x_{n-1})\), the roots \(x_i\) being--- given by @xs@.-foreign import ccall "fmpz_poly.h fmpz_poly_product_roots_fmpz_vec"- fmpz_poly_product_roots_fmpz_vec :: Ptr CFmpzPoly -> Ptr CFmpz -> CLong -> IO ()---- | /_fmpz_poly_product_roots_fmpq_vec/ /poly/ /xs/ /n/ --- --- Sets @(poly, n + 1)@ to the product of--- \((q_0 x - p_0)(q_1 x - p_1) \cdots (q_{n-1} x - p_{n-1})\), the roots--- \(p_i/q_i\) being given by @xs@.-foreign import ccall "fmpz_poly.h _fmpz_poly_product_roots_fmpq_vec"- _fmpz_poly_product_roots_fmpq_vec :: Ptr CFmpz -> Ptr CFmpq -> CLong -> IO ()---- | /fmpz_poly_product_roots_fmpq_vec/ /poly/ /xs/ /n/ --- --- Sets @poly@ to the polynomial which is the product of--- \((q_0 x - p_0)(q_1 x - p_1) \cdots (q_{n-1} x - p_{n-1})\), the roots--- \(p_i/q_i\) being given by @xs@.-foreign import ccall "fmpz_poly.h fmpz_poly_product_roots_fmpq_vec"- fmpz_poly_product_roots_fmpq_vec :: Ptr CFmpzPoly -> Ptr CFmpq -> CLong -> IO ()---- Roots --------------------------------------------------------------------------- | /_fmpz_poly_bound_roots/ /bound/ /poly/ /len/ --- --- Computes a nonnegative integer @bound@ that bounds the absolute value of--- all complex roots of @poly@. Uses Fujiwara\'s bound--- --- \[`\]--- \[2 \max \left(--- \left|\frac{a_{n-1}}{a_n}\right|,--- \left|\frac{a_{n-2}}{a_n}\right|^{\frac{1}{2}}, \dotsc--- \left|\frac{a_1}{a_n}\right|^{\frac{1}{n-1}},--- \left|\frac{a_0}{2a_n}\right|^{\frac{1}{n}}--- \right)\]--- --- where the coefficients of the polynomial are \(a_0, \ldots, a_n\).-foreign import ccall "fmpz_poly.h _fmpz_poly_bound_roots"- _fmpz_poly_bound_roots :: Ptr CFmpz -> Ptr CFmpz -> CLong -> IO ()---- | /_fmpz_poly_num_real_roots_sturm/ /n_neg/ /n_pos/ /pol/ /len/ --- --- Sets @n_neg@ and @n_pos@ to the number of negative and positive roots of--- the polynomial @(pol, len)@ using Sturm sequence. The Sturm sequence is--- computed via subresultant remainders obtained by repeated call to the--- function @_fmpz_poly_pseudo_rem_cohen@.--- --- The polynomial is assumed to be squarefree, of degree larger than 1 and--- with non-zero constant coefficient.-foreign import ccall "fmpz_poly.h _fmpz_poly_num_real_roots_sturm"- _fmpz_poly_num_real_roots_sturm :: Ptr CLong -> Ptr CLong -> Ptr CFmpz -> CLong -> IO ()---- | /fmpz_poly_num_real_roots_sturm/ /pol/ --- --- Returns the number of real roots of the squarefree polynomial @pol@--- using Sturm sequence.--- --- The polynomial is assumed to be squarefree.-foreign import ccall "fmpz_poly.h fmpz_poly_num_real_roots_sturm"- fmpz_poly_num_real_roots_sturm :: Ptr CFmpzPoly -> IO CLong---- | /_fmpz_poly_num_real_roots/ /pol/ /len/ --- --- Returns the number of real roots of the squarefree polynomial--- @(pol, len)@.--- --- The polynomial is assumed to be squarefree.-foreign import ccall "fmpz_poly.h _fmpz_poly_num_real_roots"- _fmpz_poly_num_real_roots :: Ptr CFmpz -> CLong -> IO CLong---- | /fmpz_poly_num_real_roots/ /pol/ --- --- Returns the number of real roots of the squarefree polynomial @pol@.--- --- The polynomial is assumed to be squarefree.-foreign import ccall "fmpz_poly.h fmpz_poly_num_real_roots"- fmpz_poly_num_real_roots :: Ptr CFmpzPoly -> IO CLong---- Minimal polynomials ------------------------------------------------------------- | /_fmpz_poly_cyclotomic/ /a/ /n/ /factors/ /num_factors/ /phi/ --- --- Sets @a@ to the lower half of the cyclotomic polynomial \(\Phi_n(x)\),--- given \(n \ge 3\) which must be squarefree.--- --- A precomputed array containing the prime factors of \(n\) must be--- provided, as well as the value of the Euler totient function \(\phi(n)\)--- as @phi@. If \(n\) is even, 2 must be the first factor in the list.--- --- The degree of \(\Phi_n(x)\) is exactly \(\phi(n)\). Only the low--- \((\phi(n) + 1) / 2\) coefficients are written; the high coefficients--- can be obtained afterwards by copying the low coefficients in reverse--- order, since \(\Phi_n(x)\) is a palindrome for \(n \ne 1\).--- --- We use the sparse power series algorithm described as Algorithm 4--- < [ArnoldMonagan2011]>. The algorithm is based on the identity--- --- \[`\]--- \[\Phi_n(x) = \prod_{d|n} (x^d - 1)^{\mu(n/d)}.\]--- --- Treating the polynomial as a power series, the multiplications and--- divisions can be done very cheaply using repeated additions and--- subtractions. The complexity is \(O(2^k \phi(n))\) where \(k\) is the--- number of prime factors in \(n\).--- --- To improve efficiency for small \(n\), we treat the @fmpz@ coefficients--- as machine integers when there is no risk of overflow. The following--- bounds are given in Table 6 of < [ArnoldMonagan2011]>:--- --- For \(n < 10163195\), the largest coefficient in any \(\Phi_n(x)\) has--- 27 bits, so machine arithmetic is safe on 32 bits.--- --- For \(n < 169828113\), the largest coefficient in any \(\Phi_n(x)\) has--- 60 bits, so machine arithmetic is safe on 64 bits.--- --- Further, the coefficients are always \(\pm 1\) or 0 if there are exactly--- two prime factors, so in this case machine arithmetic can be used as--- well.--- --- Finally, we handle two special cases: if there is exactly one prime--- factor \(n = p\), then \(\Phi_n(x) = 1 + x + x^2 + \ldots + x^{n-1}\),--- and if \(n = 2m\), we use \(\Phi_n(x) = \Phi_m(-x)\) to fall back to the--- case when \(n\) is odd.-foreign import ccall "fmpz_poly.h _fmpz_poly_cyclotomic"- _fmpz_poly_cyclotomic :: Ptr CFmpz -> CULong -> Ptr CMp -> CLong -> CULong -> IO ()---- | /fmpz_poly_cyclotomic/ /poly/ /n/ --- --- Sets @poly@ to the \(n\)-th cyclotomic polynomial, defined as--- \(\Phi_n(x) = \prod_{\omega} (x-\omega)\) where \(\omega\) runs over all--- the \(n\)-th primitive roots of unity.--- --- We factor \(n\) into \(n = qs\) where \(q\) is squarefree, and compute--- \(\Phi_q(x)\). Then \(\Phi_n(x) = \Phi_q(x^s)\).-foreign import ccall "fmpz_poly.h fmpz_poly_cyclotomic"- fmpz_poly_cyclotomic :: Ptr CFmpzPoly -> CULong -> IO ()---- | /_fmpz_poly_is_cyclotomic/ /poly/ /len/ --- --- If @poly@ is a cyclotomic polynomial, returns the index \(n\) of this--- cyclotomic polynomial. If @poly@ is not a cyclotomic polynomial, returns--- 0.-foreign import ccall "fmpz_poly.h _fmpz_poly_is_cyclotomic"- _fmpz_poly_is_cyclotomic :: Ptr CFmpz -> CLong -> IO CULong---- | /_fmpz_poly_cos_minpoly/ /coeffs/ /n/ --- --- Sets @poly@ to the minimal polynomial of \(2 \cos(2 \pi / n)\). For--- suitable choice of \(n\), this gives the minimal polynomial of--- \(2 \cos(a \pi)\) or \(2 \sin(a \pi)\) for any rational \(a\).--- --- The cosine is multiplied by a factor two since this gives a monic--- polynomial with integer coefficients. One can obtain the minimal--- polynomial for \(\cos(2 \pi / n)\) by making the substitution--- \(x \to x / 2\).--- --- For \(n > 2\), the degree of the polynomial is \(\varphi(n) / 2\). For--- \(n = 1, 2\), the degree is 1. For \(n = 0\), we define the output to be--- the constant polynomial 1.-foreign import ccall "fmpz_poly.h _fmpz_poly_cos_minpoly"- _fmpz_poly_cos_minpoly :: Ptr CFmpz -> CULong -> IO ()---- | /_fmpz_poly_swinnerton_dyer/ /coeffs/ /n/ --- --- Sets @poly@ to the Swinnerton-Dyer polynomial \(S_n\), defined as the--- integer polynomial--- \(S_n = \prod (x \pm \sqrt{2} \pm \sqrt{3} \pm \sqrt{5} \pm \ldots \pm \sqrt{p_n})\)--- where \(p_n\) denotes the \(n\)-th prime number and all combinations of--- signs are taken. This polynomial has degree \(2^n\) and is irreducible--- over the integers (it is the minimal polynomial of--- \(\sqrt{2} + \ldots + \sqrt{p_n}\)).-foreign import ccall "fmpz_poly.h _fmpz_poly_swinnerton_dyer"- _fmpz_poly_swinnerton_dyer :: Ptr CFmpz -> CULong -> IO ()---- Orthogonal polynomials ---------------------------------------------------------- | /_fmpz_poly_chebyshev_t/ /coeffs/ /n/ --- --- Sets @poly@ to the Chebyshev polynomial of the first kind \(T_n(x)\),--- defined by \(T_n(x) = \cos(n \cos^{-1}(x))\), for \(n\ge0\). The--- coefficients are calculated using a hypergeometric recurrence.-foreign import ccall "fmpz_poly.h _fmpz_poly_chebyshev_t"- _fmpz_poly_chebyshev_t :: Ptr CFmpz -> CULong -> IO ()---- | /_fmpz_poly_chebyshev_u/ /coeffs/ /n/ --- --- Sets @poly@ to the Chebyshev polynomial of the first kind \(U_n(x)\),--- defined by \((n+1) U_n(x) = T'_{n+1}(x)\), for \(n\ge0\). The--- coefficients are calculated using a hypergeometric recurrence.-foreign import ccall "fmpz_poly.h _fmpz_poly_chebyshev_u"- _fmpz_poly_chebyshev_u :: Ptr CFmpz -> CULong -> IO ()---- | /_fmpz_poly_legendre_pt/ /coeffs/ /n/ --- --- Sets @coeffs@ to the coefficient array of the shifted Legendre--- polynomial \(\tilde{P_n}(x)\), defined by--- \(\tilde{P_n}(x) = P_n(2x-1)\), for \(n\ge0\). The coefficients are--- calculated using a hypergeometric recurrence. The length of the array--- will be @n+1@. See @fmpq_poly@ for the Legendre polynomials.-foreign import ccall "fmpz_poly.h _fmpz_poly_legendre_pt"- _fmpz_poly_legendre_pt :: Ptr CFmpz -> CULong -> IO ()---- | /fmpz_poly_legendre_pt/ /poly/ /n/ --- --- Sets @poly@ to the shifted Legendre polynomial \(\tilde{P_n}(x)\),--- defined by \(\tilde{P_n}(x) = P_n(2x-1)\), for \(n\ge0\). The--- coefficients are calculated using a hypergeometric recurrence. See--- @fmpq_poly@ for the Legendre polynomials.-foreign import ccall "fmpz_poly.h fmpz_poly_legendre_pt"- fmpz_poly_legendre_pt :: Ptr CFmpzPoly -> CULong -> IO ()---- | /_fmpz_poly_hermite_h/ /coeffs/ /n/ --- --- Sets @coeffs@ to the coefficient array of the Hermite polynomial--- \(H_n(x)\), defined by \(H'_n(x) = 2nH_{n-1}(x)\), for \(n\ge0\). The--- coefficients are calculated using a hypergeometric recurrence. The--- length of the array will be @n+1@.-foreign import ccall "fmpz_poly.h _fmpz_poly_hermite_h"- _fmpz_poly_hermite_h :: Ptr CFmpz -> CULong -> IO ()---- | /fmpz_poly_hermite_h/ /poly/ /n/ --- --- Sets @poly@ to the Hermite polynomial \(H_n(x)\), defined by--- \(H'_n(x) = 2nH_{n-1}(x)\), for \(n\ge0\). The coefficients are--- calculated using a hypergeometric recurrence.-foreign import ccall "fmpz_poly.h fmpz_poly_hermite_h"- fmpz_poly_hermite_h :: Ptr CFmpzPoly -> CULong -> IO ()---- | /_fmpz_poly_hermite_he/ /coeffs/ /n/ --- --- Sets @coeffs@ to the coefficient array of the Hermite polynomial--- \(He_n(x)\), defined by--- \(He_n(x) = 2^{-\tfrac{n}{2}}H_n\left(\frac{x}{\sqrt2}\right)\), for--- \(n\ge0\). The coefficients are calculated using a hypergeometric--- recurrence. The length of the array will be @n+1@.-foreign import ccall "fmpz_poly.h _fmpz_poly_hermite_he"- _fmpz_poly_hermite_he :: Ptr CFmpz -> CULong -> IO ()---- | /fmpz_poly_hermite_he/ /poly/ /n/ --- --- Sets @poly@ to the Hermite polynomial \(He_n(x)\), defined by--- \(He_n(x) = 2^{-\tfrac{n}{2}}H_n\left(\frac{x}{\sqrt2}\right)\), for--- \(n\ge0\). The coefficients are calculated using a hypergeometric--- recurrence.-foreign import ccall "fmpz_poly.h fmpz_poly_hermite_he"- fmpz_poly_hermite_he :: Ptr CFmpzPoly -> CULong -> IO ()---- Fibonacci polynomials ----------------------------------------------------------- | /_fmpz_poly_fibonacci/ /coeffs/ /n/ --- --- Sets @coeffs@ to the coefficient array of the \(n\)-th Fibonacci--- polynomial. The coefficients are calculated using a hypergeometric--- recurrence.-foreign import ccall "fmpz_poly.h _fmpz_poly_fibonacci"- _fmpz_poly_fibonacci :: Ptr CFmpz -> CULong -> IO ()---- | /fmpz_poly_fibonacci/ /poly/ /n/ --- --- Sets @poly@ to the \(n\)-th Fibonacci polynomial. The coefficients are--- calculated using a hypergeometric recurrence.-foreign import ccall "fmpz_poly.h fmpz_poly_fibonacci"- fmpz_poly_fibonacci :: Ptr CFmpzPoly -> CULong -> IO ()---- THIS DOES NOT SEEM TO EXIST IN THE ACTUAL IMPLEMENTATION ------------------------ -- Eulerian numbers and polynomials ------------------------------------------------ -- Eulerian numbers are the coefficients to the Eulerian polynomials--- ----- -- \[`\]--- -- \[A_n(x) = \sum_{m = 0}^{n} A(n, m) x^m,\]--- ----- -- where the Eulerian polynomials are defined by the exponential generating--- -- function--- ----- -- \[`\]--- -- \[\frac{x - 1}{x - e^{(x - 1) t}}--- -- = \sum_{n = 0}^{\infty} A_n(x) \frac{t^n}{n!}.\]--- ----- -- The Eulerian numbers can be expressed explicitly via the formula ..--- -- math::\` A(n, m) = s< um>{k = 0}^{m + 1} (-1)^k binom{n + 1}{k} (m + 1 ---- -- k)^n.--- ----- -- Note: Not to be confused with Euler numbers and polynomials.--- ----- -- | /arith_eulerian_polynomial/ /res/ /n/ --- -- --- -- Sets @res@ to the Eulerian polynomial \(A_n(x)\), where we define--- -- \(A_0(x) = 1\). The polynomial is calculated via a recursive relation.--- foreign import ccall "fmpz_poly.h arith_eulerian_polynomial"--- arith_eulerian_polynomial :: Ptr CFmpzPoly -> CULong -> IO ()---- Modular forms and q-series ------------------------------------------------------ | /_fmpz_poly_eta_qexp/ /f/ /r/ /len/ --- --- Sets \(f\) to the \(q\)-expansion to length \(n\) of the Dedekind eta--- function (without the leading factor \(q^{1/24}\)) raised to the power--- \(r\), i.e.--- \((q^{-1/24} \eta(q))^r = \prod_{k=1}^{\infty} (1 - q^k)^r\).--- --- In particular, \(r = -1\) gives the generating function of the partition--- function \(p(k)\), and \(r = 24\) gives, after multiplication by \(q\),--- the modular discriminant \(\Delta(q)\) which generates the Ramanujan tau--- function \(\tau(k)\).--- --- This function uses sparse formulas for \(r = 1, 2, 3, 4, 6\) and--- otherwise reduces to one of those cases using power series arithmetic.-foreign import ccall "fmpz_poly.h _fmpz_poly_eta_qexp"- _fmpz_poly_eta_qexp :: Ptr CFmpz -> CLong -> CLong -> IO ()---- | /_fmpz_poly_theta_qexp/ /f/ /r/ /len/ --- --- Sets \(f\) to the \(q\)-expansion to length \(n\) of the Jacobi theta--- function raised to the power \(r\), i.e. \(\vartheta(q)^r\) where--- \(\vartheta(q) = 1 + 2 \sum_{k=1}^{\infty} q^{k^2}\).--- --- This function uses sparse formulas for \(r = 1, 2\) and otherwise--- reduces to those cases using power series arithmetic.-foreign import ccall "fmpz_poly.h _fmpz_poly_theta_qexp"- _fmpz_poly_theta_qexp :: Ptr CFmpz -> CLong -> CLong -> IO ()---- CLD bounds ---------------------------------------------------------------------- | /fmpz_poly_CLD_bound/ /res/ /f/ /n/ --- --- Compute a bound on the \(n\) coefficient of \(fg'/g\) where \(g\) is any--- factor of \(f\).-foreign import ccall "fmpz_poly.h fmpz_poly_CLD_bound"- fmpz_poly_CLD_bound :: Ptr CFmpz -> Ptr CFmpzPoly -> CLong -> IO ()+ , _fmpz_poly_set_str+ , fmpz_poly_set_str+ , _fmpz_poly_get_str+ , fmpz_poly_get_str+ , _fmpz_poly_get_str_pretty+ , fmpz_poly_get_str_pretty+ , fmpz_poly_zero+ , fmpz_poly_one+ , fmpz_poly_zero_coeffs+ , fmpz_poly_swap+ , _fmpz_poly_reverse+ , fmpz_poly_reverse+ , fmpz_poly_truncate+ , fmpz_poly_set_trunc+ -- * Randomisation+ , fmpz_poly_randtest+ , fmpz_poly_randtest_unsigned+ , fmpz_poly_randtest_not_zero+ , fmpz_poly_randtest_no_real_root+ , fmpz_poly_randtest_irreducible1+ , fmpz_poly_randtest_irreducible2+ , fmpz_poly_randtest_irreducible+ -- * Getting and setting coefficients+ , fmpz_poly_get_coeff_fmpz+ , fmpz_poly_get_coeff_si+ , fmpz_poly_get_coeff_ui+--, fmpz_poly_get_coeff_ptr+--, fmpz_poly_lead+ , fmpz_poly_set_coeff_fmpz+ , fmpz_poly_set_coeff_si+ , fmpz_poly_set_coeff_ui+ -- * Comparison+ , fmpz_poly_equal+ , fmpz_poly_equal_trunc+--, fmpz_poly_is_zero+ , fmpz_poly_is_one+ , fmpz_poly_is_unit+ , fmpz_poly_is_gen+ -- * Addition and subtraction+ , _fmpz_poly_add+ , fmpz_poly_add+ , fmpz_poly_add_series+ , _fmpz_poly_sub+ , fmpz_poly_sub+ , fmpz_poly_sub_series+ , fmpz_poly_neg+ -- * Scalar absolute value, multiplication and division+ , fmpz_poly_scalar_abs+ , fmpz_poly_scalar_mul_fmpz+ , fmpz_poly_scalar_mul_si+ , fmpz_poly_scalar_mul_ui+ , fmpz_poly_scalar_mul_2exp+ , fmpz_poly_scalar_addmul_si+ , fmpz_poly_scalar_addmul_ui+ , fmpz_poly_scalar_addmul_fmpz+ , fmpz_poly_scalar_submul_fmpz+ , fmpz_poly_scalar_fdiv_fmpz+ , fmpz_poly_scalar_fdiv_si+ , fmpz_poly_scalar_fdiv_ui+ , fmpz_poly_scalar_fdiv_2exp+ , fmpz_poly_scalar_tdiv_fmpz+ , fmpz_poly_scalar_tdiv_si+ , fmpz_poly_scalar_tdiv_ui+ , fmpz_poly_scalar_tdiv_2exp+ , fmpz_poly_scalar_divexact_fmpz+ , fmpz_poly_scalar_divexact_si+ , fmpz_poly_scalar_divexact_ui+ , fmpz_poly_scalar_mod_fmpz+ , fmpz_poly_scalar_smod_fmpz+ , _fmpz_poly_remove_content_2exp+ , _fmpz_poly_scale_2exp+ -- * Bit packing+ , _fmpz_poly_bit_pack+ , _fmpz_poly_bit_unpack+ , _fmpz_poly_bit_unpack_unsigned+ , fmpz_poly_bit_pack+ , fmpz_poly_bit_unpack+ , fmpz_poly_bit_unpack_unsigned+ -- * Multiplication+ , _fmpz_poly_mul_classical+ , fmpz_poly_mul_classical+ , _fmpz_poly_mullow_classical+ , fmpz_poly_mullow_classical+ , _fmpz_poly_mulhigh_classical+ , fmpz_poly_mulhigh_classical+ , _fmpz_poly_mulmid_classical+ , fmpz_poly_mulmid_classical+ , _fmpz_poly_mul_karatsuba+ , fmpz_poly_mul_karatsuba+ , _fmpz_poly_mullow_karatsuba_n+ , fmpz_poly_mullow_karatsuba_n+ , _fmpz_poly_mulhigh_karatsuba_n+ , fmpz_poly_mulhigh_karatsuba_n+ , _fmpz_poly_mul_KS+ , fmpz_poly_mul_KS+ , _fmpz_poly_mullow_KS+ , fmpz_poly_mullow_KS+ , _fmpz_poly_mul_SS+ , fmpz_poly_mul_SS+ , _fmpz_poly_mullow_SS+ , fmpz_poly_mullow_SS+ , _fmpz_poly_mul+ , fmpz_poly_mul+ , _fmpz_poly_mullow+ , fmpz_poly_mullow+ , fmpz_poly_mulhigh_n+ , _fmpz_poly_mulhigh+ -- * FFT precached multiplication+ , fmpz_poly_mul_SS_precache_init+ , fmpz_poly_mul_precache_clear+ , _fmpz_poly_mullow_SS_precache+ , fmpz_poly_mullow_SS_precache+ , fmpz_poly_mul_SS_precache+ -- * Squaring+ , _fmpz_poly_sqr_KS+ , fmpz_poly_sqr_KS+ , _fmpz_poly_sqr_karatsuba+ , fmpz_poly_sqr_karatsuba+ , _fmpz_poly_sqr_classical+ , fmpz_poly_sqr_classical+ , _fmpz_poly_sqr+ , fmpz_poly_sqr+ , _fmpz_poly_sqrlow_KS+ , fmpz_poly_sqrlow_KS+ , _fmpz_poly_sqrlow_karatsuba_n+ , fmpz_poly_sqrlow_karatsuba_n+ , _fmpz_poly_sqrlow_classical+ , fmpz_poly_sqrlow_classical+ , _fmpz_poly_sqrlow+ , fmpz_poly_sqrlow+ -- * Powering+ , _fmpz_poly_pow_multinomial+ , fmpz_poly_pow_multinomial+ , _fmpz_poly_pow_binomial+ , fmpz_poly_pow_binomial+ , _fmpz_poly_pow_addchains+ , fmpz_poly_pow_addchains+ , _fmpz_poly_pow_binexp+ , fmpz_poly_pow_binexp+ , _fmpz_poly_pow_small+ , _fmpz_poly_pow+ , fmpz_poly_pow+ , _fmpz_poly_pow_trunc+ , fmpz_poly_pow_trunc+ -- * Shifting+ , _fmpz_poly_shift_left+ , fmpz_poly_shift_left+ , _fmpz_poly_shift_right+ , fmpz_poly_shift_right+ -- * Bit sizes and norms+ , fmpz_poly_max_limbs+ , fmpz_poly_max_bits+ , fmpz_poly_height+ , _fmpz_poly_2norm+ , fmpz_poly_2norm+ , _fmpz_poly_2norm_normalised_bits+ -- * Greatest common divisor+ , _fmpz_poly_gcd_subresultant+ , fmpz_poly_gcd_subresultant+ , _fmpz_poly_gcd_heuristic+ , fmpz_poly_gcd_heuristic+ , _fmpz_poly_gcd_modular+ , fmpz_poly_gcd_modular+ , _fmpz_poly_gcd+ , fmpz_poly_gcd+ , _fmpz_poly_xgcd_modular+ , fmpz_poly_xgcd_modular+ , _fmpz_poly_xgcd+ , fmpz_poly_xgcd+ , _fmpz_poly_lcm+ , fmpz_poly_lcm+ , _fmpz_poly_resultant_modular+ , fmpz_poly_resultant_modular+ , fmpz_poly_resultant_modular_div+ , _fmpz_poly_resultant_euclidean+ , fmpz_poly_resultant_euclidean+ , _fmpz_poly_resultant+ , fmpz_poly_resultant+ -- * Discriminant+ , _fmpz_poly_discriminant+ , fmpz_poly_discriminant+ -- * Gaussian content+ , _fmpz_poly_content+ , fmpz_poly_content+ , _fmpz_poly_primitive_part+ , fmpz_poly_primitive_part+ -- * Square-free+ , _fmpz_poly_is_squarefree+ , fmpz_poly_is_squarefree+ -- * Euclidean division+ , _fmpz_poly_divrem_basecase+ , fmpz_poly_divrem_basecase+ , _fmpz_poly_divrem_divconquer_recursive+ , _fmpz_poly_divrem_divconquer+ , fmpz_poly_divrem_divconquer+ , _fmpz_poly_divrem+ , fmpz_poly_divrem+ , _fmpz_poly_div_basecase+ , fmpz_poly_div_basecase+ , _fmpz_poly_divremlow_divconquer_recursive+ , _fmpz_poly_div_divconquer_recursive+ , _fmpz_poly_div_divconquer+ , fmpz_poly_div_divconquer+ , _fmpz_poly_div+ , fmpz_poly_div+ , _fmpz_poly_rem_basecase+ , fmpz_poly_rem_basecase+ , _fmpz_poly_rem+ , fmpz_poly_rem+ , _fmpz_poly_div_root+ , fmpz_poly_div_root+ -- * Division with precomputed inverse+ , _fmpz_poly_preinvert+ , fmpz_poly_preinvert+ , _fmpz_poly_div_preinv+ , fmpz_poly_div_preinv+ , _fmpz_poly_divrem_preinv+ , fmpz_poly_divrem_preinv+ , _fmpz_poly_powers_precompute+ , fmpz_poly_powers_precompute+ , _fmpz_poly_powers_clear+ , fmpz_poly_powers_clear+ , _fmpz_poly_rem_powers_precomp+ , fmpz_poly_rem_powers_precomp+ -- * Divisibility testing+ , _fmpz_poly_divides+ , fmpz_poly_divides+ , fmpz_poly_remove+ -- * Division mod p+ , fmpz_poly_divlow_smodp+ , fmpz_poly_divhigh_smodp+ -- * Power series division+ , _fmpz_poly_inv_series_basecase+ , fmpz_poly_inv_series_basecase+ , _fmpz_poly_inv_series_newton+ , fmpz_poly_inv_series_newton+ , _fmpz_poly_inv_series+ , fmpz_poly_inv_series+ , _fmpz_poly_div_series_basecase+ , _fmpz_poly_div_series_divconquer+ , _fmpz_poly_div_series+ , fmpz_poly_div_series_basecase+ , fmpz_poly_div_series_divconquer+ , fmpz_poly_div_series+ -- * Pseudo division+ , _fmpz_poly_pseudo_divrem_basecase+ , fmpz_poly_pseudo_divrem_basecase+ , _fmpz_poly_pseudo_divrem_divconquer+ , fmpz_poly_pseudo_divrem_divconquer+ , _fmpz_poly_pseudo_divrem_cohen+ , fmpz_poly_pseudo_divrem_cohen+ , _fmpz_poly_pseudo_rem_cohen+ , fmpz_poly_pseudo_rem_cohen+--, _fmpz_poly_pseudo_divrem+ , fmpz_poly_pseudo_divrem+ , _fmpz_poly_pseudo_div+ , fmpz_poly_pseudo_div+ , _fmpz_poly_pseudo_rem+ , fmpz_poly_pseudo_rem+ -- * Derivative+ , _fmpz_poly_derivative+ , fmpz_poly_derivative+ , _fmpz_poly_nth_derivative+ , fmpz_poly_nth_derivative+ -- * Evaluation+ , _fmpz_poly_evaluate_divconquer_fmpz+ , fmpz_poly_evaluate_divconquer_fmpz+ , _fmpz_poly_evaluate_horner_fmpz+ , fmpz_poly_evaluate_horner_fmpz+ , _fmpz_poly_evaluate_fmpz+ , fmpz_poly_evaluate_fmpz+ , _fmpz_poly_evaluate_divconquer_fmpq+ , fmpz_poly_evaluate_divconquer_fmpq+ , _fmpz_poly_evaluate_horner_fmpq+ , fmpz_poly_evaluate_horner_fmpq+ , _fmpz_poly_evaluate_fmpq+ , fmpz_poly_evaluate_fmpq+ , _fmpz_poly_evaluate_mod+ , fmpz_poly_evaluate_mod+ , fmpz_poly_evaluate_fmpz_vec+ , _fmpz_poly_evaluate_horner_d+ , fmpz_poly_evaluate_horner_d+ , _fmpz_poly_evaluate_horner_d_2exp+ , fmpz_poly_evaluate_horner_d_2exp+ , _fmpz_poly_evaluate_horner_d_2exp2+ -- * Newton basis+ , _fmpz_poly_monomial_to_newton+ , _fmpz_poly_newton_to_monomial+ -- * Interpolation+ , fmpz_poly_interpolate_fmpz_vec+ -- * Composition+ , _fmpz_poly_compose_horner+ , fmpz_poly_compose_horner+ , _fmpz_poly_compose_divconquer+ , fmpz_poly_compose_divconquer+ , _fmpz_poly_compose+ , fmpz_poly_compose+ -- * Inflation and deflation+ , fmpz_poly_inflate+ , fmpz_poly_deflate+ , fmpz_poly_deflation+ -- * Taylor shift+ , _fmpz_poly_taylor_shift_horner+ , fmpz_poly_taylor_shift_horner+ , _fmpz_poly_taylor_shift_divconquer+ , fmpz_poly_taylor_shift_divconquer+ , _fmpz_poly_taylor_shift_multi_mod+ , fmpz_poly_taylor_shift_multi_mod+ , _fmpz_poly_taylor_shift+ , fmpz_poly_taylor_shift+ -- * Power series composition+ , _fmpz_poly_compose_series_horner+ , fmpz_poly_compose_series_horner+ , _fmpz_poly_compose_series_brent_kung+ , fmpz_poly_compose_series_brent_kung+ , _fmpz_poly_compose_series+ , fmpz_poly_compose_series+ -- * Power series reversion+ , _fmpz_poly_revert_series_lagrange+ , fmpz_poly_revert_series_lagrange+ , _fmpz_poly_revert_series_lagrange_fast+ , fmpz_poly_revert_series_lagrange_fast+ , _fmpz_poly_revert_series_newton+ , fmpz_poly_revert_series_newton+ , _fmpz_poly_revert_series+ , fmpz_poly_revert_series+ -- * Square root+ , _fmpz_poly_sqrtrem_classical+ , fmpz_poly_sqrtrem_classical+ , _fmpz_poly_sqrtrem_divconquer+ , fmpz_poly_sqrtrem_divconquer+ , _fmpz_poly_sqrt_classical+ , fmpz_poly_sqrt_classical+ , _fmpz_poly_sqrt_KS+ , fmpz_poly_sqrt_KS+ , _fmpz_poly_sqrt_divconquer+ , fmpz_poly_sqrt_divconquer+ , _fmpz_poly_sqrt+ , fmpz_poly_sqrt+ , _fmpz_poly_sqrt_series+ , fmpz_poly_sqrt_series+ -- * Power sums+ , _fmpz_poly_power_sums_naive+ , fmpz_poly_power_sums_naive+ , fmpz_poly_power_sums+ , _fmpz_poly_power_sums_to_poly+ , fmpz_poly_power_sums_to_poly+ -- * Signature+ , _fmpz_poly_signature+ , fmpz_poly_signature+ -- * Hensel lifting+ , fmpz_poly_hensel_build_tree+ , fmpz_poly_hensel_lift+ , fmpz_poly_hensel_lift_without_inverse+ , fmpz_poly_hensel_lift_only_inverse+ , fmpz_poly_hensel_lift_tree_recursive+ , fmpz_poly_hensel_lift_tree+ , _fmpz_poly_hensel_start_lift+ , _fmpz_poly_hensel_continue_lift+ , fmpz_poly_hensel_lift_once+ -- * Input and output+ , _fmpz_poly_print+ , fmpz_poly_print+ , _fmpz_poly_print_pretty+ , fmpz_poly_print_pretty+ , _fmpz_poly_fprint+ , fmpz_poly_fprint+ , _fmpz_poly_fprint_pretty+ , fmpz_poly_fprint_pretty+ , fmpz_poly_read+ , fmpz_poly_read_pretty+ , fmpz_poly_fread+ , fmpz_poly_fread_pretty+ -- * Modular reduction and reconstruction+ , fmpz_poly_get_nmod_poly+ , fmpz_poly_set_nmod_poly+ , fmpz_poly_set_nmod_poly_unsigned+ , _fmpz_poly_CRT_ui_precomp+ , _fmpz_poly_CRT_ui+ , fmpz_poly_CRT_ui+ -- * Products+ , _fmpz_poly_product_roots_fmpz_vec+ , fmpz_poly_product_roots_fmpz_vec+ , _fmpz_poly_product_roots_fmpq_vec+ , fmpz_poly_product_roots_fmpq_vec+ -- * Roots+ , _fmpz_poly_bound_roots+ , fmpz_poly_bound_roots+ , _fmpz_poly_num_real_roots_sturm+ , fmpz_poly_num_real_roots_sturm+ , _fmpz_poly_num_real_roots+ , fmpz_poly_num_real_roots+ -- * Minimal polynomials+ , _fmpz_poly_cyclotomic+ , fmpz_poly_cyclotomic+ , _fmpz_poly_is_cyclotomic+ , fmpz_poly_is_cyclotomic+ , _fmpz_poly_cos_minpoly+ , fmpz_poly_cos_minpoly+ , _fmpz_poly_swinnerton_dyer+ , fmpz_poly_swinnerton_dyer+ -- * Orthogonal polynomials+ , _fmpz_poly_chebyshev_t+ , fmpz_poly_chebyshev_t+ , _fmpz_poly_chebyshev_u+ , fmpz_poly_chebyshev_u+ , _fmpz_poly_legendre_pt+ , fmpz_poly_legendre_pt+ , _fmpz_poly_hermite_h+ , fmpz_poly_hermite_h+ , _fmpz_poly_hermite_he+ , fmpz_poly_hermite_he+ -- * Fibonacci polynomials+ , _fmpz_poly_fibonacci+ , fmpz_poly_fibonacci+ -- * Eulerian numbers and polynomials+--, arith_eulerian_polynomial+ -- * Modular forms and q-series+ , _fmpz_poly_eta_qexp+ , fmpz_poly_eta_qexp+ , _fmpz_poly_theta_qexp+ , fmpz_poly_theta_qexp+ -- * CLD bounds+ , fmpz_poly_CLD_bound+) where +-- univariate polynomials over the integers ------------------------------------++import Control.Monad++import Foreign.C.String+import Foreign.C.Types+import Foreign.ForeignPtr+import Foreign.Ptr ( Ptr, FunPtr, nullPtr, plusPtr )+import Foreign.Storable+import Foreign.Marshal ( free )+import Foreign.Marshal.Array ( advancePtr )++import Data.Number.Flint.Flint+import Data.Number.Flint.Fmpz+import Data.Number.Flint.Fmpq+import Data.Number.Flint.NMod.Types++#include <flint/flint.h>+#include <flint/fmpz.h>+#include <flint/fmpq.h>+#include <flint/fmpz_poly.h>++-- fmpz_poly_t -----------------------------------------------------------------++data FmpzPoly = FmpzPoly {-# UNPACK #-} !(ForeignPtr CFmpzPoly)+data CFmpzPoly = CFmpzPoly (Ptr CFmpz) CLong CLong++instance Storable CFmpzPoly where+ {-# INLINE sizeOf #-}+ sizeOf _ = #{size fmpz_poly_t}+ {-# INLINE alignment #-}+ alignment _ = #{alignment fmpz_poly_t}+ peek ptr = do+ coeffs <- #{peek fmpz_poly_struct, coeffs} ptr+ alloc <- #{peek fmpz_poly_struct, alloc } ptr+ length <- #{peek fmpz_poly_struct, length} ptr+ return $ CFmpzPoly coeffs alloc length+ poke = error "CFmpzPoly.poke: Not defined"++-- | /newFmpzPoly/+--+-- Construct a new `FmpzPoly`+newFmpzPoly = do+ p <- mallocForeignPtr+ withForeignPtr p fmpz_poly_init+ addForeignPtrFinalizer p_fmpz_poly_clear p+ return $ FmpzPoly p++-- | /withFmpzPoly/ /poly/ /f/+-- +-- Execute /f/ on /poly/+{-# INLINE withFmpzPoly #-}+withFmpzPoly (FmpzPoly p) f = do+ withForeignPtr p $ \fp -> f fp >>= return . (FmpzPoly p,)++-- | /withNewFmpzPoly/ /poly/ /f/+-- +-- Execute /f/ on a new `FmpzPoly`+withNewFmpzPoly f = do+ x <- newFmpzPoly+ withFmpzPoly x $ \x -> f x++-- fmpz_poly_powers_precomp_t --------------------------------------------------++-- | Data structure containing the /CFmpzPolyPowersPrecomp/ pointer+data FmpzPolyPowersPrecomp = FmpzPolyPowersPrecomp+ {-# UNPACK #-} !(ForeignPtr CFmpzPolyPowersPrecomp) +type CFmpzPolyPowersPrecomp = CFlint FmpzPolyPowersPrecomp++-- fmpz_poly_factor_t ----------------------------------------------------------++-- | Data structure containing the /CFmpzPolyFactor/ pointer+data FmpzPolyFactor = FmpzPolyFactor+ {-# UNPACK #-} !(ForeignPtr CFmpzPolyFactor) +type CFmpzPolyFactor = CFlint FmpzPolyFactor++-- fmpz_poly_mul_precache_t ----------------------------------------------------++-- | Data structure containing the /CFmpzPolyMulPrecache/ pointer+data FmpzPolyMulPrecache = FmpzPolyMulPrecache+ {-# UNPACK #-} !(ForeignPtr CFmpzPolyMulPrecache) +type CFmpzPolyMulPrecache = CFlint FmpzPolyMulPrecache++-- Memory management -----------------------------------------------------------++-- | /fmpz_poly_init/ /poly/ +--+-- Initialises @poly@ for use, setting its length to zero. A corresponding+-- call to @fmpz_poly_clear@ must be made after finishing with the+-- @fmpz_poly_t@ to free the memory used by the polynomial.+foreign import ccall "fmpz_poly.h fmpz_poly_init"+ fmpz_poly_init :: Ptr CFmpzPoly -> IO ()++-- | /fmpz_poly_init2/ /poly/ /alloc/ +--+-- Initialises @poly@ with space for at least @alloc@ coefficients and sets+-- the length to zero. The allocated coefficients are all set to zero.+foreign import ccall "fmpz_poly.h fmpz_poly_init2"+ fmpz_poly_init2 :: Ptr CFmpzPoly -> CLong -> IO ()++-- | /fmpz_poly_realloc/ /poly/ /alloc/ +--+-- Reallocates the given polynomial to have space for @alloc@ coefficients.+-- If @alloc@ is zero the polynomial is cleared and then reinitialised. If+-- the current length is greater than @alloc@ the polynomial is first+-- truncated to length @alloc@.+foreign import ccall "fmpz_poly.h fmpz_poly_realloc"+ fmpz_poly_realloc :: Ptr CFmpzPoly -> CLong -> IO ()++-- | /fmpz_poly_fit_length/ /poly/ /len/ +--+-- If @len@ is greater than the number of coefficients currently allocated,+-- then the polynomial is reallocated to have space for at least @len@+-- coefficients. No data is lost when calling this function.+-- +-- The function efficiently deals with the case where @fit_length@ is+-- called many times in small increments by at least doubling the number of+-- allocated coefficients when length is larger than the number of+-- coefficients currently allocated.+foreign import ccall "fmpz_poly.h fmpz_poly_fit_length"+ fmpz_poly_fit_length :: Ptr CFmpzPoly -> CLong -> IO ()++-- | /fmpz_poly_clear/ /poly/ +--+-- Clears the given polynomial, releasing any memory used. It must be+-- reinitialised in order to be used again.+foreign import ccall "fmpz_poly.h fmpz_poly_clear"+ fmpz_poly_clear :: Ptr CFmpzPoly -> IO ()++foreign import ccall "fmpz_poly.h &fmpz_poly_clear"+ p_fmpz_poly_clear :: FunPtr (Ptr CFmpzPoly -> IO ())++-- | /_fmpz_poly_normalise/ /poly/ +--+-- Sets the length of @poly@ so that the top coefficient is non-zero. If+-- all coefficients are zero, the length is set to zero. This function is+-- mainly used internally, as all functions guarantee normalisation.+foreign import ccall "fmpz_poly.h _fmpz_poly_normalise"+ _fmpz_poly_normalise :: Ptr CFmpzPoly -> IO ()++-- | /_fmpz_poly_set_length/ /poly/ /newlen/ +--+-- Demotes the coefficients of @poly@ beyond @newlen@ and sets the length+-- of @poly@ to @newlen@.+foreign import ccall "fmpz_poly.h _fmpz_poly_set_length"+ _fmpz_poly_set_length :: Ptr CFmpzPoly -> CLong -> IO ()++-- | /fmpz_poly_attach_truncate/ /trunc/ /poly/ /n/ +--+-- This function sets the uninitialised polynomial @trunc@ to the low \(n\)+-- coefficients of @poly@, or to @poly@ if the latter doesn\'t have \(n\)+-- coefficients. The polynomial @trunc@ not be cleared or used as the+-- output of any Flint functions.+foreign import ccall "fmpz_poly.h fmpz_poly_attach_truncate"+ fmpz_poly_attach_truncate :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()++-- | /fmpz_poly_attach_shift/ /trunc/ /poly/ /n/ +--+-- This function sets the uninitialised polynomial @trunc@ to the high+-- coefficients of @poly@, i.e. the coefficients not among the low \(n\)+-- coefficients of @poly@. If the latter doesn\'t have \(n\) coefficients+-- @trunc@ is set to the zero polynomial. The polynomial @trunc@ not be+-- cleared or used as the output of any Flint functions.+foreign import ccall "fmpz_poly.h fmpz_poly_attach_shift"+ fmpz_poly_attach_shift :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()++-- Polynomial parameters -------------------------------------------------------++-- | /fmpz_poly_length/ /poly/ +--+-- Returns the length of @poly@. The zero polynomial has length zero.+foreign import ccall "fmpz_poly.h fmpz_poly_length"+ fmpz_poly_length :: Ptr CFmpzPoly -> IO CLong++-- | /fmpz_poly_degree/ /poly/ +--+-- Returns the degree of @poly@, which is one less than its length.+foreign import ccall "fmpz_poly.h fmpz_poly_degree"+ fmpz_poly_degree :: Ptr CFmpzPoly -> IO CLong++-- Assignment and basic manipulation -------------------------------------------++-- | /fmpz_poly_set/ /poly1/ /poly2/ +--+-- Sets @poly1@ to equal @poly2@.+foreign import ccall "fmpz_poly.h fmpz_poly_set"+ fmpz_poly_set :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()++-- | /fmpz_poly_set_si/ /poly/ /c/ +--+-- Sets @poly@ to the signed integer @c@.+foreign import ccall "fmpz_poly.h fmpz_poly_set_si"+ fmpz_poly_set_si :: Ptr CFmpzPoly -> CLong -> IO ()++-- | /fmpz_poly_set_ui/ /poly/ /c/ +--+-- Sets @poly@ to the unsigned integer @c@.+foreign import ccall "fmpz_poly.h fmpz_poly_set_ui"+ fmpz_poly_set_ui :: Ptr CFmpzPoly -> CULong -> IO ()++-- | /fmpz_poly_set_fmpz/ /poly/ /c/ +--+-- Sets @poly@ to the integer @c@.+foreign import ccall "fmpz_poly.h fmpz_poly_set_fmpz"+ fmpz_poly_set_fmpz :: Ptr CFmpzPoly -> Ptr CFmpz -> IO ()++-- | /_fmpz_poly_set_str/ /poly/ /str/ +--+-- Sets @poly@ to the polynomial encoded in the null-terminated string+-- @str@. Assumes that @poly@ is allocated as a sufficiently large array+-- suitable for the number of coefficients present in @str@.+-- +-- Returns \(0\) if no error occurred. Otherwise, returns a non-zero value,+-- in which case the resulting value of @poly@ is undefined. If @str@ is+-- not null-terminated, calling this method might result in a segmentation+-- fault.+foreign import ccall "fmpz_poly.h _fmpz_poly_set_str"+ _fmpz_poly_set_str :: Ptr CFmpz -> CString -> IO CInt++-- | /fmpz_poly_set_str/ /poly/ /str/ +--+-- Imports a polynomial from a null-terminated string. If the string @str@+-- represents a valid polynomial returns \(0\), otherwise returns \(1\).+-- +-- Returns \(0\) if no error occurred. Otherwise, returns a non-zero value,+-- in which case the resulting value of @poly@ is undefined. If @str@ is+-- not null-terminated, calling this method might result in a segmentation+-- fault.+foreign import ccall "fmpz_poly.h fmpz_poly_set_str"+ fmpz_poly_set_str :: Ptr CFmpzPoly -> CString -> IO CInt++-- | /_fmpz_poly_get_str/ /poly/ /len/ +--+-- Returns the plain FLINT string representation of the polynomial+-- @(poly, len)@.+foreign import ccall "fmpz_poly.h _fmpz_poly_get_str"+ _fmpz_poly_get_str :: Ptr CFmpz -> CLong -> IO CString++-- | /fmpz_poly_get_str/ /poly/ +--+-- Returns the plain FLINT string representation of the polynomial @poly@.+foreign import ccall "fmpz_poly.h fmpz_poly_get_str"+ fmpz_poly_get_str :: Ptr CFmpzPoly -> IO CString++-- | /_fmpz_poly_get_str_pretty/ /poly/ /len/ /x/ +--+-- Returns a pretty representation of the polynomial @(poly, len)@ using+-- the null-terminated string @x@ as the variable name.+foreign import ccall "fmpz_poly.h _fmpz_poly_get_str_pretty"+ _fmpz_poly_get_str_pretty :: Ptr CFmpz -> CLong -> CString -> IO CString++-- | /fmpz_poly_get_str_pretty/ /poly/ /x/ +--+-- Returns a pretty representation of the polynomial @poly@ using the+-- null-terminated string @x@ as the variable name.+foreign import ccall "fmpz_poly.h fmpz_poly_get_str_pretty"+ fmpz_poly_get_str_pretty :: Ptr CFmpzPoly -> CString -> IO CString++-- | /fmpz_poly_zero/ /poly/ +--+-- Sets @poly@ to the zero polynomial.+foreign import ccall "fmpz_poly.h fmpz_poly_zero"+ fmpz_poly_zero :: Ptr CFmpzPoly -> IO ()++-- | /fmpz_poly_one/ /poly/ +--+-- Sets @poly@ to the constant polynomial one.+foreign import ccall "fmpz_poly.h fmpz_poly_one"+ fmpz_poly_one :: Ptr CFmpzPoly -> IO ()++-- | /fmpz_poly_zero_coeffs/ /poly/ /i/ /j/ +--+-- Sets the coefficients of \(x^i, \dotsc, x^{j-1}\) to zero.+foreign import ccall "fmpz_poly.h fmpz_poly_zero_coeffs"+ fmpz_poly_zero_coeffs :: Ptr CFmpzPoly -> CLong -> CLong -> IO ()++-- | /fmpz_poly_swap/ /poly1/ /poly2/ +--+-- Swaps @poly1@ and @poly2@. This is done efficiently without copying data+-- by swapping pointers, etc.+foreign import ccall "fmpz_poly.h fmpz_poly_swap"+ fmpz_poly_swap :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()++-- | /_fmpz_poly_reverse/ /res/ /poly/ /len/ /n/ +--+-- Sets @(res, n)@ to the reverse of @(poly, n)@, where @poly@ is in fact+-- an array of length @len@. Assumes that @0 \< len \<= n@. Supports+-- aliasing of @res@ and @poly@, but the behaviour is undefined in case of+-- partial overlap.+foreign import ccall "fmpz_poly.h _fmpz_poly_reverse"+ _fmpz_poly_reverse :: Ptr CFmpz -> Ptr CFmpz -> CLong -> CLong -> IO ()++-- | /fmpz_poly_reverse/ /res/ /poly/ /n/ +--+-- This function considers the polynomial @poly@ to be of length \(n\),+-- notionally truncating and zero padding if required, and reverses the+-- result. Since the function normalises its result @res@ may be of length+-- less than \(n\).+foreign import ccall "fmpz_poly.h fmpz_poly_reverse"+ fmpz_poly_reverse :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()++-- | /fmpz_poly_truncate/ /poly/ /newlen/ +--+-- If the current length of @poly@ is greater than @newlen@, it is+-- truncated to have the given length. Discarded coefficients are not+-- necessarily set to zero.+foreign import ccall "fmpz_poly.h fmpz_poly_truncate"+ fmpz_poly_truncate :: Ptr CFmpzPoly -> CLong -> IO ()++-- | /fmpz_poly_set_trunc/ /res/ /poly/ /n/ +--+-- Sets @res@ to a copy of @poly@, truncated to length @n@.+foreign import ccall "fmpz_poly.h fmpz_poly_set_trunc"+ fmpz_poly_set_trunc :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()++-- Randomisation ---------------------------------------------------------------++-- | /fmpz_poly_randtest/ /f/ /state/ /len/ /bits/ +--+-- Sets \(f\) to a random polynomial with up to the given length and where+-- each coefficient has up to the given number of bits. The coefficients+-- are signed randomly.+foreign import ccall "fmpz_poly.h fmpz_poly_randtest"+ fmpz_poly_randtest :: Ptr CFmpzPoly -> Ptr CFRandState -> CLong -> CFBitCnt -> IO ()++-- | /fmpz_poly_randtest_unsigned/ /f/ /state/ /len/ /bits/ +--+-- Sets \(f\) to a random polynomial with up to the given length and where+-- each coefficient has up to the given number of bits.+foreign import ccall "fmpz_poly.h fmpz_poly_randtest_unsigned"+ fmpz_poly_randtest_unsigned :: Ptr CFmpzPoly -> Ptr CFRandState -> CLong -> CFBitCnt -> IO ()++-- | /fmpz_poly_randtest_not_zero/ /f/ /state/ /len/ /bits/ +--+-- As for @fmpz_poly_randtest@ except that @len@ and bits may not be zero+-- and the polynomial generated is guaranteed not to be the zero+-- polynomial.+foreign import ccall "fmpz_poly.h fmpz_poly_randtest_not_zero"+ fmpz_poly_randtest_not_zero :: Ptr CFmpzPoly -> Ptr CFRandState -> CLong -> CFBitCnt -> IO ()++-- | /fmpz_poly_randtest_no_real_root/ /p/ /state/ /len/ /bits/ +--+-- Sets @p@ to a random polynomial without any real root, whose length is+-- up to @len@ and where each coefficient has up to the given number of+-- bits.+foreign import ccall "fmpz_poly.h fmpz_poly_randtest_no_real_root"+ fmpz_poly_randtest_no_real_root :: Ptr CFmpzPoly -> Ptr CFRandState -> CLong -> CFBitCnt -> IO ()++-- | /fmpz_poly_randtest_irreducible1/ /pol/ /state/ /len/ /bits/ +foreign import ccall "fmpz_poly.h fmpz_poly_randtest_irreducible1"+ fmpz_poly_randtest_irreducible1 :: Ptr CFmpzPoly -> Ptr CFRandState -> CLong -> CMpBitCnt -> IO ()+-- | /fmpz_poly_randtest_irreducible2/ /pol/ /state/ /len/ /bits/ +foreign import ccall "fmpz_poly.h fmpz_poly_randtest_irreducible2"+ fmpz_poly_randtest_irreducible2 :: Ptr CFmpzPoly -> Ptr CFRandState -> CLong -> CMpBitCnt -> IO ()+-- | /fmpz_poly_randtest_irreducible/ /pol/ /state/ /len/ /bits/ +--+-- Sets @p@ to a random irreducible polynomial, whose length is up to @len@+-- and where each coefficient has up to the given number of bits. There are+-- two algorithms: /irreducible1/ generates an irreducible polynomial+-- modulo a random prime number and lifts it to the integers;+-- /irreducible2/ generates a random integer polynomial, factors it, and+-- returns a random factor. The default function chooses randomly between+-- these methods.+foreign import ccall "fmpz_poly.h fmpz_poly_randtest_irreducible"+ fmpz_poly_randtest_irreducible :: Ptr CFmpzPoly -> Ptr CFRandState -> CLong -> CMpBitCnt -> IO ()++-- Getting and setting coefficients --------------------------------------------++-- | /fmpz_poly_get_coeff_fmpz/ /x/ /poly/ /n/ +--+-- Sets \(x\) to the \(n\)-th coefficient of @poly@. Coefficient numbering+-- is from zero and if \(n\) is set to a value beyond the end of the+-- polynomial, zero is returned.+foreign import ccall "fmpz_poly.h fmpz_poly_get_coeff_fmpz"+ fmpz_poly_get_coeff_fmpz :: Ptr CFmpz -> Ptr CFmpzPoly -> CLong -> IO ()++-- | /fmpz_poly_get_coeff_si/ /poly/ /n/ +--+-- Returns coefficient \(n\) of @poly@ as a @slong@. The result is+-- undefined if the value does not fit into a @slong@. Coefficient+-- numbering is from zero and if \(n\) is set to a value beyond the end of+-- the polynomial, zero is returned.+foreign import ccall "fmpz_poly.h fmpz_poly_get_coeff_si"+ fmpz_poly_get_coeff_si :: Ptr CFmpzPoly -> CLong -> IO CLong++-- | /fmpz_poly_get_coeff_ui/ /poly/ /n/ +--+-- Returns coefficient \(n\) of @poly@ as a @ulong@. The result is+-- undefined if the value does not fit into a @ulong@. Coefficient+-- numbering is from zero and if \(n\) is set to a value beyond the end of+-- the polynomial, zero is returned.+foreign import ccall "fmpz_poly.h fmpz_poly_get_coeff_ui"+ fmpz_poly_get_coeff_ui :: Ptr CFmpzPoly -> CLong -> IO CULong++-- -- | /fmpz_poly_get_coeff_ptr/ /poly/ /n/ +--+-- -- Returns a reference to the coefficient of \(x^n\) in the polynomial, as+-- -- an @fmpz *@. This function is provided so that individual coefficients+-- -- can be accessed and operated on by functions in the @fmpz@ module. This+-- -- function does not make a copy of the data, but returns a reference to+-- -- the actual coefficient.+-- -- +-- -- Returns @NULL@ when \(n\) exceeds the degree of the polynomial.+-- -- +-- -- This function is implemented as a macro.+-- foreign import ccall "fmpz_poly.h fmpz_poly_get_coeff_ptr"+-- fmpz_poly_get_coeff_ptr :: Ptr CFmpzPoly -> CLong -> IO (Ptr CFmpz)++-- -- | /fmpz_poly_lead/ /poly/ +--+-- -- Returns a reference to the leading coefficient of the polynomial, as an+-- -- @fmpz *@. This function is provided so that the leading coefficient can+-- -- be easily accessed and operated on by functions in the @fmpz@ module.+-- -- This function does not make a copy of the data, but returns a reference+-- -- to the actual coefficient.+-- -- +-- -- Returns @NULL@ when the polynomial is zero.+-- -- +-- -- This function is implemented as a macro.+-- foreign import ccall "fmpz_poly.h fmpz_poly_lead"+-- fmpz_poly_lead :: Ptr CFmpzPoly -> IO (Ptr CFmpz)++-- | /fmpz_poly_set_coeff_fmpz/ /poly/ /n/ /x/ +--+-- Sets coefficient \(n\) of @poly@ to the @fmpz@ value @x@. Coefficient+-- numbering starts from zero and if \(n\) is beyond the current length of+-- @poly@ then the polynomial is extended and zero coefficients inserted if+-- necessary.+foreign import ccall "fmpz_poly.h fmpz_poly_set_coeff_fmpz"+ fmpz_poly_set_coeff_fmpz :: Ptr CFmpzPoly -> CLong -> Ptr CFmpz -> IO ()++-- | /fmpz_poly_set_coeff_si/ /poly/ /n/ /x/ +--+-- Sets coefficient \(n\) of @poly@ to the @slong@ value @x@. Coefficient+-- numbering starts from zero and if \(n\) is beyond the current length of+-- @poly@ then the polynomial is extended and zero coefficients inserted if+-- necessary.+foreign import ccall "fmpz_poly.h fmpz_poly_set_coeff_si"+ fmpz_poly_set_coeff_si :: Ptr CFmpzPoly -> CLong -> CLong -> IO ()++-- | /fmpz_poly_set_coeff_ui/ /poly/ /n/ /x/ +--+-- Sets coefficient \(n\) of @poly@ to the @ulong@ value @x@. Coefficient+-- numbering starts from zero and if \(n\) is beyond the current length of+-- @poly@ then the polynomial is extended and zero coefficients inserted if+-- necessary.+foreign import ccall "fmpz_poly.h fmpz_poly_set_coeff_ui"+ fmpz_poly_set_coeff_ui :: Ptr CFmpzPoly -> CLong -> CULong -> IO ()++-- Comparison ------------------------------------------------------------------++-- | /fmpz_poly_equal/ /poly1/ /poly2/ +--+-- Returns \(1\) if @poly1@ is equal to @poly2@, otherwise returns \(0\).+-- The polynomials are assumed to be normalised.+foreign import ccall "fmpz_poly.h fmpz_poly_equal"+ fmpz_poly_equal :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO CInt++-- | /fmpz_poly_equal_trunc/ /poly1/ /poly2/ /n/ +--+-- Return \(1\) if @poly1@ and @poly2@, notionally truncated to length+-- \(n\) are equal, otherwise return \(0\).+foreign import ccall "fmpz_poly.h fmpz_poly_equal_trunc"+ fmpz_poly_equal_trunc :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO CInt++-- -- | /fmpz_poly_is_zero/ /poly/ +--+-- -- Returns \(1\) if the polynomial is zero and \(0\) otherwise.+-- -- +-- -- This function is implemented as a macro.+-- foreign import ccall "fmpz_poly.h fmpz_poly_is_zero"+-- fmpz_poly_is_zero :: Ptr CFmpzPoly -> IO CInt++-- | /fmpz_poly_is_one/ /poly/ +--+-- Returns \(1\) if the polynomial is one and \(0\) otherwise.+foreign import ccall "fmpz_poly.h fmpz_poly_is_one"+ fmpz_poly_is_one :: Ptr CFmpzPoly -> IO CInt++-- | /fmpz_poly_is_unit/ /poly/ +--+-- Returns \(1\) if the polynomial is the constant polynomial \(\pm 1\),+-- and \(0\) otherwise.+foreign import ccall "fmpz_poly.h fmpz_poly_is_unit"+ fmpz_poly_is_unit :: Ptr CFmpzPoly -> IO CInt++-- | /fmpz_poly_is_gen/ /poly/ +--+-- Returns \(1\) if the polynomial is the degree \(1\) polynomial \(x\),+-- and \(0\) otherwise.+foreign import ccall "fmpz_poly.h fmpz_poly_is_gen"+ fmpz_poly_is_gen :: Ptr CFmpzPoly -> IO CInt++-- Addition and subtraction ----------------------------------------------------++-- | /_fmpz_poly_add/ /res/ /poly1/ /len1/ /poly2/ /len2/ +--+-- Sets @res@ to the sum of @(poly1, len1)@ and @(poly2, len2)@. It is+-- assumed that @res@ has sufficient space for the longer of the two+-- polynomials.+foreign import ccall "fmpz_poly.h _fmpz_poly_add"+ _fmpz_poly_add :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> IO ()++-- | /fmpz_poly_add/ /res/ /poly1/ /poly2/ +--+-- Sets @res@ to the sum of @poly1@ and @poly2@.+foreign import ccall "fmpz_poly.h fmpz_poly_add"+ fmpz_poly_add :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()++-- | /fmpz_poly_add_series/ /res/ /poly1/ /poly2/ /n/ +--+-- Notionally truncate @poly1@ and @poly2@ to length \(n\) and then set+-- @res@ to the sum.+foreign import ccall "fmpz_poly.h fmpz_poly_add_series"+ fmpz_poly_add_series :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()++-- | /_fmpz_poly_sub/ /res/ /poly1/ /len1/ /poly2/ /len2/ +--+-- Sets @res@ to @(poly1, len1)@ minus @(poly2, len2)@. It is assumed that+-- @res@ has sufficient space for the longer of the two polynomials.+foreign import ccall "fmpz_poly.h _fmpz_poly_sub"+ _fmpz_poly_sub :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> IO ()++-- | /fmpz_poly_sub/ /res/ /poly1/ /poly2/ +--+-- Sets @res@ to @poly1@ minus @poly2@.+foreign import ccall "fmpz_poly.h fmpz_poly_sub"+ fmpz_poly_sub :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()++-- | /fmpz_poly_sub_series/ /res/ /poly1/ /poly2/ /n/ +--+-- Notionally truncate @poly1@ and @poly2@ to length \(n\) and then set+-- @res@ to the sum.+foreign import ccall "fmpz_poly.h fmpz_poly_sub_series"+ fmpz_poly_sub_series :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()++-- | /fmpz_poly_neg/ /res/ /poly/ +--+-- Sets @res@ to @-poly@.+foreign import ccall "fmpz_poly.h fmpz_poly_neg"+ fmpz_poly_neg :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()++-- Scalar absolute value, multiplication and division --------------------------++-- | /fmpz_poly_scalar_abs/ /res/ /poly/ +--+-- Sets @poly1@ to the polynomial whose coefficients are the absolute value+-- of those of @poly2@.+foreign import ccall "fmpz_poly.h fmpz_poly_scalar_abs"+ fmpz_poly_scalar_abs :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()++-- | /fmpz_poly_scalar_mul_fmpz/ /poly1/ /poly2/ /x/ +--+-- Sets @poly1@ to @poly2@ times \(x\).+foreign import ccall "fmpz_poly.h fmpz_poly_scalar_mul_fmpz"+ fmpz_poly_scalar_mul_fmpz :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpz -> IO ()++-- | /fmpz_poly_scalar_mul_si/ /poly1/ /poly2/ /x/ +--+-- Sets @poly1@ to @poly2@ times the signed @slong x@.+foreign import ccall "fmpz_poly.h fmpz_poly_scalar_mul_si"+ fmpz_poly_scalar_mul_si :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()++-- | /fmpz_poly_scalar_mul_ui/ /poly1/ /poly2/ /x/ +--+-- Sets @poly1@ to @poly2@ times the @ulong x@.+foreign import ccall "fmpz_poly.h fmpz_poly_scalar_mul_ui"+ fmpz_poly_scalar_mul_ui :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CULong -> IO ()++-- | /fmpz_poly_scalar_mul_2exp/ /poly1/ /poly2/ /exp/ +--+-- Sets @poly1@ to @poly2@ times @2^exp@.+foreign import ccall "fmpz_poly.h fmpz_poly_scalar_mul_2exp"+ fmpz_poly_scalar_mul_2exp :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CULong -> IO ()++-- | /fmpz_poly_scalar_addmul_si/ /poly1/ /poly2/ /x/ +--+foreign import ccall "fmpz_poly.h fmpz_poly_scalar_addmul_si"+ fmpz_poly_scalar_addmul_si :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()++-- | /fmpz_poly_scalar_addmul_ui/ /poly1/ /poly2/ /x/ +--+foreign import ccall "fmpz_poly.h fmpz_poly_scalar_addmul_ui"+ fmpz_poly_scalar_addmul_ui :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CULong -> IO ()++-- | /fmpz_poly_scalar_addmul_fmpz/ /poly1/ /poly2/ /x/ +--+-- Sets @poly1@ to @poly1 + x * poly2@.+foreign import ccall "fmpz_poly.h fmpz_poly_scalar_addmul_fmpz"+ fmpz_poly_scalar_addmul_fmpz :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpz -> IO ()++-- | /fmpz_poly_scalar_submul_fmpz/ /poly1/ /poly2/ /x/ +--+-- Sets @poly1@ to @poly1 - x * poly2@.+foreign import ccall "fmpz_poly.h fmpz_poly_scalar_submul_fmpz"+ fmpz_poly_scalar_submul_fmpz :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpz -> IO ()++-- | /fmpz_poly_scalar_fdiv_fmpz/ /poly1/ /poly2/ /x/ +--+-- Sets @poly1@ to @poly2@ divided by the @fmpz_t x@, rounding coefficients+-- down toward \(- \infty\).+foreign import ccall "fmpz_poly.h fmpz_poly_scalar_fdiv_fmpz"+ fmpz_poly_scalar_fdiv_fmpz :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpz -> IO ()++-- | /fmpz_poly_scalar_fdiv_si/ /poly1/ /poly2/ /x/ +--+-- Sets @poly1@ to @poly2@ divided by the @slong x@, rounding coefficients+-- down toward \(- \infty\).+foreign import ccall "fmpz_poly.h fmpz_poly_scalar_fdiv_si"+ fmpz_poly_scalar_fdiv_si :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()++-- | /fmpz_poly_scalar_fdiv_ui/ /poly1/ /poly2/ /x/ +--+-- Sets @poly1@ to @poly2@ divided by the @ulong x@, rounding coefficients+-- down toward \(- \infty\).+foreign import ccall "fmpz_poly.h fmpz_poly_scalar_fdiv_ui"+ fmpz_poly_scalar_fdiv_ui :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CULong -> IO ()++-- | /fmpz_poly_scalar_fdiv_2exp/ /poly1/ /poly2/ /x/ +--+-- Sets @poly1@ to @poly2@ divided by @2^x@, rounding coefficients down+-- toward \(- \infty\).+foreign import ccall "fmpz_poly.h fmpz_poly_scalar_fdiv_2exp"+ fmpz_poly_scalar_fdiv_2exp :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CULong -> IO ()++-- | /fmpz_poly_scalar_tdiv_fmpz/ /poly1/ /poly2/ /x/ +--+-- Sets @poly1@ to @poly2@ divided by the @fmpz_t x@, rounding coefficients+-- toward \(0\).+foreign import ccall "fmpz_poly.h fmpz_poly_scalar_tdiv_fmpz"+ fmpz_poly_scalar_tdiv_fmpz :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpz -> IO ()++-- | /fmpz_poly_scalar_tdiv_si/ /poly1/ /poly2/ /x/ +--+-- Sets @poly1@ to @poly2@ divided by the @slong x@, rounding coefficients+-- toward \(0\).+foreign import ccall "fmpz_poly.h fmpz_poly_scalar_tdiv_si"+ fmpz_poly_scalar_tdiv_si :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()++-- | /fmpz_poly_scalar_tdiv_ui/ /poly1/ /poly2/ /x/ +--+-- Sets @poly1@ to @poly2@ divided by the @ulong x@, rounding coefficients+-- toward \(0\).+foreign import ccall "fmpz_poly.h fmpz_poly_scalar_tdiv_ui"+ fmpz_poly_scalar_tdiv_ui :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CULong -> IO ()++-- | /fmpz_poly_scalar_tdiv_2exp/ /poly1/ /poly2/ /x/ +--+-- Sets @poly1@ to @poly2@ divided by @2^x@, rounding coefficients toward+-- \(0\).+foreign import ccall "fmpz_poly.h fmpz_poly_scalar_tdiv_2exp"+ fmpz_poly_scalar_tdiv_2exp :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CULong -> IO ()++-- | /fmpz_poly_scalar_divexact_fmpz/ /poly1/ /poly2/ /x/ +--+-- Sets @poly1@ to @poly2@ divided by the @fmpz_t x@, assuming the division+-- is exact for every coefficient.+foreign import ccall "fmpz_poly.h fmpz_poly_scalar_divexact_fmpz"+ fmpz_poly_scalar_divexact_fmpz :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpz -> IO ()++-- | /fmpz_poly_scalar_divexact_si/ /poly1/ /poly2/ /x/ +--+-- Sets @poly1@ to @poly2@ divided by the @slong x@, assuming the+-- coefficient is exact for every coefficient.+foreign import ccall "fmpz_poly.h fmpz_poly_scalar_divexact_si"+ fmpz_poly_scalar_divexact_si :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()++-- | /fmpz_poly_scalar_divexact_ui/ /poly1/ /poly2/ /x/ +--+-- Sets @poly1@ to @poly2@ divided by the @ulong x@, assuming the+-- coefficient is exact for every coefficient.+foreign import ccall "fmpz_poly.h fmpz_poly_scalar_divexact_ui"+ fmpz_poly_scalar_divexact_ui :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CULong -> IO ()++-- | /fmpz_poly_scalar_mod_fmpz/ /poly1/ /poly2/ /p/ +--+-- Sets @poly1@ to @poly2@, reducing each coefficient modulo \(p > 0\).+foreign import ccall "fmpz_poly.h fmpz_poly_scalar_mod_fmpz"+ fmpz_poly_scalar_mod_fmpz :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpz -> IO ()++-- | /fmpz_poly_scalar_smod_fmpz/ /poly1/ /poly2/ /p/ +--+-- Sets @poly1@ to @poly2@, symmetrically reducing each coefficient modulo+-- \(p > 0\), that is, choosing the unique representative in the interval+-- \((-p/2, p/2]\).+foreign import ccall "fmpz_poly.h fmpz_poly_scalar_smod_fmpz"+ fmpz_poly_scalar_smod_fmpz :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpz -> IO ()++-- | /_fmpz_poly_remove_content_2exp/ /pol/ /len/ +--+-- Remove the 2-content of @pol@ and return the number \(k\) that is the+-- maximal non-negative integer so that \(2^k\) divides all coefficients of+-- the polynomial. For the zero polynomial, \(0\) is returned.+foreign import ccall "fmpz_poly.h _fmpz_poly_remove_content_2exp"+ _fmpz_poly_remove_content_2exp :: Ptr CFmpz -> CLong -> IO CLong++-- | /_fmpz_poly_scale_2exp/ /pol/ /len/ /k/ +--+-- Scale @(pol, len)@ to \(p(2^k X)\) in-place and divide by the 2-content+-- (so that the gcd of coefficients is odd). If @k@ is negative the+-- polynomial is multiplied by \(2^{kd}\).+foreign import ccall "fmpz_poly.h _fmpz_poly_scale_2exp"+ _fmpz_poly_scale_2exp :: Ptr CFmpz -> CLong -> CLong -> IO ()++-- Bit packing -----------------------------------------------------------------++-- | /_fmpz_poly_bit_pack/ /arr/ /poly/ /len/ /bit_size/ /negate/ +--+-- Packs the coefficients of @poly@ into bitfields of the given @bit_size@,+-- negating the coefficients before packing if @negate@ is set to \(-1\).+foreign import ccall "fmpz_poly.h _fmpz_poly_bit_pack"+ _fmpz_poly_bit_pack :: Ptr CMp -> Ptr CFmpz -> CLong -> CFBitCnt -> CInt -> IO ()++-- | /_fmpz_poly_bit_unpack/ /poly/ /len/ /arr/ /bit_size/ /negate/ +--+-- Unpacks the polynomial of given length from the array as packed into+-- fields of the given @bit_size@, finally negating the coefficients if+-- @negate@ is set to \(-1\). Returns borrow, which is nonzero if a leading+-- term with coefficient \(\pm1\) should be added at position @len@ of+-- @poly@.+foreign import ccall "fmpz_poly.h _fmpz_poly_bit_unpack"+ _fmpz_poly_bit_unpack :: Ptr CFmpz -> CLong -> Ptr CMp -> CFBitCnt -> CInt -> IO CInt++-- | /_fmpz_poly_bit_unpack_unsigned/ /poly/ /len/ /arr/ /bit_size/ +--+-- Unpacks the polynomial of given length from the array as packed into+-- fields of the given @bit_size@. The coefficients are assumed to be+-- unsigned.+foreign import ccall "fmpz_poly.h _fmpz_poly_bit_unpack_unsigned"+ _fmpz_poly_bit_unpack_unsigned :: Ptr CFmpz -> CLong -> Ptr CMp -> CFBitCnt -> IO ()++-- | /fmpz_poly_bit_pack/ /f/ /poly/ /bit_size/ +--+-- Packs @poly@ into bitfields of size @bit_size@, writing the result to+-- @f@. The sign of @f@ will be the same as that of the leading coefficient+-- of @poly@.+foreign import ccall "fmpz_poly.h fmpz_poly_bit_pack"+ fmpz_poly_bit_pack :: Ptr CFmpz -> Ptr CFmpzPoly -> CFBitCnt -> IO ()++-- | /fmpz_poly_bit_unpack/ /poly/ /f/ /bit_size/ +--+-- Unpacks the polynomial with signed coefficients packed into fields of+-- size @bit_size@ as represented by the integer @f@.+foreign import ccall "fmpz_poly.h fmpz_poly_bit_unpack"+ fmpz_poly_bit_unpack :: Ptr CFmpzPoly -> Ptr CFmpz -> CFBitCnt -> IO ()++-- | /fmpz_poly_bit_unpack_unsigned/ /poly/ /f/ /bit_size/ +--+-- Unpacks the polynomial with unsigned coefficients packed into fields of+-- size @bit_size@ as represented by the integer @f@. It is required that+-- @f@ is nonnegative.+foreign import ccall "fmpz_poly.h fmpz_poly_bit_unpack_unsigned"+ fmpz_poly_bit_unpack_unsigned :: Ptr CFmpzPoly -> Ptr CFmpz -> CFBitCnt -> IO ()++-- Multiplication --------------------------------------------------------------++-- | /_fmpz_poly_mul_classical/ /res/ /poly1/ /len1/ /poly2/ /len2/ +--+-- Sets @(res, len1 + len2 - 1)@ to the product of @(poly1, len1)@ and+-- @(poly2, len2)@.+-- +-- Assumes @len1@ and @len2@ are positive. Allows zero-padding of the two+-- input polynomials. No aliasing of inputs with outputs is allowed.+foreign import ccall "fmpz_poly.h _fmpz_poly_mul_classical"+ _fmpz_poly_mul_classical :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> IO ()++-- | /fmpz_poly_mul_classical/ /res/ /poly1/ /poly2/ +--+-- Sets @res@ to the product of @poly1@ and @poly2@, computed using the+-- classical or schoolbook method.+foreign import ccall "fmpz_poly.h fmpz_poly_mul_classical"+ fmpz_poly_mul_classical :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()++-- | /_fmpz_poly_mullow_classical/ /res/ /poly1/ /len1/ /poly2/ /len2/ /n/ +--+-- Sets @(res, n)@ to the first \(n\) coefficients of @(poly1, len1)@+-- multiplied by @(poly2, len2)@.+-- +-- Assumes @0 \< n \<= len1 + len2 - 1@. Assumes neither @len1@ nor @len2@+-- is zero.+foreign import ccall "fmpz_poly.h _fmpz_poly_mullow_classical"+ _fmpz_poly_mullow_classical :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> CLong -> IO ()++-- | /fmpz_poly_mullow_classical/ /res/ /poly1/ /poly2/ /n/ +--+-- Sets @res@ to the first \(n\) coefficients of @poly1 * poly2@.+foreign import ccall "fmpz_poly.h fmpz_poly_mullow_classical"+ fmpz_poly_mullow_classical :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()++-- | /_fmpz_poly_mulhigh_classical/ /res/ /poly1/ /len1/ /poly2/ /len2/ /start/ +--+-- Sets the first @start@ coefficients of @res@ to zero and the remainder+-- to the corresponding coefficients of @(poly1, len1) * (poly2, len2)@.+-- +-- Assumes @start \<= len1 + len2 - 1@. Assumes neither @len1@ nor @len2@+-- is zero.+foreign import ccall "fmpz_poly.h _fmpz_poly_mulhigh_classical"+ _fmpz_poly_mulhigh_classical :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> CLong -> IO ()++-- | /fmpz_poly_mulhigh_classical/ /res/ /poly1/ /poly2/ /start/ +--+-- Sets the first @start@ coefficients of @res@ to zero and the remainder+-- to the corresponding coefficients of the product of @poly1@ and @poly2@.+foreign import ccall "fmpz_poly.h fmpz_poly_mulhigh_classical"+ fmpz_poly_mulhigh_classical :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()++-- | /_fmpz_poly_mulmid_classical/ /res/ /poly1/ /len1/ /poly2/ /len2/ +--+-- Sets @res@ to the middle @len1 - len2 + 1@ coefficients of the product+-- of @(poly1, len1)@ and @(poly2, len2)@, i.e. the coefficients from+-- degree @len2 - 1@ to @len1 - 1@ inclusive. Assumes that+-- @len1 >= len2 > 0@.+foreign import ccall "fmpz_poly.h _fmpz_poly_mulmid_classical"+ _fmpz_poly_mulmid_classical :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> IO ()++-- | /fmpz_poly_mulmid_classical/ /res/ /poly1/ /poly2/ +--+-- Sets @res@ to the middle @len(poly1) - len(poly2) + 1@ coefficients of+-- @poly1 * poly2@, i.e. the coefficient from degree @len2 - 1@ to+-- @len1 - 1@ inclusive. Assumes that @len1 >= len2@.+foreign import ccall "fmpz_poly.h fmpz_poly_mulmid_classical"+ fmpz_poly_mulmid_classical :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()++-- | /_fmpz_poly_mul_karatsuba/ /res/ /poly1/ /len1/ /poly2/ /len2/ +--+-- Sets @(res, len1 + len2 - 1)@ to the product of @(poly1, len1)@ and+-- @(poly2, len2)@. Assumes @len1 >= len2 > 0@. Allows zero-padding of the+-- two input polynomials. No aliasing of inputs with outputs is allowed.+foreign import ccall "fmpz_poly.h _fmpz_poly_mul_karatsuba"+ _fmpz_poly_mul_karatsuba :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> IO ()++-- | /fmpz_poly_mul_karatsuba/ /res/ /poly1/ /poly2/ +--+-- Sets @res@ to the product of @poly1@ and @poly2@.+foreign import ccall "fmpz_poly.h fmpz_poly_mul_karatsuba"+ fmpz_poly_mul_karatsuba :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()++-- | /_fmpz_poly_mullow_karatsuba_n/ /res/ /poly1/ /poly2/ /n/ +--+-- Sets @res@ to the product of @poly1@ and @poly2@ and truncates to the+-- given length. It is assumed that @poly1@ and @poly2@ are precisely the+-- given length, possibly zero padded. Assumes \(n\) is not zero.+foreign import ccall "fmpz_poly.h _fmpz_poly_mullow_karatsuba_n"+ _fmpz_poly_mullow_karatsuba_n :: Ptr CFmpz -> Ptr CFmpz -> Ptr CFmpz -> CLong -> IO ()++-- | /fmpz_poly_mullow_karatsuba_n/ /res/ /poly1/ /poly2/ /n/ +--+-- Sets @res@ to the product of @poly1@ and @poly2@ and truncates to the+-- given length.+foreign import ccall "fmpz_poly.h fmpz_poly_mullow_karatsuba_n"+ fmpz_poly_mullow_karatsuba_n :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()++-- | /_fmpz_poly_mulhigh_karatsuba_n/ /res/ /poly1/ /poly2/ /len/ +--+-- Sets @res@ to the product of @poly1@ and @poly2@ and truncates at the+-- top to the given length. The first @len - 1@ coefficients are set to+-- zero. It is assumed that @poly1@ and @poly2@ are precisely the given+-- length, possibly zero padded. Assumes @len@ is not zero.+foreign import ccall "fmpz_poly.h _fmpz_poly_mulhigh_karatsuba_n"+ _fmpz_poly_mulhigh_karatsuba_n :: Ptr CFmpz -> Ptr CFmpz -> Ptr CFmpz -> CLong -> IO ()++-- | /fmpz_poly_mulhigh_karatsuba_n/ /res/ /poly1/ /poly2/ /len/ +--+-- Sets the first @len - 1@ coefficients of the result to zero and the+-- remaining coefficients to the corresponding coefficients of the product+-- of @poly1@ and @poly2@. Assumes @poly1@ and @poly2@ are at most of the+-- given length.+foreign import ccall "fmpz_poly.h fmpz_poly_mulhigh_karatsuba_n"+ fmpz_poly_mulhigh_karatsuba_n :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()++-- | /_fmpz_poly_mul_KS/ /res/ /poly1/ /len1/ /poly2/ /len2/ +--+-- Sets @(res, len1 + len2 - 1)@ to the product of @(poly1, len1)@ and+-- @(poly2, len2)@.+-- +-- Places no assumptions on @len1@ and @len2@. Allows zero-padding of the+-- two input polynomials. Supports aliasing of inputs and outputs.+foreign import ccall "fmpz_poly.h _fmpz_poly_mul_KS"+ _fmpz_poly_mul_KS :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> IO ()++-- | /fmpz_poly_mul_KS/ /res/ /poly1/ /poly2/ +--+-- Sets @res@ to the product of @poly1@ and @poly2@.+foreign import ccall "fmpz_poly.h fmpz_poly_mul_KS"+ fmpz_poly_mul_KS :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()++-- | /_fmpz_poly_mullow_KS/ /res/ /poly1/ /len1/ /poly2/ /len2/ /n/ +--+-- Sets @(res, n)@ to the lowest \(n\) coefficients of the product of+-- @(poly1, len1)@ and @(poly2, len2)@.+-- +-- Assumes that @len1@ and @len2@ are positive, but does allow for the+-- polynomials to be zero-padded. The polynomials may be zero, too. Assumes+-- \(n\) is positive. Supports aliasing between @res@, @poly1@ and @poly2@.+foreign import ccall "fmpz_poly.h _fmpz_poly_mullow_KS"+ _fmpz_poly_mullow_KS :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> CLong -> IO ()++-- | /fmpz_poly_mullow_KS/ /res/ /poly1/ /poly2/ /n/ +--+-- Sets @res@ to the lowest \(n\) coefficients of the product of @poly1@+-- and @poly2@.+foreign import ccall "fmpz_poly.h fmpz_poly_mullow_KS"+ fmpz_poly_mullow_KS :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()++-- | /_fmpz_poly_mul_SS/ /output/ /input1/ /length1/ /input2/ /length2/ +--+-- Sets @(output, length1 + length2 - 1)@ to the product of+-- @(input1, length1)@ and @(input2, length2)@.+-- +-- We must have @len1 > 1@ and @len2 > 1@. Allows zero-padding of the two+-- input polynomials. Supports aliasing of inputs and outputs.+foreign import ccall "fmpz_poly.h _fmpz_poly_mul_SS"+ _fmpz_poly_mul_SS :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> IO ()++-- | /fmpz_poly_mul_SS/ /res/ /poly1/ /poly2/ +--+-- Sets @res@ to the product of @poly1@ and @poly2@. Uses the+-- Schönhage-Strassen algorithm.+foreign import ccall "fmpz_poly.h fmpz_poly_mul_SS"+ fmpz_poly_mul_SS :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()++-- | /_fmpz_poly_mullow_SS/ /output/ /input1/ /length1/ /input2/ /length2/ /n/ +--+-- Sets @(res, n)@ to the lowest \(n\) coefficients of the product of+-- @(poly1, len1)@ and @(poly2, len2)@.+-- +-- Assumes that @len1@ and @len2@ are positive, but does allow for the+-- polynomials to be zero-padded. We must have @len1 > 1@ and @len2 > 1@.+-- Assumes \(n\) is positive. Supports aliasing between @res@, @poly1@ and+-- @poly2@.+foreign import ccall "fmpz_poly.h _fmpz_poly_mullow_SS"+ _fmpz_poly_mullow_SS :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> CLong -> IO ()++-- | /fmpz_poly_mullow_SS/ /res/ /poly1/ /poly2/ /n/ +--+-- Sets @res@ to the lowest \(n\) coefficients of the product of @poly1@+-- and @poly2@.+foreign import ccall "fmpz_poly.h fmpz_poly_mullow_SS"+ fmpz_poly_mullow_SS :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()++-- | /_fmpz_poly_mul/ /res/ /poly1/ /len1/ /poly2/ /len2/ +--+-- Sets @(res, len1 + len2 - 1)@ to the product of @(poly1, len1)@ and+-- @(poly2, len2)@. Assumes @len1 >= len2 > 0@. Allows zero-padding of the+-- two input polynomials. Does not support aliasing between the inputs and+-- the output.+foreign import ccall "fmpz_poly.h _fmpz_poly_mul"+ _fmpz_poly_mul :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> IO ()++-- | /fmpz_poly_mul/ /res/ /poly1/ /poly2/ +--+-- Sets @res@ to the product of @poly1@ and @poly2@. Chooses an optimal+-- algorithm from the choices above.+foreign import ccall "fmpz_poly.h fmpz_poly_mul"+ fmpz_poly_mul :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()++-- | /_fmpz_poly_mullow/ /res/ /poly1/ /len1/ /poly2/ /len2/ /n/ +--+-- Sets @(res, n)@ to the lowest \(n\) coefficients of the product of+-- @(poly1, len1)@ and @(poly2, len2)@.+-- +-- Assumes @len1 >= len2 > 0@ and @0 \< n \<= len1 + len2 - 1@. Allows for+-- zero-padding in the inputs. Does not support aliasing between the inputs+-- and the output.+foreign import ccall "fmpz_poly.h _fmpz_poly_mullow"+ _fmpz_poly_mullow :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> CLong -> IO ()++-- | /fmpz_poly_mullow/ /res/ /poly1/ /poly2/ /n/ +--+-- Sets @res@ to the lowest \(n\) coefficients of the product of @poly1@+-- and @poly2@.+foreign import ccall "fmpz_poly.h fmpz_poly_mullow"+ fmpz_poly_mullow :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()++-- | /fmpz_poly_mulhigh_n/ /res/ /poly1/ /poly2/ /n/ +--+-- Sets the high \(n\) coefficients of @res@ to the high \(n\) coefficients+-- of the product of @poly1@ and @poly2@, assuming the latter are precisely+-- \(n\) coefficients in length, zero padded if necessary. The remaining+-- \(n - 1\) coefficients may be arbitrary.+foreign import ccall "fmpz_poly.h fmpz_poly_mulhigh_n"+ fmpz_poly_mulhigh_n :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()++-- | /_fmpz_poly_mulhigh/ /res/ /poly1/ /len1/ /poly2/ /len2/ /start/ +--+-- Sets all but the low \(n\) coefficients of \(res\) to the corresponding+-- coefficients of the product of \(poly1\) of length \(len1\) and+-- \(poly2\) of length \(len2\), the remaining coefficients being+-- arbitrary. It is assumed that \(len1 >= len2 > 0\) and that+-- \(0 < n < len1 + len2 - 1\). Aliasing of inputs is not permitted.+foreign import ccall "fmpz_poly.h _fmpz_poly_mulhigh"+ _fmpz_poly_mulhigh :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> CLong -> IO ()++-- FFT precached multiplication ------------------------------------------------++-- | /fmpz_poly_mul_SS_precache_init/ /pre/ /len1/ /bits1/ /poly2/ +--+-- Precompute the FFT of @poly2@ to enable repeated multiplication of+-- @poly2@ by polynomials whose length does not exceed @len1@ and whose+-- number of bits per coefficient does not exceed @bits1@.+-- +-- The value @bits1@ may be negative, i.e. it may be the result of calling+-- @fmpz_poly_max_bits@. The function only considers the absolute value of+-- @bits1@.+-- +-- Suppose @len2@ is the length of @poly2@ and @len = len1 + len2 - 1@ is+-- the maximum output length of a polynomial multiplication using @pre@.+-- Then internally @len@ is rounded up to a power of two, \(2^n\) say. The+-- truncated FFT algorithm is used to smooth performance but note that it+-- can only do this in the range \((2^{n-1}, 2^n]\). Therefore, it may be+-- more efficient to recompute \(pre\) for cases where the output length+-- will fall below \(2^{n-1} + 1\). Otherwise the implementation will zero+-- pad them up to that length.+-- +-- Note that the Schoenhage-Strassen algorithm is only efficient for+-- polynomials with relatively large coefficients relative to the length of+-- the polynomials.+-- +-- Also note that there are no restrictions on the polynomials. In+-- particular the polynomial whose FFT is being precached does not have to+-- be either longer or shorter than the polynomials it is to be multiplied+-- by.+foreign import ccall "fmpz_poly.h fmpz_poly_mul_SS_precache_init"+ fmpz_poly_mul_SS_precache_init :: Ptr CFmpzPolyMulPrecache -> CLong -> CLong -> Ptr CFmpzPoly -> IO ()++-- | /fmpz_poly_mul_precache_clear/ /pre/ +--+-- Clear the space allocated by @fmpz_poly_mul_SS_precache_init@.+foreign import ccall "fmpz_poly.h fmpz_poly_mul_precache_clear"+ fmpz_poly_mul_precache_clear :: Ptr CFmpzPolyMulPrecache -> IO ()++-- | /_fmpz_poly_mullow_SS_precache/ /output/ /input1/ /len1/ /pre/ /trunc/ +--+-- Write into @output@ the first @trunc@ coefficients of the polynomial+-- @(input1, len1)@ by the polynomial whose FFT was precached by+-- @fmpz_poly_mul_SS_precache_init@ and stored in @pre@.+-- +-- For performance reasons it is recommended that all polynomials be+-- truncated to at most @trunc@ coefficients if possible.+foreign import ccall "fmpz_poly.h _fmpz_poly_mullow_SS_precache"+ _fmpz_poly_mullow_SS_precache :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpzPolyMulPrecache -> CLong -> IO ()++-- | /fmpz_poly_mullow_SS_precache/ /res/ /poly1/ /pre/ /n/ +--+-- Set @res@ to the product of @poly1@ by the polynomial whose FFT was+-- precached by @fmpz_poly_mul_SS_precache_init@ (and stored in pre). The+-- result is truncated to \(n\) coefficients (and normalised).+-- +-- There are no restrictions on the length of @poly1@ other than those+-- given in the call to @fmpz_poly_mul_SS_precache_init@.+foreign import ccall "fmpz_poly.h fmpz_poly_mullow_SS_precache"+ fmpz_poly_mullow_SS_precache :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPolyMulPrecache -> CLong -> IO ()++-- | /fmpz_poly_mul_SS_precache/ /res/ /poly1/ /pre/ +--+-- Set @res@ to the product of @poly1@ by the polynomial whose FFT was+-- precached by @fmpz_poly_mul_SS_precache_init@ (and stored in pre).+-- +-- There are no restrictions on the length of @poly1@ other than those+-- given in the call to @fmpz_poly_mul_SS_precache_init@.+foreign import ccall "fmpz_poly.h fmpz_poly_mul_SS_precache"+ fmpz_poly_mul_SS_precache :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPolyMulPrecache -> IO ()++-- Squaring --------------------------------------------------------------------++-- | /_fmpz_poly_sqr_KS/ /rop/ /op/ /len/ +--+-- Sets @(rop, 2*len - 1)@ to the square of @(op, len)@, assuming that+-- @len > 0@.+-- +-- Supports zero-padding in @(op, len)@. Does not support aliasing.+foreign import ccall "fmpz_poly.h _fmpz_poly_sqr_KS"+ _fmpz_poly_sqr_KS :: Ptr CFmpz -> Ptr CFmpz -> CLong -> IO ()++-- | /fmpz_poly_sqr_KS/ /rop/ /op/ +--+-- Sets @rop@ to the square of the polynomial @op@ using Kronecker+-- segmentation.+foreign import ccall "fmpz_poly.h fmpz_poly_sqr_KS"+ fmpz_poly_sqr_KS :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()++-- | /_fmpz_poly_sqr_karatsuba/ /rop/ /op/ /len/ +--+-- Sets @(rop, 2*len - 1)@ to the square of @(op, len)@, assuming that+-- @len > 0@.+-- +-- Supports zero-padding in @(op, len)@. Does not support aliasing.+foreign import ccall "fmpz_poly.h _fmpz_poly_sqr_karatsuba"+ _fmpz_poly_sqr_karatsuba :: Ptr CFmpz -> Ptr CFmpz -> CLong -> IO ()++-- | /fmpz_poly_sqr_karatsuba/ /rop/ /op/ +--+-- Sets @rop@ to the square of the polynomial @op@ using the Karatsuba+-- multiplication algorithm.+foreign import ccall "fmpz_poly.h fmpz_poly_sqr_karatsuba"+ fmpz_poly_sqr_karatsuba :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()++-- | /_fmpz_poly_sqr_classical/ /rop/ /op/ /len/ +--+-- Sets @(rop, 2*len - 1)@ to the square of @(op, len)@, assuming that+-- @len > 0@.+-- +-- Supports zero-padding in @(op, len)@. Does not support aliasing.+foreign import ccall "fmpz_poly.h _fmpz_poly_sqr_classical"+ _fmpz_poly_sqr_classical :: Ptr CFmpz -> Ptr CFmpz -> CLong -> IO ()++-- | /fmpz_poly_sqr_classical/ /rop/ /op/ +--+-- Sets @rop@ to the square of the polynomial @op@ using the classical or+-- schoolbook method.+foreign import ccall "fmpz_poly.h fmpz_poly_sqr_classical"+ fmpz_poly_sqr_classical :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()++-- | /_fmpz_poly_sqr/ /rop/ /op/ /len/ +--+-- Sets @(rop, 2*len - 1)@ to the square of @(op, len)@, assuming that+-- @len > 0@.+-- +-- Supports zero-padding in @(op, len)@. Does not support aliasing.+foreign import ccall "fmpz_poly.h _fmpz_poly_sqr"+ _fmpz_poly_sqr :: Ptr CFmpz -> Ptr CFmpz -> CLong -> IO ()++-- | /fmpz_poly_sqr/ /rop/ /op/ +--+-- Sets @rop@ to the square of the polynomial @op@.+foreign import ccall "fmpz_poly.h fmpz_poly_sqr"+ fmpz_poly_sqr :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()++-- | /_fmpz_poly_sqrlow_KS/ /res/ /poly/ /len/ /n/ +--+-- Sets @(res, n)@ to the lowest \(n\) coefficients of the square of+-- @(poly, len)@.+-- +-- Assumes that @len@ is positive, but does allow for the polynomial to be+-- zero-padded. The polynomial may be zero, too. Assumes \(n\) is positive.+-- Supports aliasing between @res@ and @poly@.+foreign import ccall "fmpz_poly.h _fmpz_poly_sqrlow_KS"+ _fmpz_poly_sqrlow_KS :: Ptr CFmpz -> Ptr CFmpz -> CLong -> CLong -> IO ()++-- | /fmpz_poly_sqrlow_KS/ /res/ /poly/ /n/ +--+-- Sets @res@ to the lowest \(n\) coefficients of the square of @poly@.+foreign import ccall "fmpz_poly.h fmpz_poly_sqrlow_KS"+ fmpz_poly_sqrlow_KS :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()++-- | /_fmpz_poly_sqrlow_karatsuba_n/ /res/ /poly/ /n/ +--+-- Sets @(res, n)@ to the square of @(poly, n)@ truncated to length \(n\),+-- which is assumed to be positive. Allows for @poly@ to be zero-padded.+foreign import ccall "fmpz_poly.h _fmpz_poly_sqrlow_karatsuba_n"+ _fmpz_poly_sqrlow_karatsuba_n :: Ptr CFmpz -> Ptr CFmpz -> CLong -> IO ()++-- | /fmpz_poly_sqrlow_karatsuba_n/ /res/ /poly/ /n/ +--+-- Sets @res@ to the square of @poly@ and truncates to the given length.+foreign import ccall "fmpz_poly.h fmpz_poly_sqrlow_karatsuba_n"+ fmpz_poly_sqrlow_karatsuba_n :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()++-- | /_fmpz_poly_sqrlow_classical/ /res/ /poly/ /len/ /n/ +--+-- Sets @(res, n)@ to the first \(n\) coefficients of the square of+-- @(poly, len)@.+-- +-- Assumes that @0 \< n \<= 2 * len - 1@.+foreign import ccall "fmpz_poly.h _fmpz_poly_sqrlow_classical"+ _fmpz_poly_sqrlow_classical :: Ptr CFmpz -> Ptr CFmpz -> CLong -> CLong -> IO ()++-- | /fmpz_poly_sqrlow_classical/ /res/ /poly/ /n/ +--+-- Sets @res@ to the first \(n\) coefficients of the square of @poly@.+foreign import ccall "fmpz_poly.h fmpz_poly_sqrlow_classical"+ fmpz_poly_sqrlow_classical :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()++-- | /_fmpz_poly_sqrlow/ /res/ /poly/ /len/ /n/ +--+-- Sets @(res, n)@ to the lowest \(n\) coefficients of the square of+-- @(poly, len)@.+-- +-- Assumes @len1 >= len2 > 0@ and @0 \< n \<= 2 * len - 1@. Allows for+-- zero-padding in the input. Does not support aliasing between the input+-- and the output.+foreign import ccall "fmpz_poly.h _fmpz_poly_sqrlow"+ _fmpz_poly_sqrlow :: Ptr CFmpz -> Ptr CFmpz -> CLong -> CLong -> IO ()++-- | /fmpz_poly_sqrlow/ /res/ /poly/ /n/ +--+-- Sets @res@ to the lowest \(n\) coefficients of the square of @poly@.+foreign import ccall "fmpz_poly.h fmpz_poly_sqrlow"+ fmpz_poly_sqrlow :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()++-- Powering --------------------------------------------------------------------++-- | /_fmpz_poly_pow_multinomial/ /res/ /poly/ /len/ /e/ +--+-- Computes @res = poly^e@. This uses the J.C.P. Miller pure recurrence as+-- follows:+-- +-- If \(\ell\) is the index of the lowest non-zero coefficient in @poly@,+-- as a first step this method zeros out the lowest \(e \ell\) coefficients+-- of @res@. The recurrence above is then used to compute the remaining+-- coefficients.+-- +-- Assumes @len > 0@, @e > 0@. Does not support aliasing.+foreign import ccall "fmpz_poly.h _fmpz_poly_pow_multinomial"+ _fmpz_poly_pow_multinomial :: Ptr CFmpz -> Ptr CFmpz -> CLong -> CULong -> IO ()++-- | /fmpz_poly_pow_multinomial/ /res/ /poly/ /e/ +--+-- Computes @res = poly^e@ using a generalisation of binomial expansion+-- called the J.C.P. Miller pure recurrence [1], [2]. If \(e\) is zero,+-- returns one, so that in particular @0^0 = 1@.+-- +-- The formal statement of the recurrence is as follows. Write the input+-- polynomial as \(P(x) = p_0 + p_1 x + \dotsb + p_m x^m\) with+-- \(p_0 \neq 0\) and let+-- +-- \[`\]+-- \[P(x)^n = a(n, 0) + a(n, 1) x + \dotsb + a(n, mn) x^{mn}.\]+-- +-- Then \(a(n, 0) = p_0^n\) and, for all \(1 \leq k \leq mn\),+-- +-- \[`\]+-- \[a(n, k) =+-- (k p_0)^{-1} \sum_{i = 1}^m p_i \bigl( (n + 1) i - k \bigr) a(n, k-i).\]+-- +-- [1] D. Knuth, The Art of Computer Programming Vol. 2, Seminumerical+-- Algorithms, Third Edition (Reading, Massachusetts: Addison-Wesley, 1997)+-- +-- [2] D. Zeilberger, The J.C.P. Miller Recurrence for Exponentiating a+-- Polynomial, and its q-Analog, Journal of Difference Equations and+-- Applications, 1995, Vol. 1, pp. 57--60+foreign import ccall "fmpz_poly.h fmpz_poly_pow_multinomial"+ fmpz_poly_pow_multinomial :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CULong -> IO ()++-- | /_fmpz_poly_pow_binomial/ /res/ /poly/ /e/ +--+-- Computes @res = poly^e@ when poly is of length 2, using binomial+-- expansion.+-- +-- Assumes \(e > 0\). Does not support aliasing.+foreign import ccall "fmpz_poly.h _fmpz_poly_pow_binomial"+ _fmpz_poly_pow_binomial :: Ptr CFmpz -> Ptr CFmpz -> CULong -> IO ()++-- | /fmpz_poly_pow_binomial/ /res/ /poly/ /e/ +--+-- Computes @res = poly^e@ when @poly@ is of length \(2\), using binomial+-- expansion.+-- +-- If the length of @poly@ is not \(2\), raises an exception and aborts.+foreign import ccall "fmpz_poly.h fmpz_poly_pow_binomial"+ fmpz_poly_pow_binomial :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CULong -> IO ()++-- | /_fmpz_poly_pow_addchains/ /res/ /poly/ /len/ /a/ /n/ +--+-- Given a star chain \(1 = a_0 < a_1 < \dotsb < a_n = e\) computes+-- @res = poly^e@.+-- +-- A star chain is an addition chain \(1 = a_0 < a_1 < \dotsb < a_n\) such+-- that, for all \(i > 0\), \(a_i = a_{i-1} + a_j\) for some \(j < i\).+-- +-- Assumes that \(e > 2\), or equivalently \(n > 1\), and @len > 0@. Does+-- not support aliasing.+foreign import ccall "fmpz_poly.h _fmpz_poly_pow_addchains"+ _fmpz_poly_pow_addchains :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CInt -> CInt -> IO ()++-- | /fmpz_poly_pow_addchains/ /res/ /poly/ /e/ +--+-- Computes @res = poly^e@ using addition chains whenever+-- \(0 \leq e \leq 148\).+-- +-- If \(e > 148\), raises an exception and aborts.+foreign import ccall "fmpz_poly.h fmpz_poly_pow_addchains"+ fmpz_poly_pow_addchains :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CULong -> IO ()++-- | /_fmpz_poly_pow_binexp/ /res/ /poly/ /len/ /e/ +--+-- Sets @res = poly^e@ using left-to-right binary exponentiation as+-- described on p. 461 of < [Knu1997]>.+-- +-- Assumes that @len > 0@, @e > 1@. Assumes that @res@ is an array of+-- length at least @e*(len - 1) + 1@. Does not support aliasing.+foreign import ccall "fmpz_poly.h _fmpz_poly_pow_binexp"+ _fmpz_poly_pow_binexp :: Ptr CFmpz -> Ptr CFmpz -> CLong -> CULong -> IO ()++-- | /fmpz_poly_pow_binexp/ /res/ /poly/ /e/ +--+-- Computes @res = poly^e@ using the binary exponentiation algorithm. If+-- \(e\) is zero, returns one, so that in particular @0^0 = 1@.+foreign import ccall "fmpz_poly.h fmpz_poly_pow_binexp"+ fmpz_poly_pow_binexp :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CULong -> IO ()++-- | /_fmpz_poly_pow_small/ /res/ /poly/ /len/ /e/ +--+-- Sets @res = poly^e@ whenever \(0 \leq e \leq 4\).+-- +-- Assumes that @len > 0@ and that @res@ is an array of length at least+-- @e*(len - 1) + 1@. Does not support aliasing.+foreign import ccall "fmpz_poly.h _fmpz_poly_pow_small"+ _fmpz_poly_pow_small :: Ptr CFmpz -> Ptr CFmpz -> CLong -> CULong -> IO ()++-- | /_fmpz_poly_pow/ /res/ /poly/ /len/ /e/ +--+-- Sets @res = poly^e@, assuming that @e, len > 0@ and that @res@ has space+-- for @e*(len - 1) + 1@ coefficients. Does not support aliasing.+foreign import ccall "fmpz_poly.h _fmpz_poly_pow"+ _fmpz_poly_pow :: Ptr CFmpz -> Ptr CFmpz -> CLong -> CULong -> IO ()++-- | /fmpz_poly_pow/ /res/ /poly/ /e/ +--+-- Computes @res = poly^e@. If \(e\) is zero, returns one, so that in+-- particular @0^0 = 1@.+foreign import ccall "fmpz_poly.h fmpz_poly_pow"+ fmpz_poly_pow :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CULong -> IO ()++-- | /_fmpz_poly_pow_trunc/ /res/ /poly/ /e/ /n/ +--+-- Sets @(res, n)@ to @(poly, n)@ raised to the power \(e\) and truncated+-- to length \(n\).+-- +-- Assumes that \(e, n > 0\). Allows zero-padding of @(poly, n)@. Does not+-- support aliasing of any inputs and outputs.+foreign import ccall "fmpz_poly.h _fmpz_poly_pow_trunc"+ _fmpz_poly_pow_trunc :: Ptr CFmpz -> Ptr CFmpz -> CULong -> CLong -> IO ()++-- | /fmpz_poly_pow_trunc/ /res/ /poly/ /e/ /n/ +--+-- Notationally raises @poly@ to the power \(e\), truncates the result to+-- length \(n\) and writes the result in @res@. This is computed much more+-- efficiently than simply powering the polynomial and truncating.+-- +-- Thus, if \(n = 0\) the result is zero. Otherwise, whenever \(e = 0\) the+-- result will be the constant polynomial equal to \(1\).+-- +-- This function can be used to raise power series to a power in an+-- efficient way.+foreign import ccall "fmpz_poly.h fmpz_poly_pow_trunc"+ fmpz_poly_pow_trunc :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CULong -> CLong -> IO ()++-- Shifting --------------------------------------------------------------------++-- | /_fmpz_poly_shift_left/ /res/ /poly/ /len/ /n/ +--+-- Sets @(res, len + n)@ to @(poly, len)@ shifted left by \(n\)+-- coefficients.+-- +-- Inserts zero coefficients at the lower end. Assumes that @len@ and \(n\)+-- are positive, and that @res@ fits @len + n@ elements. Supports aliasing+-- between @res@ and @poly@.+foreign import ccall "fmpz_poly.h _fmpz_poly_shift_left"+ _fmpz_poly_shift_left :: Ptr CFmpz -> Ptr CFmpz -> CLong -> CLong -> IO ()++-- | /fmpz_poly_shift_left/ /res/ /poly/ /n/ +--+-- Sets @res@ to @poly@ shifted left by \(n\) coeffs. Zero coefficients are+-- inserted.+foreign import ccall "fmpz_poly.h fmpz_poly_shift_left"+ fmpz_poly_shift_left :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()++-- | /_fmpz_poly_shift_right/ /res/ /poly/ /len/ /n/ +--+-- Sets @(res, len - n)@ to @(poly, len)@ shifted right by \(n\)+-- coefficients.+-- +-- Assumes that @len@ and \(n\) are positive, that @len > n@, and that+-- @res@ fits @len - n@ elements. Supports aliasing between @res@ and+-- @poly@, although in this case the top coefficients of @poly@ are not set+-- to zero.+foreign import ccall "fmpz_poly.h _fmpz_poly_shift_right"+ _fmpz_poly_shift_right :: Ptr CFmpz -> Ptr CFmpz -> CLong -> CLong -> IO ()++-- | /fmpz_poly_shift_right/ /res/ /poly/ /n/ +--+-- Sets @res@ to @poly@ shifted right by \(n\) coefficients. If \(n\) is+-- equal to or greater than the current length of @poly@, @res@ is set to+-- the zero polynomial.+foreign import ccall "fmpz_poly.h fmpz_poly_shift_right"+ fmpz_poly_shift_right :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()++-- Bit sizes and norms ---------------------------------------------------------++-- | /fmpz_poly_max_limbs/ /poly/ +--+-- Returns the maximum number of limbs required to store the absolute value+-- of coefficients of @poly@. If @poly@ is zero, returns \(0\).+foreign import ccall "fmpz_poly.h fmpz_poly_max_limbs"+ fmpz_poly_max_limbs :: Ptr CFmpzPoly -> IO CULong++-- | /fmpz_poly_max_bits/ /poly/ +--+-- Computes the maximum number of bits \(b\) required to store the absolute+-- value of coefficients of @poly@. If all the coefficients of @poly@ are+-- non-negative, \(b\) is returned, otherwise \(-b\) is returned.+foreign import ccall "fmpz_poly.h fmpz_poly_max_bits"+ fmpz_poly_max_bits :: Ptr CFmpzPoly -> IO CLong++-- | /fmpz_poly_height/ /height/ /poly/ +--+-- Computes the height of @poly@, defined as the largest of the absolute+-- values of the coefficients of @poly@. Equivalently, this gives the+-- infinity norm of the coefficients. If @poly@ is zero, the height is+-- \(0\).+foreign import ccall "fmpz_poly.h fmpz_poly_height"+ fmpz_poly_height :: Ptr CFmpz -> Ptr CFmpzPoly -> IO ()++-- | /_fmpz_poly_2norm/ /res/ /poly/ /len/ +--+-- Sets @res@ to the Euclidean norm of @(poly, len)@, that is, the integer+-- square root of the sum of the squares of the coefficients of @poly@.+foreign import ccall "fmpz_poly.h _fmpz_poly_2norm"+ _fmpz_poly_2norm :: Ptr CFmpz -> Ptr CFmpz -> CLong -> IO ()++-- | /fmpz_poly_2norm/ /res/ /poly/ +--+-- Sets @res@ to the Euclidean norm of @poly@, that is, the integer square+-- root of the sum of the squares of the coefficients of @poly@.+foreign import ccall "fmpz_poly.h fmpz_poly_2norm"+ fmpz_poly_2norm :: Ptr CFmpz -> Ptr CFmpzPoly -> IO ()++-- | /_fmpz_poly_2norm_normalised_bits/ /poly/ /len/ +--+-- Returns an upper bound on the number of bits of the normalised Euclidean+-- norm of @(poly, len)@, i.e. the number of bits of the Euclidean norm+-- divided by the absolute value of the leading coefficient. The returned+-- value will be no more than 1 bit too large.+-- +-- This is used in the computation of the Landau-Mignotte bound.+-- +-- It is assumed that @len > 0@. The result only makes sense if the leading+-- coefficient is nonzero.+foreign import ccall "fmpz_poly.h _fmpz_poly_2norm_normalised_bits"+ _fmpz_poly_2norm_normalised_bits :: Ptr CFmpz -> CLong -> IO CMpLimb++-- Greatest common divisor -----------------------------------------------------++-- | /_fmpz_poly_gcd_subresultant/ /res/ /poly1/ /len1/ /poly2/ /len2/ +--+-- Computes the greatest common divisor @(res, len2)@ of @(poly1, len1)@+-- and @(poly2, len2)@, assuming @len1 >= len2 > 0@. The result is+-- normalised to have positive leading coefficient. Aliasing between @res@,+-- @poly1@ and @poly2@ is supported.+foreign import ccall "fmpz_poly.h _fmpz_poly_gcd_subresultant"+ _fmpz_poly_gcd_subresultant :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> IO ()++-- | /fmpz_poly_gcd_subresultant/ /res/ /poly1/ /poly2/ +--+-- Computes the greatest common divisor @res@ of @poly1@ and @poly2@,+-- normalised to have non-negative leading coefficient.+-- +-- This function uses the subresultant algorithm as described in Algorithm+-- 3.3.1 of < [Coh1996]>.+foreign import ccall "fmpz_poly.h fmpz_poly_gcd_subresultant"+ fmpz_poly_gcd_subresultant :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()++-- | /_fmpz_poly_gcd_heuristic/ /res/ /poly1/ /len1/ /poly2/ /len2/ +--+-- Computes the greatest common divisor @(res, len2)@ of @(poly1, len1)@+-- and @(poly2, len2)@, assuming @len1 >= len2 > 0@. The result is+-- normalised to have positive leading coefficient. Aliasing between @res@,+-- @poly1@ and @poly2@ is not supported. The function may not always+-- succeed in finding the GCD. If it fails, the function returns 0,+-- otherwise it returns 1.+foreign import ccall "fmpz_poly.h _fmpz_poly_gcd_heuristic"+ _fmpz_poly_gcd_heuristic :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> IO CInt++-- | /fmpz_poly_gcd_heuristic/ /res/ /poly1/ /poly2/ +--+-- Computes the greatest common divisor @res@ of @poly1@ and @poly2@,+-- normalised to have non-negative leading coefficient.+-- +-- The function may not always succeed in finding the GCD. If it fails, the+-- function returns 0, otherwise it returns 1.+-- +-- This function uses the heuristic GCD algorithm (GCDHEU). The basic+-- strategy is to remove the content of the polynomials, pack them using+-- Kronecker segmentation (given a bound on the size of the coefficients of+-- the GCD) and take the integer GCD. Unpack the result and test+-- divisibility.+foreign import ccall "fmpz_poly.h fmpz_poly_gcd_heuristic"+ fmpz_poly_gcd_heuristic :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO CInt++-- | /_fmpz_poly_gcd_modular/ /res/ /poly1/ /len1/ /poly2/ /len2/ +--+-- Computes the greatest common divisor @(res, len2)@ of @(poly1, len1)@+-- and @(poly2, len2)@, assuming @len1 >= len2 > 0@. The result is+-- normalised to have positive leading coefficient. Aliasing between @res@,+-- @poly1@ and @poly2@ is not supported.+foreign import ccall "fmpz_poly.h _fmpz_poly_gcd_modular"+ _fmpz_poly_gcd_modular :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> IO ()++-- | /fmpz_poly_gcd_modular/ /res/ /poly1/ /poly2/ +--+-- Computes the greatest common divisor @res@ of @poly1@ and @poly2@,+-- normalised to have non-negative leading coefficient.+-- +-- This function uses the modular GCD algorithm. The basic strategy is to+-- remove the content of the polynomials, reduce them modulo sufficiently+-- many primes and do CRT reconstruction until some bound is reached (or we+-- can prove with trial division that we have the GCD).+foreign import ccall "fmpz_poly.h fmpz_poly_gcd_modular"+ fmpz_poly_gcd_modular :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()++-- | /_fmpz_poly_gcd/ /res/ /poly1/ /len1/ /poly2/ /len2/ +--+-- Computes the greatest common divisor @res@ of @(poly1, len1)@ and+-- @(poly2, len2)@, assuming @len1 >= len2 > 0@. The result is normalised+-- to have positive leading coefficient.+-- +-- Assumes that @res@ has space for @len2@ coefficients. Aliasing between+-- @res@, @poly1@ and @poly2@ is not supported.+foreign import ccall "fmpz_poly.h _fmpz_poly_gcd"+ _fmpz_poly_gcd :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> IO ()++-- | /fmpz_poly_gcd/ /res/ /poly1/ /poly2/ +--+-- Computes the greatest common divisor @res@ of @poly1@ and @poly2@,+-- normalised to have non-negative leading coefficient.+foreign import ccall "fmpz_poly.h fmpz_poly_gcd"+ fmpz_poly_gcd :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()++-- | /_fmpz_poly_xgcd_modular/ /r/ /s/ /t/ /f/ /len1/ /g/ /len2/ +--+-- Set \(r\) to the resultant of @(f, len1)@ and @(g, len2)@. If the+-- resultant is zero, the function returns immediately. Otherwise it finds+-- polynomials \(s\) and \(t\) such that @s*f + t*g = r@. The length of+-- \(s\) will be no greater than @len2@ and the length of \(t\) will be no+-- greater than @len1@ (both are zero padded if necessary).+-- +-- It is assumed that @len1 >= len2 > 0@. No aliasing of inputs and outputs+-- is permitted.+-- +-- The function assumes that \(f\) and \(g\) are primitive (have Gaussian+-- content equal to 1). The result is undefined otherwise.+-- +-- Uses a multimodular algorithm. The resultant is first computed and+-- extended GCDs modulo various primes \(p\) are computed and combined+-- using CRT. When the CRT stabilises the resulting polynomials are simply+-- reduced modulo further primes until a proven bound is reached.+foreign import ccall "fmpz_poly.h _fmpz_poly_xgcd_modular"+ _fmpz_poly_xgcd_modular :: Ptr CFmpz -> Ptr CFmpz -> Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> IO ()++-- | /fmpz_poly_xgcd_modular/ /r/ /s/ /t/ /f/ /g/ +--+-- Set \(r\) to the resultant of \(f\) and \(g\). If the resultant is zero,+-- the function then returns immediately, otherwise \(s\) and \(t\) are+-- found such that @s*f + t*g = r@.+-- +-- The function assumes that \(f\) and \(g\) are primitive (have Gaussian+-- content equal to 1). The result is undefined otherwise.+-- +-- Uses the multimodular algorithm.+foreign import ccall "fmpz_poly.h fmpz_poly_xgcd_modular"+ fmpz_poly_xgcd_modular :: Ptr CFmpz -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()++-- | /_fmpz_poly_xgcd/ /r/ /s/ /t/ /f/ /len1/ /g/ /len2/ +--+-- Set \(r\) to the resultant of @(f, len1)@ and @(g, len2)@. If the+-- resultant is zero, the function returns immediately. Otherwise it finds+-- polynomials \(s\) and \(t\) such that @s*f + t*g = r@. The length of+-- \(s\) will be no greater than @len2@ and the length of \(t\) will be no+-- greater than @len1@ (both are zero padded if necessary).+-- +-- The function assumes that \(f\) and \(g\) are primitive (have Gaussian+-- content equal to 1). The result is undefined otherwise.+-- +-- It is assumed that @len1 >= len2 > 0@. No aliasing of inputs and outputs+-- is permitted.+foreign import ccall "fmpz_poly.h _fmpz_poly_xgcd"+ _fmpz_poly_xgcd :: Ptr CFmpz -> Ptr CFmpz -> Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> IO ()++-- | /fmpz_poly_xgcd/ /r/ /s/ /t/ /f/ /g/ +--+-- Set \(r\) to the resultant of \(f\) and \(g\). If the resultant is zero,+-- the function then returns immediately, otherwise \(s\) and \(t\) are+-- found such that @s*f + t*g = r@.+-- +-- The function assumes that \(f\) and \(g\) are primitive (have Gaussian+-- content equal to 1). The result is undefined otherwise.+foreign import ccall "fmpz_poly.h fmpz_poly_xgcd"+ fmpz_poly_xgcd :: Ptr CFmpz -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()++-- | /_fmpz_poly_lcm/ /res/ /poly1/ /len1/ /poly2/ /len2/ +--+-- Sets @(res, len1 + len2 - 1)@ to the least common multiple of the two+-- polynomials @(poly1, len1)@ and @(poly2, len2)@, normalised to have+-- non-negative leading coefficient.+-- +-- Assumes that @len1 >= len2 > 0@.+-- +-- Does not support aliasing.+foreign import ccall "fmpz_poly.h _fmpz_poly_lcm"+ _fmpz_poly_lcm :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> IO ()++-- | /fmpz_poly_lcm/ /res/ /poly1/ /poly2/ +--+-- Sets @res@ to the least common multiple of the two polynomials @poly1@+-- and @poly2@, normalised to have non-negative leading coefficient.+-- +-- If either of the two polynomials is zero, sets @res@ to zero.+-- +-- This ensures that the equality+-- +-- \[`\]+-- \[f g = \gcd(f, g) \operatorname{lcm}(f, g)\]+-- +-- holds up to sign.+foreign import ccall "fmpz_poly.h fmpz_poly_lcm"+ fmpz_poly_lcm :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()++-- | /_fmpz_poly_resultant_modular/ /res/ /poly1/ /len1/ /poly2/ /len2/ +--+-- Sets @res@ to the resultant of @(poly1, len1)@ and @(poly2, len2)@,+-- assuming that @len1 >= len2 > 0@.+foreign import ccall "fmpz_poly.h _fmpz_poly_resultant_modular"+ _fmpz_poly_resultant_modular :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> IO ()++-- | /fmpz_poly_resultant_modular/ /res/ /poly1/ /poly2/ +--+-- Computes the resultant of @poly1@ and @poly2@.+-- +-- For two non-zero polynomials \(f(x) = a_m x^m + \dotsb + a_0\) and+-- \(g(x) = b_n x^n + \dotsb + b_0\) of degrees \(m\) and \(n\), the+-- resultant is defined to be+-- +-- \[`\]+-- \[a_m^n b_n^m \prod_{(x, y) : f(x) = g(y) = 0} (x - y).\]+-- +-- For convenience, we define the resultant to be equal to zero if either+-- of the two polynomials is zero.+-- +-- This function uses the modular algorithm described in < [Col1971]>.+foreign import ccall "fmpz_poly.h fmpz_poly_resultant_modular"+ fmpz_poly_resultant_modular :: Ptr CFmpz -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()++-- | /fmpz_poly_resultant_modular_div/ /res/ /poly1/ /poly2/ /div/ /nbits/ +--+-- Computes the resultant of @poly1@ and @poly2@ divided by @div@ using a+-- slight modification of the above function. It is assumed that the+-- resultant is exactly divisible by @div@ and the result @res@ has at most+-- @nbits@ bits. This bypasses the computation of general bounds.+foreign import ccall "fmpz_poly.h fmpz_poly_resultant_modular_div"+ fmpz_poly_resultant_modular_div :: Ptr CFmpz -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpz -> CLong -> IO ()++-- | /_fmpz_poly_resultant_euclidean/ /res/ /poly1/ /len1/ /poly2/ /len2/ +--+-- Sets @res@ to the resultant of @(poly1, len1)@ and @(poly2, len2)@,+-- assuming that @len1 >= len2 > 0@.+foreign import ccall "fmpz_poly.h _fmpz_poly_resultant_euclidean"+ _fmpz_poly_resultant_euclidean :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> IO ()++-- | /fmpz_poly_resultant_euclidean/ /res/ /poly1/ /poly2/ +--+-- Computes the resultant of @poly1@ and @poly2@.+-- +-- For two non-zero polynomials \(f(x) = a_m x^m + \dotsb + a_0\) and+-- \(g(x) = b_n x^n + \dotsb + b_0\) of degrees \(m\) and \(n\), the+-- resultant is defined to be+-- +-- \[`\]+-- \[a_m^n b_n^m \prod_{(x, y) : f(x) = g(y) = 0} (x - y).\]+-- +-- For convenience, we define the resultant to be equal to zero if either+-- of the two polynomials is zero.+-- +-- This function uses the algorithm described in Algorithm 3.3.7 of+-- < [Coh1996]>.+foreign import ccall "fmpz_poly.h fmpz_poly_resultant_euclidean"+ fmpz_poly_resultant_euclidean :: Ptr CFmpz -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()++-- | /_fmpz_poly_resultant/ /res/ /poly1/ /len1/ /poly2/ /len2/ +--+-- Sets @res@ to the resultant of @(poly1, len1)@ and @(poly2, len2)@,+-- assuming that @len1 >= len2 > 0@.+foreign import ccall "fmpz_poly.h _fmpz_poly_resultant"+ _fmpz_poly_resultant :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> IO ()++-- | /fmpz_poly_resultant/ /res/ /poly1/ /poly2/ +--+-- Computes the resultant of @poly1@ and @poly2@.+-- +-- For two non-zero polynomials \(f(x) = a_m x^m + \dotsb + a_0\) and+-- \(g(x) = b_n x^n + \dotsb + b_0\) of degrees \(m\) and \(n\), the+-- resultant is defined to be+-- +-- \[`\]+-- \[a_m^n b_n^m \prod_{(x, y) : f(x) = g(y) = 0} (x - y).\]+-- +-- For convenience, we define the resultant to be equal to zero if either+-- of the two polynomials is zero.+foreign import ccall "fmpz_poly.h fmpz_poly_resultant"+ fmpz_poly_resultant :: Ptr CFmpz -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()++-- Discriminant ----------------------------------------------------------------++-- | /_fmpz_poly_discriminant/ /res/ /poly/ /len/ +--+-- Set @res@ to the discriminant of @(poly, len)@. Assumes @len > 1@.+foreign import ccall "fmpz_poly.h _fmpz_poly_discriminant"+ _fmpz_poly_discriminant :: Ptr CFmpz -> Ptr CFmpz -> CLong -> IO ()++-- | /fmpz_poly_discriminant/ /res/ /poly/ +--+-- Set @res@ to the discriminant of @poly@. We normalise the discriminant+-- so that \(\operatorname{disc}(f) = (-1)^{(n(n-1)/2)}+-- \operatorname{res}(f, f')/\operatorname{lc}(f)\), thus+-- \(\operatorname{disc}(f) = \operatorname{lc}(f)^{(2n - 2)} \prod_{i < j} (r_i+-- - r_j)^2\), where \(\operatorname{lc}(f)\) is the leading coefficient of+-- \(f\), \(n\) is the degree of \(f\) and \(r_i\) are the roots of \(f\).+foreign import ccall "fmpz_poly.h fmpz_poly_discriminant"+ fmpz_poly_discriminant :: Ptr CFmpz -> Ptr CFmpzPoly -> IO ()++-- Gaussian content ------------------------------------------------------------++-- | /_fmpz_poly_content/ /res/ /poly/ /len/ +--+-- Sets @res@ to the non-negative content of @(poly, len)@. Aliasing+-- between @res@ and the coefficients of @poly@ is not supported.+foreign import ccall "fmpz_poly.h _fmpz_poly_content"+ _fmpz_poly_content :: Ptr CFmpz -> Ptr CFmpz -> CLong -> IO ()++-- | /fmpz_poly_content/ /res/ /poly/ +--+-- Sets @res@ to the non-negative content of @poly@. The content of the+-- zero polynomial is defined to be zero. Supports aliasing, that is, @res@+-- is allowed to be one of the coefficients of @poly@.+foreign import ccall "fmpz_poly.h fmpz_poly_content"+ fmpz_poly_content :: Ptr CFmpz -> Ptr CFmpzPoly -> IO ()++-- | /_fmpz_poly_primitive_part/ /res/ /poly/ /len/ +--+-- Sets @(res, len)@ to @(poly, len)@ divided by the content of+-- @(poly, len)@, and normalises the result to have non-negative leading+-- coefficient.+-- +-- Assumes that @(poly, len)@ is non-zero. Supports aliasing of @res@ and+-- @poly@.+foreign import ccall "fmpz_poly.h _fmpz_poly_primitive_part"+ _fmpz_poly_primitive_part :: Ptr CFmpz -> Ptr CFmpz -> CLong -> IO ()++-- | /fmpz_poly_primitive_part/ /res/ /poly/ +--+-- Sets @res@ to @poly@ divided by the content of @poly@, and normalises+-- the result to have non-negative leading coefficient. If @poly@ is zero,+-- sets @res@ to zero.+foreign import ccall "fmpz_poly.h fmpz_poly_primitive_part"+ fmpz_poly_primitive_part :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()++-- Square-free -----------------------------------------------------------------++-- | /_fmpz_poly_is_squarefree/ /poly/ /len/ +--+-- Returns whether the polynomial @(poly, len)@ is square-free.+foreign import ccall "fmpz_poly.h _fmpz_poly_is_squarefree"+ _fmpz_poly_is_squarefree :: Ptr CFmpz -> CLong -> IO CInt++-- | /fmpz_poly_is_squarefree/ /poly/ +--+-- Returns whether the polynomial @poly@ is square-free. A non-zero+-- polynomial is defined to be square-free if it has no non-unit square+-- factors. We also define the zero polynomial to be square-free.+-- +-- Returns \(1\) if the length of @poly@ is at most \(2\). Returns whether+-- the discriminant is zero for quadratic polynomials. Otherwise, returns+-- whether the greatest common divisor of @poly@ and its derivative has+-- length \(1\).+foreign import ccall "fmpz_poly.h fmpz_poly_is_squarefree"+ fmpz_poly_is_squarefree :: Ptr CFmpzPoly -> IO CInt++-- Euclidean division ----------------------------------------------------------++-- | /_fmpz_poly_divrem_basecase/ /Q/ /R/ /A/ /lenA/ /B/ /lenB/ /exact/ +--+-- Computes @(Q, lenA - lenB + 1)@, @(R, lenA)@ such that \(A = B Q + R\)+-- and each coefficient of \(R\) beyond @lenB@ is reduced modulo the+-- leading coefficient of \(B\). If the leading coefficient of \(B\) is+-- \(\pm 1\) or the division is exact, this is the same thing as division+-- over \(\mathbb{Q}\).+-- +-- Assumes that \(\operatorname{len}(A), \operatorname{len}(B) > 0\).+-- Allows zero-padding in @(A, lenA)@. \(R\) and \(A\) may be aliased, but+-- apart from this no aliasing of input and output operands is allowed.+-- +-- If the flag @exact@ is \(1\), the function stops if an inexact division+-- is encountered, upon which the function will return \(0\). If no inexact+-- division is encountered, the function returns \(1\). Note that this does+-- not guarantee the remainder of the polynomial division is zero, merely+-- that its length is less than that of B. This feature is useful for+-- series division and for divisibility testing (upon testing the+-- remainder).+-- +-- For ordinary use set the flag @exact@ to \(0\). In this case, no checks+-- or early aborts occur and the function always returns \(1\).+foreign import ccall "fmpz_poly.h _fmpz_poly_divrem_basecase"+ _fmpz_poly_divrem_basecase :: Ptr CFmpz -> Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> CInt -> IO CInt++-- | /fmpz_poly_divrem_basecase/ /Q/ /R/ /A/ /B/ +--+-- Computes \(Q\), \(R\) such that \(A = B Q + R\) and each coefficient of+-- \(R\) beyond \(\operatorname{len}(B) - 1\) is reduced modulo the leading+-- coefficient of \(B\). If the leading coefficient of \(B\) is \(\pm 1\)+-- or the division is exact, this is the same thing as division over+-- \(\mathbb{Q}\). An exception is raised if \(B\) is zero.+foreign import ccall "fmpz_poly.h fmpz_poly_divrem_basecase"+ fmpz_poly_divrem_basecase :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()++-- | /_fmpz_poly_divrem_divconquer_recursive/ /Q/ /BQ/ /W/ /A/ /B/ /lenB/ /exact/ +--+-- Computes @(Q, lenB)@, @(BQ, 2 lenB - 1)@ such that \(BQ = B \times Q\)+-- and \(A = B Q + R\) where each coefficient of \(R\) beyond+-- \(\operatorname{len}(B) - 1\) is reduced modulo the leading coefficient+-- of \(B\). We assume that+-- \(\operatorname{len}(A) = 2 \operatorname{len}(B) - 1\). If the leading+-- coefficient of \(B\) is \(\pm 1\) or the division is exact, this is the+-- same as division over \(\mathbb{Q}\).+-- +-- Assumes \(\operatorname{len}(B) > 0\). Allows zero-padding in+-- @(A, lenA)@. Requires a temporary array @(W, 2 lenB - 1)@. No aliasing+-- of input and output operands is allowed.+-- +-- This function does not read the bottom \(\operatorname{len}(B) - 1\)+-- coefficients from \(A\), which means that they might not even need to+-- exist in allocated memory.+-- +-- If the flag @exact@ is \(1\), the function stops if an inexact division+-- is encountered, upon which the function will return \(0\). If no inexact+-- division is encountered, the function returns \(1\). Note that this does+-- not guarantee the remainder of the polynomial division is zero, merely+-- that its length is less than that of B. This feature is useful for+-- series division and for divisibility testing (upon testing the+-- remainder).+-- +-- For ordinary use set the flag @exact@ to \(0\). In this case, no checks+-- or early aborts occur and the function always returns \(1\).+foreign import ccall "fmpz_poly.h _fmpz_poly_divrem_divconquer_recursive"+ _fmpz_poly_divrem_divconquer_recursive :: Ptr CFmpz -> Ptr CFmpz -> Ptr CFmpz -> Ptr CFmpz -> Ptr CFmpz -> CLong -> CInt -> IO CInt++-- | /_fmpz_poly_divrem_divconquer/ /Q/ /R/ /A/ /lenA/ /B/ /lenB/ /exact/ +--+-- Computes @(Q, lenA - lenB + 1)@, @(R, lenA)@ such that \(A = B Q + R\)+-- and each coefficient of \(R\) beyond \(\operatorname{len}(B) - 1\) is+-- reduced modulo the leading coefficient of \(B\). If the leading+-- coefficient of \(B\) is \(\pm 1\) or the division is exact, this is the+-- same as division over \(\mathbb{Q}\).+-- +-- Assumes \(\operatorname{len}(A) \geq \operatorname{len}(B) > 0\). Allows+-- zero-padding in @(A, lenA)@. No aliasing of input and output operands is+-- allowed.+-- +-- If the flag @exact@ is \(1\), the function stops if an inexact division+-- is encountered, upon which the function will return \(0\). If no inexact+-- division is encountered, the function returns \(1\). Note that this does+-- not guarantee the remainder of the polynomial division is zero, merely+-- that its length is less than that of B. This feature is useful for+-- series division and for divisibility testing (upon testing the+-- remainder).+-- +-- For ordinary use set the flag @exact@ to \(0\). In this case, no checks+-- or early aborts occur and the function always returns \(1\).+foreign import ccall "fmpz_poly.h _fmpz_poly_divrem_divconquer"+ _fmpz_poly_divrem_divconquer :: Ptr CFmpz -> Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> CInt -> IO CInt++-- | /fmpz_poly_divrem_divconquer/ /Q/ /R/ /A/ /B/ +--+-- Computes \(Q\), \(R\) such that \(A = B Q + R\) and each coefficient of+-- \(R\) beyond \(\operatorname{len}(B) - 1\) is reduced modulo the leading+-- coefficient of \(B\). If the leading coefficient of \(B\) is \(\pm 1\)+-- or the division is exact, this is the same as division over+-- \(\mathbb{Q}\). An exception is raised if \(B\) is zero.+foreign import ccall "fmpz_poly.h fmpz_poly_divrem_divconquer"+ fmpz_poly_divrem_divconquer :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()++-- | /_fmpz_poly_divrem/ /Q/ /R/ /A/ /lenA/ /B/ /lenB/ /exact/ +--+-- Computes @(Q, lenA - lenB + 1)@, @(R, lenA)@ such that \(A = B Q + R\)+-- and each coefficient of \(R\) beyond \(\operatorname{len}(B) - 1\) is+-- reduced modulo the leading coefficient of \(B\). If the leading+-- coefficient of \(B\) is \(\pm 1\) or the division is exact, this is the+-- same thing as division over \(\mathbb{Q}\).+-- +-- Assumes \(\operatorname{len}(A) \geq \operatorname{len}(B) > 0\). Allows+-- zero-padding in @(A, lenA)@. No aliasing of input and output operands is+-- allowed.+-- +-- If the flag @exact@ is \(1\), the function stops if an inexact division+-- is encountered, upon which the function will return \(0\). If no inexact+-- division is encountered, the function returns \(1\). Note that this does+-- not guarantee the remainder of the polynomial division is zero, merely+-- that its length is less than that of B. This feature is useful for+-- series division and for divisibility testing (upon testing the+-- remainder).+-- +-- For ordinary use set the flag @exact@ to \(0\). In this case, no checks+-- or early aborts occur and the function always returns \(1\).+foreign import ccall "fmpz_poly.h _fmpz_poly_divrem"+ _fmpz_poly_divrem :: Ptr CFmpz -> Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> CInt -> IO CInt++-- | /fmpz_poly_divrem/ /Q/ /R/ /A/ /B/ +--+-- Computes \(Q\), \(R\) such that \(A = B Q + R\) and each coefficient of+-- \(R\) beyond \(\operatorname{len}(B) - 1\) is reduced modulo the leading+-- coefficient of \(B\). If the leading coefficient of \(B\) is \(\pm 1\)+-- or the division is exact, this is the same as division over+-- \(\mathbb{Q}\). An exception is raised if \(B\) is zero.+foreign import ccall "fmpz_poly.h fmpz_poly_divrem"+ fmpz_poly_divrem :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()++-- | /_fmpz_poly_div_basecase/ /Q/ /R/ /A/ /lenA/ /B/ /lenB/ /exact/ +--+-- Computes the quotient @(Q, lenA - lenB + 1)@ of @(A, lenA)@ divided by+-- @(B, lenB)@.+-- +-- Notationally, computes \(Q\), \(R\) such that \(A = B Q + R\) and each+-- coefficient of \(R\) beyond \(\operatorname{len}(B) - 1\) is reduced+-- modulo the leading coefficient of \(B\).+-- +-- If the leading coefficient of \(B\) is \(\pm 1\) or the division is+-- exact, this is the same as division over \(\mathbb{Q}\).+-- +-- Assumes \(\operatorname{len}(A), \operatorname{len}(B) > 0\). Allows+-- zero-padding in @(A, lenA)@. Requires a temporary array \(R\) of size at+-- least the (actual) length of \(A\). For convenience, \(R\) may be+-- @NULL@. \(R\) and \(A\) may be aliased, but apart from this no aliasing+-- of input and output operands is allowed.+-- +-- If the flag @exact@ is \(1\), the function stops if an inexact division+-- is encountered, upon which the function will return \(0\). If no inexact+-- division is encountered, the function returns \(1\). Note that this does+-- not guarantee the remainder of the polynomial division is zero, merely+-- that its length is less than that of B. This feature is useful for+-- series division and for divisibility testing (upon testing the+-- remainder).+-- +-- For ordinary use set the flag @exact@ to \(0\). In this case, no checks+-- or early aborts occur and the function always returns \(1\).+foreign import ccall "fmpz_poly.h _fmpz_poly_div_basecase"+ _fmpz_poly_div_basecase :: Ptr CFmpz -> Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> CInt -> IO CInt++-- | /fmpz_poly_div_basecase/ /Q/ /A/ /B/ +--+-- Computes the quotient \(Q\) of \(A\) divided by \(Q\).+-- +-- Notationally, computes \(Q\), \(R\) such that \(A = B Q + R\) and each+-- coefficient of \(R\) beyond \(\operatorname{len}(B) - 1\) is reduced+-- modulo the leading coefficient of \(B\).+-- +-- If the leading coefficient of \(B\) is \(\pm 1\) or the division is+-- exact, this is the same as division over \(\mathbb{Q}\). An exception is+-- raised if \(B\) is zero.+foreign import ccall "fmpz_poly.h fmpz_poly_div_basecase"+ fmpz_poly_div_basecase :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()++-- | /_fmpz_poly_divremlow_divconquer_recursive/ /Q/ /BQ/ /A/ /B/ /lenB/ /exact/ +--+-- Divide and conquer division of @(A, 2 lenB - 1)@ by @(B, lenB)@,+-- computing only the bottom \(\operatorname{len}(B) - 1\) coefficients of+-- \(B Q\).+-- +-- Assumes \(\operatorname{len}(B) > 0\). Requires \(B Q\) to have length+-- at least \(2 \operatorname{len}(B) - 1\), although only the bottom+-- \(\operatorname{len}(B) - 1\) coefficients will carry meaningful output.+-- Does not support any aliasing. Allows zero-padding in \(A\), but not in+-- \(B\).+-- +-- If the flag @exact@ is \(1\), the function stops if an inexact division+-- is encountered, upon which the function will return \(0\). If no inexact+-- division is encountered, the function returns \(1\). Note that this does+-- not guarantee the remainder of the polynomial division is zero, merely+-- that its length is less than that of B. This feature is useful for+-- series division and for divisibility testing (upon testing the+-- remainder).+-- +-- For ordinary use set the flag @exact@ to \(0\). In this case, no checks+-- or early aborts occur and the function always returns \(1\).+foreign import ccall "fmpz_poly.h _fmpz_poly_divremlow_divconquer_recursive"+ _fmpz_poly_divremlow_divconquer_recursive :: Ptr CFmpz -> Ptr CFmpz -> Ptr CFmpz -> Ptr CFmpz -> CLong -> CInt -> IO CInt++-- | /_fmpz_poly_div_divconquer_recursive/ /Q/ /temp/ /A/ /B/ /lenB/ /exact/ +--+-- Recursive short division in the balanced case.+-- +-- Computes the quotient @(Q, lenB)@ of @(A, 2 lenB - 1)@ upon division by+-- @(B, lenB)@. Requires \(\operatorname{len}(B) > 0\). Needs a temporary+-- array @temp@ of length \(2 \operatorname{len}(B) - 1\). Does not support+-- any aliasing.+-- +-- For further details, see < [Mul2000]>.+-- +-- If the flag @exact@ is \(1\), the function stops if an inexact division+-- is encountered, upon which the function will return \(0\). If no inexact+-- division is encountered, the function returns \(1\). Note that this does+-- not guarantee the remainder of the polynomial division is zero, merely+-- that its length is less than that of B. This feature is useful for+-- series division and for divisibility testing (upon testing the+-- remainder).+-- +-- For ordinary use set the flag @exact@ to \(0\). In this case, no checks+-- or early aborts occur and the function always returns \(1\).+foreign import ccall "fmpz_poly.h _fmpz_poly_div_divconquer_recursive"+ _fmpz_poly_div_divconquer_recursive :: Ptr CFmpz -> Ptr CFmpz -> Ptr CFmpz -> Ptr CFmpz -> CLong -> CInt -> IO CInt++-- | /_fmpz_poly_div_divconquer/ /Q/ /A/ /lenA/ /B/ /lenB/ /exact/ +--+-- Computes the quotient @(Q, lenA - lenB + 1)@ of @(A, lenA)@ upon+-- division by @(B, lenB)@. Assumes that+-- \(\operatorname{len}(A) \geq \operatorname{len}(B) > 0\). Does not+-- support aliasing.+-- +-- If the flag @exact@ is \(1\), the function stops if an inexact division+-- is encountered, upon which the function will return \(0\). If no inexact+-- division is encountered, the function returns \(1\). Note that this does+-- not guarantee the remainder of the polynomial division is zero, merely+-- that its length is less than that of B. This feature is useful for+-- series division and for divisibility testing (upon testing the+-- remainder).+-- +-- For ordinary use set the flag @exact@ to \(0\). In this case, no checks+-- or early aborts occur and the function always returns \(1\).+foreign import ccall "fmpz_poly.h _fmpz_poly_div_divconquer"+ _fmpz_poly_div_divconquer :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> CInt -> IO CInt++-- | /fmpz_poly_div_divconquer/ /Q/ /A/ /B/ +--+-- Computes the quotient \(Q\) of \(A\) divided by \(B\).+-- +-- Notationally, computes \(Q\), \(R\) such that \(A = B Q + R\) and each+-- coefficient of \(R\) beyond \(\operatorname{len}(B) - 1\) is reduced+-- modulo the leading coefficient of \(B\).+-- +-- If the leading coefficient of \(B\) is \(\pm 1\) or the division is+-- exact, this is the same as division over \(\mathbb{Q}\). An exception is+-- raised if \(B\) is zero.+foreign import ccall "fmpz_poly.h fmpz_poly_div_divconquer"+ fmpz_poly_div_divconquer :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()++-- | /_fmpz_poly_div/ /Q/ /A/ /lenA/ /B/ /lenB/ /exact/ +--+-- Computes the quotient @(Q, lenA - lenB + 1)@ of @(A, lenA)@ divided by+-- @(B, lenB)@.+-- +-- Notationally, computes \(Q\), \(R\) such that \(A = B Q + R\) and each+-- coefficient of \(R\) beyond \(\operatorname{len}(B) - 1\) is reduced+-- modulo the leading coefficient of \(B\). If the leading coefficient of+-- \(B\) is \(\pm 1\) or the division is exact, this is the same as+-- division over \(\mathbb{Q}\).+-- +-- Assumes \(\operatorname{len}(A) \geq \operatorname{len}(B) > 0\). Allows+-- zero-padding in @(A, lenA)@. Aliasing of input and output operands is+-- not allowed.+-- +-- If the flag @exact@ is \(1\), the function stops if an inexact division+-- is encountered, upon which the function will return \(0\). If no inexact+-- division is encountered, the function returns \(1\). Note that this does+-- not guarantee the remainder of the polynomial division is zero, merely+-- that its length is less than that of B. This feature is useful for+-- series division and for divisibility testing (upon testing the+-- remainder).+-- +-- For ordinary use set the flag @exact@ to \(0\). In this case, no checks+-- or early aborts occur and the function always returns \(1\).+foreign import ccall "fmpz_poly.h _fmpz_poly_div"+ _fmpz_poly_div :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> CInt -> IO CInt++-- | /fmpz_poly_div/ /Q/ /A/ /B/ +--+-- Computes the quotient \(Q\) of \(A\) divided by \(B\).+-- +-- Notationally, computes \(Q\), \(R\) such that \(A = B Q + R\) and each+-- coefficient of \(R\) beyond \(\operatorname{len}(B) - 1\) is reduced+-- modulo the leading coefficient of \(B\). If the leading coefficient of+-- \(B\) is \(\pm 1\) or the division is exact, this is the same as+-- division over \(Q\). An exception is raised if \(B\) is zero.+foreign import ccall "fmpz_poly.h fmpz_poly_div"+ fmpz_poly_div :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()++-- | /_fmpz_poly_rem_basecase/ /R/ /A/ /lenA/ /B/ /lenB/ +--+-- Computes the remainder @(R, lenA)@ of @(A, lenA)@ upon division by+-- @(B, lenB)@.+-- +-- Notationally, computes \(Q\), \(R\) such that \(A = B Q + R\) and each+-- coefficient of \(R\) beyond \(\operatorname{len}(B) - 1\) is reduced+-- modulo the leading coefficient of \(B\). If the leading coefficient of+-- \(B\) is \(\pm 1\) or the division is exact, this is the same thing as+-- division over \(\mathbb{Q}\).+-- +-- Assumes that \(\operatorname{len}(A), \operatorname{len}(B) > 0\).+-- Allows zero-padding in @(A, lenA)@. \(R\) and \(A\) may be aliased, but+-- apart from this no aliasing of input and output operands is allowed.+foreign import ccall "fmpz_poly.h _fmpz_poly_rem_basecase"+ _fmpz_poly_rem_basecase :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> IO ()++-- | /fmpz_poly_rem_basecase/ /R/ /A/ /B/ +--+-- Computes the remainder \(R\) of \(A\) upon division by \(B\).+-- +-- Notationally, computes \(Q\), \(R\) such that \(A = B Q + R\) and each+-- coefficient of \(R\) beyond \(\operatorname{len}(B) - 1\) is reduced+-- modulo the leading coefficient of \(B\). If the leading coefficient of+-- \(B\) is \(\pm 1\) or the division is exact, this is the same as+-- division over \(\mathbb{Q}\). An exception is raised if \(B\) is zero.+foreign import ccall "fmpz_poly.h fmpz_poly_rem_basecase"+ fmpz_poly_rem_basecase :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()++-- | /_fmpz_poly_rem/ /R/ /A/ /lenA/ /B/ /lenB/ +--+-- Computes the remainder @(R, lenA)@ of @(A, lenA)@ upon division by+-- @(B, lenB)@.+-- +-- Notationally, computes \(Q\), \(R\) such that \(A = B Q + R\) and each+-- coefficient of \(R\) beyond \(\operatorname{len}(B) - 1\) is reduced+-- modulo the leading coefficient of \(B\). If the leading coefficient of+-- \(B\) is \(\pm 1\) or the division is exact, this is the same thing as+-- division over \(\mathbb{Q}\).+-- +-- Assumes that \(\operatorname{len}(A) \geq \operatorname{len}(B) > 0\).+-- Allows zero-padding in @(A, lenA)@. Aliasing of input and output+-- operands is not allowed.+foreign import ccall "fmpz_poly.h _fmpz_poly_rem"+ _fmpz_poly_rem :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> IO ()++-- | /fmpz_poly_rem/ /R/ /A/ /B/ +--+-- Computes the remainder \(R\) of \(A\) upon division by \(B\).+-- +-- Notationally, computes \(Q\), \(R\) such that \(A = B Q + R\) and each+-- coefficient of \(R\) beyond \(\operatorname{len}(B) - 1\) is reduced+-- modulo the leading coefficient of \(B\). If the leading coefficient of+-- \(B\) is \(\pm 1\) or the division is exact, this is the same as+-- division over \(\mathbb{Q}\). An exception is raised if \(B\) is zero.+foreign import ccall "fmpz_poly.h fmpz_poly_rem"+ fmpz_poly_rem :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()++-- | /_fmpz_poly_div_root/ /Q/ /A/ /len/ /c/ +--+-- Computes the quotient @(Q, len-1)@ of @(A, len)@ upon division by+-- \(x - c\).+-- +-- Supports aliasing of @Q@ and @A@, but the result is undefined in case of+-- partial overlap.+foreign import ccall "fmpz_poly.h _fmpz_poly_div_root"+ _fmpz_poly_div_root :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> IO ()++-- | /fmpz_poly_div_root/ /Q/ /A/ /c/ +--+-- Computes the quotient @(Q, len-1)@ of @(A, len)@ upon division by+-- \(x - c\).+foreign import ccall "fmpz_poly.h fmpz_poly_div_root"+ fmpz_poly_div_root :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpz -> IO ()++-- Division with precomputed inverse -------------------------------------------++-- | /_fmpz_poly_preinvert/ /B_inv/ /B/ /n/ +--+-- Given a monic polynomial @B@ of length @n@, compute a precomputed+-- inverse @B_inv@ of length @n@ for use in the functions below. No+-- aliasing of @B@ and @B_inv@ is permitted. We assume @n@ is not zero.+foreign import ccall "fmpz_poly.h _fmpz_poly_preinvert"+ _fmpz_poly_preinvert :: Ptr CFmpz -> Ptr CFmpz -> CLong -> IO ()++-- | /fmpz_poly_preinvert/ /B_inv/ /B/ +--+-- Given a monic polynomial @B@, compute a precomputed inverse @B_inv@ for+-- use in the functions below. An exception is raised if @B@ is zero.+foreign import ccall "fmpz_poly.h fmpz_poly_preinvert"+ fmpz_poly_preinvert :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()++-- | /_fmpz_poly_div_preinv/ /Q/ /A/ /len1/ /B/ /B_inv/ /len2/ +--+-- Given a precomputed inverse @B_inv@ of the polynomial @B@ of length+-- @len2@, compute the quotient @Q@ of @A@ by @B@. We assume the length+-- @len1@ of @A@ is at least @len2@. The polynomial @Q@ must have space for+-- @len1 - len2 + 1@ coefficients. No aliasing of operands is permitted.+foreign import ccall "fmpz_poly.h _fmpz_poly_div_preinv"+ _fmpz_poly_div_preinv :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> Ptr CFmpz -> CLong -> IO ()++-- | /fmpz_poly_div_preinv/ /Q/ /A/ /B/ /B_inv/ +--+-- Given a precomputed inverse @B_inv@ of the polynomial @B@, compute the+-- quotient @Q@ of @A@ by @B@. Aliasing of @B@ and @B_inv@ is not+-- permitted.+foreign import ccall "fmpz_poly.h fmpz_poly_div_preinv"+ fmpz_poly_div_preinv :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()++-- | /_fmpz_poly_divrem_preinv/ /Q/ /A/ /len1/ /B/ /B_inv/ /len2/ +--+-- Given a precomputed inverse @B_inv@ of the polynomial @B@ of length+-- @len2@, compute the quotient @Q@ of @A@ by @B@. The remainder is then+-- placed in @A@. We assume the length @len1@ of @A@ is at least @len2@.+-- The polynomial @Q@ must have space for @len1 - len2 + 1@ coefficients.+-- No aliasing of operands is permitted.+foreign import ccall "fmpz_poly.h _fmpz_poly_divrem_preinv"+ _fmpz_poly_divrem_preinv :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> Ptr CFmpz -> CLong -> IO ()++-- | /fmpz_poly_divrem_preinv/ /Q/ /R/ /A/ /B/ /B_inv/ +--+-- Given a precomputed inverse @B_inv@ of the polynomial @B@, compute the+-- quotient @Q@ of @A@ by @B@ and the remainder @R@. Aliasing of @B@ and+-- @B_inv@ is not permitted.+foreign import ccall "fmpz_poly.h fmpz_poly_divrem_preinv"+ fmpz_poly_divrem_preinv :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()++-- | /_fmpz_poly_powers_precompute/ /B/ /len/ +--+-- Computes @2*len - 1@ powers of \(x\) modulo the polynomial \(B\) of the+-- given length. This is used as a kind of precomputed inverse in the+-- remainder routine below.+foreign import ccall "fmpz_poly.h _fmpz_poly_powers_precompute"+ _fmpz_poly_powers_precompute :: Ptr CFmpz -> CLong -> IO (Ptr (Ptr CFmpz))++-- | /fmpz_poly_powers_precompute/ /pinv/ /poly/ +--+-- Computes @2*len - 1@ powers of \(x\) modulo the polynomial \(B\) of the+-- given length. This is used as a kind of precomputed inverse in the+-- remainder routine below.+foreign import ccall "fmpz_poly.h fmpz_poly_powers_precompute"+ fmpz_poly_powers_precompute :: Ptr CFmpzPolyPowersPrecomp -> Ptr CFmpzPoly -> IO ()++-- | /_fmpz_poly_powers_clear/ /powers/ /len/ +--+-- Clean up resources used by precomputed powers which have been computed+-- by @_fmpz_poly_powers_precompute@.+foreign import ccall "fmpz_poly.h _fmpz_poly_powers_clear"+ _fmpz_poly_powers_clear :: Ptr (Ptr CFmpz) -> CLong -> IO ()++-- | /fmpz_poly_powers_clear/ /pinv/ +--+-- Clean up resources used by precomputed powers which have been computed+-- by @fmpz_poly_powers_precompute@.+foreign import ccall "fmpz_poly.h fmpz_poly_powers_clear"+ fmpz_poly_powers_clear :: Ptr CFmpzPolyPowersPrecomp -> IO ()++-- | /_fmpz_poly_rem_powers_precomp/ /A/ /m/ /B/ /n/ /powers/ +--+-- Set \(A\) to the remainder of \(A\) divide \(B\) given precomputed+-- powers mod \(B\) provided by @_fmpz_poly_powers_precompute@. No aliasing+-- is allowed.+foreign import ccall "fmpz_poly.h _fmpz_poly_rem_powers_precomp"+ _fmpz_poly_rem_powers_precomp :: Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> Ptr (Ptr CFmpz) -> IO ()++-- | /fmpz_poly_rem_powers_precomp/ /R/ /A/ /B/ /B_inv/ +--+-- Set \(R\) to the remainder of \(A\) divide \(B\) given precomputed+-- powers mod \(B\) provided by @fmpz_poly_powers_precompute@.+foreign import ccall "fmpz_poly.h fmpz_poly_rem_powers_precomp"+ fmpz_poly_rem_powers_precomp :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPolyPowersPrecomp -> IO ()++-- Divisibility testing --------------------------------------------------------++-- | /_fmpz_poly_divides/ /Q/ /A/ /lenA/ /B/ /lenB/ +--+-- Returns 1 if @(B, lenB)@ divides @(A, lenA)@ exactly and sets \(Q\) to+-- the quotient, otherwise returns 0.+-- +-- It is assumed that+-- \(\operatorname{len}(A) \geq \operatorname{len}(B) > 0\) and that \(Q\)+-- has space for \(\operatorname{len}(A) - \operatorname{len}(B) + 1\)+-- coefficients.+-- +-- Aliasing of \(Q\) with either of the inputs is not permitted.+-- +-- This function is currently unoptimised and provided for convenience+-- only.+foreign import ccall "fmpz_poly.h _fmpz_poly_divides"+ _fmpz_poly_divides :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> IO CInt++-- | /fmpz_poly_divides/ /Q/ /A/ /B/ +--+-- Returns 1 if \(B\) divides \(A\) exactly and sets \(Q\) to the quotient,+-- otherwise returns 0.+-- +-- This function is currently unoptimised and provided for convenience+-- only.+foreign import ccall "fmpz_poly.h fmpz_poly_divides"+ fmpz_poly_divides :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO CInt++-- | /fmpz_poly_remove/ /res/ /poly1/ /poly2/ +--+-- Set @res@ to @poly1@ divided by the highest power of @poly2@ that+-- divides it and return the power. The divisor @poly2@ must not be zero or+-- \(\pm 1\), otherwise an exception is raised.+foreign import ccall "fmpz_poly.h fmpz_poly_remove"+ fmpz_poly_remove :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO CLong++-- Division mod p --------------------------------------------------------------++-- | /fmpz_poly_divlow_smodp/ /res/ /f/ /g/ /p/ /n/ +--+-- Compute the \(n\) lowest coefficients of \(f\) divided by \(g\),+-- assuming the division is exact modulo \(p\). The computed coefficients+-- are reduced modulo \(p\) using the symmetric remainder system. We+-- require \(f\) to be at least \(n\) in length. The function can handle+-- trailing zeroes, but the low nonzero coefficient of \(g\) must be+-- coprime to \(p\). This is a bespoke function used by factoring.+foreign import ccall "fmpz_poly.h fmpz_poly_divlow_smodp"+ fmpz_poly_divlow_smodp :: Ptr CFmpz -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpz -> CLong -> IO ()++-- | /fmpz_poly_divhigh_smodp/ /res/ /f/ /g/ /p/ /n/ +--+-- Compute the \(n\) highest coefficients of \(f\) divided by \(g\),+-- assuming the division is exact modulo \(p\). The computed coefficients+-- are reduced modulo \(p\) using the symmetric remainder system. We+-- require \(f\) to be as output by @fmpz_poly_mulhigh_n@ given polynomials+-- \(g\) and a polynomial of length \(n\) as inputs. The leading+-- coefficient of \(g\) must be coprime to \(p\). This is a bespoke+-- function used by factoring.+foreign import ccall "fmpz_poly.h fmpz_poly_divhigh_smodp"+ fmpz_poly_divhigh_smodp :: Ptr CFmpz -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpz -> CLong -> IO ()++-- Power series division -------------------------------------------------------++-- | /_fmpz_poly_inv_series_basecase/ /Qinv/ /Q/ /Qlen/ /n/ +--+-- Computes the first \(n\) terms of the inverse power series of+-- @(Q, lenQ)@ using a recurrence.+-- +-- Assumes that \(n \geq 1\) and that \(Q\) has constant term \(\pm 1\).+-- Does not support aliasing.+foreign import ccall "fmpz_poly.h _fmpz_poly_inv_series_basecase"+ _fmpz_poly_inv_series_basecase :: Ptr CFmpz -> Ptr CFmpz -> CLong -> CLong -> IO ()++-- | /fmpz_poly_inv_series_basecase/ /Qinv/ /Q/ /n/ +--+-- Computes the first \(n\) terms of the inverse power series of \(Q\)+-- using a recurrence, assuming that \(Q\) has constant term \(\pm 1\) and+-- \(n \geq 1\).+foreign import ccall "fmpz_poly.h fmpz_poly_inv_series_basecase"+ fmpz_poly_inv_series_basecase :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()++-- | /_fmpz_poly_inv_series_newton/ /Qinv/ /Q/ /Qlen/ /n/ +--+-- Computes the first \(n\) terms of the inverse power series of+-- @(Q, lenQ)@ using Newton iteration.+-- +-- Assumes that \(n \geq 1\) and that \(Q\) has constant term \(\pm 1\).+-- Does not support aliasing.+foreign import ccall "fmpz_poly.h _fmpz_poly_inv_series_newton"+ _fmpz_poly_inv_series_newton :: Ptr CFmpz -> Ptr CFmpz -> CLong -> CLong -> IO ()++-- | /fmpz_poly_inv_series_newton/ /Qinv/ /Q/ /n/ +--+-- Computes the first \(n\) terms of the inverse power series of \(Q\)+-- using Newton iteration, assuming \(Q\) has constant term \(\pm 1\) and+-- \(n \geq 1\).+foreign import ccall "fmpz_poly.h fmpz_poly_inv_series_newton"+ fmpz_poly_inv_series_newton :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()++-- | /_fmpz_poly_inv_series/ /Qinv/ /Q/ /Qlen/ /n/ +--+-- Computes the first \(n\) terms of the inverse power series of+-- @(Q, lenQ)@.+-- +-- Assumes that \(n \geq 1\) and that \(Q\) has constant term \(\pm 1\).+-- Does not support aliasing.+foreign import ccall "fmpz_poly.h _fmpz_poly_inv_series"+ _fmpz_poly_inv_series :: Ptr CFmpz -> Ptr CFmpz -> CLong -> CLong -> IO ()++-- | /fmpz_poly_inv_series/ /Qinv/ /Q/ /n/ +--+-- Computes the first \(n\) terms of the inverse power series of \(Q\),+-- assuming \(Q\) has constant term \(\pm 1\) and \(n \geq 1\).+foreign import ccall "fmpz_poly.h fmpz_poly_inv_series"+ fmpz_poly_inv_series :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()++-- | /_fmpz_poly_div_series_basecase/ /Q/ /A/ /Alen/ /B/ /Blen/ /n/ +--+foreign import ccall "fmpz_poly.h _fmpz_poly_div_series_basecase"+ _fmpz_poly_div_series_basecase :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> CLong -> IO ()++-- | /_fmpz_poly_div_series_divconquer/ /Q/ /A/ /Alen/ /B/ /Blen/ /n/ +--+foreign import ccall "fmpz_poly.h _fmpz_poly_div_series_divconquer"+ _fmpz_poly_div_series_divconquer :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> CLong -> IO ()++-- | /_fmpz_poly_div_series/ /Q/ /A/ /Alen/ /B/ /Blen/ /n/ +--+-- Divides @(A, Alen)@ by @(B, Blen)@ as power series over \(\mathbb{Z}\),+-- assuming \(B\) has constant term \(\pm 1\) and \(n \geq 1\). Aliasing is+-- not supported.+foreign import ccall "fmpz_poly.h _fmpz_poly_div_series"+ _fmpz_poly_div_series :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> CLong -> IO ()++-- | /fmpz_poly_div_series_basecase/ /Q/ /A/ /B/ /n/ +--+foreign import ccall "fmpz_poly.h fmpz_poly_div_series_basecase"+ fmpz_poly_div_series_basecase :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()++-- | /fmpz_poly_div_series_divconquer/ /Q/ /A/ /B/ /n/ +--+foreign import ccall "fmpz_poly.h fmpz_poly_div_series_divconquer"+ fmpz_poly_div_series_divconquer :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()++-- | /fmpz_poly_div_series/ /Q/ /A/ /B/ /n/ +--+-- Performs power series division in \(\mathbb{Z}[[x]] / (x^n)\). The+-- function considers the polynomials \(A\) and \(B\) as power series of+-- length \(n\) starting with the constant terms. The function assumes that+-- \(B\) has constant term \(\pm 1\) and \(n \geq 1\).+foreign import ccall "fmpz_poly.h fmpz_poly_div_series"+ fmpz_poly_div_series :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()++-- Pseudo division -------------------------------------------------------------++-- | /_fmpz_poly_pseudo_divrem_basecase/ /Q/ /R/ /d/ /A/ /lenA/ /B/ /lenB/ /inv/ +--+-- If \(\ell\) is the leading coefficient of \(B\), then computes \(Q\),+-- \(R\) such that \(\ell^d A = Q B + R\). This function is used for+-- simulating division over \(\mathbb{Q}\).+-- +-- Assumes that \(\operatorname{len}(A) \geq \operatorname{len}(B) > 0\).+-- Assumes that \(Q\) can fit+-- \(\operatorname{len}(A) - \operatorname{len}(B) + 1\) coefficients, and+-- that \(R\) can fit \(\operatorname{len}(A)\) coefficients. Supports+-- aliasing of @(R, lenA)@ and @(A, lenA)@. But other than this, no+-- aliasing of the inputs and outputs is supported.+-- +-- An optional precomputed inverse of the leading coefficient of \(B\) from+-- @fmpz_preinvn_init@ can be supplied. Otherwise @inv@ should be @NULL@.+-- +-- Note: @fmpz.h@ has to be included before @fmpz_poly.h@ in order for+-- @fmpz_poly.h@ to declare this function.+foreign import ccall "fmpz_poly.h _fmpz_poly_pseudo_divrem_basecase"+ _fmpz_poly_pseudo_divrem_basecase :: Ptr CFmpz -> Ptr CFmpz -> Ptr CULong -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> Ptr CFmpzPreInvN -> IO ()++-- | /fmpz_poly_pseudo_divrem_basecase/ /Q/ /R/ /d/ /A/ /B/ +--+-- If \(\ell\) is the leading coefficient of \(B\), then computes \(Q\),+-- \(R\) such that \(\ell^d A = Q B + R\). This function is used for+-- simulating division over \(\mathbb{Q}\).+foreign import ccall "fmpz_poly.h fmpz_poly_pseudo_divrem_basecase"+ fmpz_poly_pseudo_divrem_basecase :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CULong -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()++-- | /_fmpz_poly_pseudo_divrem_divconquer/ /Q/ /R/ /d/ /A/ /lenA/ /B/ /lenB/ /inv/ +--+-- Computes @(Q, lenA - lenB + 1)@, @(R, lenA)@ such that+-- \(\ell^d A = B Q + R\), only setting the bottom+-- \(\operatorname{len}(B) - 1\) coefficients of \(R\) to their correct+-- values. The remaining top coefficients of @(R, lenA)@ may be arbitrary.+-- +-- Assumes \(\operatorname{len}(A) \geq \operatorname{len}(B) > 0\). Allows+-- zero-padding in @(A, lenA)@. No aliasing of input and output operands is+-- allowed.+-- +-- An optional precomputed inverse of the leading coefficient of \(B\) from+-- @fmpz_preinvn_init@ can be supplied. Otherwise @inv@ should be @NULL@.+-- +-- Note: @fmpz.h@ has to be included before @fmpz_poly.h@ in order for+-- @fmpz_poly.h@ to declare this function.+foreign import ccall "fmpz_poly.h _fmpz_poly_pseudo_divrem_divconquer"+ _fmpz_poly_pseudo_divrem_divconquer :: Ptr CFmpz -> Ptr CFmpz -> Ptr CULong -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> Ptr CFmpzPreInvN -> IO ()++-- | /fmpz_poly_pseudo_divrem_divconquer/ /Q/ /R/ /d/ /A/ /B/ +--+-- Computes \(Q\), \(R\), and \(d\) such that \(\ell^d A = B Q + R\), where+-- \(R\) has length less than the length of \(B\) and \(\ell\) is the+-- leading coefficient of \(B\). An exception is raised if \(B\) is zero.+foreign import ccall "fmpz_poly.h fmpz_poly_pseudo_divrem_divconquer"+ fmpz_poly_pseudo_divrem_divconquer :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CULong -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()++-- | /_fmpz_poly_pseudo_divrem_cohen/ /Q/ /R/ /A/ /lenA/ /B/ /lenB/ +--+-- Assumes that \(\operatorname{len}(A) \geq \operatorname{len}(B) > 0\).+-- Assumes that \(Q\) can fit+-- \(\operatorname{len}(A) - \operatorname{len}(B) + 1\) coefficients, and+-- that \(R\) can fit \(\operatorname{len}(A)\) coefficients. Supports+-- aliasing of @(R, lenA)@ and @(A, lenA)@. But other than this, no+-- aliasing of the inputs and outputs is supported.+foreign import ccall "fmpz_poly.h _fmpz_poly_pseudo_divrem_cohen"+ _fmpz_poly_pseudo_divrem_cohen :: Ptr CFmpz -> Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> IO ()++-- | /fmpz_poly_pseudo_divrem_cohen/ /Q/ /R/ /A/ /B/ +--+-- This is a variant of @fmpz_poly_pseudo_divrem@ which computes+-- polynomials \(Q\) and \(R\) such that \(\ell^d A = B Q + R\). However,+-- the value of \(d\) is fixed at+-- \(\max{\{0, \operatorname{len}(A) - \operatorname{len}(B) + 1\}}\).+-- +-- This function is faster when the remainder is not well behaved, i.e.+-- where it is not expected to be close to zero. Note that this function is+-- not asymptotically fast. It is efficient only for short polynomials,+-- e.g. when \(\operatorname{len}(B) < 32\).+foreign import ccall "fmpz_poly.h fmpz_poly_pseudo_divrem_cohen"+ fmpz_poly_pseudo_divrem_cohen :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()++-- | /_fmpz_poly_pseudo_rem_cohen/ /R/ /A/ /lenA/ /B/ /lenB/ +--+-- Assumes that \(\operatorname{len}(A) \geq \operatorname{len}(B) > 0\).+-- Assumes that \(R\) can fit \(\operatorname{len}(A)\) coefficients.+-- Supports aliasing of @(R, lenA)@ and @(A, lenA)@. But other than this,+-- no aliasing of the inputs and outputs is supported.+foreign import ccall "fmpz_poly.h _fmpz_poly_pseudo_rem_cohen"+ _fmpz_poly_pseudo_rem_cohen :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> IO ()++-- | /fmpz_poly_pseudo_rem_cohen/ /R/ /A/ /B/ +--+-- This is a variant of @fmpz_poly_pseudo_rem@ which computes polynomials+-- \(Q\) and \(R\) such that \(\ell^d A = B Q + R\), but only returns+-- \(R\). However, the value of \(d\) is fixed at+-- \(\max{\{0, \operatorname{len}(A) - \operatorname{len}(B) + 1\}}\).+-- +-- This function is faster when the remainder is not well behaved, i.e.+-- where it is not expected to be close to zero. Note that this function is+-- not asymptotically fast. It is efficient only for short polynomials,+-- e.g. when \(\operatorname{len}(B) < 32\).+-- +-- This function uses the algorithm described in Algorithm 3.1.2 of+-- < [Coh1996]>.+foreign import ccall "fmpz_poly.h fmpz_poly_pseudo_rem_cohen"+ fmpz_poly_pseudo_rem_cohen :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()++-- -- | /_fmpz_poly_pseudo_divrem/ /Q/ /R/ /d/ /A/ /lenA/ /B/ /lenB/ /inv/ +--+-- -- If \(\ell\) is the leading coefficient of \(B\), then computes+-- -- @(Q, lenA - lenB + 1)@, @(R, lenB - 1)@ and \(d\) such that+-- -- \(\ell^d A = B Q + R\). This function is used for simulating division+-- -- over \(\mathbb{Q}\).+-- -- +-- -- Assumes that \(\operatorname{len}(A) \geq \operatorname{len}(B) > 0\).+-- -- Assumes that \(Q\) can fit+-- -- \(\operatorname{len}(A) - \operatorname{len}(B) + 1\) coefficients, and+-- -- that \(R\) can fit \(\operatorname{len}(A)\) coefficients, although on+-- -- exit only the bottom \(\operatorname{len}(B)\) coefficients will carry+-- -- meaningful data.+-- -- +-- -- Supports aliasing of @(R, lenA)@ and @(A, lenA)@. But other than this,+-- -- no aliasing of the inputs and outputs is supported.+-- -- +-- -- An optional precomputed inverse of the leading coefficient of \(B\) from+-- -- @fmpz_preinvn_init@ can be supplied. Otherwise @inv@ should be @NULL@.+-- -- +-- -- Note: @fmpz.h@ has to be included before @fmpz_poly.h@ in order for+-- -- @fmpz_poly.h@ to declare this function.+-- foreign import ccall "fmpz_poly.h _fmpz_poly_pseudo_divrem"+-- _fmpz_poly_pseudo_divrem :: Ptr CFmpz -> Ptr CFmpz -> Ptr CULong -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> Ptr CFmpzPreInvN -> IO ()++-- | /fmpz_poly_pseudo_divrem/ /Q/ /R/ /d/ /A/ /B/ +--+-- Computes \(Q\), \(R\), and \(d\) such that \(\ell^d A = B Q + R\).+foreign import ccall "fmpz_poly.h fmpz_poly_pseudo_divrem"+ fmpz_poly_pseudo_divrem :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CULong -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()++-- | /_fmpz_poly_pseudo_div/ /Q/ /d/ /A/ /lenA/ /B/ /lenB/ /inv/ +--+-- Pseudo-division, only returning the quotient.+-- +-- Note: @fmpz.h@ has to be included before @fmpz_poly.h@ in order for+-- @fmpz_poly.h@ to declare this function.+foreign import ccall "fmpz_poly.h _fmpz_poly_pseudo_div"+ _fmpz_poly_pseudo_div :: Ptr CFmpz -> Ptr CULong -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> Ptr CFmpzPreInvN -> IO ()++-- | /fmpz_poly_pseudo_div/ /Q/ /d/ /A/ /B/ +--+-- Pseudo-division, only returning the quotient.+foreign import ccall "fmpz_poly.h fmpz_poly_pseudo_div"+ fmpz_poly_pseudo_div :: Ptr CFmpzPoly -> Ptr CULong -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()++-- | /_fmpz_poly_pseudo_rem/ /R/ /d/ /A/ /lenA/ /B/ /lenB/ /inv/ +--+-- Pseudo-division, only returning the remainder.+-- +-- Note: @fmpz.h@ has to be included before @fmpz_poly.h@ in order for+-- @fmpz_poly.h@ to declare this function.+foreign import ccall "fmpz_poly.h _fmpz_poly_pseudo_rem"+ _fmpz_poly_pseudo_rem :: Ptr CFmpz -> Ptr CULong -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> Ptr CFmpzPreInvN -> IO ()++-- | /fmpz_poly_pseudo_rem/ /R/ /d/ /A/ /B/ +--+-- Pseudo-division, only returning the remainder.+foreign import ccall "fmpz_poly.h fmpz_poly_pseudo_rem"+ fmpz_poly_pseudo_rem :: Ptr CFmpzPoly -> Ptr CULong -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()++-- Derivative ------------------------------------------------------------------++-- | /_fmpz_poly_derivative/ /rpoly/ /poly/ /len/ +--+-- Sets @(rpoly, len - 1)@ to the derivative of @(poly, len)@. Also handles+-- the cases where @len@ is \(0\) or \(1\) correctly. Supports aliasing of+-- @rpoly@ and @poly@.+foreign import ccall "fmpz_poly.h _fmpz_poly_derivative"+ _fmpz_poly_derivative :: Ptr CFmpz -> Ptr CFmpz -> CLong -> IO ()++-- | /fmpz_poly_derivative/ /res/ /poly/ +--+-- Sets @res@ to the derivative of @poly@.+foreign import ccall "fmpz_poly.h fmpz_poly_derivative"+ fmpz_poly_derivative :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()++-- | /_fmpz_poly_nth_derivative/ /rpoly/ /poly/ /n/ /len/ +--+-- Sets @(rpoly, len - n)@ to the nth derivative of @(poly, len)@. Also+-- handles the cases where @len \<= n@ correctly. Supports aliasing of+-- @rpoly@ and @poly@.+foreign import ccall "fmpz_poly.h _fmpz_poly_nth_derivative"+ _fmpz_poly_nth_derivative :: Ptr CFmpz -> Ptr CFmpz -> CULong -> CLong -> IO ()++-- | /fmpz_poly_nth_derivative/ /res/ /poly/ /n/ +--+-- Sets @res@ to the nth derivative of @poly@.+foreign import ccall "fmpz_poly.h fmpz_poly_nth_derivative"+ fmpz_poly_nth_derivative :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CULong -> IO ()++-- Evaluation ------------------------------------------------------------------++-- | /_fmpz_poly_evaluate_divconquer_fmpz/ /res/ /poly/ /len/ /a/ +--+-- Evaluates the polynomial @(poly, len)@ at the integer \(a\) using a+-- divide and conquer approach. Assumes that the length of the polynomial+-- is at least one. Allows zero padding. Does not allow aliasing between+-- @res@ and @x@.+foreign import ccall "fmpz_poly.h _fmpz_poly_evaluate_divconquer_fmpz"+ _fmpz_poly_evaluate_divconquer_fmpz :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> IO ()++-- | /fmpz_poly_evaluate_divconquer_fmpz/ /res/ /poly/ /a/ +--+-- Evaluates the polynomial @poly@ at the integer \(a\) using a divide and+-- conquer approach.+-- +-- Aliasing between @res@ and @a@ is supported, however, @res@ may not be+-- part of @poly@.+foreign import ccall "fmpz_poly.h fmpz_poly_evaluate_divconquer_fmpz"+ fmpz_poly_evaluate_divconquer_fmpz :: Ptr CFmpz -> Ptr CFmpzPoly -> Ptr CFmpz -> IO ()++-- | /_fmpz_poly_evaluate_horner_fmpz/ /res/ /f/ /len/ /a/ +--+-- Evaluates the polynomial @(f, len)@ at the integer \(a\) using Horner\'s+-- rule, and sets @res@ to the result. Aliasing between @res@ and \(a\) or+-- any of the coefficients of \(f\) is not supported.+foreign import ccall "fmpz_poly.h _fmpz_poly_evaluate_horner_fmpz"+ _fmpz_poly_evaluate_horner_fmpz :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> IO ()++-- | /fmpz_poly_evaluate_horner_fmpz/ /res/ /f/ /a/ +--+-- Evaluates the polynomial \(f\) at the integer \(a\) using Horner\'s+-- rule, and sets @res@ to the result.+-- +-- As expected, aliasing between @res@ and @a@ is supported. However, @res@+-- may not be aliased with a coefficient of \(f\).+foreign import ccall "fmpz_poly.h fmpz_poly_evaluate_horner_fmpz"+ fmpz_poly_evaluate_horner_fmpz :: Ptr CFmpz -> Ptr CFmpzPoly -> Ptr CFmpz -> IO ()++-- | /_fmpz_poly_evaluate_fmpz/ /res/ /f/ /len/ /a/ +--+-- Evaluates the polynomial @(f, len)@ at the integer \(a\) and sets @res@+-- to the result. Aliasing between @res@ and \(a\) or any of the+-- coefficients of \(f\) is not supported.+foreign import ccall "fmpz_poly.h _fmpz_poly_evaluate_fmpz"+ _fmpz_poly_evaluate_fmpz :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> IO ()++-- | /fmpz_poly_evaluate_fmpz/ /res/ /f/ /a/ +--+-- Evaluates the polynomial \(f\) at the integer \(a\) and sets @res@ to+-- the result.+-- +-- As expected, aliasing between @res@ and \(a\) is supported. However,+-- @res@ may not be aliased with a coefficient of \(f\).+foreign import ccall "fmpz_poly.h fmpz_poly_evaluate_fmpz"+ fmpz_poly_evaluate_fmpz :: Ptr CFmpz -> Ptr CFmpzPoly -> Ptr CFmpz -> IO ()++-- | /_fmpz_poly_evaluate_divconquer_fmpq/ /rnum/ /rden/ /f/ /len/ /anum/ /aden/ +--+-- Evaluates the polynomial @(f, len)@ at the rational @(anum, aden)@ using+-- a divide and conquer approach, and sets @(rnum, rden)@ to the result in+-- lowest terms. Assumes that the length of the polynomial is at least one.+-- +-- Aliasing between @(rnum, rden)@ and @(anum, aden)@ or any of the+-- coefficients of \(f\) is not supported.+foreign import ccall "fmpz_poly.h _fmpz_poly_evaluate_divconquer_fmpq"+ _fmpz_poly_evaluate_divconquer_fmpq :: Ptr CFmpz -> Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> Ptr CFmpz -> IO ()++-- | /fmpz_poly_evaluate_divconquer_fmpq/ /res/ /f/ /a/ +--+-- Evaluates the polynomial \(f\) at the rational \(a\) using a divide and+-- conquer approach, and sets @res@ to the result.+foreign import ccall "fmpz_poly.h fmpz_poly_evaluate_divconquer_fmpq"+ fmpz_poly_evaluate_divconquer_fmpq :: Ptr CFmpq -> Ptr CFmpzPoly -> Ptr CFmpq -> IO ()++-- | /_fmpz_poly_evaluate_horner_fmpq/ /rnum/ /rden/ /f/ /len/ /anum/ /aden/ +--+-- Evaluates the polynomial @(f, len)@ at the rational @(anum, aden)@ using+-- Horner\'s rule, and sets @(rnum, rden)@ to the result in lowest terms.+-- +-- Aliasing between @(rnum, rden)@ and @(anum, aden)@ or any of the+-- coefficients of \(f\) is not supported.+foreign import ccall "fmpz_poly.h _fmpz_poly_evaluate_horner_fmpq"+ _fmpz_poly_evaluate_horner_fmpq :: Ptr CFmpz -> Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> Ptr CFmpz -> IO ()++-- | /fmpz_poly_evaluate_horner_fmpq/ /res/ /f/ /a/ +--+-- Evaluates the polynomial \(f\) at the rational \(a\) using Horner\'s+-- rule, and sets @res@ to the result.+foreign import ccall "fmpz_poly.h fmpz_poly_evaluate_horner_fmpq"+ fmpz_poly_evaluate_horner_fmpq :: Ptr CFmpq -> Ptr CFmpzPoly -> Ptr CFmpq -> IO ()++-- | /_fmpz_poly_evaluate_fmpq/ /rnum/ /rden/ /f/ /len/ /anum/ /aden/ +--+-- Evaluates the polynomial @(f, len)@ at the rational @(anum, aden)@ and+-- sets @(rnum, rden)@ to the result in lowest terms.+-- +-- Aliasing between @(rnum, rden)@ and @(anum, aden)@ or any of the+-- coefficients of \(f\) is not supported.+foreign import ccall "fmpz_poly.h _fmpz_poly_evaluate_fmpq"+ _fmpz_poly_evaluate_fmpq :: Ptr CFmpz -> Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> Ptr CFmpz -> IO ()++-- | /fmpz_poly_evaluate_fmpq/ /res/ /f/ /a/ +--+-- Evaluates the polynomial \(f\) at the rational \(a\), and sets @res@ to+-- the result.+foreign import ccall "fmpz_poly.h fmpz_poly_evaluate_fmpq"+ fmpz_poly_evaluate_fmpq :: Ptr CFmpq -> Ptr CFmpzPoly -> Ptr CFmpq -> IO ()++-- | /_fmpz_poly_evaluate_mod/ /poly/ /len/ /a/ /n/ /ninv/ +--+-- Evaluates @(poly, len)@ at the value \(a\) modulo \(n\) and returns the+-- result. The last argument @ninv@ must be set to the precomputed inverse+-- of \(n\), which can be obtained using the function @n_preinvert_limb@.+foreign import ccall "fmpz_poly.h _fmpz_poly_evaluate_mod"+ _fmpz_poly_evaluate_mod :: Ptr CFmpz -> CLong -> CMpLimb -> CMpLimb -> CMpLimb -> IO CMpLimb++-- | /fmpz_poly_evaluate_mod/ /poly/ /a/ /n/ +--+-- Evaluates @poly@ at the value \(a\) modulo \(n\) and returns the result.+foreign import ccall "fmpz_poly.h fmpz_poly_evaluate_mod"+ fmpz_poly_evaluate_mod :: Ptr CFmpzPoly -> CMpLimb -> CMpLimb -> IO CMpLimb++-- | /fmpz_poly_evaluate_fmpz_vec/ /res/ /f/ /a/ /n/ +--+-- Evaluates @f@ at the \(n\) values given in the vector @f@, writing the+-- results to @res@.+foreign import ccall "fmpz_poly.h fmpz_poly_evaluate_fmpz_vec"+ fmpz_poly_evaluate_fmpz_vec :: Ptr CFmpz -> Ptr CFmpzPoly -> Ptr CFmpz -> CLong -> IO ()++-- | /_fmpz_poly_evaluate_horner_d/ /poly/ /n/ /d/ +--+-- Evaluate @(poly, n)@ at the double \(d\). No attempt is made to do this+-- efficiently or in a numerically stable way. It is currently only used in+-- Flint for quick and dirty evaluations of polynomials with all+-- coefficients positive.+foreign import ccall "fmpz_poly.h _fmpz_poly_evaluate_horner_d"+ _fmpz_poly_evaluate_horner_d :: Ptr CFmpz -> CLong -> CDouble -> IO CDouble++-- | /fmpz_poly_evaluate_horner_d/ /poly/ /d/ +--+-- Evaluate @poly@ at the double \(d\). No attempt is made to do this+-- efficiently or in a numerically stable way. It is currently only used in+-- Flint for quick and dirty evaluations of polynomials with all+-- coefficients positive.+foreign import ccall "fmpz_poly.h fmpz_poly_evaluate_horner_d"+ fmpz_poly_evaluate_horner_d :: Ptr CFmpzPoly -> CDouble -> IO CDouble++-- | /_fmpz_poly_evaluate_horner_d_2exp/ /exp/ /poly/ /n/ /d/ +--+-- Evaluate @(poly, n)@ at the double \(d\). Return the result as a double+-- and an exponent @exp@ combination. No attempt is made to do this+-- efficiently or in a numerically stable way. It is currently only used in+-- Flint for quick and dirty evaluations of polynomials with all+-- coefficients positive.+foreign import ccall "fmpz_poly.h _fmpz_poly_evaluate_horner_d_2exp"+ _fmpz_poly_evaluate_horner_d_2exp :: Ptr CLong -> Ptr CFmpz -> CLong -> CDouble -> IO CDouble++-- | /fmpz_poly_evaluate_horner_d_2exp/ /exp/ /poly/ /d/ +--+-- Evaluate @poly@ at the double \(d\). Return the result as a double and+-- an exponent @exp@ combination. No attempt is made to do this efficiently+-- or in a numerically stable way. It is currently only used in Flint for+-- quick and dirty evaluations of polynomials with all coefficients+-- positive.+foreign import ccall "fmpz_poly.h fmpz_poly_evaluate_horner_d_2exp"+ fmpz_poly_evaluate_horner_d_2exp :: Ptr CLong -> Ptr CFmpzPoly -> CDouble -> IO CDouble++-- | /_fmpz_poly_evaluate_horner_d_2exp2/ /exp/ /poly/ /n/ /d/ /dexp/ +--+-- Evaluate @poly@ at @d*2^dexp@. Return the result as a double and an+-- exponent @exp@ combination. No attempt is made to do this efficiently or+-- in a numerically stable way. It is currently only used in Flint for+-- quick and dirty evaluations of polynomials with all coefficients+-- positive.+foreign import ccall "fmpz_poly.h _fmpz_poly_evaluate_horner_d_2exp2"+ _fmpz_poly_evaluate_horner_d_2exp2 :: Ptr CLong -> Ptr CFmpz -> CLong -> CDouble -> CLong -> IO CDouble++-- Newton basis ----------------------------------------------------------------++-- | /_fmpz_poly_monomial_to_newton/ /poly/ /roots/ /n/ +--+-- Converts @(poly, n)@ in-place from its coefficients given in the+-- standard monomial basis to the Newton basis for the roots+-- \(r_0, r_1, \ldots, r_{n-2}\). In other words, this determines output+-- coefficients \(c_i\) such that+-- \(c_0 + c_1(x-r_0) + c_2(x-r_0)(x-r_1) + \ldots + c_{n-1}(x-r_0)(x-r_1)\cdots(x-r_{n-2})\)+-- is equal to the input polynomial. Uses repeated polynomial division.+foreign import ccall "fmpz_poly.h _fmpz_poly_monomial_to_newton"+ _fmpz_poly_monomial_to_newton :: Ptr CFmpz -> Ptr CFmpz -> CLong -> IO ()++-- | /_fmpz_poly_newton_to_monomial/ /poly/ /roots/ /n/ +--+-- Converts @(poly, n)@ in-place from its coefficients given in the Newton+-- basis for the roots \(r_0, r_1, \ldots, r_{n-2}\) to the standard+-- monomial basis. In other words, this evaluates+-- \(c_0 + c_1(x-r_0) + c_2(x-r_0)(x-r_1) + \ldots + c_{n-1}(x-r_0)(x-r_1)\cdots(x-r_{n-2})\)+-- where \(c_i\) are the input coefficients for @poly@. Uses Horner\'s+-- rule.+foreign import ccall "fmpz_poly.h _fmpz_poly_newton_to_monomial"+ _fmpz_poly_newton_to_monomial :: Ptr CFmpz -> Ptr CFmpz -> CLong -> IO ()++-- Interpolation ---------------------------------------------------------------++-- | /fmpz_poly_interpolate_fmpz_vec/ /poly/ /xs/ /ys/ /n/ +--+-- Sets @poly@ to the unique interpolating polynomial of degree at most+-- \(n - 1\) satisfying \(f(x_i) = y_i\) for every pair \(x_i, y_u\) in+-- @xs@ and @ys@, assuming that this polynomial has integer coefficients.+-- +-- If an interpolating polynomial with integer coefficients does not exist,+-- a @FLINT_INEXACT@ exception is thrown.+-- +-- It is assumed that the \(x\) values are distinct.+foreign import ccall "fmpz_poly.h fmpz_poly_interpolate_fmpz_vec"+ fmpz_poly_interpolate_fmpz_vec :: Ptr CFmpzPoly -> Ptr CFmpz -> Ptr CFmpz -> CLong -> IO ()++-- Composition -----------------------------------------------------------------++-- | /_fmpz_poly_compose_horner/ /res/ /poly1/ /len1/ /poly2/ /len2/ +--+-- Sets @res@ to the composition of @(poly1, len1)@ and @(poly2, len2)@.+-- +-- Assumes that @res@ has space for @(len1-1)*(len2-1) + 1@ coefficients.+-- Assumes that @poly1@ and @poly2@ are non-zero polynomials. Does not+-- support aliasing between any of the inputs and the output.+foreign import ccall "fmpz_poly.h _fmpz_poly_compose_horner"+ _fmpz_poly_compose_horner :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> IO ()++-- | /fmpz_poly_compose_horner/ /res/ /poly1/ /poly2/ +--+-- Sets @res@ to the composition of @poly1@ and @poly2@. To be more+-- precise, denoting @res@, @poly1@, and @poly2@ by \(f\), \(g\), and+-- \(h\), sets \(f(t) = g(h(t))\).+-- +-- This implementation uses Horner\'s method.+foreign import ccall "fmpz_poly.h fmpz_poly_compose_horner"+ fmpz_poly_compose_horner :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()++-- | /_fmpz_poly_compose_divconquer/ /res/ /poly1/ /len1/ /poly2/ /len2/ +--+-- Computes the composition of @(poly1, len1)@ and @(poly2, len2)@ using a+-- divide and conquer approach and places the result into @res@, assuming+-- @res@ can hold the output of length @(len1 - 1) * (len2 - 1) + 1@.+-- +-- Assumes @len1, len2 > 0@. Does not support aliasing between @res@ and+-- any of @(poly1, len1)@ and @(poly2, len2)@.+foreign import ccall "fmpz_poly.h _fmpz_poly_compose_divconquer"+ _fmpz_poly_compose_divconquer :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> IO ()++-- | /fmpz_poly_compose_divconquer/ /res/ /poly1/ /poly2/ +--+-- Sets @res@ to the composition of @poly1@ and @poly2@. To be precise+-- about the order of composition, denoting @res@, @poly1@, and @poly2@ by+-- \(f\), \(g\), and \(h\), respectively, sets \(f(t) = g(h(t))\).+foreign import ccall "fmpz_poly.h fmpz_poly_compose_divconquer"+ fmpz_poly_compose_divconquer :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()++-- | /_fmpz_poly_compose/ /res/ /poly1/ /len1/ /poly2/ /len2/ +--+-- Sets @res@ to the composition of @(poly1, len1)@ and @(poly2, len2)@.+-- +-- Assumes that @res@ has space for @(len1-1)*(len2-1) + 1@ coefficients.+-- Assumes that @poly1@ and @poly2@ are non-zero polynomials. Does not+-- support aliasing between any of the inputs and the output.+foreign import ccall "fmpz_poly.h _fmpz_poly_compose"+ _fmpz_poly_compose :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> IO ()++-- | /fmpz_poly_compose/ /res/ /poly1/ /poly2/ +--+-- Sets @res@ to the composition of @poly1@ and @poly2@. To be precise+-- about the order of composition, denoting @res@, @poly1@, and @poly2@ by+-- \(f\), \(g\), and \(h\), respectively, sets \(f(t) = g(h(t))\).+foreign import ccall "fmpz_poly.h fmpz_poly_compose"+ fmpz_poly_compose :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()++-- Inflation and deflation -----------------------------------------------------++-- | /fmpz_poly_inflate/ /result/ /input/ /inflation/ +--+-- Sets @result@ to the inflated polynomial \(p(x^n)\) where \(p\) is given+-- by @input@ and \(n\) is given by @inflation@.+foreign import ccall "fmpz_poly.h fmpz_poly_inflate"+ fmpz_poly_inflate :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CULong -> IO ()++-- | /fmpz_poly_deflate/ /result/ /input/ /deflation/ +--+-- Sets @result@ to the deflated polynomial \(p(x^{1/n})\) where \(p\) is+-- given by @input@ and \(n\) is given by @deflation@. Requires \(n > 0\).+foreign import ccall "fmpz_poly.h fmpz_poly_deflate"+ fmpz_poly_deflate :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CULong -> IO ()++-- | /fmpz_poly_deflation/ /input/ +--+-- Returns the largest integer by which @input@ can be deflated. As special+-- cases, returns 0 if @input@ is the zero polynomial and 1 if @input@ is a+-- constant polynomial.+foreign import ccall "fmpz_poly.h fmpz_poly_deflation"+ fmpz_poly_deflation :: Ptr CFmpzPoly -> IO CULong++-- Taylor shift ----------------------------------------------------------------++-- | /_fmpz_poly_taylor_shift_horner/ /poly/ /c/ /n/ +--+-- Performs the Taylor shift composing @poly@ by \(x+c\) in-place. Uses an+-- efficient version Horner\'s rule.+foreign import ccall "fmpz_poly.h _fmpz_poly_taylor_shift_horner"+ _fmpz_poly_taylor_shift_horner :: Ptr CFmpz -> Ptr CFmpz -> CLong -> IO ()++-- | /fmpz_poly_taylor_shift_horner/ /g/ /f/ /c/ +--+-- Performs the Taylor shift composing @f@ by \(x+c\).+foreign import ccall "fmpz_poly.h fmpz_poly_taylor_shift_horner"+ fmpz_poly_taylor_shift_horner :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpz -> IO ()++-- | /_fmpz_poly_taylor_shift_divconquer/ /poly/ /c/ /n/ +--+-- Performs the Taylor shift composing @poly@ by \(x+c\) in-place. Uses the+-- divide-and-conquer polynomial composition algorithm.+foreign import ccall "fmpz_poly.h _fmpz_poly_taylor_shift_divconquer"+ _fmpz_poly_taylor_shift_divconquer :: Ptr CFmpz -> Ptr CFmpz -> CLong -> IO ()++-- | /fmpz_poly_taylor_shift_divconquer/ /g/ /f/ /c/ +--+-- Performs the Taylor shift composing @f@ by \(x+c\). Uses the+-- divide-and-conquer polynomial composition algorithm.+foreign import ccall "fmpz_poly.h fmpz_poly_taylor_shift_divconquer"+ fmpz_poly_taylor_shift_divconquer :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpz -> IO ()++-- | /_fmpz_poly_taylor_shift_multi_mod/ /poly/ /c/ /n/ +--+-- Performs the Taylor shift composing @poly@ by \(x+c\) in-place. Uses a+-- multimodular algorithm, distributing the computation across+-- @flint_get_num_threads@ threads.+foreign import ccall "fmpz_poly.h _fmpz_poly_taylor_shift_multi_mod"+ _fmpz_poly_taylor_shift_multi_mod :: Ptr CFmpz -> Ptr CFmpz -> CLong -> IO ()++-- | /fmpz_poly_taylor_shift_multi_mod/ /g/ /f/ /c/ +--+-- Performs the Taylor shift composing @f@ by \(x+c\). Uses a multimodular+-- algorithm, distributing the computation across @flint_get_num_threads@+-- threads.+foreign import ccall "fmpz_poly.h fmpz_poly_taylor_shift_multi_mod"+ fmpz_poly_taylor_shift_multi_mod :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpz -> IO ()++-- | /_fmpz_poly_taylor_shift/ /poly/ /c/ /n/ +--+-- Performs the Taylor shift composing @poly@ by \(x+c\) in-place.+foreign import ccall "fmpz_poly.h _fmpz_poly_taylor_shift"+ _fmpz_poly_taylor_shift :: Ptr CFmpz -> Ptr CFmpz -> CLong -> IO ()++-- | /fmpz_poly_taylor_shift/ /g/ /f/ /c/ +--+-- Performs the Taylor shift composing @f@ by \(x+c\).+foreign import ccall "fmpz_poly.h fmpz_poly_taylor_shift"+ fmpz_poly_taylor_shift :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpz -> IO ()++-- Power series composition ----------------------------------------------------++-- | /_fmpz_poly_compose_series_horner/ /res/ /poly1/ /len1/ /poly2/ /len2/ /n/ +--+-- Sets @res@ to the composition of @poly1@ and @poly2@ modulo \(x^n\),+-- where the constant term of @poly2@ is required to be zero.+-- +-- Assumes that @len1, len2, n > 0@, that @len1, len2 \<= n@, and that+-- @(len1-1) * (len2-1) + 1 \<= n@, and that @res@ has space for @n@+-- coefficients. Does not support aliasing between any of the inputs and+-- the output.+-- +-- This implementation uses the Horner scheme.+foreign import ccall "fmpz_poly.h _fmpz_poly_compose_series_horner"+ _fmpz_poly_compose_series_horner :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> CLong -> IO ()++-- | /fmpz_poly_compose_series_horner/ /res/ /poly1/ /poly2/ /n/ +--+-- Sets @res@ to the composition of @poly1@ and @poly2@ modulo \(x^n\),+-- where the constant term of @poly2@ is required to be zero.+-- +-- This implementation uses the Horner scheme.+foreign import ccall "fmpz_poly.h fmpz_poly_compose_series_horner"+ fmpz_poly_compose_series_horner :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()++-- | /_fmpz_poly_compose_series_brent_kung/ /res/ /poly1/ /len1/ /poly2/ /len2/ /n/ +--+-- Sets @res@ to the composition of @poly1@ and @poly2@ modulo \(x^n\),+-- where the constant term of @poly2@ is required to be zero.+-- +-- Assumes that @len1, len2, n > 0@, that @len1, len2 \<= n@, and that+-- @(len1-1) * (len2-1) + 1 \<= n@, and that @res@ has space for @n@+-- coefficients. Does not support aliasing between any of the inputs and+-- the output.+-- +-- This implementation uses Brent-Kung algorithm 2.1 < [BrentKung1978]>.+foreign import ccall "fmpz_poly.h _fmpz_poly_compose_series_brent_kung"+ _fmpz_poly_compose_series_brent_kung :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> CLong -> IO ()++-- | /fmpz_poly_compose_series_brent_kung/ /res/ /poly1/ /poly2/ /n/ +--+-- Sets @res@ to the composition of @poly1@ and @poly2@ modulo \(x^n\),+-- where the constant term of @poly2@ is required to be zero.+-- +-- This implementation uses Brent-Kung algorithm 2.1 < [BrentKung1978]>.+foreign import ccall "fmpz_poly.h fmpz_poly_compose_series_brent_kung"+ fmpz_poly_compose_series_brent_kung :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()++-- | /_fmpz_poly_compose_series/ /res/ /poly1/ /len1/ /poly2/ /len2/ /n/ +--+-- Sets @res@ to the composition of @poly1@ and @poly2@ modulo \(x^n\),+-- where the constant term of @poly2@ is required to be zero.+-- +-- Assumes that @len1, len2, n > 0@, that @len1, len2 \<= n@, and that+-- @(len1-1) * (len2-1) + 1 \<= n@, and that @res@ has space for @n@+-- coefficients. Does not support aliasing between any of the inputs and+-- the output.+-- +-- This implementation automatically switches between the Horner scheme and+-- Brent-Kung algorithm 2.1 depending on the size of the inputs.+foreign import ccall "fmpz_poly.h _fmpz_poly_compose_series"+ _fmpz_poly_compose_series :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> CLong -> CLong -> IO ()++-- | /fmpz_poly_compose_series/ /res/ /poly1/ /poly2/ /n/ +--+-- Sets @res@ to the composition of @poly1@ and @poly2@ modulo \(x^n\),+-- where the constant term of @poly2@ is required to be zero.+-- +-- This implementation automatically switches between the Horner scheme and+-- Brent-Kung algorithm 2.1 depending on the size of the inputs.+foreign import ccall "fmpz_poly.h fmpz_poly_compose_series"+ fmpz_poly_compose_series :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()++-- Power series reversion ------------------------------------------------------++-- | /_fmpz_poly_revert_series_lagrange/ /Qinv/ /Q/ /Qlen/ /n/ +--+-- Sets @Qinv@ to the compositional inverse or reversion of @(Q, Qlen)@ as+-- a power series, i.e. computes \(Q^{-1}\) such that+-- \(Q(Q^{-1}(x)) = Q^{-1}(Q(x)) = x \bmod x^n\). The arguments may not be+-- aliased, and @Qlen@ must be at least 2. It is required that \(Q_0 = 0\)+-- and \(Q_1 = \pm 1\).+-- +-- This implementation uses the Lagrange inversion formula.+foreign import ccall "fmpz_poly.h _fmpz_poly_revert_series_lagrange"+ _fmpz_poly_revert_series_lagrange :: Ptr CFmpz -> Ptr CFmpz -> CLong -> CLong -> IO ()++-- | /fmpz_poly_revert_series_lagrange/ /Qinv/ /Q/ /n/ +--+-- Sets @Qinv@ to the compositional inverse or reversion of @Q@ as a power+-- series, i.e. computes \(Q^{-1}\) such that+-- \(Q(Q^{-1}(x)) = Q^{-1}(Q(x)) = x \bmod x^n\). It is required that+-- \(Q_0 = 0\) and \(Q_1 = \pm 1\).+-- +-- This implementation uses the Lagrange inversion formula.+foreign import ccall "fmpz_poly.h fmpz_poly_revert_series_lagrange"+ fmpz_poly_revert_series_lagrange :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()++-- | /_fmpz_poly_revert_series_lagrange_fast/ /Qinv/ /Q/ /Qlen/ /n/ +--+-- Sets @Qinv@ to the compositional inverse or reversion of @(Q, Qlen)@ as+-- a power series, i.e. computes \(Q^{-1}\) such that+-- \(Q(Q^{-1}(x)) = Q^{-1}(Q(x)) = x \bmod x^n\). The arguments may not be+-- aliased, and @Qlen@ must be at least 2. It is required that \(Q_0 = 0\)+-- and \(Q_1 = \pm 1\).+-- +-- This implementation uses a reduced-complexity implementation of the+-- Lagrange inversion formula.+foreign import ccall "fmpz_poly.h _fmpz_poly_revert_series_lagrange_fast"+ _fmpz_poly_revert_series_lagrange_fast :: Ptr CFmpz -> Ptr CFmpz -> CLong -> CLong -> IO ()++-- | /fmpz_poly_revert_series_lagrange_fast/ /Qinv/ /Q/ /n/ +--+-- Sets @Qinv@ to the compositional inverse or reversion of @Q@ as a power+-- series, i.e. computes \(Q^{-1}\) such that+-- \(Q(Q^{-1}(x)) = Q^{-1}(Q(x)) = x \bmod x^n\). It is required that+-- \(Q_0 = 0\) and \(Q_1 = \pm 1\).+-- +-- This implementation uses a reduced-complexity implementation of the+-- Lagrange inversion formula.+foreign import ccall "fmpz_poly.h fmpz_poly_revert_series_lagrange_fast"+ fmpz_poly_revert_series_lagrange_fast :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()++-- | /_fmpz_poly_revert_series_newton/ /Qinv/ /Q/ /Qlen/ /n/ +--+-- Sets @Qinv@ to the compositional inverse or reversion of @Q@ as a power+-- series, i.e. computes \(Q^{-1}\) such that+-- \(Q(Q^{-1}(x)) = Q^{-1}(Q(x)) = x \bmod x^n\). The arguments may not be+-- aliased, and @Qlen@ must be at least 2. It is required that \(Q_0 = 0\)+-- and \(Q_1 = \pm 1\).+-- +-- This implementation uses Newton iteration < [BrentKung1978]>.+foreign import ccall "fmpz_poly.h _fmpz_poly_revert_series_newton"+ _fmpz_poly_revert_series_newton :: Ptr CFmpz -> Ptr CFmpz -> CLong -> CLong -> IO ()++-- | /fmpz_poly_revert_series_newton/ /Qinv/ /Q/ /n/ +--+-- Sets @Qinv@ to the compositional inverse or reversion of @Q@ as a power+-- series, i.e. computes \(Q^{-1}\) such that+-- \(Q(Q^{-1}(x)) = Q^{-1}(Q(x)) = x \bmod x^n\). It is required that+-- \(Q_0 = 0\) and \(Q_1 = \pm 1\).+-- +-- This implementation uses Newton iteration < [BrentKung1978]>.+foreign import ccall "fmpz_poly.h fmpz_poly_revert_series_newton"+ fmpz_poly_revert_series_newton :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()++-- | /_fmpz_poly_revert_series/ /Qinv/ /Q/ /Qlen/ /n/ +--+-- Sets @Qinv@ to the compositional inverse or reversion of @Q@ as a power+-- series, i.e. computes \(Q^{-1}\) such that+-- \(Q(Q^{-1}(x)) = Q^{-1}(Q(x)) = x \bmod x^n\). The arguments may not be+-- aliased, and @Qlen@ must be at least 2. It is required that \(Q_0 = 0\)+-- and \(Q_1 = \pm 1\).+-- +-- This implementation defaults to the fast version of Lagrange+-- interpolation.+foreign import ccall "fmpz_poly.h _fmpz_poly_revert_series"+ _fmpz_poly_revert_series :: Ptr CFmpz -> Ptr CFmpz -> CLong -> CLong -> IO ()++-- | /fmpz_poly_revert_series/ /Qinv/ /Q/ /n/ +--+-- Sets @Qinv@ to the compositional inverse or reversion of @Q@ as a power+-- series, i.e. computes \(Q^{-1}\) such that+-- \(Q(Q^{-1}(x)) = Q^{-1}(Q(x)) = x \bmod x^n\). It is required that+-- \(Q_0 = 0\) and \(Q_1 = \pm 1\).+-- +-- This implementation defaults to the fast version of Lagrange+-- interpolation.+foreign import ccall "fmpz_poly.h fmpz_poly_revert_series"+ fmpz_poly_revert_series :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()++-- Square root -----------------------------------------------------------------++-- | /_fmpz_poly_sqrtrem_classical/ /res/ /r/ /poly/ /len/ +--+-- Returns 1 if @(poly, len)@ can be written in the form \(A^2 + R\) where+-- deg(R) \< deg(@poly@), otherwise returns \(0\). If it can be so written,+-- @(res, m - 1)@ is set to \(A\) and @(res, m)@ is set to \(R\), where+-- \(m = \deg(\mathtt{poly})/2 + 1\).+-- +-- For efficiency reasons, @r@ must have room for @len@ coefficients, and+-- may alias @poly@.+foreign import ccall "fmpz_poly.h _fmpz_poly_sqrtrem_classical"+ _fmpz_poly_sqrtrem_classical :: Ptr CFmpz -> Ptr CFmpz -> Ptr CFmpz -> CLong -> IO CInt++-- | /fmpz_poly_sqrtrem_classical/ /b/ /r/ /a/ +--+-- If \(a\) can be written as \(b^2 + r\) with \(\deg(r) < \deg(a)/2\),+-- return \(1\) and set \(b\) and \(r\) appropriately. Otherwise return+-- \(0\).+foreign import ccall "fmpz_poly.h fmpz_poly_sqrtrem_classical"+ fmpz_poly_sqrtrem_classical :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO CInt++-- | /_fmpz_poly_sqrtrem_divconquer/ /res/ /r/ /poly/ /len/ /temp/ +--+-- Returns 1 if @(poly, len)@ can be written in the form \(A^2 + R\) where+-- deg(R) \< deg(@poly@), otherwise returns \(0\). If it can be so written,+-- @(res, m - 1)@ is set to \(A\) and @(res, m)@ is set to \(R\), where+-- \(m = \deg(\mathtt{poly})/2 + 1\).+-- +-- For efficiency reasons, @r@ must have room for @len@ coefficients, and+-- may alias @poly@. Temporary space of @len@ coefficients is required.+foreign import ccall "fmpz_poly.h _fmpz_poly_sqrtrem_divconquer"+ _fmpz_poly_sqrtrem_divconquer :: Ptr CFmpz -> Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> IO CInt++-- | /fmpz_poly_sqrtrem_divconquer/ /b/ /r/ /a/ +--+-- If \(a\) can be written as \(b^2 + r\) with \(\deg(r) < \deg(a)/2\),+-- return \(1\) and set \(b\) and \(r\) appropriately. Otherwise return+-- \(0\).+foreign import ccall "fmpz_poly.h fmpz_poly_sqrtrem_divconquer"+ fmpz_poly_sqrtrem_divconquer :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO CInt++-- | /_fmpz_poly_sqrt_classical/ /res/ /poly/ /len/ /exact/ +--+-- If @exact@ is \(1\) and @(poly, len)@ is a perfect square, sets+-- @(res, len \/ 2 + 1)@ to the square root of @poly@ with positive leading+-- coefficient and returns 1. Otherwise returns 0.+-- +-- If @exact@ is \(0\), allows a remainder after the square root, which is+-- not computed.+-- +-- This function first uses various tests to detect nonsquares quickly.+-- Then, it computes the square root iteratively from top to bottom,+-- requiring \(O(n^2)\) coefficient operations.+foreign import ccall "fmpz_poly.h _fmpz_poly_sqrt_classical"+ _fmpz_poly_sqrt_classical :: Ptr CFmpz -> Ptr CFmpz -> CLong -> CInt -> IO CInt++-- | /fmpz_poly_sqrt_classical/ /b/ /a/ +--+-- If @a@ is a perfect square, sets @b@ to the square root of @a@ with+-- positive leading coefficient and returns 1. Otherwise returns 0.+foreign import ccall "fmpz_poly.h fmpz_poly_sqrt_classical"+ fmpz_poly_sqrt_classical :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO CInt++-- | /_fmpz_poly_sqrt_KS/ /res/ /poly/ /len/ +--+-- Heuristic square root. If the return value is \(-1\), the function+-- failed, otherwise it succeeded and the following applies.+-- +-- If @(poly, len)@ is a perfect square, sets @(res, len \/ 2 + 1)@ to the+-- square root of @poly@ with positive leading coefficient and returns 1.+-- Otherwise returns 0.+-- +-- This function first uses various tests to detect nonsquares quickly.+-- Then, it computes the square root iteratively from top to bottom.+foreign import ccall "fmpz_poly.h _fmpz_poly_sqrt_KS"+ _fmpz_poly_sqrt_KS :: Ptr CFmpz -> Ptr CFmpz -> CLong -> IO CInt++-- | /fmpz_poly_sqrt_KS/ /b/ /a/ +--+-- Heuristic square root. If the return value is \(-1\), the function+-- failed, otherwise it succeeded and the following applies.+-- +-- If @a@ is a perfect square, sets @b@ to the square root of @a@ with+-- positive leading coefficient and returns 1. Otherwise returns 0.+foreign import ccall "fmpz_poly.h fmpz_poly_sqrt_KS"+ fmpz_poly_sqrt_KS :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO CInt++-- | /_fmpz_poly_sqrt_divconquer/ /res/ /poly/ /len/ /exact/ +--+-- If @exact@ is \(1\) and @(poly, len)@ is a perfect square, sets+-- @(res, len \/ 2 + 1)@ to the square root of @poly@ with positive leading+-- coefficient and returns 1. Otherwise returns 0.+-- +-- If @exact@ is \(0\), allows a remainder after the square root, which is+-- not computed.+-- +-- This function first uses various tests to detect nonsquares quickly.+-- Then, it computes the square root iteratively from top to bottom.+foreign import ccall "fmpz_poly.h _fmpz_poly_sqrt_divconquer"+ _fmpz_poly_sqrt_divconquer :: Ptr CFmpz -> Ptr CFmpz -> CLong -> CInt -> IO CInt++-- | /fmpz_poly_sqrt_divconquer/ /b/ /a/ +--+-- If @a@ is a perfect square, sets @b@ to the square root of @a@ with+-- positive leading coefficient and returns 1. Otherwise returns 0.+foreign import ccall "fmpz_poly.h fmpz_poly_sqrt_divconquer"+ fmpz_poly_sqrt_divconquer :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO CInt++-- | /_fmpz_poly_sqrt/ /res/ /poly/ /len/ +--+-- If @(poly, len)@ is a perfect square, sets @(res, len \/ 2 + 1)@ to the+-- square root of @poly@ with positive leading coefficient and returns 1.+-- Otherwise returns 0.+foreign import ccall "fmpz_poly.h _fmpz_poly_sqrt"+ _fmpz_poly_sqrt :: Ptr CFmpz -> Ptr CFmpz -> CLong -> IO CInt++-- | /fmpz_poly_sqrt/ /b/ /a/ +--+-- If @a@ is a perfect square, sets @b@ to the square root of @a@ with+-- positive leading coefficient and returns 1. Otherwise returns 0.+foreign import ccall "fmpz_poly.h fmpz_poly_sqrt"+ fmpz_poly_sqrt :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO CInt++-- | /_fmpz_poly_sqrt_series/ /res/ /poly/ /len/ /n/ +--+-- Set @(res, n)@ to the square root of the series @(poly, n)@, if it+-- exists, and return \(1\), otherwise, return \(0\).+-- +-- If the valuation of @poly@ is not zero, @res@ is zero padded to make up+-- for the fact that the square root may not be known to precision \(n\).+foreign import ccall "fmpz_poly.h _fmpz_poly_sqrt_series"+ _fmpz_poly_sqrt_series :: Ptr CFmpz -> Ptr CFmpz -> CLong -> CLong -> IO CInt++-- | /fmpz_poly_sqrt_series/ /b/ /a/ /n/ +--+-- Set @b@ to the square root of the series @a@, where the latter is taken+-- to be a series of precision \(n\). If such a square root exists, return+-- \(1\), otherwise, return \(0\).+-- +-- Note that if the valuation of @a@ is not zero, @b@ will not have+-- precision @n@. It is given only to the precision to which the square+-- root can be computed.+foreign import ccall "fmpz_poly.h fmpz_poly_sqrt_series"+ fmpz_poly_sqrt_series :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO CInt++-- Power sums ------------------------------------------------------------------++-- | /_fmpz_poly_power_sums_naive/ /res/ /poly/ /len/ /n/ +--+-- Compute the (truncated) power sums series of the monic polynomial+-- @(poly,len)@ up to length \(n\) using Newton identities.+foreign import ccall "fmpz_poly.h _fmpz_poly_power_sums_naive"+ _fmpz_poly_power_sums_naive :: Ptr CFmpz -> Ptr CFmpz -> CLong -> CLong -> IO ()++-- | /fmpz_poly_power_sums_naive/ /res/ /poly/ /n/ +--+-- Compute the (truncated) power sum series of the monic polynomial @poly@+-- up to length \(n\) using Newton identities.+foreign import ccall "fmpz_poly.h fmpz_poly_power_sums_naive"+ fmpz_poly_power_sums_naive :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()++-- | /fmpz_poly_power_sums/ /res/ /poly/ /n/ +--+-- Compute the (truncated) power sums series of the monic polynomial @poly@+-- up to length \(n\). That is the power series whose coefficient of degree+-- \(i\) is the sum of the \(i\)-th power of all (complex) roots of the+-- polynomial @poly@.+foreign import ccall "fmpz_poly.h fmpz_poly_power_sums"+ fmpz_poly_power_sums :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> CLong -> IO ()++-- | /_fmpz_poly_power_sums_to_poly/ /res/ /poly/ /len/ +--+-- Compute the (monic) polynomial given by its power sums series+-- @(poly,len)@.+foreign import ccall "fmpz_poly.h _fmpz_poly_power_sums_to_poly"+ _fmpz_poly_power_sums_to_poly :: Ptr CFmpz -> Ptr CFmpz -> CLong -> IO ()++-- | /fmpz_poly_power_sums_to_poly/ /res/ /Q/ +--+-- Compute the (monic) polynomial given its power sums series @(Q)@.+foreign import ccall "fmpz_poly.h fmpz_poly_power_sums_to_poly"+ fmpz_poly_power_sums_to_poly :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> IO ()++-- Signature -------------------------------------------------------------------++-- | /_fmpz_poly_signature/ /r1/ /r2/ /poly/ /len/ +--+-- Computes the signature \((r_1, r_2)\) of the polynomial @(poly, len)@.+-- Assumes that the polynomial is squarefree over \(\mathbb{Q}\).+foreign import ccall "fmpz_poly.h _fmpz_poly_signature"+ _fmpz_poly_signature :: Ptr CLong -> Ptr CLong -> Ptr CFmpz -> CLong -> IO ()++-- | /fmpz_poly_signature/ /r1/ /r2/ /poly/ +--+-- Computes the signature \((r_1, r_2)\) of the polynomial @poly@, which is+-- assumed to be square-free over \(\mathbb{Q}\). The values of \(r_1\) and+-- \(2 r_2\) are the number of real and complex roots of the polynomial,+-- respectively. For convenience, the zero polynomial is allowed, in which+-- case the output is \((0, 0)\).+-- +-- If the polynomial is not square-free, the behaviour is undefined and an+-- exception may be raised.+-- +-- This function uses the algorithm described in Algorithm 4.1.11 of+-- < [Coh1996]>.+foreign import ccall "fmpz_poly.h fmpz_poly_signature"+ fmpz_poly_signature :: Ptr CLong -> Ptr CLong -> Ptr CFmpzPoly -> IO ()++-- Hensel lifting --------------------------------------------------------------++-- | /fmpz_poly_hensel_build_tree/ /link/ /v/ /w/ /fac/ +--+-- Initialises and builds a Hensel tree consisting of two arrays \(v\),+-- \(w\) of polynomials and an array of links, called @link@.+-- +-- The caller supplies a set of \(r\) local factors (in the factor+-- structure @fac@) of some polynomial \(F\) over \(\mathbf{Z}\). They also+-- supply two arrays of initialised polynomials \(v\) and \(w\), each of+-- length \(2r - 2\) and an array @link@, also of length \(2r - 2\).+-- +-- We will have five arrays: a \(v\) of @fmpz_poly_t@\'s and a \(V\) of+-- @nmod_poly_t@\'s and also a \(w\) and a \(W\) and @link@. Here\'s the+-- idea: we sort each leaf and node of a factor tree by degree, in fact+-- choosing to multiply the two smallest factors, then the next two+-- smallest (factors or products) etc. until a tree is made. The tree will+-- be stored in the \(v\)\'s. The first two elements of \(v\) will be the+-- smallest modular factors, the last two elements of \(v\) will multiply+-- to form \(F\) itself. Since \(v\) will be rearranging the original+-- factors we will need to be able to recover the original order. For this+-- we use the array @link@ which has nonnegative even numbers and negative+-- numbers. It is an array of @slong@s which aligns with \(V\) and \(v\) if+-- @link@ has a negative number in spot \(j\) that means \(V_j\) is an+-- original modular factor which has been lifted, if @link[j]@ is a+-- nonnegative even number then \(V_j\) stores a product of the two entries+-- at @V[link[j]]@ and @V[link[j]+1]@. \(W\) and \(w\) play the role of the+-- extended GCD, at \(V_0\), \(V_2\), \(V_4\), etc. we have a new product,+-- \(W_0\), \(W_2\), \(W_4\), etc. are the XGCD cofactors of the \(V\)\'s.+-- For example, \(V_0 W_0 + V_1 W_1 \equiv 1 \pmod{p^{\ell}}\) for some+-- \(\ell\). These will be lifted along with the entries in \(V\). It is+-- not enough to just lift each factor, we have to lift the entire tree and+-- the tree of XGCD cofactors.+foreign import ccall "fmpz_poly.h fmpz_poly_hensel_build_tree"+ fmpz_poly_hensel_build_tree :: Ptr CLong -> Ptr (Ptr CFmpzPoly) -> Ptr (Ptr CFmpzPoly) -> Ptr CNModPolyFactor -> IO ()++-- | /fmpz_poly_hensel_lift/ /G/ /H/ /A/ /B/ /f/ /g/ /h/ /a/ /b/ /p/ /p1/ +--+-- This is the main Hensel lifting routine, which performs a Hensel step+-- from polynomials mod \(p\) to polynomials mod \(P = p p_1\). One starts+-- with polynomials \(f\), \(g\), \(h\) such that \(f = gh \pmod p\). The+-- polynomials \(a\), \(b\) satisfy \(ag + bh = 1 \pmod p\).+-- +-- The lifting formulae are+-- +-- \[`\]+-- \[G = \biggl( \bigl( \frac{f-gh}{p} \bigr) b \bmod g \biggr) p + g\]+-- \[H = \biggl( \bigl( \frac{f-gh}{p} \bigr) a \bmod h \biggr) p + h\]+-- \[B = \biggl( \bigl( \frac{1-aG-bH}{p} \bigr) b \bmod g \biggr) p + b\]+-- \[A = \biggl( \bigl( \frac{1-aG-bH}{p} \bigr) a \bmod h \biggr) p + a\]+-- +-- Upon return we have \(A G + B H = 1 \pmod P\) and \(f = G H \pmod P\),+-- where \(G = g \pmod p\) etc.+-- +-- We require that \(1 < p_1 \leq p\) and that the input polynomials+-- \(f, g, h\) have degree at least \(1\) and that the input polynomials+-- \(a\) and \(b\) are non-zero.+-- +-- The output arguments \(G, H, A, B\) may only be aliased with the input+-- arguments \(g, h, a, b\), respectively.+foreign import ccall "fmpz_poly.h fmpz_poly_hensel_lift"+ fmpz_poly_hensel_lift :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpz -> Ptr CFmpz -> IO ()++-- | /fmpz_poly_hensel_lift_without_inverse/ /Gout/ /Hout/ /f/ /g/ /h/ /a/ /b/ /p/ /p1/ +--+-- Given polynomials such that \(f = gh \pmod p\) and+-- \(ag + bh = 1 \pmod p\), lifts only the factors \(g\) and \(h\) modulo+-- \(P = p p_1\).+-- +-- See @fmpz_poly_hensel_lift@.+foreign import ccall "fmpz_poly.h fmpz_poly_hensel_lift_without_inverse"+ fmpz_poly_hensel_lift_without_inverse :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpz -> Ptr CFmpz -> IO ()++-- | /fmpz_poly_hensel_lift_only_inverse/ /Aout/ /Bout/ /G/ /H/ /a/ /b/ /p/ /p1/ +--+-- Given polynomials such that \(f = gh \pmod p\) and+-- \(ag + bh = 1 \pmod p\), lifts only the cofactors \(a\) and \(b\) modulo+-- \(P = p p_1\).+-- +-- See @fmpz_poly_hensel_lift@.+foreign import ccall "fmpz_poly.h fmpz_poly_hensel_lift_only_inverse"+ fmpz_poly_hensel_lift_only_inverse :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpz -> Ptr CFmpz -> IO ()++-- | /fmpz_poly_hensel_lift_tree_recursive/ /link/ /v/ /w/ /f/ /j/ /inv/ /p0/ /p1/ +--+-- Takes a current Hensel tree @(link, v, w)@ and a pair \((j,j+1)\) of+-- entries in the tree and lifts the tree from mod \(p_0\) to mod+-- \(P = p_0 p_1\), where \(1 < p_1 \leq p_0\).+-- +-- Set @inv@ to \(-1\) if restarting Hensel lifting, \(0\) if stopping and+-- \(1\) otherwise.+-- +-- Here \(f = g h\) is the polynomial whose factors we are trying to lift.+-- We will have that @v[j]@ is the product of @v[link[j]]@ and+-- @v[link[j] + 1]@ as described above.+-- +-- Does support aliasing of \(f\) with one of the polynomials in the lists+-- \(v\) and \(w\). But the polynomials in these two lists are not allowed+-- to be aliases of each other.+foreign import ccall "fmpz_poly.h fmpz_poly_hensel_lift_tree_recursive"+ fmpz_poly_hensel_lift_tree_recursive :: Ptr CLong -> Ptr (Ptr CFmpzPoly) -> Ptr (Ptr CFmpzPoly) -> Ptr CFmpzPoly -> CLong -> CLong -> Ptr CFmpz -> Ptr CFmpz -> IO ()++-- | /fmpz_poly_hensel_lift_tree/ /link/ /v/ /w/ /f/ /r/ /p/ /e0/ /e1/ /inv/ +--+-- Computes \(p_0 = p^{e_0}\) and \(p_1 = p^{e_1 - e_0}\) for a small prime+-- \(p\) and \(P = p^{e_1}\).+-- +-- If we aim to lift to \(p^b\) then \(f\) is the polynomial whose factors+-- we wish to lift, made monic mod \(p^b\). As usual, @(link, v, w)@ is an+-- initialised tree.+-- +-- This starts the recursion on lifting the /product tree/ for lifting from+-- \(p^{e_0}\) to \(p^{e_1}\). The value of @inv@ corresponds to that given+-- for the function @fmpz_poly_hensel_lift_tree_recursive@. We set \(r\) to+-- the number of local factors of \(f\).+-- +-- In terms of the notation, above \(P = p^{e_1}\), \(p_0 = p^{e_0}\) and+-- \(p_1 = p^{e_1-e_0}\).+-- +-- Assumes that \(f\) is monic.+-- +-- Assumes that \(1 < p_1 \leq p_0\), that is, \(0 < e_1 \leq e_0\).+foreign import ccall "fmpz_poly.h fmpz_poly_hensel_lift_tree"+ fmpz_poly_hensel_lift_tree :: Ptr CLong -> Ptr (Ptr CFmpzPoly) -> Ptr (Ptr CFmpzPoly) -> Ptr CFmpzPoly -> CLong -> Ptr CFmpz -> CLong -> CLong -> CLong -> IO ()++-- | /_fmpz_poly_hensel_start_lift/ /lifted_fac/ /link/ /v/ /w/ /f/ /local_fac/ /N/ +--+-- This function takes the local factors in @local_fac@ and Hensel lifts+-- them until they are known mod \(p^N\), where \(N \geq 1\).+-- +-- These lifted factors will be stored (in the same ordering) in+-- @lifted_fac@. It is assumed that @link@, @v@, and @w@ are initialized+-- arrays of @fmpz_poly_t@\'s with at least \(2*r - 2\) entries and that+-- \(r \geq 2\). This is done outside of this function so that you can keep+-- them for restarting Hensel lifting later. The product of local factors+-- must be squarefree.+-- +-- The return value is an exponent which must be passed to the function+-- @_fmpz_poly_hensel_continue_lift@ as @prev_exp@ if the Hensel lifting is+-- to be resumed.+-- +-- Currently, supports the case when \(N = 1\) for convenience, although it+-- is preferable in this case to simply iterate over the local factors and+-- convert them to polynomials over \(\mathbf{Z}\).+foreign import ccall "fmpz_poly.h _fmpz_poly_hensel_start_lift"+ _fmpz_poly_hensel_start_lift :: Ptr CFmpzPolyFactor -> Ptr CLong -> Ptr (Ptr CFmpzPoly) -> Ptr (Ptr CFmpzPoly) -> Ptr CFmpzPoly -> Ptr CNModPolyFactor -> CLong -> IO CLong++-- | /_fmpz_poly_hensel_continue_lift/ /lifted_fac/ /link/ /v/ /w/ /f/ /prev/ /curr/ /N/ /p/ +--+-- This function restarts a stopped Hensel lift.+-- +-- It lifts from @curr@ to \(N\). It also requires @prev@ (to lift the+-- cofactors) given as the return value of the function+-- @_fmpz_poly_hensel_start_lift@ or the function+-- @_fmpz_poly_hensel_continue_lift@. The current lifted factors are+-- supplied in @lifted_fac@ and upon return are updated there. As usual+-- @link@, @v@, and @w@ describe the current Hensel tree, \(r\) is the+-- number of local factors and \(p\) is the small prime modulo whose power+-- we are lifting to. It is required that @curr@ be at least \(1\) and that+-- @N > curr@.+-- +-- Currently, supports the case when @prev@ and @curr@ are equal.+foreign import ccall "fmpz_poly.h _fmpz_poly_hensel_continue_lift"+ _fmpz_poly_hensel_continue_lift :: Ptr CFmpzPolyFactor -> Ptr CLong -> Ptr (Ptr CFmpzPoly) -> Ptr (Ptr CFmpzPoly) -> Ptr CFmpzPoly -> CLong -> CLong -> CLong -> Ptr CFmpz -> IO CLong++-- | /fmpz_poly_hensel_lift_once/ /lifted_fac/ /f/ /local_fac/ /N/ +--+-- This function does a Hensel lift.+-- +-- It lifts local factors stored in @local_fac@ of \(f\) to \(p^N\), where+-- \(N \geq 2\). The lifted factors will be stored in @lifted_fac@. This+-- lift cannot be restarted. This function is a convenience function+-- intended for end users. The product of local factors must be squarefree.+foreign import ccall "fmpz_poly.h fmpz_poly_hensel_lift_once"+ fmpz_poly_hensel_lift_once :: Ptr CFmpzPolyFactor -> Ptr CFmpzPoly -> Ptr CNModPolyFactor -> CLong -> IO ()++-- Input and output ------------------------------------------------------------++-- The functions in this section are not intended to be particularly fast.+-- They are intended mainly as a debugging aid.+--+-- For the string output functions there are two variants. The first uses a+-- simple string representation of polynomials which prints only the length+-- of the polynomial and the integer coefficients, whilst the latter+-- variant, appended with @_pretty@, uses a more traditional string+-- representation of polynomials which prints a variable name as part of+-- the representation.+--+-- The first string representation is given by a sequence of integers, in+-- decimal notation, separated by white space. The first integer gives the+-- length of the polynomial; the remaining integers are the coefficients.+-- For example \(5x^3 - x + 1\) is represented by the string+-- @\"4 1 -1 0 5\"@, and the zero polynomial is represented by @\"0\"@.+-- The coefficients may be signed and arbitrary precision.+--+-- The string representation of the functions appended by @_pretty@+-- includes only the non-zero terms of the polynomial, starting with the+-- one of highest degree. Each term starts with a coefficient, prepended+-- with a sign, followed by the character @*@, followed by a variable name,+-- which must be passed as a string parameter to the function, followed by+-- a caret @^@ followed by a non-negative exponent.+--+-- If the sign of the leading coefficient is positive, it is omitted. Also+-- the exponents of the degree 1 and 0 terms are omitted, as is the+-- variable and the @*@ character in the case of the degree 0 coefficient.+-- If the coefficient is plus or minus one, the coefficient is omitted,+-- except for the sign.+--+-- Some examples of the @_pretty@ representation are:+--++++-- | /_fmpz_poly_print/ /poly/ /len/ +--+-- Prints the polynomial @(poly, len)@ to @stdout@.+-- +-- In case of success, returns a positive value. In case of failure,+-- returns a non-positive value.+foreign import ccall "fmpz_poly.h _fmpz_poly_print"+ _fmpz_poly_print :: Ptr CFmpz -> CLong -> IO CInt++-- | /fmpz_poly_print/ /poly/ +--+-- Prints the polynomial to @stdout@.+-- +-- In case of success, returns a positive value. In case of failure,+-- returns a non-positive value.+foreign import ccall "fmpz_poly.h fmpz_poly_print"+ fmpz_poly_print :: Ptr CFmpzPoly -> IO CInt++-- | /_fmpz_poly_print_pretty/ /poly/ /len/ /x/ +--+-- Prints the pretty representation of @(poly, len)@ to @stdout@, using the+-- string @x@ to represent the indeterminate.+-- +-- In case of success, returns a positive value. In case of failure,+-- returns a non-positive value.+foreign import ccall "fmpz_poly.h _fmpz_poly_print_pretty"+ _fmpz_poly_print_pretty :: Ptr CFmpz -> CLong -> CString -> IO CInt++-- | /fmpz_poly_print_pretty/ /poly/ /x/ +--+-- Prints the pretty representation of @poly@ to @stdout@, using the string+-- @x@ to represent the indeterminate.+-- +-- In case of success, returns a positive value. In case of failure,+-- returns a non-positive value.+foreign import ccall "fmpz_poly.h fmpz_poly_print_pretty"+ fmpz_poly_print_pretty :: Ptr CFmpzPoly -> CString -> IO CInt++-- | /_fmpz_poly_fprint/ /file/ /poly/ /len/ +--+-- Prints the polynomial @(poly, len)@ to the stream @file@.+-- +-- In case of success, returns a positive value. In case of failure,+-- returns a non-positive value.+foreign import ccall "fmpz_poly.h _fmpz_poly_fprint"+ _fmpz_poly_fprint :: Ptr CFile -> Ptr CFmpz -> CLong -> IO CInt++-- | /fmpz_poly_fprint/ /file/ /poly/ +--+-- Prints the polynomial to the stream @file@.+-- +-- In case of success, returns a positive value. In case of failure,+-- returns a non-positive value.+foreign import ccall "fmpz_poly.h fmpz_poly_fprint"+ fmpz_poly_fprint :: Ptr CFile -> Ptr CFmpzPoly -> IO CInt++-- | /_fmpz_poly_fprint_pretty/ /file/ /poly/ /len/ /x/ +--+-- Prints the pretty representation of @(poly, len)@ to the stream @file@,+-- using the string @x@ to represent the indeterminate.+-- +-- In case of success, returns a positive value. In case of failure,+-- returns a non-positive value.+foreign import ccall "fmpz_poly.h _fmpz_poly_fprint_pretty"+ _fmpz_poly_fprint_pretty :: Ptr CFile -> Ptr CFmpz -> CLong -> CString -> IO CInt++-- | /fmpz_poly_fprint_pretty/ /file/ /poly/ /x/ +--+-- Prints the pretty representation of @poly@ to the stream @file@, using+-- the string @x@ to represent the indeterminate.+-- +-- In case of success, returns a positive value. In case of failure,+-- returns a non-positive value.+foreign import ccall "fmpz_poly.h fmpz_poly_fprint_pretty"+ fmpz_poly_fprint_pretty :: Ptr CFile -> Ptr CFmpzPoly -> CString -> IO CInt++-- | /fmpz_poly_read/ /poly/ +--+-- Reads a polynomial from @stdin@, storing the result in @poly@.+-- +-- In case of success, returns a positive number. In case of failure,+-- returns a non-positive value.+foreign import ccall "fmpz_poly.h fmpz_poly_read"+ fmpz_poly_read :: Ptr CFmpzPoly -> IO CInt++-- | /fmpz_poly_read_pretty/ /poly/ /x/ +--+-- Reads a polynomial in pretty format from @stdin@.+-- +-- For further details, see the documentation for the function+-- @fmpz_poly_fread_pretty@.+foreign import ccall "fmpz_poly.h fmpz_poly_read_pretty"+ fmpz_poly_read_pretty :: Ptr CFmpzPoly -> Ptr (Ptr CChar) -> IO CInt++-- | /fmpz_poly_fread/ /file/ /poly/ +--+-- Reads a polynomial from the stream @file@, storing the result in @poly@.+-- +-- In case of success, returns a positive number. In case of failure,+-- returns a non-positive value.+foreign import ccall "fmpz_poly.h fmpz_poly_fread"+ fmpz_poly_fread :: Ptr CFile -> Ptr CFmpzPoly -> IO CInt++-- | /fmpz_poly_fread_pretty/ /file/ /poly/ /x/ +--+-- Reads a polynomial from the file @file@ and sets @poly@ to this+-- polynomial. The string @*x@ is set to the variable name that is used in+-- the input.+-- +-- Returns a positive value, equal to the number of characters read from+-- the file, in case of success. Returns a non-positive value in case of+-- failure, which could either be a read error or the indicator of a+-- malformed input.+foreign import ccall "fmpz_poly.h fmpz_poly_fread_pretty"+ fmpz_poly_fread_pretty :: Ptr CFile -> Ptr CFmpzPoly -> Ptr (Ptr CChar) -> IO CInt++-- Modular reduction and reconstruction ----------------------------------------++-- | /fmpz_poly_get_nmod_poly/ /Amod/ /A/ +--+-- Sets the coefficients of @Amod@ to the coefficients in @A@, reduced by+-- the modulus of @Amod@.+foreign import ccall "fmpz_poly.h fmpz_poly_get_nmod_poly"+ fmpz_poly_get_nmod_poly :: Ptr CNModPoly -> Ptr CFmpzPoly -> IO ()++-- | /fmpz_poly_set_nmod_poly/ /A/ /Amod/ +--+-- Sets the coefficients of @A@ to the residues in @Amod@, normalised to+-- the interval \(-m/2 \le r < m/2\) where \(m\) is the modulus.+foreign import ccall "fmpz_poly.h fmpz_poly_set_nmod_poly"+ fmpz_poly_set_nmod_poly :: Ptr CFmpzPoly -> Ptr CNModPoly -> IO ()++-- | /fmpz_poly_set_nmod_poly_unsigned/ /A/ /Amod/ +--+-- Sets the coefficients of @A@ to the residues in @Amod@, normalised to+-- the interval \(0 \le r < m\) where \(m\) is the modulus.+foreign import ccall "fmpz_poly.h fmpz_poly_set_nmod_poly_unsigned"+ fmpz_poly_set_nmod_poly_unsigned :: Ptr CFmpzPoly -> Ptr CNModPoly -> IO ()++-- | /_fmpz_poly_CRT_ui_precomp/ /res/ /poly1/ /len1/ /m1/ /poly2/ /len2/ /m2/ /m2inv/ /m1m2/ /c/ /sign/ +--+-- Sets the coefficients in @res@ to the CRT reconstruction modulo+-- \(m_1m_2\) of the residues @(poly1, len1)@ and @(poly2, len2)@ which are+-- images modulo \(m_1\) and \(m_2\) respectively. The caller must supply+-- the precomputed product of the input moduli as \(m_1m_2\), the inverse+-- of \(m_1\) modulo \(m_2\) as \(c\), and the precomputed inverse of+-- \(m_2\) (in the form computed by @n_preinvert_limb@) as @m2inv@.+-- +-- If @sign@ = 0, residues \(0 \le r < m_1 m_2\) are computed, while if+-- @sign@ = 1, residues \(-m_1 m_2/2 \le r < m_1 m_2/2\) are computed.+-- +-- Coefficients of @res@ are written up to the maximum of @len1@ and+-- @len2@.+foreign import ccall "fmpz_poly.h _fmpz_poly_CRT_ui_precomp"+ _fmpz_poly_CRT_ui_precomp :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> Ptr CMp -> CLong -> CMpLimb -> CMpLimb -> Ptr CFmpz -> CMpLimb -> CInt -> IO ()++-- | /_fmpz_poly_CRT_ui/ /res/ /poly1/ /len1/ /m1/ /poly2/ /len2/ /m2/ /m2inv/ /sign/ +--+-- This function is identical to @_fmpz_poly_CRT_ui_precomp@, apart from+-- automatically computing \(m_1m_2\) and \(c\). It also aborts if \(c\)+-- cannot be computed.+foreign import ccall "fmpz_poly.h _fmpz_poly_CRT_ui"+ _fmpz_poly_CRT_ui :: Ptr CFmpz -> Ptr CFmpz -> CLong -> Ptr CFmpz -> Ptr CMp -> CLong -> CMpLimb -> CMpLimb -> CInt -> IO ()++-- | /fmpz_poly_CRT_ui/ /res/ /poly1/ /m/ /poly2/ /sign/ +--+-- Given @poly1@ with coefficients modulo @m@ and @poly2@ with modulus+-- \(n\), sets @res@ to the CRT reconstruction modulo \(mn\) with+-- coefficients satisfying \(-mn/2 \le c < mn/2\) (if sign = 1) or+-- \(0 \le c < mn\) (if sign = 0).+foreign import ccall "fmpz_poly.h fmpz_poly_CRT_ui"+ fmpz_poly_CRT_ui :: Ptr CFmpzPoly -> Ptr CFmpzPoly -> Ptr CFmpz -> Ptr CNModPoly -> CInt -> IO ()++-- Products --------------------------------------------------------------------++-- | /_fmpz_poly_product_roots_fmpz_vec/ /poly/ /xs/ /n/ +--+-- Sets @(poly, n + 1)@ to the monic polynomial which is the product of+-- \((x - x_0)(x - x_1) \cdots (x - x_{n-1})\), the roots \(x_i\) being+-- given by @xs@.+-- +-- Aliasing of the input and output is not allowed.+foreign import ccall "fmpz_poly.h _fmpz_poly_product_roots_fmpz_vec"+ _fmpz_poly_product_roots_fmpz_vec :: Ptr CFmpz -> Ptr CFmpz -> CLong -> IO ()++-- | /fmpz_poly_product_roots_fmpz_vec/ /poly/ /xs/ /n/ +--+-- Sets @poly@ to the monic polynomial which is the product of+-- \((x - x_0)(x - x_1) \cdots (x - x_{n-1})\), the roots \(x_i\) being+-- given by @xs@.+foreign import ccall "fmpz_poly.h fmpz_poly_product_roots_fmpz_vec"+ fmpz_poly_product_roots_fmpz_vec :: Ptr CFmpzPoly -> Ptr CFmpz -> CLong -> IO ()++-- | /_fmpz_poly_product_roots_fmpq_vec/ /poly/ /xs/ /n/ +--+-- Sets @(poly, n + 1)@ to the product of+-- \((q_0 x - p_0)(q_1 x - p_1) \cdots (q_{n-1} x - p_{n-1})\), the roots+-- \(p_i/q_i\) being given by @xs@.+foreign import ccall "fmpz_poly.h _fmpz_poly_product_roots_fmpq_vec"+ _fmpz_poly_product_roots_fmpq_vec :: Ptr CFmpz -> Ptr CFmpq -> CLong -> IO ()++-- | /fmpz_poly_product_roots_fmpq_vec/ /poly/ /xs/ /n/ +--+-- Sets @poly@ to the polynomial which is the product of+-- \((q_0 x - p_0)(q_1 x - p_1) \cdots (q_{n-1} x - p_{n-1})\), the roots+-- \(p_i/q_i\) being given by @xs@.+foreign import ccall "fmpz_poly.h fmpz_poly_product_roots_fmpq_vec"+ fmpz_poly_product_roots_fmpq_vec :: Ptr CFmpzPoly -> Ptr CFmpq -> CLong -> IO ()++-- Roots -----------------------------------------------------------------------++-- | /_fmpz_poly_bound_roots/ /bound/ /poly/ /len/ +foreign import ccall "fmpz_poly.h _fmpz_poly_bound_roots"+ _fmpz_poly_bound_roots :: Ptr CFmpz -> Ptr CFmpz -> CLong -> IO ()+-- | /fmpz_poly_bound_roots/ /bound/ /poly/ +--+-- Computes a nonnegative integer @bound@ that bounds the absolute value of+-- all complex roots of @poly@. Uses Fujiwara\'s bound+-- +-- \[`\]+-- \[2 \max \left(+-- \left|\frac{a_{n-1}}{a_n}\right|,+-- \left|\frac{a_{n-2}}{a_n}\right|^{\frac{1}{2}}, \dotsc,+-- \left|\frac{a_1}{a_n}\right|^{\frac{1}{n-1}},+-- \left|\frac{a_0}{2a_n}\right|^{\frac{1}{n}}+-- \right)\]+-- +-- where the coefficients of the polynomial are \(a_0, \ldots, a_n\).+foreign import ccall "fmpz_poly.h fmpz_poly_bound_roots"+ fmpz_poly_bound_roots :: Ptr CFmpz -> Ptr CFmpzPoly -> IO ()++-- | /_fmpz_poly_num_real_roots_sturm/ /n_neg/ /n_pos/ /pol/ /len/ +--+-- Sets @n_neg@ and @n_pos@ to the number of negative and positive roots of+-- the polynomial @(pol, len)@ using Sturm sequence. The Sturm sequence is+-- computed via subresultant remainders obtained by repeated call to the+-- function @_fmpz_poly_pseudo_rem_cohen@.+-- +-- The polynomial is assumed to be squarefree, of degree larger than 1 and+-- with non-zero constant coefficient.+foreign import ccall "fmpz_poly.h _fmpz_poly_num_real_roots_sturm"+ _fmpz_poly_num_real_roots_sturm :: Ptr CLong -> Ptr CLong -> Ptr CFmpz -> CLong -> IO ()++-- | /fmpz_poly_num_real_roots_sturm/ /pol/ +--+-- Returns the number of real roots of the squarefree polynomial @pol@+-- using Sturm sequence.+-- +-- The polynomial is assumed to be squarefree.+foreign import ccall "fmpz_poly.h fmpz_poly_num_real_roots_sturm"+ fmpz_poly_num_real_roots_sturm :: Ptr CFmpzPoly -> IO CLong++-- | /_fmpz_poly_num_real_roots/ /pol/ /len/ +--+-- Returns the number of real roots of the squarefree polynomial+-- @(pol, len)@.+-- +-- The polynomial is assumed to be squarefree.+foreign import ccall "fmpz_poly.h _fmpz_poly_num_real_roots"+ _fmpz_poly_num_real_roots :: Ptr CFmpz -> CLong -> IO CLong++-- | /fmpz_poly_num_real_roots/ /pol/ +--+-- Returns the number of real roots of the squarefree polynomial @pol@.+-- +-- The polynomial is assumed to be squarefree.+foreign import ccall "fmpz_poly.h fmpz_poly_num_real_roots"+ fmpz_poly_num_real_roots :: Ptr CFmpzPoly -> IO CLong++-- Minimal polynomials ---------------------------------------------------------++-- | /_fmpz_poly_cyclotomic/ /a/ /n/ /factors/ /num_factors/ /phi/ +--+-- Sets @a@ to the lower half of the cyclotomic polynomial \(\Phi_n(x)\),+-- given \(n \ge 3\) which must be squarefree.+-- +-- A precomputed array containing the prime factors of \(n\) must be+-- provided, as well as the value of the Euler totient function \(\phi(n)\)+-- as @phi@. If \(n\) is even, 2 must be the first factor in the list.+-- +-- The degree of \(\Phi_n(x)\) is exactly \(\phi(n)\). Only the low+-- \((\phi(n) + 1) / 2\) coefficients are written; the high coefficients+-- can be obtained afterwards by copying the low coefficients in reverse+-- order, since \(\Phi_n(x)\) is a palindrome for \(n \ne 1\).+-- +-- We use the sparse power series algorithm described as Algorithm 4+-- < [ArnoldMonagan2011]>. The algorithm is based on the identity+-- +-- \[`\]+-- \[\Phi_n(x) = \prod_{d|n} (x^d - 1)^{\mu(n/d)}.\]+-- +-- Treating the polynomial as a power series, the multiplications and+-- divisions can be done very cheaply using repeated additions and+-- subtractions. The complexity is \(O(2^k \phi(n))\) where \(k\) is the+-- number of prime factors in \(n\).+-- +-- To improve efficiency for small \(n\), we treat the @fmpz@ coefficients+-- as machine integers when there is no risk of overflow. The following+-- bounds are given in Table 6 of < [ArnoldMonagan2011]>:+-- +-- For \(n < 10163195\), the largest coefficient in any \(\Phi_n(x)\) has+-- 27 bits, so machine arithmetic is safe on 32 bits.+-- +-- For \(n < 169828113\), the largest coefficient in any \(\Phi_n(x)\) has+-- 60 bits, so machine arithmetic is safe on 64 bits.+-- +-- Further, the coefficients are always \(\pm 1\) or 0 if there are exactly+-- two prime factors, so in this case machine arithmetic can be used as+-- well.+-- +-- Finally, we handle two special cases: if there is exactly one prime+-- factor \(n = p\), then \(\Phi_n(x) = 1 + x + x^2 + \ldots + x^{n-1}\),+-- and if \(n = 2m\), we use \(\Phi_n(x) = \Phi_m(-x)\) to fall back to the+-- case when \(n\) is odd.+foreign import ccall "fmpz_poly.h _fmpz_poly_cyclotomic"+ _fmpz_poly_cyclotomic :: Ptr CFmpz -> CULong -> Ptr CMp -> CLong -> CULong -> IO ()++-- | /fmpz_poly_cyclotomic/ /poly/ /n/ +--+-- Sets @poly@ to the \(n\)-th cyclotomic polynomial, defined as+-- \(\Phi_n(x) = \prod_{\omega} (x-\omega)\) where \(\omega\) runs over all+-- the \(n\)-th primitive roots of unity.+-- +-- We factor \(n\) into \(n = qs\) where \(q\) is squarefree, and compute+-- \(\Phi_q(x)\). Then \(\Phi_n(x) = \Phi_q(x^s)\).+foreign import ccall "fmpz_poly.h fmpz_poly_cyclotomic"+ fmpz_poly_cyclotomic :: Ptr CFmpzPoly -> CULong -> IO ()++-- | /_fmpz_poly_is_cyclotomic/ /poly/ /len/ +foreign import ccall "fmpz_poly.h _fmpz_poly_is_cyclotomic"+ _fmpz_poly_is_cyclotomic :: Ptr CFmpz -> CLong -> IO CULong+-- | /fmpz_poly_is_cyclotomic/ /poly/ +--+-- If @poly@ is a cyclotomic polynomial, returns the index \(n\) of this+-- cyclotomic polynomial. If @poly@ is not a cyclotomic polynomial, returns+-- 0.+foreign import ccall "fmpz_poly.h fmpz_poly_is_cyclotomic"+ fmpz_poly_is_cyclotomic :: Ptr CFmpzPoly -> IO CULong++-- | /_fmpz_poly_cos_minpoly/ /coeffs/ /n/ +foreign import ccall "fmpz_poly.h _fmpz_poly_cos_minpoly"+ _fmpz_poly_cos_minpoly :: Ptr CFmpz -> CULong -> IO ()+-- | /fmpz_poly_cos_minpoly/ /poly/ /n/ +--+-- Sets @poly@ to the minimal polynomial of \(2 \cos(2 \pi / n)\). For+-- suitable choice of \(n\), this gives the minimal polynomial of+-- \(2 \cos(a \pi)\) or \(2 \sin(a \pi)\) for any rational \(a\).+-- +-- The cosine is multiplied by a factor two since this gives a monic+-- polynomial with integer coefficients. One can obtain the minimal+-- polynomial for \(\cos(2 \pi / n)\) by making the substitution+-- \(x \to x / 2\).+-- +-- For \(n > 2\), the degree of the polynomial is \(\varphi(n) / 2\). For+-- \(n = 1, 2\), the degree is 1. For \(n = 0\), we define the output to be+-- the constant polynomial 1.+-- +-- See < [WaktinsZeitlin1993]>.+foreign import ccall "fmpz_poly.h fmpz_poly_cos_minpoly"+ fmpz_poly_cos_minpoly :: Ptr CFmpzPoly -> CULong -> IO ()++-- | /_fmpz_poly_swinnerton_dyer/ /coeffs/ /n/ +foreign import ccall "fmpz_poly.h _fmpz_poly_swinnerton_dyer"+ _fmpz_poly_swinnerton_dyer :: Ptr CFmpz -> CULong -> IO ()+-- | /fmpz_poly_swinnerton_dyer/ /poly/ /n/ +--+-- Sets @poly@ to the Swinnerton-Dyer polynomial \(S_n\), defined as the+-- integer polynomial+-- \(S_n = \prod (x \pm \sqrt{2} \pm \sqrt{3} \pm \sqrt{5} \pm \ldots \pm \sqrt{p_n})\)+-- where \(p_n\) denotes the \(n\)-th prime number and all combinations of+-- signs are taken. This polynomial has degree \(2^n\) and is irreducible+-- over the integers (it is the minimal polynomial of+-- \(\sqrt{2} + \ldots + \sqrt{p_n}\)).+foreign import ccall "fmpz_poly.h fmpz_poly_swinnerton_dyer"+ fmpz_poly_swinnerton_dyer :: Ptr CFmpzPoly -> CULong -> IO ()++-- Orthogonal polynomials ------------------------------------------------------++-- | /_fmpz_poly_chebyshev_t/ /coeffs/ /n/ +foreign import ccall "fmpz_poly.h _fmpz_poly_chebyshev_t"+ _fmpz_poly_chebyshev_t :: Ptr CFmpz -> CULong -> IO ()+-- | /fmpz_poly_chebyshev_t/ /poly/ /n/ +--+-- Sets @poly@ to the Chebyshev polynomial of the first kind \(T_n(x)\),+-- defined by \(T_n(x) = \cos(n \cos^{-1}(x))\), for \(n\ge0\). The+-- coefficients are calculated using a hypergeometric recurrence.+foreign import ccall "fmpz_poly.h fmpz_poly_chebyshev_t"+ fmpz_poly_chebyshev_t :: Ptr CFmpzPoly -> CULong -> IO ()++-- | /_fmpz_poly_chebyshev_u/ /coeffs/ /n/ +foreign import ccall "fmpz_poly.h _fmpz_poly_chebyshev_u"+ _fmpz_poly_chebyshev_u :: Ptr CFmpz -> CULong -> IO ()+-- | /fmpz_poly_chebyshev_u/ /poly/ /n/ +--+-- Sets @poly@ to the Chebyshev polynomial of the first kind \(U_n(x)\),+-- defined by \((n+1) U_n(x) = T'_{n+1}(x)\), for \(n\ge0\). The+-- coefficients are calculated using a hypergeometric recurrence.+foreign import ccall "fmpz_poly.h fmpz_poly_chebyshev_u"+ fmpz_poly_chebyshev_u :: Ptr CFmpzPoly -> CULong -> IO ()++-- | /_fmpz_poly_legendre_pt/ /coeffs/ /n/ +--+-- Sets @coeffs@ to the coefficient array of the shifted Legendre+-- polynomial \(\tilde{P_n}(x)\), defined by+-- \(\tilde{P_n}(x) = P_n(2x-1)\), for \(n\ge0\). The coefficients are+-- calculated using a hypergeometric recurrence. The length of the array+-- will be @n+1@. See @fmpq_poly@ for the Legendre polynomials.+foreign import ccall "fmpz_poly.h _fmpz_poly_legendre_pt"+ _fmpz_poly_legendre_pt :: Ptr CFmpz -> CULong -> IO ()++-- | /fmpz_poly_legendre_pt/ /poly/ /n/ +--+-- Sets @poly@ to the shifted Legendre polynomial \(\tilde{P_n}(x)\),+-- defined by \(\tilde{P_n}(x) = P_n(2x-1)\), for \(n\ge0\). The+-- coefficients are calculated using a hypergeometric recurrence. See+-- @fmpq_poly@ for the Legendre polynomials.+foreign import ccall "fmpz_poly.h fmpz_poly_legendre_pt"+ fmpz_poly_legendre_pt :: Ptr CFmpzPoly -> CULong -> IO ()++-- | /_fmpz_poly_hermite_h/ /coeffs/ /n/ +--+-- Sets @coeffs@ to the coefficient array of the Hermite polynomial+-- \(H_n(x)\), defined by \(H'_n(x) = 2nH_{n-1}(x)\), for \(n\ge0\). The+-- coefficients are calculated using a hypergeometric recurrence. The+-- length of the array will be @n+1@.+foreign import ccall "fmpz_poly.h _fmpz_poly_hermite_h"+ _fmpz_poly_hermite_h :: Ptr CFmpz -> CULong -> IO ()++-- | /fmpz_poly_hermite_h/ /poly/ /n/ +--+-- Sets @poly@ to the Hermite polynomial \(H_n(x)\), defined by+-- \(H'_n(x) = 2nH_{n-1}(x)\), for \(n\ge0\). The coefficients are+-- calculated using a hypergeometric recurrence.+foreign import ccall "fmpz_poly.h fmpz_poly_hermite_h"+ fmpz_poly_hermite_h :: Ptr CFmpzPoly -> CULong -> IO ()++-- | /_fmpz_poly_hermite_he/ /coeffs/ /n/ +--+-- Sets @coeffs@ to the coefficient array of the Hermite polynomial+-- \(He_n(x)\), defined by+-- \(He_n(x) = 2^{-\tfrac{n}{2}}H_n\left(\frac{x}{\sqrt2}\right)\), for+-- \(n\ge0\). The coefficients are calculated using a hypergeometric+-- recurrence. The length of the array will be @n+1@.+foreign import ccall "fmpz_poly.h _fmpz_poly_hermite_he"+ _fmpz_poly_hermite_he :: Ptr CFmpz -> CULong -> IO ()++-- | /fmpz_poly_hermite_he/ /poly/ /n/ +--+-- Sets @poly@ to the Hermite polynomial \(He_n(x)\), defined by+-- \(He_n(x) = 2^{-\tfrac{n}{2}}H_n\left(\frac{x}{\sqrt2}\right)\), for+-- \(n\ge0\). The coefficients are calculated using a hypergeometric+-- recurrence.+foreign import ccall "fmpz_poly.h fmpz_poly_hermite_he"+ fmpz_poly_hermite_he :: Ptr CFmpzPoly -> CULong -> IO ()++-- Fibonacci polynomials -------------------------------------------------------++-- | /_fmpz_poly_fibonacci/ /coeffs/ /n/ +--+-- Sets @coeffs@ to the coefficient array of the \(n\)-th Fibonacci+-- polynomial. The coefficients are calculated using a hypergeometric+-- recurrence.+foreign import ccall "fmpz_poly.h _fmpz_poly_fibonacci"+ _fmpz_poly_fibonacci :: Ptr CFmpz -> CULong -> IO ()++-- | /fmpz_poly_fibonacci/ /poly/ /n/ +--+-- Sets @poly@ to the \(n\)-th Fibonacci polynomial. The coefficients are+-- calculated using a hypergeometric recurrence.+foreign import ccall "fmpz_poly.h fmpz_poly_fibonacci"+ fmpz_poly_fibonacci :: Ptr CFmpzPoly -> CULong -> IO ()++-- Eulerian numbers and polynomials --------------------------------------------++-- Eulerian numbers are the coefficients to the Eulerian polynomials+--+-- \[`\]+-- \[A_n(x) = \sum_{m = 0}^{n} A(n, m) x^m,\]+--+-- where the Eulerian polynomials are defined by the exponential generating+-- function+--+-- \[`\]+-- \[\frac{x - 1}{x - e^{(x - 1) t}}+-- = \sum_{n = 0}^{\infty} A_n(x) \frac{t^n}{n!}.\]+--+-- The Eulerian numbers can be expressed explicitly via the formula+--+-- \[`\]+-- \[A(n, m) = \sum_{k = 0}^{m + 1} (-1)^k \binom{n + 1}{k} (m + 1 - k)^n.\]+--+-- Note: Not to be confused with Euler numbers and polynomials.+--+-- -- | /arith_eulerian_polynomial/ /res/ /n/ +--+-- -- Sets @res@ to the Eulerian polynomial \(A_n(x)\), where we define+-- -- \(A_0(x) = 1\). The polynomial is calculated via a recursive relation.+-- foreign import ccall "fmpz_poly.h arith_eulerian_polynomial"+-- arith_eulerian_polynomial :: Ptr CFmpzPoly -> CULong -> IO ()++-- Modular forms and q-series --------------------------------------------------++-- | /_fmpz_poly_eta_qexp/ /f/ /r/ /len/ +foreign import ccall "fmpz_poly.h _fmpz_poly_eta_qexp"+ _fmpz_poly_eta_qexp :: Ptr CFmpz -> CLong -> CLong -> IO ()+-- | /fmpz_poly_eta_qexp/ /f/ /r/ /n/ +--+-- Sets \(f\) to the \(q\)-expansion to length \(n\) of the Dedekind eta+-- function (without the leading factor \(q^{1/24}\)) raised to the power+-- \(r\), i.e.+-- \((q^{-1/24} \eta(q))^r = \prod_{k=1}^{\infty} (1 - q^k)^r\).+-- +-- In particular, \(r = -1\) gives the generating function of the partition+-- function \(p(k)\), and \(r = 24\) gives, after multiplication by \(q\),+-- the modular discriminant \(\Delta(q)\) which generates the Ramanujan tau+-- function \(\tau(k)\).+-- +-- This function uses sparse formulas for \(r = 1, 2, 3, 4, 6\) and+-- otherwise reduces to one of those cases using power series arithmetic.+foreign import ccall "fmpz_poly.h fmpz_poly_eta_qexp"+ fmpz_poly_eta_qexp :: Ptr CFmpzPoly -> CLong -> CLong -> IO ()++-- | /_fmpz_poly_theta_qexp/ /f/ /r/ /len/ +foreign import ccall "fmpz_poly.h _fmpz_poly_theta_qexp"+ _fmpz_poly_theta_qexp :: Ptr CFmpz -> CLong -> CLong -> IO ()+-- | /fmpz_poly_theta_qexp/ /f/ /r/ /n/ +--+-- Sets \(f\) to the \(q\)-expansion to length \(n\) of the Jacobi theta+-- function raised to the power \(r\), i.e. \(\vartheta(q)^r\) where+-- \(\vartheta(q) = 1 + 2 \sum_{k=1}^{\infty} q^{k^2}\).+-- +-- This function uses sparse formulas for \(r = 1, 2\) and otherwise+-- reduces to those cases using power series arithmetic.+foreign import ccall "fmpz_poly.h fmpz_poly_theta_qexp"+ fmpz_poly_theta_qexp :: Ptr CFmpzPoly -> CLong -> CLong -> IO ()++-- CLD bounds ------------------------------------------------------------------++-- | /fmpz_poly_CLD_bound/ /res/ /f/ /n/ +--+-- Compute a bound on the \(n\) coefficient of \(fg'/g\) where \(g\) is any+-- factor of \(f\).+foreign import ccall "fmpz_poly.h fmpz_poly_CLD_bound"+ fmpz_poly_CLD_bound :: Ptr CFmpz -> Ptr CFmpzPoly -> CLong -> IO ()+
src/Data/Number/Flint/Fmpz/Poly/Factor/FFI.hsc view
@@ -10,6 +10,7 @@ , CFmpzPolyFactor (..) , newFmpzPolyFactor , withFmpzPolyFactor+ , withNewFmpzPolyFactor -- * Types, macros and constants -- * Memory management , fmpz_poly_factor_init
src/Data/Number/Flint/Fmpz/Poly/Instances.hs view
@@ -1,4 +1,3 @@-{-# OPTIONS_HADDOCK hide, prune, ignore-exports #-} {-| module : Data.Number.Flint.Fmpz.Poly.Instances copyright : (c) 2022 Hartmut Monien@@ -8,8 +7,6 @@ module Data.Number.Flint.Fmpz.Poly.Instances ( FmpzPoly (..) , module GHC.Exts- , hermitePolynomial- , cyclotomicPolynomial ) where import Test.QuickCheck@@ -24,8 +21,10 @@ import Foreign.Storable import Foreign.Marshal.Alloc (free) import Foreign.Marshal.Array (advancePtr)+import Text.ParserCombinators.ReadP import Data.Bits+import Data.Char import Data.Number.Flint.Fmpz import Data.Number.Flint.Fmpz.Instances@@ -43,6 +42,9 @@ free cs return s +instance Read FmpzPoly where+ readsPrec _ = readP_to_S parseFmpzPoly+ instance Num FmpzPoly where (*) = lift2 fmpz_poly_mul (+) = lift2 fmpz_poly_add@@ -152,16 +154,17 @@ f result x return result --- special functions -------------------------------------------------------------cyclotomicPolynomial n = unsafePerformIO $ do- poly <- newFmpzPoly- withFmpzPoly poly $ \poly ->- fmpz_poly_cyclotomic poly n- return poly+parseFmpzPoly :: ReadP FmpzPoly+parseFmpzPoly = do+ n <- parseItemNumber+ v <- count n parseItem + return $ fromList v+ where+ parseItemNumber = read <$> munch1 isNumber <* char ' '+ parseItem = read <$> (char ' ' *> parseFmpz)+ parseFmpz = do+ s <- munch (\x -> x == '+' || x == '-')+ skipSpaces+ d <- munch1 isNumber+ return $ s ++ d -hermitePolynomial n = unsafePerformIO $ do- poly <- newFmpzPoly- withFmpzPoly poly $ \poly ->- fmpz_poly_hermite_h poly n- return poly
src/Data/Number/Flint/Fmpz/Poly/Q/Instances.hs view
@@ -1,4 +1,3 @@-{-# OPTIONS_HADDOCK hide, prune, ignore-exports #-} module Data.Number.Flint.Fmpz.Poly.Q.Instances ( FmpzPolyQ (..) ) where
src/Data/Number/Flint/Fq/Embed.hs view
@@ -1,4 +1,3 @@-{-# OPTIONS_HADDOCK hide, prune, ignore-exports #-} module Data.Number.Flint.Fq.Embed ( module Data.Number.Flint.Fq.Embed.FFI ) where
src/Data/Number/Flint/Fq/Mat.hs view
@@ -1,8 +1,8 @@ {-| -module : Data.Number.Flint.Fq.Mat-copyright : (c) 2022 Hartmut Monien-license : MIT-style (see LICENSE)-maintainer : hmonien@uni-bonn.de+module : Data.Number.Flint.Fq.Mat+copyright : (c) 2022 Hartmut Monien+license : GNU GPL, version 2 or above (see LICENSE)+maintainer : hmonien@uni-bonn.de An @FqMat@ represents an matrix over a finite field. This module implements operations on matrices over a finite field.
src/Data/Number/Flint/Fq/NMod.hs view
@@ -1,8 +1,8 @@ {-| -module : Data.Number.Flint.Fq.NMod-copyright : (c) 2022 Hartmut Monien-license : MIT-style (see LICENSE)-maintainer : hmonien@uni-bonn.de+module : Data.Number.Flint.Fq.NMod+copyright : (c) 2022 Hartmut Monien+license : GNU GPL, version 2 or above (see LICENSE)+maintainer : hmonien@uni-bonn.de -} module Data.Number.Flint.Fq.NMod (
src/Data/Number/Flint/Fq/NMod/Embed.hs view
@@ -1,8 +1,8 @@ {- | -module : Data.Number.Flint.Fq.NMod.Embed-copyright : (c) 2022 Hartmut Monien-license : MIT-style (see LICENSE)-maintainer : hmonien@uni-bonn.de+module : Data.Number.Flint.Fq.NMod.Embed+copyright : (c) 2022 Hartmut Monien+license : GNU GPL, version 2 or above (see LICENSE)+maintainer : hmonien@uni-bonn.de -} module Data.Number.Flint.Fq.NMod.Embed (
src/Data/Number/Flint/Fq/NMod/Mat.hs view
@@ -1,8 +1,8 @@ {- | -module : Data.Number.Flint.Fq.Mat-copyright : (c) 2022 Hartmut Monien-license : MIT-style (see LICENSE)-maintainer : hmonien@uni-bonn.de+module : Data.Number.Flint.Fq.Mat+copyright : (c) 2022 Hartmut Monien+license : GNU GPL, version 2 or above (see LICENSE)+maintainer : hmonien@uni-bonn.de An @FqNModMat@ represents an matrix over a finite field (word-size characteristic). This module implements operations on matrices over a
src/Data/Number/Flint/Fq/NMod/Types.hs view
@@ -1,4 +1,3 @@-{-# OPTIONS_HADDOCK hide, prune, ignore-exports #-} module Data.Number.Flint.Fq.NMod.Types ( module Data.Number.Flint.Fq.NMod.Types.FFI ) where
src/Data/Number/Flint/Fq/NMod/Types/FFI.hsc view
@@ -1,4 +1,3 @@-{-# OPTIONS_HADDOCK hide, prune, ignore-exports #-} {-| module : Data.Number.Flint.Fq.NMod.Types.FFI copyright : (c) 2022 Hartmut Monien
src/Data/Number/Flint/Fq/NMod/Vec.hs view
@@ -1,8 +1,8 @@ {- | -module : Data.Number.Flint.Fq.Nmod.Vec-copyright : (c) 2022 Hartmut Monien-license : MIT-style (see LICENSE)-maintainer : hmonien@uni-bonn.de+module : Data.Number.Flint.Fq.Nmod.Vec+copyright : (c) 2022 Hartmut Monien+license : GNU GPL, version 2 or above (see LICENSE)+maintainer : hmonien@uni-bonn.de -} module Data.Number.Flint.Fq.NMod.Vec (
src/Data/Number/Flint/Fq/Poly.hs view
@@ -1,8 +1,8 @@ {- | -module : Data.Number.Flint.Fq.Poly-copyright : (c) 2022 Hartmut Monien-license : MIT-style (see LICENSE)-maintainer : hmonien@uni-bonn.de+module : Data.Number.Flint.Fq.Poly+copyright : (c) 2022 Hartmut Monien+license : GNU GPL, version 2 or above (see LICENSE)+maintainer : hmonien@uni-bonn.de An @FqPoly@ represents a polynomial over a finite field. This module implements operations on polynomials over a finite field.
src/Data/Number/Flint/Fq/Types.hs view
@@ -1,4 +1,3 @@-{-# OPTIONS_HADDOCK hide, prune, ignore-exports #-} module Data.Number.Flint.Fq.Types ( module Data.Number.Flint.Fq.Types.FFI ) where
src/Data/Number/Flint/Fq/Types/FFI.hsc view
@@ -1,4 +1,3 @@-{-# OPTIONS_HADDOCK hide, prune, ignore-exports #-} {-| module : Data.Number.Flint.Fq.Types.FFI copyright : (c) 2022 Hartmut Monien
src/Data/Number/Flint/Fq/Vec.hs view
@@ -1,8 +1,8 @@ {-| -module : Data.Number.Flint.Fq.Vec-copyright : (c) 2022 Hartmut Monien-license : MIT-style (see LICENSE)-maintainer : hmonien@uni-bonn.de+module : Data.Number.Flint.Fq.Vec+copyright : (c) 2022 Hartmut Monien+license : GNU GPL, version 2 or above (see LICENSE)+maintainer : hmonien@uni-bonn.de -} module Data.Number.Flint.Fq.Vec (
src/Data/Number/Flint/Fq/Zech.hs view
@@ -1,8 +1,8 @@ {-| -module : Data.Number.Flint.Fq.Zech-copyright : (c) 2022 Hartmut Monien-license : MIT-style (see LICENSE)-maintainer : hmonien@uni-bonn.de+module : Data.Number.Flint.Fq.Zech+copyright : (c) 2022 Hartmut Monien+license : GNU GPL, version 2 or above (see LICENSE)+maintainer : hmonien@uni-bonn.de -} module Data.Number.Flint.Fq.Zech (
src/Data/Number/Flint/Fq/Zech/Embed.hs view
@@ -1,8 +1,8 @@ {- | -module : Data.Number.Flint.Fq.Zech.Embed-copyright : (c) 2022 Hartmut Monien-license : MIT-style (see LICENSE)-maintainer : hmonien@uni-bonn.de+module : Data.Number.Flint.Fq.Zech.Embed+copyright : (c) 2022 Hartmut Monien+license : GNU GPL, version 2 or above (see LICENSE)+maintainer : hmonien@uni-bonn.de -} module Data.Number.Flint.Fq.Zech.Embed (
src/Data/Number/Flint/Fq/Zech/Mat.hs view
@@ -1,8 +1,8 @@ {- | -module : Data.Number.Flint.Fq.Zech.Mat-copyright : (c) 2022 Hartmut Monien-license : MIT-style (see LICENSE)-maintainer : hmonien@uni-bonn.de+module : Data.Number.Flint.Fq.Zech.Mat+copyright : (c) 2022 Hartmut Monien+license : GNU GPL, version 2 or above (see LICENSE)+maintainer : hmonien@uni-bonn.de -} module Data.Number.Flint.Fq.Zech.Mat (
src/Data/Number/Flint/Fq/Zech/Poly.hs view
@@ -1,8 +1,8 @@ {- | -module : Data.Number.Flint.Fq.Zech.Poly-copyright : (c) 2022 Hartmut Monien-license : MIT-style (see LICENSE)-maintainer : hmonien@uni-bonn.de+module : Data.Number.Flint.Fq.Zech.Poly+copyright : (c) 2022 Hartmut Monien+license : GNU GPL, version 2 or above (see LICENSE)+maintainer : hmonien@uni-bonn.de -} module Data.Number.Flint.Fq.Zech.Poly (
src/Data/Number/Flint/Fq/Zech/Types.hs view
@@ -1,9 +1,8 @@-{-# OPTIONS_HADDOCK hide, prune, ignore-exports #-} {- | -module : Data.Number.Flint.Fq.Zech.Types-copyright : (c) 2022 Hartmut Monien-license : MIT-style (see LICENSE)-maintainer : hmonien@uni-bonn.de+module : Data.Number.Flint.Fq.Zech.Types+copyright : (c) 2022 Hartmut Monien+license : GNU GPL, version 2 or above (see LICENSE)+maintainer : hmonien@uni-bonn.de -} module Data.Number.Flint.Fq.Zech.Types (
src/Data/Number/Flint/Fq/Zech/Vec.hs view
@@ -1,8 +1,8 @@ {- | -module : Data.Number.Flint.Fq.Zech.Vec-copyright : (c) 2022 Hartmut Monien-license : MIT-style (see LICENSE)-maintainer : hmonien@uni-bonn.de+module : Data.Number.Flint.Fq.Zech.Vec+copyright : (c) 2022 Hartmut Monien+license : GNU GPL, version 2 or above (see LICENSE)+maintainer : hmonien@uni-bonn.de -} module Data.Number.Flint.Fq.Zech.Vec (
src/Data/Number/Flint/Groups/Dirichlet/FFI.hsc view
@@ -66,10 +66,13 @@ -- Dirichlet characters -------------------------------------------------------- import Foreign.C.Types+import Foreign.C.String import Foreign.Ptr import Foreign.ForeignPtr import Foreign.Storable +import Data.Number.Flint.Flint+ #include <flint/dirichlet.h> -- dirichlet_group_t -----------------------------------------------------------@@ -186,7 +189,8 @@ newDirichletChar group = do x <- mallocForeignPtr withForeignPtr x $ \x -> do- dirichlet_char_init x group+ withDirichletGroup group $ \group -> do+ dirichlet_char_init x group addForeignPtrFinalizer p_dirichlet_char_clear x return $ DirichletChar x @@ -234,8 +238,15 @@ -- | /dirichlet_char_print/ /G/ /chi/ -- -- Prints the array of exponents representing this character.-foreign import ccall "dirichlet.h dirichlet_char_print"- dirichlet_char_print :: Ptr CDirichletGroup -> Ptr CDirichletChar -> IO ()+dirichlet_char_print :: Ptr CDirichletGroup -> Ptr CDirichletChar -> IO ()+dirichlet_char_print g c = do+ printCStr (dirichlet_char_get_str g) c+ return ()+ ++foreign import ccall "dirichlet.h dirichlet_char_get_str"+ dirichlet_char_get_str :: Ptr CDirichletGroup+ -> Ptr CDirichletChar -> IO CString -- | /dirichlet_char_log/ /x/ /G/ /m/ --
src/Data/Number/Flint/Groups/Qfb/Instances.hs view
@@ -1,4 +1,3 @@-{-# OPTIONS_HADDOCK hide, prune, ignore-exports #-} module Data.Number.Flint.Groups.Qfb.Instances where import System.IO.Unsafe
src/Data/Number/Flint/NF/Fmpzi/Instances.hs view
@@ -1,4 +1,3 @@-{-# OPTIONS_HADDOCK hide, prune, ignore-exports #-} module Data.Number.Flint.NF.Fmpzi.Instances where import System.IO.Unsafe
src/Data/Number/Flint/NF/QQbar/FFI.hsc view
@@ -15,6 +15,9 @@ , newQQbarFromDouble , withQQbar , withNewQQbar+ -- * Memory management+ , _qqbar_vec_init+ , _qqbar_vec_clear -- * Assignment , qqbar_swap , qqbar_set@@ -208,6 +211,7 @@ import Data.Number.Flint.Fmpq import Data.Number.Flint.Fmpq.Poly+import Data.Number.Flint.Fmpq.Mat import Data.Number.Flint.Arb.Types import Data.Number.Flint.Acb.Types@@ -1052,7 +1056,7 @@ -- matrix /mat/. These functions compute the characteristic polynomial of -- /mat/ and then call @qqbar_roots_fmpz_poly@ with the same flags. foreign import ccall "qqbar.h qqbar_eigenvalues_fmpq_mat"- qqbar_eigenvalues_fmpq_mat :: Ptr CQQbar -> Ptr CFmpzMat -> CInt -> IO ()+ qqbar_eigenvalues_fmpq_mat :: Ptr CQQbar -> Ptr CFmpqMat -> CInt -> IO () -- Roots of unity and trigonometric functions ----------------------------------
src/Data/Number/Flint/NF/QQbar/Instances.hs view
@@ -1,4 +1,3 @@-{-# OPTIONS_HADDOCK hide, prune, ignore-exports #-} module Data.Number.Flint.NF.QQbar.Instances where import System.IO.Unsafe
src/Data/Number/Flint/NMod/Poly/Instances.hs view
@@ -1,4 +1,3 @@-{-# OPTIONS_HADDOCK hide, prune, ignore-exports #-} module Data.Number.Flint.NMod.Poly.Instances ( NModPoly (..) , module GHC.Exts
src/Data/Number/Flint/NMod/Types.hs view
@@ -1,4 +1,3 @@-{-# OPTIONS_HADDOCK hide, prune, ignore-exports #-} module Data.Number.Flint.NMod.Types ( module Data.Number.Flint.NMod.Types.FFI
src/Data/Number/Flint/Padic/Poly/FFI.hsc view
@@ -137,7 +137,12 @@ `ap` #{peek padic_poly_struct, length} ptr `ap` #{peek padic_poly_struct, val } ptr `ap` #{peek padic_poly_struct, N } ptr- poke = undefined+ poke ptr (CPadicPoly coeffs alloc length val n) = do+ (#poke padic_poly_struct, coeffs) ptr coeffs+ (#poke padic_poly_struct, alloc ) ptr alloc+ (#poke padic_poly_struct, length) ptr length+ (#poke padic_poly_struct, val ) ptr val+ (#poke padic_poly_struct, N ) ptr n newPadicPoly = do x <- mallocForeignPtr
src/Data/Number/Flint/Qadic/FFI.hsc view
@@ -19,6 +19,8 @@ , newQadic , withQadic , withNewQadic+ , newQadicWithPrec+ , withNewQadicWithPrec -- * q-adic context -- -- | Context@@ -158,6 +160,18 @@ x <- newQadic withQadic x f +newQadicWithPrec prec = do+ x <- mallocForeignPtr+ withForeignPtr x $ \x -> qadic_init2 x prec+ addForeignPtrFinalizer p_qadic_clear x+ return $ Qadic x++-- | Apply `f` to new q-adic+{-# INLINE withNewQadicWithPrec #-}+withNewQadicWithPrec prec f = do+ x <- newQadicWithPrec prec + withQadic x f+ -- qadic_ctx_t ---------------------------------------------------------------- data QadicCtx = QadicCtx {-# UNPACK #-} !(ForeignPtr CQadicCtx)
src/Data/Number/Flint/Support/D/Mat/Instances.hs view
@@ -1,4 +1,3 @@-{-# OPTIONS_HADDOCK hide, prune, ignore-exports #-} module Data.Number.Flint.Support.D.Mat.Instances where import System.IO.Unsafe