VTK  9.1.0
vtkKMeansDistanceFunctor.h
Go to the documentation of this file.
1#ifndef vtkKMeansDistanceFunctor_h
2#define vtkKMeansDistanceFunctor_h
3
16#include "vtkFiltersStatisticsModule.h" // For export macro
17#include "vtkObject.h"
18
19class vtkVariantArray;
21class vtkTable;
22
23class VTKFILTERSSTATISTICS_EXPORT vtkKMeansDistanceFunctor : public vtkObject
24{
25public:
28 void PrintSelf(ostream& os, vtkIndent indent) override;
29
35
40 virtual void operator()(double&, vtkVariantArray*, vtkVariantArray*);
41
50 virtual void PairwiseUpdate(vtkTable* clusterCenters, vtkIdType row, vtkVariantArray* data,
51 vtkIdType dataCardinality, vtkIdType totalCardinality);
52
62
69
73 virtual void DeallocateElementArray(void*);
74
81
87 virtual void PackElements(vtkTable* curTable, void* vElements);
88
90
95 virtual void UnPackElements(
96 vtkTable* curTable, vtkTable* newTable, void* vLocalElements, void* vGlobalElements, int np);
97 virtual void UnPackElements(
98 vtkTable* curTable, void* vLocalElements, vtkIdType numRows, vtkIdType numCols);
100
104 virtual int GetDataType();
105
106protected:
109
110 vtkVariantArray* EmptyTuple; // Used to quickly initialize Tuple for each datum
111 vtkTable*
112 CenterUpdates; // Used to hold online computation of next iteration's cluster center coords.
113
114private:
116 void operator=(const vtkKMeansDistanceFunctor&) = delete;
117};
118
119#endif // vtkKMeansDistanceFunctor_h
Abstract superclass for all arrays.
a simple class to control print indentation
Definition: vtkIndent.h:113
measure distance from k-means cluster centers
virtual void PairwiseUpdate(vtkTable *clusterCenters, vtkIdType row, vtkVariantArray *data, vtkIdType dataCardinality, vtkIdType totalCardinality)
This is called once per observation per run per iteration in order to assign the observation to its n...
virtual void UnPackElements(vtkTable *curTable, vtkTable *newTable, void *vLocalElements, void *vGlobalElements, int np)
Unpack the cluster center coordinates in vElements into columns of curTable.
virtual int GetDataType()
Return the data type used to store cluster center coordinates.
virtual void UnPackElements(vtkTable *curTable, void *vLocalElements, vtkIdType numRows, vtkIdType numCols)
Unpack the cluster center coordinates in vElements into columns of curTable.
virtual void operator()(double &, vtkVariantArray *, vtkVariantArray *)
Compute the distance from one observation to another, returning the distance in the first argument.
virtual vtkAbstractArray * CreateCoordinateArray()
Return a vtkAbstractArray capable of holding cluster center coordinates.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual void PackElements(vtkTable *curTable, void *vElements)
Pack the cluster center coordinates in vElements into columns of curTable.
virtual void * AllocateElementArray(vtkIdType size)
Allocate an array large enough to hold size coordinates and return a void pointer to this array.
virtual vtkVariantArray * GetEmptyTuple(vtkIdType dimension)
Return an empty tuple.
~vtkKMeansDistanceFunctor() override
virtual void DeallocateElementArray(void *)
Free an array allocated with AllocateElementArray.
virtual void PerturbElement(vtkTable *, vtkTable *, vtkIdType, vtkIdType, vtkIdType, double)
When a cluster center (1) has no observations that are closer to it than other cluster centers or (2)...
static vtkKMeansDistanceFunctor * New()
abstract base class for most VTK objects
Definition: vtkObject.h:73
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:172
An array holding vtkVariants.
@ size
Definition: vtkX3D.h:259
@ data
Definition: vtkX3D.h:321
int vtkIdType
Definition: vtkType.h:332