MPSolve 3.2.1
Loading...
Searching...
No Matches
monomial-poly.h File Reference

Implementation of the allocation and edit functions for the handling of monomial polynomials. More...

#include <mps/polynomial.h>
#include <mps/mps.h>
#include <gmp.h>
#include <pthread.h>

Go to the source code of this file.

Classes

struct  mps_monomial_poly_double_buffer
 
struct  mps_monomial_poly
 Data regarding a polynomial represented in the monomial base. More...
 

Macros

#define MPS_MONOMIAL_POLY(t)   (MPS_POLYNOMIAL_CAST (mps_monomial_poly, t))
 
#define MPS_IS_MONOMIAL_POLY(t)   (mps_polynomial_check_type (t, "mps_monomial_poly"))
 

Functions

mps_monomial_polymps_monomial_poly_new (mps_context *s, long int degree)
 Return a newly allocated mps_monomial_poly of the given degree.
 
void mps_monomial_poly_free (mps_context *s, mps_polynomial *mp)
 Free a instance of mps_monomial_poly previously allocated with mps_monomial_poly_new().
 
long int mps_monomial_poly_get_precision (mps_context *s, mps_monomial_poly *mp)
 
long int mps_monomial_poly_raise_precision (mps_context *s, mps_polynomial *mp, long int prec)
 Raise the precision bits of the multiprecision fields of the polynomial to selected value. More...
 
void mps_monomial_poly_set_coefficient_q (mps_context *s, mps_monomial_poly *mp, long int i, mpq_t real_part, mpq_t imag_part)
 This routine can be used to set the i-th coefficients of the polynomial with a multiprecision rational number. More...
 
void mps_monomial_poly_set_coefficient_d (mps_context *s, mps_monomial_poly *mp, long int i, double real_part, double imag_part)
 Set the coefficient in position i of the mpnomial. More...
 
void mps_monomial_poly_set_coefficient_f (mps_context *s, mps_monomial_poly *p, long int i, mpc_t coeff)
 
void mps_monomial_poly_set_coefficient_int (mps_context *s, mps_monomial_poly *mp, long int i, long long real_part, long long imag_part)
 
void mps_monomial_poly_set_coefficient_s (mps_context *s, mps_monomial_poly *p, int i, const char *real_coeff, const char *imag_coeff)
 Set the $i$-th coefficient of the polynomial. More...
 
void mps_monomial_poly_get_coefficient_d (mps_context *s, mps_monomial_poly *p, int i, cplx_t output)
 Get a double version of the $i$-th coefficient of the polynomial. More...
 
void mps_monomial_poly_get_coefficient_q (mps_context *s, mps_monomial_poly *p, int i, mpq_t real_output, mpq_t imag_output)
 Get a rational version of the $i$-th coefficient of the polynomial. More...
 
mps_monomial_polymps_monomial_poly_derive (mps_context *s, mps_monomial_poly *p, int k, long int wp)
 Get the k-th derivative of p with floating point coefficients approximated with the precision wp. More...
 
mps_boolean mps_monomial_poly_feval (mps_context *ctx, mps_polynomial *p, cplx_t x, cplx_t value, double *error)
 
mps_boolean mps_monomial_poly_deval (mps_context *ctx, mps_polynomial *p, cdpe_t x, cdpe_t value, rdpe_t error)
 
mps_boolean mps_monomial_poly_meval (mps_context *ctx, mps_polynomial *p, mpc_t x, mpc_t value, rdpe_t error)
 
void mps_monomial_poly_fstart (mps_context *ctx, mps_polynomial *p, mps_approximation **approximations)
 
void mps_monomial_poly_dstart (mps_context *ctx, mps_polynomial *p, mps_approximation **approximations)
 
void mps_monomial_poly_mstart (mps_context *ctx, mps_polynomial *p, mps_approximation **approximations)
 
void mps_monomial_poly_fnewton (mps_context *ctx, mps_polynomial *p, mps_approximation *root, cplx_t corr)
 
void mps_monomial_poly_dnewton (mps_context *ctx, mps_polynomial *p, mps_approximation *root, cdpe_t corr)
 
void mps_monomial_poly_mnewton (mps_context *ctx, mps_polynomial *p, mps_approximation *root, mpc_t corr, long int wp)
 
void mps_monomial_poly_get_leading_coefficient (mps_context *ctx, mps_polynomial *p, mpc_t leading_coefficient)
 
void mps_monomial_poly_deflate (mps_context *ctx, mps_polynomial *p)
 
mps_monomial_polymps_monomial_poly_read_from_stream (mps_context *s, mps_input_buffer *buffer, mps_structure structure, mps_density density, long int precision)
 Parse the stream that has been loaded into buffer and that describe a mps_monomial_poly. More...
 

Detailed Description

Implementation of the allocation and edit functions for the handling of monomial polynomials.

Function Documentation

◆ mps_monomial_poly_derive()

mps_monomial_poly * mps_monomial_poly_derive ( mps_context s,
mps_monomial_poly p,
int  k,
long int  wp 
)

Get the k-th derivative of p with floating point coefficients approximated with the precision wp.

Parameters
sThe current mps_context
pThe polynomial to derive
kThe order of the derivative that should be computed.
wpThe selected output working precision

◆ mps_monomial_poly_get_coefficient_d()

void mps_monomial_poly_get_coefficient_d ( mps_context s,
mps_monomial_poly p,
int  i,
cplx_t  output 
)

Get a double version of the $i$-th coefficient of the polynomial.

Parameters
sThe current mps_context.
pThe polynomial of which you want to know the coefficient.
iThe degree of the coefficient to obtain.
outputA cplx_t where the result will be stored.

◆ mps_monomial_poly_get_coefficient_q()

void mps_monomial_poly_get_coefficient_q ( mps_context s,
mps_monomial_poly p,
int  i,
mpq_t  real_output,
mpq_t  imag_output 
)

Get a rational version of the $i$-th coefficient of the polynomial.

Parameters
sThe current mps_context.
pThe polynomial of which you want to know the coefficient.
iThe degree of the coefficient to obtain.
real_outputA mpq_t where the real part of the result will be stored.
imag_outputA mpq_t where the imaginary part of the result will be stored.

◆ mps_monomial_poly_raise_precision()

long int mps_monomial_poly_raise_precision ( mps_context s,
mps_polynomial p,
long int  prec 
)

Raise the precision bits of the multiprecision fields of the polynomial to selected value.

If the polynomial coefficients were generated by integer or rational input they will be autoregenerated.

Parameters
sThe status of the computation.
pThe polynomial that need the precision raised, casted to a mps_polynomial.
precThe selected bits of precision.
Returns
The precision set.

◆ mps_monomial_poly_read_from_stream()

mps_monomial_poly * mps_monomial_poly_read_from_stream ( mps_context s,
mps_input_buffer buffer,
mps_structure  structure,
mps_density  density,
long int  precision 
)

Parse the stream that has been loaded into buffer and that describe a mps_monomial_poly.

Parameters
sThe current mps_context
bufferThe buffer that needs to be parsed
Thestructure of the polynomial
Thedensity configuration of the polynomial.
Theinput precision of the coefficients, if specified, 0 otherwise
Returns
A newly allocated mps_polynomial, or NULL if the parsing fails.

◆ mps_monomial_poly_set_coefficient_d()

void mps_monomial_poly_set_coefficient_d ( mps_context s,
mps_monomial_poly mp,
long int  i,
double  real_part,
double  imag_part 
)

Set the coefficient in position i of the mpnomial.

Parameters
sThe mps_context associated to this computation.
mpThe monomial_poly in which the coefficients will be set.
iThe index of the coefficient to set.
real_partThe real part of the coefficient.
imag_partThe imaginary part of the coefficient.

◆ mps_monomial_poly_set_coefficient_q()

void mps_monomial_poly_set_coefficient_q ( mps_context s,
mps_monomial_poly mp,
long int  i,
mpq_t  real_part,
mpq_t  imag_part 
)

This routine can be used to set the i-th coefficients of the polynomial with a multiprecision rational number.

Parameters
sThe mps_context the will be used for the computation. This shall be passed along with the polynomial because it manages user interaction and can perform error handling.
mpThe monomial_poly that will hold the coefficient.
iThe exponent of the monomial to which the coefficient is related.
real_partThe real part of the coefficient.
imag_partThe imaginary part of the coefficients.

◆ mps_monomial_poly_set_coefficient_s()

void mps_monomial_poly_set_coefficient_s ( mps_context s,
mps_monomial_poly p,
int  i,
const char *  real_coeff,
const char *  imag_coeff 
)

Set the $i$-th coefficient of the polynomial.

Parameters
sThe current mps_context.
pThe polynomial whose coefficient should be set.
iThe degree of the coefficient to set.
real_coeffA string representing the real part of the coefficient that should be set, or NULL as an alias for $0$.
imag_coeffA string representing the imaginary part of the coefficient that should be set, or NULL as an alias for $0$.