MPSolve  3.2.1
cluster.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 
18 #ifndef MPS_CLUSTER_H_
19 #define MPS_CLUSTER_H_
20 
21 #define MPS_ALL_CLUSTERS -1
22 
23 #include <mps/mps.h>
24 
25 MPS_BEGIN_DECLS
26 
30 struct mps_root {
34  long int k;
35 
40 
46 };
47 
51 struct mps_cluster {
55  long int n;
56 
61 
66  pthread_mutex_t lock;
67 };
68 
77 
83 
89 
95 };
96 
104  long int n;
105 
110 };
111 
112 /*********************************************************************************
113 * FUNCTIONS *
114 *********************************************************************************/
115 
116 void mps_cluster_reset (mps_context * s);
117 void mps_fcluster (mps_context * s, double * frad, int nf);
118 void mps_dcluster (mps_context * s, rdpe_t * drad, int nf);
119 void mps_mcluster (mps_context * s, rdpe_t * drad, int nf);
120 void mps_debug_cluster_structure (mps_context * s);
121 void mps_cluster_analysis (mps_context * ctx, mps_polynomial * p);
122 
123 /* Functions for mps_cluster */
125 mps_cluster * mps_cluster_with_root (mps_context * s, long int root_index);
126 void mps_cluster_free (mps_context * s, mps_cluster * cluster);
127 mps_root * mps_cluster_insert_root (mps_context * s, mps_cluster * cluster, long int root_index);
128 void mps_cluster_remove_root (mps_context * s, mps_cluster * cluster, mps_root * root);
129 mps_cluster * mps_cluster_join (mps_context * s, mps_cluster * cluster_a, mps_cluster * cluster_b);
130 
131 /* Functions for mps_clusterization */
137 void mps_clusterization_detach_clusters (mps_context * s, mps_clusterization * c);
138 void mps_clusterization_reassemble_clusters (mps_context * s, mps_clusterization * c);
139 
140 void mps_cluster_detach (mps_context * s, mps_cluster * cluster);
141 
142 MPS_END_DECLS
143 
144 #endif /* endif MPS_CLUSTER_H_ */
void mps_mcluster(mps_context *s, rdpe_t *drad, int nf)
Perform cluster analysis to each existing cluster by applying mps_xcluster to each existing cluster.
Definition: cluster-analysis.c:535
void mps_clusterization_remove_cluster(mps_context *s, mps_clusterization *c, mps_cluster_item *cluster_item)
Remove a cluster item from a clusterization, freeing it.
Definition: cluster.c:260
void mps_cluster_reset(mps_context *s)
Reset cluster structure information contained in s. After the call to this routine the roots will be ...
Definition: cluster.c:297
void mps_dcluster(mps_context *s, rdpe_t *drad, int nf)
Perform cluster analysis to each existing cluster by applying mps_xcluster to each existing cluster.
Definition: cluster-analysis.c:271
mps_cluster * mps_cluster_empty(mps_context *s)
Get an empty mps_cluster, with no roots.
Definition: cluster.c:25
void mps_clusterization_pop_cluster(mps_context *s, mps_clusterization *c, mps_cluster_item *cluster_item)
Pop out a cluster from a clusterization.
Definition: cluster.c:237
void mps_cluster_remove_root(mps_context *s, mps_cluster *cluster, mps_root *root)
Remove a root from a cluster.
Definition: cluster.c:123
void mps_cluster_free(mps_context *s, mps_cluster *cluster)
Free a previously allocated cluster with all the roots in it.
Definition: cluster.c:67
void mps_clusterization_free(mps_context *s, mps_clusterization *c)
Free a clusterization and all the cluster in it.
Definition: cluster.c:273
mps_cluster_item * mps_clusterization_insert_cluster(mps_context *s, mps_clusterization *c, mps_cluster *cluster)
Insert a new cluster into a root clusterization.
Definition: cluster.c:205
void mps_fcluster(mps_context *s, double *frad, int nf)
Definition: cluster-analysis.c:85
mps_cluster * mps_cluster_join(mps_context *s, mps_cluster *cluster_a, mps_cluster *cluster_b)
Join two cluster in one big cluster containing the roots of both. Please note that the cluster must n...
Definition: cluster.c:153
mps_root * mps_cluster_insert_root(mps_context *s, mps_cluster *cluster, long int root_index)
Insert a root in a cluster.
Definition: cluster.c:91
mps_clusterization * mps_clusterization_empty(mps_context *s)
Create a new empty clusterization.
Definition: cluster.c:189
mps_cluster * mps_cluster_with_root(mps_context *s, long int root_index)
Create a cluster containing only the selected root.
Definition: cluster.c:43
Header file for libmps.
Cluster held in a mps_clusterization.
Definition: cluster.h:72
mps_cluster_item * detached
This pointer to the cluster from which the cluster were detached, if any. Otherwise it is set to NULL...
Definition: cluster.h:94
mps_cluster_item * next
Next cluster in the clusterization, or NULL if there is no such cluster.
Definition: cluster.h:82
mps_cluster * cluster
Pointer to the actual cluster.
Definition: cluster.h:76
mps_cluster_item * prev
Previous cluster in the clusterizaion or NULL if there is no such cluster.
Definition: cluster.h:88
A cluster of mps_roots.
Definition: cluster.h:51
mps_root * first
Pointer to the first root in the cluster.
Definition: cluster.h:60
long int n
Number of roots in the cluster.
Definition: cluster.h:55
pthread_mutex_t lock
Internal mutex used to perform operations in a thread-safe way.
Definition: cluster.h:66
A list of mps_cluster.
Definition: cluster.h:100
mps_cluster_item * first
Pointer to the first cluster in the clusterization.
Definition: cluster.h:109
long int n
Number of cluster in the clusterization.
Definition: cluster.h:104
this struct holds the state of the mps computation
Definition: context.h:55
Struct that represents an abstract polynomial. All the other real polynomial implementations (such as...
Definition: polynomial.h:111
This struct represent a root inside of a mps_cluster.
Definition: cluster.h:30
mps_root * prev
Pointer to the previous root, or NULL if there is no previous root.
Definition: cluster.h:45
mps_root * next
Next root, or NULL if this is the last root of the cluster.
Definition: cluster.h:39
long int k
Index of the root that is considered.
Definition: cluster.h:34