MCPcopy Create free account
hub / github.com/creatale/node-dv / NewSphericalProto

Function NewSphericalProto

deps/tesseract/classify/cluster.cpp:1505–1524  ·  view source on GitHub ↗

* This routine creates a spherical prototype data structure to * approximate the samples in the specified cluster. * Spherical prototypes have a single variance which is * common across all dimensions. All dimensions are normally * distributed and independent. * @param N number of dimensions * @param Cluster cluster to be made into a spherical prototype * @param Statistics statistical inf

Source from the content-addressed store, hash-verified

1503 * @note History: 6/19/89, DSJ, Created.
1504 */
1505PROTOTYPE *NewSphericalProto(uinT16 N,
1506 CLUSTER *Cluster,
1507 STATISTICS *Statistics) {
1508 PROTOTYPE *Proto;
1509
1510 Proto = NewSimpleProto (N, Cluster);
1511
1512 Proto->Variance.Spherical = Statistics->AvgVariance;
1513 if (Proto->Variance.Spherical < MINVARIANCE)
1514 Proto->Variance.Spherical = MINVARIANCE;
1515
1516 Proto->Magnitude.Spherical =
1517 1.0 / sqrt ((double) (2.0 * PI * Proto->Variance.Spherical));
1518 Proto->TotalMagnitude = (float)pow((double)Proto->Magnitude.Spherical,
1519 (double) N);
1520 Proto->Weight.Spherical = 1.0 / Proto->Variance.Spherical;
1521 Proto->LogMagnitude = log ((double) Proto->TotalMagnitude);
1522
1523 return (Proto);
1524} // NewSphericalProto
1525
1526/**
1527 * This routine creates an elliptical prototype data structure to

Callers 2

MakeDegenerateProtoFunction · 0.85
MakeSphericalProtoFunction · 0.85

Calls 4

NewSimpleProtoFunction · 0.85
sqrtFunction · 0.85
powFunction · 0.85
logFunction · 0.85

Tested by

no test coverage detected