⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hist_02.cc

📁 这是一个从音频信号里提取特征参量的程序
💻 CC
📖 第 1 页 / 共 4 页
字号:
  hist6.clear();  hist6.setMode(CENTERS);  hist6.compute(llong_data, DEF_NUM_BINS);  hist6.getCounts(actual_counts);  if (!actual_counts.eq(expected_counts)) {    actual_counts.debug(L"actual counts");    expected_counts.debug(L"expected counts");    return Error::handle(name(), L"compute", Error::TEST, __FILE__,			 __LINE__);  }    hist6.clear();  hist6.setMode(CENTERS);  hist6.compute(long_data, DEF_NUM_BINS);  hist6.getCounts(actual_counts);  if (!actual_counts.eq(expected_counts)) {    actual_counts.debug(L"actual counts");    expected_counts.debug(L"expected counts");    return Error::handle(name(), L"compute", Error::TEST, __FILE__,			 __LINE__);  }    hist6.clear();  hist6.setMode(CENTERS);  hist6.compute(short_data, DEF_NUM_BINS);  hist6.getCounts(actual_counts);  if (!actual_counts.eq(expected_counts)) {    actual_counts.debug(L"actual counts");    expected_counts.debug(L"expected counts");    return Error::handle(name(), L"compute", Error::TEST, __FILE__,			 __LINE__);  }    hist6.clear();  hist6.setMode(CENTERS);  hist6.compute(ullong_data, DEF_NUM_BINS);  hist6.getCounts(actual_counts);  if (!actual_counts.eq(expected_counts)) {    actual_counts.debug(L"actual counts");    expected_counts.debug(L"expected counts");    return Error::handle(name(), L"compute", Error::TEST, __FILE__,			 __LINE__);  }    hist6.clear();  hist6.setMode(CENTERS);  hist6.compute(ulong_data, DEF_NUM_BINS);  hist6.getCounts(actual_counts);  if (!actual_counts.eq(expected_counts)) {    actual_counts.debug(L"actual counts");    expected_counts.debug(L"expected counts");    return Error::handle(name(), L"compute", Error::TEST, __FILE__,			 __LINE__);  }    hist6.clear();  hist6.setMode(CENTERS);  hist6.compute(ushort_data, DEF_NUM_BINS);  hist6.getCounts(actual_counts);  if (!actual_counts.eq(expected_counts)) {    actual_counts.debug(L"actual counts");    expected_counts.debug(L"expected counts");    return Error::handle(name(), L"compute", Error::TEST, __FILE__,			 __LINE__);  }    // test a histogram with specified bins in CENTERS mode for each data type  //  expected_counts.assign(L"1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1");  VectorDouble all_bins(L"0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10");  hist6.clear();  hist6.setMode(CENTERS);  byte_bins.assign(all_bins);  hist6.compute(byte_data, byte_bins);  hist6.getCounts(actual_counts);  if (!actual_counts.eq(expected_counts)) {    actual_counts.debug(L"actual counts");    expected_counts.debug(L"expected counts");    return Error::handle(name(), L"compute", Error::TEST, __FILE__,			 __LINE__);  }    hist6.clear();  hist6.setMode(CENTERS);  double_bins.assign(all_bins);  hist6.compute(double_data, double_bins);  hist6.getCounts(actual_counts);  if (!actual_counts.eq(expected_counts)) {    actual_counts.debug(L"actual counts");    expected_counts.debug(L"expected counts");    return Error::handle(name(), L"compute", Error::TEST, __FILE__,			 __LINE__);  }    hist6.clear();  hist6.setMode(CENTERS);  float_bins.assign(all_bins);  hist6.compute(float_data, float_bins);  hist6.getCounts(actual_counts);  if (!actual_counts.eq(expected_counts)) {    actual_counts.debug(L"actual counts");    expected_counts.debug(L"expected counts");    return Error::handle(name(), L"compute", Error::TEST, __FILE__,			 __LINE__);  }    hist6.clear();  hist6.setMode(CENTERS);  llong_bins.assign(all_bins);  hist6.compute(llong_data, llong_bins);  hist6.getCounts(actual_counts);  if (!actual_counts.eq(expected_counts)) {    actual_counts.debug(L"actual counts");    expected_counts.debug(L"expected counts");    return Error::handle(name(), L"compute", Error::TEST, __FILE__,			 __LINE__);  }    hist6.clear();  hist6.setMode(CENTERS);  long_bins.assign(all_bins);  hist6.compute(long_data, long_bins);  hist6.getCounts(actual_counts);  if (!actual_counts.eq(expected_counts)) {    actual_counts.debug(L"actual counts");    expected_counts.debug(L"expected counts");    return Error::handle(name(), L"compute", Error::TEST, __FILE__,			 __LINE__);  }    hist6.clear();  hist6.setMode(CENTERS);  short_bins.assign(all_bins);  hist6.compute(short_data, short_bins);  hist6.getCounts(actual_counts);  if (!actual_counts.eq(expected_counts)) {    actual_counts.debug(L"actual counts");    expected_counts.debug(L"expected counts");    return Error::handle(name(), L"compute", Error::TEST, __FILE__,			 __LINE__);  }    hist6.clear();  hist6.setMode(CENTERS);  ullong_bins.assign(all_bins);  hist6.compute(ullong_data, ullong_bins);  hist6.getCounts(actual_counts);  if (!actual_counts.eq(expected_counts)) {    actual_counts.debug(L"actual counts");    expected_counts.debug(L"expected counts");    return Error::handle(name(), L"compute", Error::TEST, __FILE__,			 __LINE__);  }    hist6.clear();  hist6.setMode(CENTERS);  ulong_bins.assign(all_bins);  hist6.compute(ulong_data, ulong_bins);  hist6.getCounts(actual_counts);  if (!actual_counts.eq(expected_counts)) {    actual_counts.debug(L"actual counts");    expected_counts.debug(L"expected counts");    return Error::handle(name(), L"compute", Error::TEST, __FILE__,			 __LINE__);  }    hist6.clear();  hist6.setMode(CENTERS);  ushort_bins.assign(all_bins);  hist6.compute(ushort_data, ushort_bins);  hist6.getCounts(actual_counts);  if (!actual_counts.eq(expected_counts)) {    actual_counts.debug(L"actual counts");    expected_counts.debug(L"expected counts");    return Error::handle(name(), L"compute", Error::TEST, __FILE__,			 __LINE__);  }    // update a histogram with specified bins in CENTERS mode for each data type  //  expected_counts.assign(L"2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2");  hist6.clear();  hist6.setMode(CENTERS);  byte_bins.assign(all_bins);  hist6.compute(byte_data, byte_bins);  hist6.update(byte_data);  hist6.getCounts(actual_counts);  if (!actual_counts.eq(expected_counts)) {    actual_counts.debug(L"actual counts");    expected_counts.debug(L"expected counts");    return Error::handle(name(), L"compute", Error::TEST, __FILE__,			 __LINE__);  }    hist6.clear();  hist6.setMode(CENTERS);  double_bins.assign(all_bins);  hist6.compute(double_data, double_bins);  hist6.update(double_data);  hist6.getCounts(actual_counts);  if (!actual_counts.eq(expected_counts)) {    actual_counts.debug(L"actual counts");    expected_counts.debug(L"expected counts");    return Error::handle(name(), L"compute", Error::TEST, __FILE__,			 __LINE__);  }    hist6.clear();  hist6.setMode(CENTERS);  float_bins.assign(all_bins);  hist6.compute(float_data, float_bins);  hist6.update(float_data);  hist6.getCounts(actual_counts);  if (!actual_counts.eq(expected_counts)) {    actual_counts.debug(L"actual counts");    expected_counts.debug(L"expected counts");    return Error::handle(name(), L"compute", Error::TEST, __FILE__,			 __LINE__);  }    hist6.clear();  hist6.setMode(CENTERS);  llong_bins.assign(all_bins);  hist6.compute(llong_data, llong_bins);  hist6.update(llong_data);  hist6.getCounts(actual_counts);  if (!actual_counts.eq(expected_counts)) {    actual_counts.debug(L"actual counts");    expected_counts.debug(L"expected counts");    return Error::handle(name(), L"compute", Error::TEST, __FILE__,			 __LINE__);  }    hist6.clear();  hist6.setMode(CENTERS);  long_bins.assign(all_bins);  hist6.compute(long_data, long_bins);  hist6.update(long_data);  hist6.getCounts(actual_counts);  if (!actual_counts.eq(expected_counts)) {    actual_counts.debug(L"actual counts");    expected_counts.debug(L"expected counts");    return Error::handle(name(), L"compute", Error::TEST, __FILE__,			 __LINE__);  }    hist6.clear();  hist6.setMode(CENTERS);  short_bins.assign(all_bins);  hist6.compute(short_data, short_bins);  hist6.update(short_data);  hist6.getCounts(actual_counts);  if (!actual_counts.eq(expected_counts)) {    actual_counts.debug(L"actual counts");    expected_counts.debug(L"expected counts");    return Error::handle(name(), L"compute", Error::TEST, __FILE__,			 __LINE__);  }    hist6.clear();  hist6.setMode(CENTERS);  ullong_bins.assign(all_bins);  hist6.compute(ullong_data, ullong_bins);  hist6.update(ullong_data);  hist6.getCounts(actual_counts);  if (!actual_counts.eq(expected_counts)) {    actual_counts.debug(L"actual counts");    expected_counts.debug(L"expected counts");    return Error::handle(name(), L"compute", Error::TEST, __FILE__,			 __LINE__);  }    hist6.clear();  hist6.setMode(CENTERS);  ulong_bins.assign(all_bins);  hist6.compute(ulong_data, ulong_bins);  hist6.update(ulong_data);  hist6.getCounts(actual_counts);  if (!actual_counts.eq(expected_counts)) {    actual_counts.debug(L"actual counts");    expected_counts.debug(L"expected counts");    return Error::handle(name(), L"compute", Error::TEST, __FILE__,			 __LINE__);  }    hist6.clear();  hist6.setMode(CENTERS);  ushort_bins.assign(all_bins);  hist6.compute(ushort_data, ushort_bins);  hist6.update(ushort_data);  hist6.getCounts(actual_counts);  if (!actual_counts.eq(expected_counts)) {    actual_counts.debug(L"actual counts");    expected_counts.debug(L"expected counts");    return Error::handle(name(), L"compute", Error::TEST, __FILE__,			 __LINE__);  }  // test all compute methods in EDGES mode  //  // test a new histogram in EDGES mode for each data type  //  test_data.assign(L"0, 1, 2, 3, 4, 5, 6, 7, 8, 9");  expected_counts.assign(L"1, 1, 1, 1, 1, 1, 1, 1, 1, 1");  hist6.clear();  hist6.setMode(EDGES);  byte_data.assign(test_data);  hist6.compute(byte_data);  hist6.getCounts(actual_counts);  if (!actual_counts.eq(expected_counts)) {    hist6.debug(L"hist6");    actual_counts.debug(L"actual counts");    expected_counts.debug(L"expected counts");    return Error::handle(name(), L"compute", Error::TEST, __FILE__,			 __LINE__);  }    hist6.clear();  hist6.setMode(EDGES);  double_data.assign(test_data);  hist6.compute(double_data);  hist6.getCounts(actual_counts);  if (!actual_counts.eq(expected_counts)) {    actual_counts.debug(L"actual counts");    expected_counts.debug(L"expected counts");    return Error::handle(name(), L"compute", Error::TEST, __FILE__,			 __LINE__);  }    hist6.clear();  hist6.setMode(EDGES);  float_data.assign(test_data);  hist6.compute(float_data);  hist6.getCounts(actual_counts);  if (!actual_counts.eq(expected_counts)) {    actual_counts.debug(L"actual counts");    expected_counts.debug(L"expected counts");    return Error::handle(name(), L"compute", Error::TEST, __FILE__,			 __LINE__);  }    hist6.clear();  hist6.setMode(EDGES);  llong_data.assign(test_data);  hist6.compute(llong_data);  hist6.getCounts(actual_counts);  if (!actual_counts.eq(expected_counts)) {    actual_counts.debug(L"actual counts");    expected_counts.debug(L"expected counts");    return Error::handle(name(), L"compute", Error::TEST, __FILE__,			 __LINE__);  }    hist6.clear();  hist6.setMode(EDGES);  long_data.assign(test_data);  hist6.compute(long_data);  hist6.getCounts(actual_counts);  if (!actual_counts.eq(expected_counts)) {    actual_counts.debug(L"actual counts");    expected_counts.debug(L"expected counts");    return Error::handle(name(), L"compute", Error::TEST, __FILE__,			 __LINE__);  }    hist6.clear();  hist6.setMode(EDGES);  short_data.assign(test_data);  hist6.compute(short_data);  hist6.getCounts(actual_counts);  if (!actual_counts.eq(expected_counts)) {    actual_counts.debug(L"actual counts");    expected_counts.debug(L"expected counts");    return Error::handle(name(), L"compute", Error::TEST, __FILE__,			 __LINE__);  }    hist6.clear();  hist6.setMode(EDGES);  ullong_data.assign(test_data);  hist6.compute(ullong_data);  hist6.getCounts(actual_counts);  if (!actual_counts.eq(expected_counts)) {    actual_counts.debug(L"actual counts");    expected_counts.debug(L"expected counts");    return Error::handle(name(), L"compute", Error::TEST, __FILE__,			 __LINE__);  }    hist6.clear();  hist6.setMode(EDGES);  ulong_data.assign(test_data);  hist6.compute(ulong_data);  hist6.getCounts(actual_counts);  if (!actual_counts.eq(expected_counts)) {    actual_counts.debug(L"actual counts");    expected_counts.debug(L"expected counts");    return Error::handle(name(), L"compute", Error::TEST, __FILE__,			 __LINE__);  }    hist6.clear();  hist6.setMode(EDGES);  ushort_data.assign(test_data);  hist6.compute(ushort_data);  hist6.getCounts(actual_counts);  if (!actual_counts.eq(expected_counts)) {    actual_counts.debug(L"actual counts");    expected_counts.debug(L"expected counts");    return Error::handle(name(), L"compute", Error::TEST, __FILE__,			 __LINE__);  }    // test a histogram with preset bins in EDGES mode for each data type  //  expected_counts.assign(L"1, 1, 1, 1, 1, 1, 1, 1, 1, 1");  hist6.clear();  hist6.setMode(EDGES);  hist6.setBins(test_data.min(), test_data.max(), DEF_NUM_BINS);  hist6.compute(byte_data);  hist6.getCounts(actual_counts);  if (!actual_counts.eq(expected_counts)) {    actual_counts.debug(L"actual counts");    expected_counts.debug(L"expected counts");    return Error::handle(name(), L"compute", Error::TEST, __FILE__,			 __LINE__);  }    hist6.clear();  hist6.setMode(EDGES);  hist6.setBins(test_data.min(), test_data.max(), DEF_NUM_BINS);  hist6.compute(double_data);  hist6.getCounts(actual_counts);  if (!actual_counts.eq(expected_counts)) {    actual_counts.debug(L"actual counts");    expected_counts.debug(L"expected counts");    return Error::handle(name(), L"compute", Error::TEST, __FILE__,			 __LINE__);  }    hist6.clear();  hist6.setMode(EDGES);  hist6.setBins(test_data.min(), test_data.max(), DEF_NUM_BINS);  hist6.compute(float_data);  hist6.getCounts(actual_counts);  if (!actual_counts.eq(expected_counts)) {    actual_counts.debug(L"actual counts");    expected_counts.debug(L"expected counts");    return Error::handle(name(), L"compute", Error::TEST, __FILE__,			 __LINE__);  }    hist6.clear();  hist6.setMode(EDGES);  hist6.setBins(test_data.min(), test_data.max(), DEF_NUM_BINS);  hist6.compute(llong_data);  hist6.getCounts(actual_counts);  if (!actual_counts.eq(expected_counts)) {    actual_counts.debug(L"actual counts");    expected_counts.debug(L"expected counts");    return Error::handle(name(), L"compute", Error::TEST, __FILE__,			 __LINE__);  }    hist6.clear();  hist6.setMode(EDGES);  hist6.setBins(test_data.min(), test_data.max(), DEF_NUM_BINS);  hist6.compute(long_data);  hist6.getCounts(actual_counts);  if (!actual_counts.eq(expected_counts)) {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -