GRASS GIS 8 Programmer's Manual  8.2.2dev(2023)-3d2c704037
defs/cluster.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int I_cluster_assign (struct Cluster *, int *)
 Assign cluster. More...
 
int I_cluster_begin (struct Cluster *, int)
 Initialize the cluster routines for nbands. More...
 
int I_cluster_clear (struct Cluster *)
 Clear Cluster structure. More...
 
int I_cluster_distinct (struct Cluster *, double)
 Get distinct value. More...
 
int I_cluster_exec (struct Cluster *, int, int, double, double, int, int(*)(), int *)
 
int I_cluster_exec_allocate (struct Cluster *)
 Allocate Cluster structure. More...
 
int I_cluster_exec_free (struct Cluster *)
 Free allocated Cluster structure. More...
 
int I_cluster_means (struct Cluster *)
 Calculate means value. More...
 
int I_cluster_merge (struct Cluster *)
 ? More...
 
int I_cluster_nclasses (struct Cluster *, int)
 Get number of classes. More...
 
int I_cluster_point (struct Cluster *, DCELL *)
 Adds the point x to the list of data points to be "clustered". More...
 
int I_cluster_begin_point_set (struct Cluster *, int)
 Begin point set. More...
 
int I_cluster_point_part (struct Cluster *, DCELL, int, int)
 ? More...
 
int I_cluster_end_point_set (struct Cluster *, int)
 ? More...
 
int I_cluster_reassign (struct Cluster *, int *)
 ? More...
 
int I_cluster_reclass (struct Cluster *, int)
 Reclass data. More...
 
double I_cluster_separation (struct Cluster *, int, int)
 ? More...
 
int I_cluster_signatures (struct Cluster *)
 Create signatures. More...
 
int I_cluster_sum2 (struct Cluster *)
 Compute sum of squares for each class. More...
 

Function Documentation

◆ I_cluster_assign()

int I_cluster_assign ( struct Cluster C,
int *  interrupted 
)

Assign cluster.

Parameters
Cpointer to Cluster structure
interrupted?
Returns
-1 on interrupted
0 on success

Definition at line 26 of file c_assign.c.

Referenced by I_cluster_exec().

◆ I_cluster_begin()

int I_cluster_begin ( struct Cluster C,
int  nbands 
)

Initialize the cluster routines for nbands.

Parameters
Cpointer to Cluster structure
nbandsnumber of bands
Returns
0 ok
-1 out of memory
1 illegal number of bands

Definition at line 28 of file c_begin.c.

References _, Cluster::band_sum, Cluster::band_sum2, free(), I_free_signatures(), I_init_signatures(), malloc(), Cluster::nbands, Cluster::np, Cluster::npoints, NULL, Cluster::points, Cluster::S, and Signature::title.

◆ I_cluster_begin_point_set()

int I_cluster_begin_point_set ( struct Cluster C,
int  n 
)

Begin point set.

Parameters
Cpointer to Cluster structure
n?
Returns
0 on success
-1 on error

Definition at line 71 of file c_point.c.

◆ I_cluster_clear()

int I_cluster_clear ( struct Cluster C)

◆ I_cluster_distinct()

int I_cluster_distinct ( struct Cluster C,
double  separation 
)

Get distinct value.

Parameters
Cpointer to Cluster structure
separationseparation value
Returns
distinction value

Definition at line 24 of file c_distinct.c.

References Cluster::count, I_cluster_separation(), I_cluster_sum2(), Cluster::merge1, Cluster::merge2, and Cluster::nclasses.

Referenced by I_cluster_exec().

◆ I_cluster_end_point_set()

int I_cluster_end_point_set ( struct Cluster C,
int  n 
)

?

Parameters
Cpointer to Cluster structure
n?
Returns
number of points

Definition at line 109 of file c_point.c.

◆ I_cluster_exec()

int I_cluster_exec ( struct Cluster C,
int  maxclass,
int  iterations,
double  convergence,
double  separation,
int  min_class_size,
int(*)()  checkpoint,
int *  interrupted 
)
Parameters
Cpointer to Cluster structure
maxclassmaximum number of classes
iterationsmaximum number of iterations
convergencepercentage of points stable
separationminimum distance between class centroids
min_class_sizeminimum size of class
checkpointroutine to be called at various steps
interruptedboolean to check for interrupt
Returns
0 ok
-1 out of memory
-2 interrupted
1 not enough data points

Definition at line 32 of file c_exec.c.

References _, G_warning(), I_cluster_assign(), I_cluster_distinct(), I_cluster_exec_allocate(), I_cluster_means(), I_cluster_merge(), I_cluster_reassign(), I_cluster_reclass(), I_cluster_signatures(), I_cluster_sum2(), if(), Cluster::nclasses, and Cluster::npoints.

◆ I_cluster_exec_allocate()

int I_cluster_exec_allocate ( struct Cluster C)

◆ I_cluster_exec_free()

int I_cluster_exec_free ( struct Cluster C)

Free allocated Cluster structure.

Parameters
Cpointer to Cluster structure
Returns
0

Definition at line 54 of file c_execmem.c.

References Cluster::class, Cluster::count, Cluster::countdiff, I_free(), I_free_double2(), Cluster::mean, NULL, Cluster::reclass, Cluster::sum, Cluster::sum2, and Cluster::sumdiff.

Referenced by I_cluster_exec_allocate().

◆ I_cluster_means()

int I_cluster_means ( struct Cluster C)

Calculate means value.

Parameters
Cpointer to Cluster structure
Returns
0

Definition at line 24 of file c_means.c.

Referenced by I_cluster_exec().

◆ I_cluster_merge()

int I_cluster_merge ( struct Cluster C)

?

Parameters
Cpointer to Cluster structure
Returns
0

Definition at line 23 of file c_merge.c.

References Cluster::class, Cluster::count, Cluster::merge1, Cluster::merge2, Cluster::nbands, Cluster::npoints, and Cluster::sum.

Referenced by I_cluster_exec().

◆ I_cluster_nclasses()

int I_cluster_nclasses ( struct Cluster C,
int  minsize 
)

Get number of classes.

Parameters
Cpointer to Cluster structure
minsizeminimum class size
Returns
number of classes

Definition at line 24 of file c_nclasses.c.

References Cluster::count, and Cluster::nclasses.

◆ I_cluster_point()

int I_cluster_point ( struct Cluster C,
DCELL x 
)

Adds the point x to the list of data points to be "clustered".

The dimension of x must agree with the number of bands specified in the initializing call to I_cluster_begin()

Note: if all values in x are zero, the point is rejected

Returns
0 ok
-1 out of memory, point not added
1 all values are null, point not added

Definition at line 32 of file c_point.c.

References Cluster::nbands, and Rast_is_d_null_value.

◆ I_cluster_point_part()

int I_cluster_point_part ( struct Cluster C,
DCELL  x,
int  band,
int  n 
)

?

Parameters
Cpointer to Cluster structure
xcell value
bandband number
n?
Returns
0 ok
-1 out of memory, point not added
1 all values are null, point not added

Definition at line 88 of file c_point.c.

◆ I_cluster_reassign()

int I_cluster_reassign ( struct Cluster C,
int *  interrupted 
)

?

Parameters
Cpointer to Cluster structure
interrupted
Returns
number of changes

Definition at line 25 of file c_reassign.c.

References min.

Referenced by I_cluster_exec().

◆ I_cluster_reclass()

int I_cluster_reclass ( struct Cluster C,
int  minsize 
)

Reclass data.

Parameters
Cpointer to Cluster structure
minsizeminimum class size
Returns
0 on success
1 no change

Definition at line 25 of file c_reclass.c.

Referenced by I_cluster_exec().

◆ I_cluster_separation()

double I_cluster_separation ( struct Cluster C,
int  class1,
int  class2 
)

?

Parameters
Cpointer to Cluster structure
class11st class
class22nd class

Definition at line 26 of file c_sep.c.

Referenced by I_cluster_distinct().

◆ I_cluster_signatures()

int I_cluster_signatures ( struct Cluster C)

Create signatures.

Parameters
Cpointer to Cluster structure
Returns
0

Definition at line 23 of file c_sig.c.

Referenced by I_cluster_exec().

◆ I_cluster_sum2()

int I_cluster_sum2 ( struct Cluster C)

Compute sum of squares for each class.

Parameters
Cpointer to Cluster structure
Returns
0

Definition at line 23 of file c_sum2.c.

References G_debug(), Cluster::nbands, Cluster::nclasses, Cluster::npoints, Cluster::points, and Cluster::sum2.

Referenced by I_cluster_distinct(), and I_cluster_exec().