MPSolve 3.2.1
Loading...
Searching...
No Matches
cluster.h File Reference

Data structures for cluster analysis and some accessors and internal functions. More...

#include <mps/mps.h>

Go to the source code of this file.

Classes

struct  mps_root
 This struct represent a root inside of a mps_cluster. More...
 
struct  mps_cluster
 A cluster of mps_roots. More...
 
struct  mps_cluster_item
 Cluster held in a mps_clusterization. More...
 
struct  mps_clusterization
 A list of mps_cluster. More...
 

Macros

#define MPS_ALL_CLUSTERS   -1
 

Functions

void mps_cluster_reset (mps_context *s)
 Reset cluster structure information contained in s. After the call to this routine the roots will be considered as a unique big cluster, discarding every information present before. More...
 
void mps_fcluster (mps_context *s, double *frad, int nf)
 
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. More...
 
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. More...
 
void mps_debug_cluster_structure (mps_context *s)
 
void mps_cluster_analysis (mps_context *ctx, mps_polynomial *p)
 
mps_clustermps_cluster_empty (mps_context *s)
 Get an empty mps_cluster, with no roots. More...
 
mps_clustermps_cluster_with_root (mps_context *s, long int root_index)
 Create a cluster containing only the selected root. More...
 
void mps_cluster_free (mps_context *s, mps_cluster *cluster)
 Free a previously allocated cluster with all the roots in it. More...
 
mps_rootmps_cluster_insert_root (mps_context *s, mps_cluster *cluster, long int root_index)
 Insert a root in a cluster. More...
 
void mps_cluster_remove_root (mps_context *s, mps_cluster *cluster, mps_root *root)
 Remove a root from a cluster. More...
 
mps_clustermps_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 not overlap. More...
 
mps_clusterizationmps_clusterization_empty (mps_context *s)
 Create a new empty clusterization. More...
 
mps_cluster_itemmps_clusterization_insert_cluster (mps_context *s, mps_clusterization *c, mps_cluster *cluster)
 Insert a new cluster into a root clusterization. More...
 
void mps_clusterization_pop_cluster (mps_context *s, mps_clusterization *c, mps_cluster_item *cluster_item)
 Pop out a cluster from a clusterization. More...
 
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. More...
 
void mps_clusterization_free (mps_context *s, mps_clusterization *c)
 Free a clusterization and all the cluster in it. More...
 
void mps_clusterization_detach_clusters (mps_context *s, mps_clusterization *c)
 
void mps_clusterization_reassemble_clusters (mps_context *s, mps_clusterization *c)
 
void mps_cluster_detach (mps_context *s, mps_cluster *cluster)
 

Detailed Description

Data structures for cluster analysis and some accessors and internal functions.

Function Documentation

◆ mps_cluster_empty()

mps_cluster * mps_cluster_empty ( mps_context s)

Get an empty mps_cluster, with no roots.

Parameters
sThe mps_context of the current computation.

◆ mps_cluster_free()

void mps_cluster_free ( mps_context s,
mps_cluster cluster 
)

Free a previously allocated cluster with all the roots in it.

Parameters
sThe mps_context of the current computation.
clusterThe cluster to free.

◆ mps_cluster_insert_root()

mps_root * mps_cluster_insert_root ( mps_context s,
mps_cluster cluster,
long int  root_index 
)

Insert a root in a cluster.

Parameters
sThe mps_context of the current computation.
clusterThe cluster in which the root must be inserted.
root_indexThe index of the root to insert.

◆ mps_cluster_join()

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 not overlap.

Parameters
sThe mps_context of the current computation.
cluster_aThe first cluster
cluster_bThe second cluster
Returns
A new cluster containing the roots of both.

◆ mps_cluster_remove_root()

void mps_cluster_remove_root ( mps_context s,
mps_cluster cluster,
mps_root root 
)

Remove a root from a cluster.

Parameters
sThe mps_context of the current computation.
clusterThe cluster from which the root must be removed.
rootThe root to remove.

Please note the the root specified must be in the cluster, otherwise an assertion error or segmentation fault will be triggered.

◆ mps_cluster_reset()

void mps_cluster_reset ( mps_context s)

Reset cluster structure information contained in s. After the call to this routine the roots will be considered as a unique big cluster, discarding every information present before.

Parameters
sthe mps_context pointer.

◆ mps_cluster_with_root()

mps_cluster * mps_cluster_with_root ( mps_context s,
long int  root_index 
)

Create a cluster containing only the selected root.

Parameters
sThe mps_context of the current computation.
root_indexThe root that must be in the cluster.

◆ mps_clusterization_empty()

mps_clusterization * mps_clusterization_empty ( mps_context s)

Create a new empty clusterization.

Parameters
sThe mps_context of the current computation.

◆ mps_clusterization_free()

void mps_clusterization_free ( mps_context s,
mps_clusterization c 
)

Free a clusterization and all the cluster in it.

Parameters
sThe mps_context of the current computation.
cThe clusterization to free.

◆ mps_clusterization_insert_cluster()

mps_cluster_item * mps_clusterization_insert_cluster ( mps_context s,
mps_clusterization c,
mps_cluster cluster 
)

Insert a new cluster into a root clusterization.

Parameters
sThe mps_context of the current computation.
cThe clusterization in which the cluster should be inserted.
clusterThe cluster that should be inserted.

◆ mps_clusterization_pop_cluster()

void mps_clusterization_pop_cluster ( mps_context s,
mps_clusterization c,
mps_cluster_item cluster_item 
)

Pop out a cluster from a clusterization.

Parameters
sThe mps_context of the current computation.
cThe clusterization from which the cluster_item should be popped.
cluster_itemThe cluster item to remove.

◆ mps_clusterization_remove_cluster()

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.

Parameters
sThe mps_context of the current computation.
cThe clusterization from where the cluster_item should be removed.
cluster_itemThe cluster item to remove.

◆ mps_dcluster()

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.

Rebuild the vectors s->clust, s->punt, and the integer s->nclust.

◆ mps_fcluster()

void mps_fcluster ( mps_context s,
double *  frad,
int  nf 
)

This subroutine makes cluster analysis, i.e., detects overlapping disks, where two disks overlap if the distances of their centers is less than the sum of their radii multiplied by nf.

Observe that $nf=1$ then this concept corresponds to overlapping, if $nf =2 \cdot n$, this concept corresponds to Newton isolation.

This routine set the vector clust so that it contains the indices of the disks in each overlapping group, while punt[i] points to the index of clust where the i-th group starts. Moreover m_clust[i] contains the multiplicity of the i-th cluster. nclust is the number of clusters.

Parameters
sThe mps_context associated with the current computaion.
fradThe vector of radii to use for cluster analysis.
nfsee above for a detailed description.

◆ mps_mcluster()

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.

Rebuild the vectors s->clust, s->punt, and the integer s->nclust.

See also
mps_xcluster