MPSolve 3.2.1
|
Header file for secular-related routines. More...
Go to the source code of this file.
Classes | |
struct | mps_secular_equation_double_buffer |
struct | mps_secular_equation |
Secular equation data. More... | |
struct | mps_secular_iteration_data |
This is a struct that represent an iteration on a root. It contains information that could be useful for mps_secular_*iterate() routine to determine some error bound and provide a method for the routine to communicate if it was able to set the radius or not (by setting the radius_set in the right way). More... | |
Macros | |
#define | MPS_SECULAR_EQUATION(t) (MPS_POLYNOMIAL_CAST (mps_secular_equation, t)) |
#define | MPS_IS_SECULAR_EQUATION(t) (mps_polynomial_check_type (t, "mps_secular_equation")) |
#define | MPS_SECULAR_STARTING_MP_PRECISION 128 |
This is the number of bits used when first passed in multiprecision. | |
#define | MPS_SECULAR_EQUIVALENT_FP_PRECISION (MPS_SECULAR_STARTING_MP_PRECISION / 2) |
This is the higher precision supported by GMP that is lower than the precision supported by the standard floating point machinery. It is used to set an "equivalent" precision in s->mpwp for the step of multiprecision coefficient regeneration. | |
#define | mps_secular_equation_from_status(s) (mps_secular_equation*)(s)->secular_equation |
Functions | |
void | mps_secular_fnewton (mps_context *st, mps_polynomial *p, mps_approximation *root, cplx_t corr) |
void | mps_secular_dnewton (mps_context *st, mps_polynomial *p, mps_approximation *root, cdpe_t corr) |
void | mps_secular_mnewton (mps_context *st, mps_polynomial *p, mps_approximation *root, mpc_t corr, long int wp) |
mps_boolean | mps_secular_ga_regenerate_coefficients (mps_context *s) |
Regenerate ![]() ![]() ![]() ![]() | |
void | mps_secular_deflate (mps_context *s, mps_secular_equation *sec) |
Deflate a secular equation lowering the degree of the polynomial that represent it, if that is possible. More... | |
void | mps_secular_check_data (mps_context *s, char *which_case) |
Secular version of mps_check_data () that does nothing except to set the starting case according to sec->starting_case . More... | |
void | mps_secular_restart (mps_context *s) |
void | mps_secular_switch_phase (mps_context *s, mps_phase phase) |
Prepare data for the iteration in the new phase specified in the second parameter. More... | |
long int | mps_secular_raise_coefficient_precision (mps_context *s, mps_polynomial *p, long int wp) |
Raise precision of the coefficient of the secular equation (not the roots and neither the precison of the system) to wp . More... | |
void | mps_secular_raise_precision (mps_context *s, int wp) |
Raise (or lower) the precision of the coefficients to wp bits. This will change precision of the coefficients via mps_secular_raise_coefficient_precision () , of the roots via mps_secular_raise_root_precision () and set s->mpwp . More... | |
void | mps_secular_raise_root_precision (mps_context *s, int wp) |
Raise precision of the roots (not the coefficients nor the system) to wp bits. More... | |
void | mps_secular_fstart (mps_context *s, mps_secular_equation *sec, mps_approximation **approximations) |
Compute some sensible starting points for the given secular equation (floating point version). More... | |
void | mps_secular_dstart (mps_context *s, mps_secular_equation *sec, mps_approximation **approximations) |
Compute some sensible starting points for the given secular equation (DPE version). More... | |
void | mps_secular_mstart (mps_context *s, mps_secular_equation *sec, mps_approximation **approximations) |
Compute some sensible starting points for the given secular equation (MP version). More... | |
int | mps_secular_ga_fiterate (mps_context *s, int maxit, mps_boolean just_regenerated) |
Routine that performs a block of iteration in floating point on the secular equation. More... | |
int | mps_secular_ga_diterate (mps_context *s, int maxit, mps_boolean just_regenerated) |
Routine that performs a block of iteration in floating point on the secular equation using CDPE. More... | |
int | mps_secular_ga_miterate (mps_context *s, int maxit, mps_boolean just_regenerated) |
Routine that performs a block of iteration in floating point on the secular equation using CDPE. More... | |
mps_boolean | mps_secular_ga_check_stop (mps_context *s) |
Check if iterations can terminate, i.e. if newton isolation has been reached, if the target was approximate. If the target was approximation then mps_secular_improve () should be used to reach the required precision. More... | |
void | mps_secular_ga_update_coefficients (mps_context *s) |
Update all the coefficients of the secular equation, and their moduli, using the recomputed one stored in the multiprecision version. More... | |
mps_secular_equation * | mps_secular_equation_new (mps_context *s, cplx_t *afpc, cplx_t *bfpc, unsigned long int n) |
Create a new secular equation struct. More... | |
mps_secular_equation * | mps_secular_equation_new_raw (mps_context *s, unsigned long int n) |
Raw version of mps_secular_equation_new that only allocate space for the coefficients but relies on the user to fill their values. More... | |
void | mps_secular_equation_set_coefficient_f (mps_context *ctx, mps_secular_equation *p, int i, mpc_t a, mpc_t b) |
Sets a coefficient of a secular equation. More... | |
void | mps_secular_equation_set_coefficient_q (mps_context *ctx, mps_secular_equation *p, int i, mpq_t ar, mpq_t ai, mpq_t br, mpq_t bi) |
Sets a coefficient of a secular equation. More... | |
void | mps_secular_equation_free (mps_context *ctx, mps_polynomial *p) |
Free a secular equation and the data in it. More... | |
void | mps_secular_set_radii (mps_context *s) |
Update radii of the roots according to the coefficients of the secular equation in this moment, if they are better of the radii present now. More... | |
mps_boolean | mps_secular_poly_feval_with_error (mps_context *ctx, mps_polynomial *p, cplx_t x, cplx_t value, double *error) |
mps_boolean | mps_secular_poly_deval_with_error (mps_context *ctx, mps_polynomial *p, cdpe_t x, cdpe_t value, rdpe_t error) |
mps_boolean | mps_secular_poly_meval_with_error (mps_context *ctx, mps_polynomial *p, mpc_t x, mpc_t value, rdpe_t error) |
void | mps_secular_poly_fstart (mps_context *ctx, mps_polynomial *p, mps_approximation **approximations) |
void | mps_secular_poly_dstart (mps_context *ctx, mps_polynomial *p, mps_approximation **approximations) |
void | mps_secular_poly_mstart (mps_context *ctx, mps_polynomial *p, mps_approximation **approximations) |
mps_secular_equation * | mps_secular_equation_read_from_stream (mps_context *ctx, 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_secular_equation. More... | |
Header file for secular-related routines.
void mps_secular_check_data | ( | mps_context * | s, |
char * | which_case | ||
) |
Secular version of mps_check_data ()
that does nothing except to set the starting case according to sec->starting_case
.
s | The current mps_context. |
which_case | Pointer to a char that will be set to 'f' or 'd' depending on the chosen start phase. |
void mps_secular_deflate | ( | mps_context * | s, |
mps_secular_equation * | sec | ||
) |
Deflate a secular equation lowering the degree of the polynomial that represent it, if that is possible.
Please note the s->n
and s->deg
will not be touched by this routine, so you should check that they are set according to MPS_POLYNOMIAL (sec)->degree
if deflation takes place.
mps_context_set_degree ()
s | The mps_context of the computation |
sec | The secular equation that will be deflated. |
void mps_secular_dstart | ( | mps_context * | s, |
mps_secular_equation * | sec, | ||
mps_approximation ** | approximations | ||
) |
Compute some sensible starting points for the given secular equation (DPE version).
s | The current mps_context. |
sec | The secular equation for which the starting points shall be computed. |
void mps_secular_equation_free | ( | mps_context * | ctx, |
mps_polynomial * | p | ||
) |
Free a secular equation and the data in it.
ctx | The current context. |
p | The secular equation casted to a mps_polynomial |
mps_secular_equation * mps_secular_equation_new | ( | mps_context * | s, |
cplx_t * | afpc, | ||
cplx_t * | bfpc, | ||
unsigned long int | n | ||
) |
Create a new secular equation struct.
s | The mps_context of the computation. |
afpc | The floating point complex numerator coefficients. |
bfpc | The floating point complex denominator coefficients. |
n | The degree of the secular equation. |
mps_secular_equation * mps_secular_equation_new_raw | ( | mps_context * | s, |
unsigned long int | n | ||
) |
Raw version of mps_secular_equation_new that only allocate space for the coefficients but relies on the user to fill their values.
s | The mps_context of the computation. |
n | The degree of the new secular equation to be created. |
mps_secular_equation * mps_secular_equation_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_secular_equation.
s | The current mps_context |
buffer | The buffer that needs to be parsed |
The | structure of the secular equation |
The | density configuration of the secular equation |
The | input precision of the coefficients, if specified, 0 otherwise |
void mps_secular_equation_set_coefficient_f | ( | mps_context * | ctx, |
mps_secular_equation * | p, | ||
int | i, | ||
mpc_t | a, | ||
mpc_t | b | ||
) |
Sets a coefficient of a secular equation.
ctx | The current context. |
p | The secular equation whose coefficient should be set. |
i | The index of the coefficient to set. |
a | The numerator of the coefficient. |
b | The zero of the denominator. |
The new coefficient will have the form a / (x - b).
void mps_secular_equation_set_coefficient_q | ( | mps_context * | ctx, |
mps_secular_equation * | p, | ||
int | i, | ||
mpq_t | ar, | ||
mpq_t | ai, | ||
mpq_t | br, | ||
mpq_t | bi | ||
) |
Sets a coefficient of a secular equation.
ctx | The current context. |
p | The secular equation whose coefficient should be set. |
i | The index of the coefficient to set. |
a | The numerator of the coefficient. |
b | The zero of the denominator. |
The new coefficient will have the form a / (x - b).
void mps_secular_fstart | ( | mps_context * | s, |
mps_secular_equation * | sec, | ||
mps_approximation ** | approximations | ||
) |
Compute some sensible starting points for the given secular equation (floating point version).
s | The current mps_context. |
sec | The secular equation for which the starting points shall be computed. |
mps_boolean mps_secular_ga_check_stop | ( | mps_context * | s | ) |
Check if iterations can terminate, i.e. if newton isolation has been reached, if the target was approximate. If the target was approximation then mps_secular_improve ()
should be used to reach the required precision.
s | The mps_context of the computation. |
int mps_secular_ga_diterate | ( | mps_context * | s, |
int | maxit, | ||
mps_boolean | just_regenerated | ||
) |
Routine that performs a block of iteration in floating point on the secular equation using CDPE.
s | the pointer to the mps_context struct. |
maxit | Maximum number of iteration to perform. |
just_regenerated | true if this is the first iteration after a coefficient regeneration. If just_regenerated is true and the iteration packet is completed in less than 2 * (n - computed_roots) iterations that best_approx is set to true in s->secular_equation so a raise in the precision will be triggered. |
int mps_secular_ga_fiterate | ( | mps_context * | s, |
int | maxit, | ||
mps_boolean | just_regenerated | ||
) |
Routine that performs a block of iteration in floating point on the secular equation.
s | the pointer to the mps_context struct. |
maxit | Maximum number of iteration to perform. |
just_regenerated | true if this is the first iteration after a coefficient regeneration. If just_regenerated is true and the iteration packet is completed in less than 2 * (n - computed_roots) iterations that best_approx is set to true in s->secular_equation so a raise in the precision will be triggered. |
int mps_secular_ga_miterate | ( | mps_context * | s, |
int | maxit, | ||
mps_boolean | just_regenerated | ||
) |
Routine that performs a block of iteration in floating point on the secular equation using CDPE.
s | the pointer to the mps_context struct. |
maxit | Maximum number of iteration to perform. |
just_regenerated | true if this is the first iteration after a coefficient regeneration. If just_regenerated is true and the iteration packet is completed in less than 2 * (n - computed_roots) iterations that best_approx is set to true in s->secular_equation so a raise in the precision will be triggered. |
mps_boolean mps_secular_ga_regenerate_coefficients | ( | mps_context * | s | ) |
Regenerate
s | The mps_context of the computation. |
void mps_secular_ga_update_coefficients | ( | mps_context * | s | ) |
Update all the coefficients of the secular equation, and their moduli, using the recomputed one stored in the multiprecision version.
s | The mps_context of the computation. |
void mps_secular_mstart | ( | mps_context * | s, |
mps_secular_equation * | sec, | ||
mps_approximation ** | approximations | ||
) |
Compute some sensible starting points for the given secular equation (MP version).
s | The current mps_context. |
sec | The secular equation for which the starting points shall be computed. |
long int mps_secular_raise_coefficient_precision | ( | mps_context * | s, |
mps_polynomial * | p, | ||
long int | wp | ||
) |
Raise precision of the coefficient of the secular equation (not the roots and neither the precison of the system) to wp
.
s | The mps_context of the computation. |
p | The secular equation casted to a mps_polynomial. |
wp | The bits of precision to which the coefficients will be set. |
mps_secular_raise_root_precision ()
mps_secular_raise_precision ()
void mps_secular_raise_precision | ( | mps_context * | s, |
int | wp | ||
) |
Raise (or lower) the precision of the coefficients to wp
bits. This will change precision of the coefficients via mps_secular_raise_coefficient_precision ()
, of the roots via mps_secular_raise_root_precision ()
and set s->mpwp
.
s | The mps_context of the computation. |
wp | The bits of precision to which all the computation will be brought. |
void mps_secular_raise_root_precision | ( | mps_context * | s, |
int | wp | ||
) |
Raise precision of the roots (not the coefficients nor the system) to wp
bits.
s | The mps_context of the computation. |
wp | The bits of precision to which the roots will be set. |
mps_secular_raise_coefficient_precision ()
mps_secular_raise_precision ()
void mps_secular_set_radii | ( | mps_context * | s | ) |
Update radii of the roots according to the coefficients of the secular equation in this moment, if they are better of the radii present now.
s | The mps_context of the computation. |
void mps_secular_switch_phase | ( | mps_context * | s, |
mps_phase | phase | ||
) |
Prepare data for the iteration in the new phase specified in the second parameter.
Note that for now this function is only able to handle switch from floating point phases (i.e. float_phase or dpe_phase) to multiprecision, and not coming back.
s | The mps_context of the computation. |
phase | The phase to switch the computation to. |