Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
An FmpzMPolyQ
represents an element of :math:`mathbb{Q}(x_1,ldots,x_n)`
for fixed n as a pair of Flint multivariate polynomials
(FmpzMPolyQ
). Instances are always kept in canonical form by
ensuring that the GCD of numerator and denominator is 1 and that the
coefficient of the leading term of the denominator is positive.
The user must create a multivariate polynomial context
(FmpzMPolyCtx
) specifying the number of variables n and the
monomial ordering.
Synopsis
- data FmpzMPolyQ = FmpzMPolyQ !(ForeignPtr CFmpzMPolyQ)
- data CFmpzMPolyQ = CFmpzMPolyQ CFmpzMPoly CFmpzMPoly
- newFmpzMPolyQ :: FmpzMPolyCtx -> IO FmpzMPolyQ
- withFmpzMPolyQ :: FmpzMPolyQ -> (Ptr CFmpzMPolyQ -> IO a) -> IO (FmpzMPolyQ, a)
- withFmpzMPolyQNumerator :: FmpzMPolyQ -> (Ptr CFmpzMPoly -> IO t) -> IO (FmpzMPolyQ, t)
- withFmpzMPolyQDenominator :: FmpzMPolyQ -> (Ptr CFmpzMPoly -> IO t) -> IO (FmpzMPolyQ, t)
- fmpz_mpoly_q_init :: Ptr CFmpzMPolyQ -> Ptr CFmpzMPolyCtx -> IO ()
- fmpz_mpoly_q_clear :: Ptr CFmpzMPolyQ -> Ptr CFmpzMPolyCtx -> IO ()
- fmpz_mpoly_q_swap :: Ptr CFmpzMPolyQ -> Ptr CFmpzMPolyQ -> Ptr CFmpzMPolyCtx -> IO ()
- fmpz_mpoly_q_set :: Ptr CFmpzMPolyQ -> Ptr CFmpzMPolyQ -> Ptr CFmpzMPolyCtx -> IO ()
- fmpz_mpoly_q_canonicalise :: Ptr CFmpzMPolyQ -> Ptr CFmpzMPolyCtx -> IO ()
- fmpz_mpoly_q_is_canonical :: Ptr CFmpzMPolyQ -> Ptr CFmpzMPolyCtx -> IO CInt
- fmpz_mpoly_q_is_zero :: Ptr CFmpzMPolyQ -> Ptr CFmpzMPolyCtx -> IO CInt
- fmpz_mpoly_q_is_one :: Ptr CFmpzMPolyQ -> Ptr CFmpzMPolyCtx -> IO CInt
- fmpz_mpoly_q_used_vars :: Ptr CInt -> Ptr CFmpzMPolyQ -> Ptr CFmpzMPolyCtx -> IO ()
- fmpz_mpoly_q_zero :: Ptr CFmpzMPolyQ -> Ptr CFmpzMPolyCtx -> IO ()
- fmpz_mpoly_q_one :: Ptr CFmpzMPolyQ -> Ptr CFmpzMPolyCtx -> IO ()
- fmpz_mpoly_q_gen :: Ptr CFmpzMPolyQ -> CLong -> Ptr CFmpzMPolyCtx -> IO ()
- fmpz_mpoly_q_get_str_pretty :: Ptr CFmpzMPolyQ -> Ptr (Ptr CChar) -> Ptr CFmpzMPolyCtx -> IO CString
- fmpz_mpoly_q_fprint_pretty :: Ptr CFile -> Ptr CFmpzMPolyQ -> Ptr (Ptr CChar) -> Ptr CFmpzMPolyCtx -> IO CInt
- fmpz_mpoly_q_print_pretty :: Ptr CFmpzMPolyQ -> Ptr (Ptr CChar) -> Ptr CFmpzMPolyCtx -> IO CInt
- fmpz_mpoly_q_randtest :: Ptr CFmpzMPolyQ -> Ptr CFRandState -> CLong -> CMpLimb -> CLong -> Ptr CFmpzMPolyCtx -> IO ()
- fmpz_mpoly_q_equal :: Ptr CFmpzMPolyQ -> Ptr CFmpzMPolyQ -> Ptr CFmpzMPolyCtx -> IO CInt
- fmpz_mpoly_q_neg :: Ptr CFmpzMPolyQ -> Ptr CFmpzMPolyQ -> Ptr CFmpzMPolyCtx -> IO ()
- fmpz_mpoly_q_add :: Ptr CFmpzMPolyQ -> Ptr CFmpzMPolyQ -> Ptr CFmpzMPolyQ -> Ptr CFmpzMPolyCtx -> IO ()
- fmpz_mpoly_q_sub :: Ptr CFmpzMPolyQ -> Ptr CFmpzMPolyQ -> Ptr CFmpzMPolyQ -> Ptr CFmpzMPolyCtx -> IO ()
- fmpz_mpoly_q_mul :: Ptr CFmpzMPolyQ -> Ptr CFmpzMPolyQ -> Ptr CFmpzMPolyQ -> Ptr CFmpzMPolyCtx -> IO ()
- fmpz_mpoly_q_div :: Ptr CFmpzMPolyQ -> Ptr CFmpzMPolyQ -> Ptr CFmpzMPolyQ -> Ptr CFmpzMPolyCtx -> IO ()
- fmpz_mpoly_q_inv :: Ptr CFmpzMPolyQ -> Ptr CFmpzMPolyQ -> Ptr CFmpzMPolyCtx -> IO ()
- _fmpz_mpoly_q_content :: Ptr CFmpz -> Ptr CFmpz -> Ptr CFmpzMPoly -> Ptr CFmpzMPoly -> Ptr CFmpzMPolyCtx -> IO ()
Multivariate rational functions over Q
Types
data FmpzMPolyQ Source #
data CFmpzMPolyQ Source #
Instances
Storable CFmpzMPolyQ Source # | |
Defined in Data.Number.Flint.Fmpz.MPoly.Q.FFI sizeOf :: CFmpzMPolyQ -> Int # alignment :: CFmpzMPolyQ -> Int # peekElemOff :: Ptr CFmpzMPolyQ -> Int -> IO CFmpzMPolyQ # pokeElemOff :: Ptr CFmpzMPolyQ -> Int -> CFmpzMPolyQ -> IO () # peekByteOff :: Ptr b -> Int -> IO CFmpzMPolyQ # pokeByteOff :: Ptr b -> Int -> CFmpzMPolyQ -> IO () # peek :: Ptr CFmpzMPolyQ -> IO CFmpzMPolyQ # poke :: Ptr CFmpzMPolyQ -> CFmpzMPolyQ -> IO () # |
newFmpzMPolyQ :: FmpzMPolyCtx -> IO FmpzMPolyQ Source #
Create a new FmpzMPolyQ
withFmpzMPolyQ :: FmpzMPolyQ -> (Ptr CFmpzMPolyQ -> IO a) -> IO (FmpzMPolyQ, a) Source #
Use a new FmpzMPolyQ
withFmpzMPolyQNumerator :: FmpzMPolyQ -> (Ptr CFmpzMPoly -> IO t) -> IO (FmpzMPolyQ, t) Source #
Use the numerator of FmpzMPolyQ
withFmpzMPolyQDenominator :: FmpzMPolyQ -> (Ptr CFmpzMPoly -> IO t) -> IO (FmpzMPolyQ, t) Source #
Use the denominator of FmpzMPolyQ
Memory management
fmpz_mpoly_q_init :: Ptr CFmpzMPolyQ -> Ptr CFmpzMPolyCtx -> IO () Source #
fmpz_mpoly_q_init res ctx
Initializes res for use, and sets its value to zero.
fmpz_mpoly_q_clear :: Ptr CFmpzMPolyQ -> Ptr CFmpzMPolyCtx -> IO () Source #
fmpz_mpoly_q_clear res ctx
Clears res, freeing or recycling its allocated memory.
Assignment
fmpz_mpoly_q_swap :: Ptr CFmpzMPolyQ -> Ptr CFmpzMPolyQ -> Ptr CFmpzMPolyCtx -> IO () Source #
fmpz_mpoly_q_swap x y ctx
Swaps the values of x and y efficiently.
fmpz_mpoly_q_set :: Ptr CFmpzMPolyQ -> Ptr CFmpzMPolyQ -> Ptr CFmpzMPolyCtx -> IO () Source #
fmpz_mpoly_q_set res x ctx
Sets res to the value x.
Canonicalisation
fmpz_mpoly_q_canonicalise :: Ptr CFmpzMPolyQ -> Ptr CFmpzMPolyCtx -> IO () Source #
fmpz_mpoly_q_canonicalise x ctx
Puts the numerator and denominator of x in canonical form by removing common content and making the leading term of the denominator positive.
fmpz_mpoly_q_is_canonical :: Ptr CFmpzMPolyQ -> Ptr CFmpzMPolyCtx -> IO CInt Source #
fmpz_mpoly_q_is_canonical x ctx
Returns whether x is in canonical form.
In addition to verifying that the numerator and denominator have no common content and that the leading term of the denominator is positive, this function checks that the denominator is nonzero and that the numerator and denominator have correctly sorted terms (these properties should normally hold; verifying them provides an extra consistency check for test code).
Properties
fmpz_mpoly_q_is_zero :: Ptr CFmpzMPolyQ -> Ptr CFmpzMPolyCtx -> IO CInt Source #
fmpz_mpoly_q_is_zero x ctx
Returns whether x is the constant 0.
fmpz_mpoly_q_is_one :: Ptr CFmpzMPolyQ -> Ptr CFmpzMPolyCtx -> IO CInt Source #
fmpz_mpoly_q_is_one x ctx
Returns whether x is the constant 1.
fmpz_mpoly_q_used_vars :: Ptr CInt -> Ptr CFmpzMPolyQ -> Ptr CFmpzMPolyCtx -> IO () Source #
fmpz_mpoly_q_used_vars used f ctx
For each variable, sets the corresponding entry in used to the boolean flag indicating whether that variable appears in the rational function (respectively its numerator or denominator).
Special values
fmpz_mpoly_q_zero :: Ptr CFmpzMPolyQ -> Ptr CFmpzMPolyCtx -> IO () Source #
fmpz_mpoly_q_zero res ctx
Sets res to the constant 0.
fmpz_mpoly_q_one :: Ptr CFmpzMPolyQ -> Ptr CFmpzMPolyCtx -> IO () Source #
fmpz_mpoly_q_one res ctx
Sets res to the constant 1.
fmpz_mpoly_q_gen :: Ptr CFmpzMPolyQ -> CLong -> Ptr CFmpzMPolyCtx -> IO () Source #
fmpz_mpoly_q_gen res i ctx
Sets res to the generator \(x_{i+1}\). Requires \(0 \le i < n\) where n is the number of variables of ctx.
Input and output
fmpz_mpoly_q_get_str_pretty :: Ptr CFmpzMPolyQ -> Ptr (Ptr CChar) -> Ptr CFmpzMPolyCtx -> IO CString Source #
fmpz_mpoly_q_get_str_pretty f x ctx
Returns string representation of f. If x is not NULL, the strings in x are used as the symbols for the variables.
fmpz_mpoly_q_fprint_pretty :: Ptr CFile -> Ptr CFmpzMPolyQ -> Ptr (Ptr CChar) -> Ptr CFmpzMPolyCtx -> IO CInt Source #
fmpz_mpoly_q_fprint_pretty out f x ctx
Prints f to file out. If x is not NULL, the strings in x are used as the symbols for the variables.
fmpz_mpoly_q_print_pretty :: Ptr CFmpzMPolyQ -> Ptr (Ptr CChar) -> Ptr CFmpzMPolyCtx -> IO CInt Source #
fmpz_mpoly_q_print_pretty f x ctx
Prints f to standard output. If x is not NULL, the strings in x are used as the symbols for the variables.
Random generation
fmpz_mpoly_q_randtest :: Ptr CFmpzMPolyQ -> Ptr CFRandState -> CLong -> CMpLimb -> CLong -> Ptr CFmpzMPolyCtx -> IO () Source #
fmpz_mpoly_q_randtest res state length coeff_bits exp_bound ctx
Sets res to a random rational function where both numerator and denominator have up to length terms, coefficients up to size coeff_bits, and exponents strictly smaller than exp_bound.
Comparisons
fmpz_mpoly_q_equal :: Ptr CFmpzMPolyQ -> Ptr CFmpzMPolyQ -> Ptr CFmpzMPolyCtx -> IO CInt Source #
fmpz_mpoly_q_equal x y ctx
Returns whether x and y are equal.
Arithmetic
fmpz_mpoly_q_neg :: Ptr CFmpzMPolyQ -> Ptr CFmpzMPolyQ -> Ptr CFmpzMPolyCtx -> IO () Source #
fmpz_mpoly_q_neg res x ctx
Sets res to the negation of x.
fmpz_mpoly_q_add :: Ptr CFmpzMPolyQ -> Ptr CFmpzMPolyQ -> Ptr CFmpzMPolyQ -> Ptr CFmpzMPolyCtx -> IO () Source #
fmpz_mpoly_q_add res x y ctx
Sets res to the sum of x and y.
fmpz_mpoly_q_sub :: Ptr CFmpzMPolyQ -> Ptr CFmpzMPolyQ -> Ptr CFmpzMPolyQ -> Ptr CFmpzMPolyCtx -> IO () Source #
fmpz_mpoly_q_sub res x y ctx
Sets res to the difference of x and y.
fmpz_mpoly_q_mul :: Ptr CFmpzMPolyQ -> Ptr CFmpzMPolyQ -> Ptr CFmpzMPolyQ -> Ptr CFmpzMPolyCtx -> IO () Source #
fmpz_mpoly_q_mul res x y ctx
Sets res to the product of x and y.
fmpz_mpoly_q_div :: Ptr CFmpzMPolyQ -> Ptr CFmpzMPolyQ -> Ptr CFmpzMPolyQ -> Ptr CFmpzMPolyCtx -> IO () Source #
fmpz_mpoly_q_div res x y ctx
Sets res to the quotient of x and y. Division by zero calls flint_abort.
fmpz_mpoly_q_inv :: Ptr CFmpzMPolyQ -> Ptr CFmpzMPolyQ -> Ptr CFmpzMPolyCtx -> IO () Source #
fmpz_mpoly_q_inv res x ctx
Sets res to the inverse of x. Division by zero calls flint_abort.
Content
_fmpz_mpoly_q_content :: Ptr CFmpz -> Ptr CFmpz -> Ptr CFmpzMPoly -> Ptr CFmpzMPoly -> Ptr CFmpzMPolyCtx -> IO () Source #
_fmpz_mpoly_q_content num den xnum xden ctx
Sets res to the content of the coefficients of x.