MCPcopy Create free account
hub / github.com/LBANN/lbann / commify

Function commify

src/utils/commify.cpp:34–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32namespace utils {
33
34std::string commify(size_t n)
35{
36 std::string s = std::to_string(n);
37 std::stringstream s2;
38 int c = 0;
39 for (int j = (int)s.size() - 1; j >= 0; j--) {
40 s2 << s[j];
41 ++c;
42 if (c == 3) {
43 if (j > 0) {
44 s2 << ",";
45 c = 0;
46 }
47 }
48 }
49 std::string r = s2.str();
50 std::reverse(r.begin(), r.end());
51 return r;
52}
53
54} // namespace utils
55} // namespace lbann

Callers 8

mainFunction · 0.85
mainFunction · 0.85
fillin_shared_imagesMethod · 0.85
test_imagenet_nodeMethod · 0.85
do_preload_data_storeMethod · 0.85
do_preload_data_storeMethod · 0.85
print_statisticsMethod · 0.85

Calls 4

beginMethod · 0.80
endMethod · 0.80
to_stringFunction · 0.70
sizeMethod · 0.45

Tested by 1

test_imagenet_nodeMethod · 0.68