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

Function Independent

deps/tesseract/classify/cluster.cpp:1646–1675  ·  view source on GitHub ↗

* This routine returns TRUE if the specified covariance * matrix indicates that all N dimensions are independent of * one another. One dimension is judged to be independent of * another when the magnitude of the corresponding correlation * coefficient is * less than the specified Independence factor. The * correlation coefficient is calculated as: (see Duda and * Hart, pg. 247) * coeff[i

Source from the content-addressed store, hash-verified

1644 * @note History: 6/4/89, DSJ, Created.
1645 */
1646BOOL8
1647Independent (PARAM_DESC ParamDesc[],
1648inT16 N, FLOAT32 * CoVariance, FLOAT32 Independence) {
1649 int i, j;
1650 FLOAT32 *VARii; // points to ith on-diagonal element
1651 FLOAT32 *VARjj; // points to jth on-diagonal element
1652 FLOAT32 CorrelationCoeff;
1653
1654 VARii = CoVariance;
1655 for (i = 0; i < N; i++, VARii += N + 1) {
1656 if (ParamDesc[i].NonEssential)
1657 continue;
1658
1659 VARjj = VARii + N + 1;
1660 CoVariance = VARii + 1;
1661 for (j = i + 1; j < N; j++, CoVariance++, VARjj += N + 1) {
1662 if (ParamDesc[j].NonEssential)
1663 continue;
1664
1665 if ((*VARii == 0.0) || (*VARjj == 0.0))
1666 CorrelationCoeff = 0.0;
1667 else
1668 CorrelationCoeff =
1669 sqrt (sqrt (*CoVariance * *CoVariance / (*VARii * *VARjj)));
1670 if (CorrelationCoeff > Independence)
1671 return (FALSE);
1672 }
1673 }
1674 return (TRUE);
1675} // Independent
1676
1677/**
1678 * This routine returns a histogram data structure which can

Callers 1

MakePrototypeFunction · 0.85

Calls 1

sqrtFunction · 0.85

Tested by

no test coverage detected