示例#1
0
std::vector<std::vector<size_t>> where_diff(const vec2d& data, const T& func) {
  std::vector<std::vector<size_t>> res(data.size());
  for (size_t j = 0; j < data.size(); ++j) {
    for (size_t i = 0; i < data[j].size() - 1; ++i) {
      if (func(data[j][i], data[j][i + 1])) {
        res[j].push_back(i);
      }
    }
  }
  return res;
}
示例#2
0
OneD matrixExtract(vec2d &bigMatrix, int index)
{
  int size = bigMatrix.size();
  
  OneD result(size,0);

  for (int x=0; x<size; x++)
    {
      result[x] = bigMatrix[x][index];
    }

  return result;
}
std::string python_code_caller(const std::string& script_name, const vec2d& levels, const int& dim)
{
    int levels_no = 0;
    int level_size = 0;
    int one_level = 0;
    std::stringstream caller;

    levels_no = levels.size();
    level_size = levels[0].size();

    caller << "python " << script_name << " " << dim << " ";

    for(int i = 0 ; i < levels_no ; ++i)
    {
        for(int j = 0 ; j < level_size ; ++j)
        {
            one_level = levels[i][j];
            caller << one_level << " ";
        }
    }

    return caller.str();
}
示例#4
0
文件: helper.hpp 项目: Blonck/consus
inline size_t inner_p1_size(const vec2d& data){
  return data.size();
}