当前位置: 首页>>代码示例>>C++>>正文


C++ MatrixD::size1方法代码示例

本文整理汇总了C++中MatrixD::size1方法的典型用法代码示例。如果您正苦于以下问题:C++ MatrixD::size1方法的具体用法?C++ MatrixD::size1怎么用?C++ MatrixD::size1使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MatrixD的用法示例。


在下文中一共展示了MatrixD::size1方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: transition_row_partition_assignments

double State::transition_row_partition_assignments(const MatrixD& data,
        vector<int> which_rows) {
    vector<int> global_column_indices = create_sequence(data.size2());
    double score_delta = 0;
    //
    int num_rows = which_rows.size();
    if (num_rows == 0) {
        num_rows = data.size1();
        which_rows = create_sequence(num_rows);
        //FIXME: use own shuffle so seed control is in effect
        std::random_shuffle(which_rows.begin(), which_rows.end());
    }
    set<View*>::iterator svp_it;
    for (svp_it = views.begin(); svp_it != views.end(); svp_it++) {
        // for each view
        View& v = **svp_it;
        vector<int> view_cols = get_indices_to_reorder(global_column_indices,
                                v.global_to_local);
        const MatrixD data_subset = extract_columns(data, view_cols);
        map<int, vector<double> > row_data_map = construct_data_map(data_subset);
        vector<int>::iterator vi_it;
        for (vi_it = which_rows.begin(); vi_it != which_rows.end(); vi_it++) {
            // for each SPECIFIED row
            int row_idx = *vi_it;
            vector<double> vd = row_data_map[row_idx];
            score_delta += v.transition_z(vd, row_idx);
        }
    }
    data_score += score_delta;
    return score_delta;
}
开发者ID:campustimes,项目名称:crosscat,代码行数:31,代码来源:State.cpp

示例2:

map<int, vector<double> > construct_data_map(const MatrixD data) {
  unsigned int num_rows = data.size1();
  map<int, vector<double> > data_map;
  for(unsigned int row_idx=0; row_idx<num_rows; row_idx++) {
    data_map[row_idx] = extract_row(data, row_idx);
  }
  return data_map;
}
开发者ID:campustimes,项目名称:crosscat,代码行数:8,代码来源:utils.cpp

示例3: extract_columns

MatrixD extract_columns(const MatrixD fromM, vector<int> from_cols) {
  int num_rows = fromM.size1();
  int num_cols = from_cols.size();
  MatrixD toM(num_rows, num_cols);
  for(int to_col=0; to_col<num_cols; to_col++) {
    int from_col = from_cols[to_col];
    copy_column(fromM, from_col, toM, to_col);
  }
  return toM;
}
开发者ID:campustimes,项目名称:crosscat,代码行数:10,代码来源:utils.cpp

示例4: construct_base_hyper_grids

void State::construct_base_hyper_grids(const MatrixD& data, int N_GRID,
        vector<double> ROW_CRP_ALPHA_GRID,
        vector<double> COLUMN_CRP_ALPHA_GRID) {
    int num_rows = data.size1();
    int num_cols = data.size2();
    if (ROW_CRP_ALPHA_GRID.size() == 0) {
        ROW_CRP_ALPHA_GRID = create_crp_alpha_grid(num_rows, N_GRID);
    }
    if (COLUMN_CRP_ALPHA_GRID.size() == 0) {
        COLUMN_CRP_ALPHA_GRID = create_crp_alpha_grid(num_cols, N_GRID);
    }
    row_crp_alpha_grid = ROW_CRP_ALPHA_GRID;
    column_crp_alpha_grid = COLUMN_CRP_ALPHA_GRID;
    construct_cyclic_base_hyper_grids(N_GRID, num_rows, vm_b_grid);
    construct_continuous_base_hyper_grids(N_GRID, num_rows, r_grid, nu_grid);
    construct_multinomial_base_hyper_grids(N_GRID, num_rows,
                                           multinomial_alpha_grid);
}
开发者ID:campustimes,项目名称:crosscat,代码行数:18,代码来源:State.cpp

示例5: copy_column

void copy_column(const MatrixD fromM, int from_col, MatrixD &toM, int to_col) {
  assert(fromM.size1()==toM.size1());
  int num_rows = fromM.size1();
  project(toM, boost::numeric::ublas::range(0, num_rows), boost::numeric::ublas::range(to_col, to_col+1)) = \
    project(fromM, boost::numeric::ublas::range(0, num_rows), boost::numeric::ublas::range(from_col, from_col+1));
}
开发者ID:campustimes,项目名称:crosscat,代码行数:6,代码来源:utils.cpp


注:本文中的MatrixD::size1方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。