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

Method SparseToCompact

deps/tesseract/ccutil/indexmapbidi.cpp:27–30  ·  view source on GitHub ↗

SparseToCompact takes a sparse index to an index in the compact space. Uses a binary search to find the result. For faster speed use IndexMapBiDi, but that takes more memory.

Source from the content-addressed store, hash-verified

25// Uses a binary search to find the result. For faster speed use
26// IndexMapBiDi, but that takes more memory.
27int IndexMap::SparseToCompact(int sparse_index) const {
28 int result = compact_map_.binary_search(sparse_index);
29 return compact_map_[result] == sparse_index ? result : -1;
30}
31
32// Copy from the input.
33void IndexMap::CopyFrom(const IndexMap& src) {

Callers 13

GetCompactClassIDMethod · 0.45
NextMethod · 0.45
MapFeatureMethod · 0.45
MapIndexFeatureMethod · 0.45
NumClassSamplesMethod · 0.45
GetSampleMethod · 0.45
MutableSampleMethod · 0.45
ClusterDistanceMethod · 0.45
GlobalSampleIndexMethod · 0.45
GetCanonicalSampleMethod · 0.45
GetCanonicalDistMethod · 0.45

Calls 1

binary_searchMethod · 0.80

Tested by

no test coverage detected