10 #include "../lib/args.h" 11 #include "../lib/misc.h" 17 int main(
int argc,
const char* argv[]) {
18 get_args(argc, argv,
"depths1.json depths2.json [depths.txt]");
24 std::set<std::string> common_features;
25 for(
const auto& kv : depths1) {
26 const std::string& feature_name = kv.first;
27 if(depths2.find(feature_name) != depths2.end()) common_features.insert(feature_name);
29 std::cout <<
"depths1 count: " << depths1.size() << std::endl;
30 std::cout <<
"depths2 count: " << depths2.size() << std::endl;
31 std::cout <<
"common count: " << common_features.size() << std::endl;
35 for(
const std::string& feature_name : common_features) {
36 real d1 = depths1.at(feature_name);
37 real d2 = depths2.at(feature_name);
38 rms_error +=
sq(d1 - d2);
40 rms_error = std::sqrt(rms_error / common_features.size());
41 std::cout <<
"rms_error: " << rms_error << std::endl;
44 if(! out_depths_filename.empty()) {
45 std::ofstream stream(out_depths_filename);
46 stream << std::setprecision(10);
47 for(
const std::string& feature_name : common_features) {
48 real d1 = depths1.at(feature_name);
49 real d2 = depths2.at(feature_name);
50 stream << feature_name <<
' ' << d1 <<
' ' << d2 <<
'\n';
Numeric sq(Numeric n)
Compute square of a number.
std::string out_filename_opt_arg(const std::string &def)
std::map< std::string, straight_depth > straight_depths
straight_depths straight_depths_arg()
int main(int argc, const char *argv[])
void get_args(int argc, const char *argv[], const std::string &usage)