本文整理汇总了C++中PVarSizeList类的典型用法代码示例。如果您正苦于以下问题:C++ PVarSizeList类的具体用法?C++ PVarSizeList怎么用?C++ PVarSizeList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PVarSizeList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: VarSizeList_get
ind_t VarSizeList_get(const PVarSizeList pset, uint32 i, ind_t* data, ind_t max_dim){
assert(i < pset->count());
auto cur = pset->get(i);
for (int i=0;i<max_dim;i++)
data[i] = cur[i];
return cur.size();
}
示例2: GetIndexSet
PVarSizeList GetIndexSet(PVarSizeList pRet,
const PProfitCalculator profCalc,
double max_prof,
double **p_profits) {
ind_t max_d = profCalc->max_dim();
ind_mul_ind_t ind_set;
ind_set.push_back(setprof_t(mul_ind_t(), profCalc->calc_log_prof(mul_ind_t())));
double cur_prof;
ind_mul_ind_t::iterator itrCur = ind_set.begin();
while (itrCur != ind_set.end()) {
if (itrCur->size < max_d) {
mul_ind_t cur_ind = itrCur->ind;
ind_set.push_back(setprof_t(cur_ind, -1, itrCur->size+1));
ind_t cur_size = itrCur->size;
cur_ind.step(cur_size);
while ((cur_prof=profCalc->calc_log_prof(cur_ind)) <= max_prof){
ind_set.push_back(setprof_t(cur_ind, cur_prof));
cur_ind.step(cur_size);
}
// if (added > 0) // This assumes that dimensions are ordered!
}
// If this iterator has negative profit it means it's temporary and
// can be deleted safely (since all derivatives are already added)
if (itrCur->profit < 0)
itrCur = ind_set.erase(itrCur); // erase returns the next iterator
else
itrCur++;
}
ind_set.sort(compare_setprof);
if (p_profits)
*p_profits = static_cast<double*>(malloc(sizeof(double) * ind_set.size()));
uint32 i=0;
if (!pRet)
pRet = new VarSizeList(ind_set.size());
for (auto itr=ind_set.begin();itr!=ind_set.end();itr++){
if (!pRet->has_ind(itr->ind))
pRet->push_back(itr->ind);
if (p_profits)
(*p_profits)[i++] = itr->profit;
}
return pRet;
}
示例3: VarSizeList_from_matrix
PVarSizeList VarSizeList_from_matrix(const ind_t *sizes, uint32 count,
const ind_t *j, uint32 j_size,
const ind_t *data, uint32 data_size){
PVarSizeList pset = new VarSizeList(count);
uint32 total_size = 0;
for (uint32 i=0;i<count;i++){
total_size += sizes[i];
assert(j_size >= total_size);
assert(data_size >= total_size);
pset->push_back(mul_ind_t(j, data, sizes[i]));
j += sizes[i];
data += sizes[i];
}
return pset;
}
示例4: VarSizeList_estimate_bias
double VarSizeList_estimate_bias(const PVarSizeList pset,
const double *err_contributions,
uint32 count,
const double *rates, uint32 rates_size){
return pset->estimate_bias(err_contributions, count,
rates, rates_size);
}
示例5: VarSizeList_get_adaptive_order
void VarSizeList_get_adaptive_order(const PVarSizeList pset,
const double *error,
const double *work,
uint32 *adaptive_order,
uint32 count,
ind_t seedLookahead){
pset->get_adaptive_order(error, work, adaptive_order, count, seedLookahead);
}
示例6: VarSizeList_expand_set
PVarSizeList VarSizeList_expand_set(const PVarSizeList pset,
const double* error,
const double* work,
uint32 count,
ind_t dimLookahead){
PVarSizeList result = new VarSizeList();
*result = pset->expand_set(error, work, count, dimLookahead);
return result;
}
示例7: VarSizeList_get
ind_t VarSizeList_get(const PVarSizeList pset, uint32 i, ind_t* data,
ind_t* j, ind_t size){
const mul_ind_t& cur = pset->get(i);
i=0;
assert(cur.active() <= size);
for (auto itr=cur.begin();itr!=cur.end();itr++, i++) {
data[i] = itr->value;
j[i] = itr->ind;
}
return cur.active();
}
示例8: VarSizeList_from_matrix
PVarSizeList VarSizeList_from_matrix(PVarSizeList pset,
const ind_t *sizes, uint32 count,
const ind_t *j, uint32 j_size,
const ind_t *data, uint32 data_size){
if (!pset)
pset = new VarSizeList(count);
uint32 total_size = 0;
for (uint32 i=0;i<count;i++){
total_size += sizes[i];
assert(j_size >= total_size);
assert(data_size >= total_size);
//std::cout << "adding: " << mul_ind_t(j, data, sizes[i]) << "of size" << sizes[i] << std::endl;
pset->push_back(mul_ind_t(j, data, sizes[i]));
j += sizes[i];
data += sizes[i];
}
return pset;
}
示例9: VarSizeList_to_matrix
void VarSizeList_to_matrix(const PVarSizeList pset, ind_t *ij, uint32 ij_size,
ind_t *data, uint32 data_size){
pset->to_matrix(ij, ij_size, data, data_size);
}
示例10: VarSizeList_all_active_dim
void VarSizeList_all_active_dim(const PVarSizeList pset, uint32 *active_dim, uint32 size){
pset->all_active_dim(active_dim, size);
}
示例11: VarSizeList_all_dim
void VarSizeList_all_dim(const PVarSizeList pset, uint32 *dim, uint32 size){
pset->all_dim(dim, size);
}
示例12: VarSizeList_get_active_dim
ind_t VarSizeList_get_active_dim(const PVarSizeList pset, uint32 i){
return pset->get(i).active();
}
示例13: VarSizeList_get_dim
ind_t VarSizeList_get_dim(const PVarSizeList pset, uint32 i){
return pset->get(i).size();
}
示例14: CalculateSetProfit
void CalculateSetProfit(const PVarSizeList pset,
const PProfitCalculator profCalc,
double *log_prof, uint32 size){
pset->calc_set_profit(profCalc, log_prof, size);
}
示例15: VarSizeList_is_parent_of_admissible
void VarSizeList_is_parent_of_admissible(const PVarSizeList pset, unsigned char *out, uint32 count){
pset->is_parent_of_admissible(out, count);
}