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 /**
12  * @file
13  *
14  * @brief Representation of a single approximation.
15  */
16 
17 #ifndef MPS_APPROXIMATION_H_
18 #define MPS_APPROXIMATION_H_
19 
20 MPS_BEGIN_DECLS
21 
22 #ifdef _MPS_PRIVATE
23 
24 struct mps_approximation {
25   cplx_t fvalue;
26   cdpe_t dvalue;
27   mpc_t mvalue;
28 
29   double frad;
30   rdpe_t drad;
31 
32   mps_boolean approximated;
33   mps_boolean again;
34   long int wp;
35 
36   mps_root_status status;
37 
38   /**
39    * @brief Attributes that have been set on
40    * the roots.
41    */
42   mps_root_attrs attrs;
43 
44   /**
45    * @brief Inclusion status of the root
46    * in the target set specified in the field
47    * <code>input_config->search_set</code>.
48    */
49   mps_root_inclusion inclusion;
50 };
51 
52 #endif
53 
54 /* Creation and deletion of approximations. */
55 mps_approximation * mps_approximation_new (mps_context * s);
56 void mps_approximation_free (mps_context * s, mps_approximation * appr);
57 mps_approximation * mps_approximation_copy (mps_context * ctx, mps_approximation * original);
58 
59 
60 /* Public accessor functions */
61 void mps_approximation_get_fvalue (mps_context * ctx, mps_approximation * approximation, cplx_t output);
62 void mps_approximation_get_dvalue (mps_context * ctx, mps_approximation * approximation, cdpe_t output);
63 void mps_approximation_get_mvalue (mps_context * ctx, mps_approximation * approximation, mpc_t output);
64 double mps_approximation_get_frad (mps_context * ctx, mps_approximation * approximation);
65 void mps_approximation_get_drad (mps_context * ctx, mps_approximation * approximation, rdpe_t output);
66 mps_root_status mps_approximation_get_status (mps_context * ctx, mps_approximation * approximation);
67 mps_root_attrs mps_approximation_get_attrs (mps_context * ctx, mps_approximation * approximation);
68 mps_root_inclusion mps_approximaiton_get_inclusion (mps_context * ctx, mps_approximation * approximation);
69 mps_boolean mps_approximation_get_again (mps_context * ctx, mps_approximation * approximation);
70 
71 /* Public setters functions */
72 void mps_approximation_set_fvalue (mps_context * ctx, mps_approximation * approximation, const cplx_t value);
73 void mps_approximation_set_dvalue (mps_context * ctx, mps_approximation * approximation, const cdpe_t value);
74 void mps_approximation_set_mvalue (mps_context * ctx, mps_approximation * approximation, const mpc_t value);
75 void mps_approximation_set_frad (mps_context * ctx, mps_approximation * approximation, const double frad);
76 void mps_approximation_set_drad (mps_context * ctx, mps_approximation * approximation, const rdpe_t drad);
77 void mps_approximation_set_status (mps_context * ctx, mps_approximation * approximation, const mps_root_status status);
78 void mps_approximation_set_attrs (mps_context * ctx, mps_approximation * approximation, const mps_root_attrs attrs);
79 void mps_approximation_set_inclusion (mps_context * ctx, mps_approximation * approximation, const mps_root_inclusion inclusion);
80 void mps_approximation_set_again (mps_context * ctx, mps_approximation * approximation, const mps_boolean again);
81 
82 MPS_END_DECLS
83 
84 #endif /* #ifndef MPS_ROOT_H */
85