MPSolve 3.2.1
Loading...
Searching...
No Matches
monomial-poly.h
Go to the documentation of this file.
1/*
2 * This file is part of MPSolve 3.2.1
3 *
4 * Copyright (C) 2001-2020, Dipartimento di Matematica "L. Tonelli", Pisa.
5 * License: http://www.gnu.org/licenses/gpl.html GPL version 3 or higher
6 *
7 * Authors:
8 * Leonardo Robol <leonardo.robol@unipi.it>
9 */
10
11#ifndef MPS_MONOMIAL_POLY_H_
12#define MPS_MONOMIAL_POLY_H_
13
21 #include <mps/polynomial.h>
22 #include <mps/mps.h>
23 #include <gmp.h>
24 #include <pthread.h>
25
26#define MPS_MONOMIAL_POLY(t) (MPS_POLYNOMIAL_CAST (mps_monomial_poly, t))
27#define MPS_IS_MONOMIAL_POLY(t) (mps_polynomial_check_type (t, "mps_monomial_poly"))
28
29MPS_BEGIN_DECLS
30
31#ifdef _MPS_PRIVATE
32
34 char active;
35 mpc_t *mfpc1;
36 mpc_t *mfpc2;
37};
38
39
49
51
60 mps_boolean *spar;
61
65 double *fpr;
66
70 cplx_t *fpc;
71
75 cplx_t *fppc;
76
80 rdpe_t *dpr;
81
85 cdpe_t *dpc;
86
90 mpf_t *mfpr;
91
95 mpc_t *mfpc;
96
101 pthread_mutex_t * mfpc_mutex;
102
106 mpc_t *mfppc;
107
111 double *fap;
112
116 rdpe_t *dap;
117
122
127
132 pthread_mutex_t regenerating;
133
137 long int prec;
138};
139#endif /* #ifdef _MPS_PRIVATE */
140
141/* These routines are thought for polynomial handling, i.e. allocating and
142 * setting coefficients of the polynomials, and setting the precision of the
143 * floating point coefficients that are in there */
144
146
148
149long int mps_monomial_poly_get_precision (mps_context * s, mps_monomial_poly * mp);
150
151long int mps_monomial_poly_raise_precision (mps_context * s, mps_polynomial * mp, long int prec);
152
154 mpq_t real_part, mpq_t imag_part);
156 double real_part, double imag_part);
157void mps_monomial_poly_set_coefficient_f (mps_context * s, mps_monomial_poly * p, long int i,
158 mpc_t coeff);
159void mps_monomial_poly_set_coefficient_int (mps_context * s, mps_monomial_poly * mp, long int i,
160 long long real_part, long long imag_part);
161
163 int i, const char * real_coeff,
164 const char * imag_coeff);
165
167 int i, cplx_t output);
168
170 int i, mpq_t real_output, mpq_t imag_output);
171
173
174mps_boolean mps_monomial_poly_feval (mps_context * ctx, mps_polynomial *p, cplx_t x, cplx_t value, double * error);
175
176mps_boolean mps_monomial_poly_deval (mps_context * ctx, mps_polynomial *p, cdpe_t x, cdpe_t value, rdpe_t error);
177
178mps_boolean mps_monomial_poly_meval (mps_context * ctx, mps_polynomial *p, mpc_t x, mpc_t value, rdpe_t error);
179
180void mps_monomial_poly_fstart (mps_context * ctx, mps_polynomial * p, mps_approximation ** approximations);
181
182void mps_monomial_poly_dstart (mps_context * ctx, mps_polynomial * p, mps_approximation ** approximations);
183
184void mps_monomial_poly_mstart (mps_context * ctx, mps_polynomial * p, mps_approximation ** approximations);
185
186void mps_monomial_poly_fnewton (mps_context * ctx, mps_polynomial * p,
187 mps_approximation * root, cplx_t corr);
188
189void mps_monomial_poly_dnewton (mps_context * ctx, mps_polynomial * p,
190 mps_approximation * root, cdpe_t corr);
191
192void mps_monomial_poly_mnewton (mps_context * ctx, mps_polynomial * p,
193 mps_approximation * root, mpc_t corr, long int wp);
194
195void mps_monomial_poly_get_leading_coefficient (mps_context * ctx, mps_polynomial * p,
196 mpc_t leading_coefficient);
197
198void mps_monomial_poly_deflate (mps_context * ctx, mps_polynomial * p);
199
201 mps_structure structure, mps_density density,
202 long int precision);
203
204MPS_END_DECLS
205
206#endif
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.
Definition: monomial-parser.c:28
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 -th coefficient of the polynomial.
Definition: monomial-poly.c:497
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.
Definition: monomial-poly.c:159
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.
Definition: monomial-poly.c:327
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 rationa...
Definition: monomial-poly.c:262
mps_monomial_poly * mps_monomial_poly_new(mps_context *s, long int degree)
Return a newly allocated mps_monomial_poly of the given degree.
Definition: monomial-poly.c:21
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.
Definition: monomial-poly.c:549
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 -th coefficient of the polynomial.
Definition: monomial-poly.c:458
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().
Definition: monomial-poly.c:104
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 -th coefficient of the polynomial.
Definition: monomial-poly.c:515
Header file for libmps.
Definition: approximation.h:24
this struct holds the state of the mps computation
Definition: context.h:55
Buffer used to parse input files in MPSolve. It can read a stream line by line.
Definition: input-buffer.h:33
Definition: monomial-poly.h:33
Data regarding a polynomial represented in the monomial base.
Definition: monomial-poly.h:44
rdpe_t * dpr
Dpe real coefficients.
Definition: monomial-poly.h:80
cdpe_t * dpc
Dpe complex coefficients.
Definition: monomial-poly.h:85
mpf_t * mfpr
Multiprecision real coefficients.
Definition: monomial-poly.h:90
rdpe_t * dap
Array containing moduli of the coefficients as dpe numbers.
Definition: monomial-poly.h:116
cplx_t * fppc
Array containing standard complex coefficients.
Definition: monomial-poly.h:75
long int prec
Precision of the polynomial coefficients.
Definition: monomial-poly.h:137
mpq_t * initial_mqp_r
Real part of rational input coefficients.
Definition: monomial-poly.h:121
pthread_mutex_t * mfpc_mutex
Array of mutexes that need to be locked when reading at the i-th compoenent of the poly.
Definition: monomial-poly.h:101
struct mps_polynomial methods
Implementation of the methods.
Definition: monomial-poly.h:48
mpc_t * mfppc
Multiprecision complex coefficients of .
Definition: monomial-poly.h:106
mps_boolean * spar
This array contains the structure of the sparse polynomial.
Definition: monomial-poly.h:60
mpc_t * mfpc
Multiprecision complex coefficients.
Definition: monomial-poly.h:95
double * fpr
Standard real coefficients.
Definition: monomial-poly.h:65
mpq_t * initial_mqp_i
Imaginary part of rational input coefficients.
Definition: monomial-poly.h:126
double * fap
Array containing moduli of the coefficients as double numbers.
Definition: monomial-poly.h:111
cplx_t * fpc
Standard complex coefficients.
Definition: monomial-poly.h:70
pthread_mutex_t regenerating
This mutex must be locked while regenerating the coefficients of the polynomial.
Definition: monomial-poly.h:132
Struct that represents an abstract polynomial. All the other real polynomial implementations (such as...
Definition: polynomial.h:111