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


C++ AzDvect类代码示例

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


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

示例1: AzException

/*-------------------------------------------------------------*/
void AzDmat::prod(const AzDmat *m0, const AzDmat *m1, bool is_m0_tran, bool is_m1_tran)
{
  const char *eyec = "AzDmat::prod"; 
  if (is_m1_tran) {
    throw new AzException(eyec, "No support for the transpose of the second matrix"); 
  }
  if (is_m0_tran) {
    reform(m0->colNum(), m1->colNum()); 
    for (int col = 0; col < m1->colNum(); ++col) {
      AzDvect *myv = col_u(col); 
      const AzDvect *v1 = m1->col(col); 
      for (int row = 0; row < rowNum(); ++row) {
        double val = m0->col(col)->innerProduct(v1); 
        myv->set(row, val); 
      }
    }
  }
  else {
    reform(m0->rowNum(), m1->colNum()); 
    for (int col = 0; col < m1->colNum(); ++col) {
      AzDvect *myv = col_u(col); 
      const AzDvect *v1 = m1->col(col); 
      for (int row1 = 0; row1 < v1->rowNum(); ++row1) {
        myv->add(m0->col(row1), v1->get(row1)); 
      }
    }      
  }
}
开发者ID:DeercoderCourse,项目名称:NLP,代码行数:29,代码来源:AzDmat.cpp

示例2: resetDw

 /*---*/
 void resetDw(const AzDvect *inp_v_dw) {
   if (!AzDvect::isNull(inp_v_dw)) {
     if (inp_v_dw->rowNum() != v_y.rowNum()) {
       throw new AzException("AzOptOnTree::resetDw", "dimensionality conflict"); 
     }
     v_fixed_dw.set(inp_v_dw); 
   }
   else {
     v_fixed_dw.destroy(); 
   }
 }
开发者ID:AlexInTown,项目名称:santander_2016,代码行数:12,代码来源:AzOptOnTree.hpp

示例3: AzException

/*----------------------------------------------------------------------*/
void AzSvDataS::mergeData(const AzSmat *m_x,
                         const AzSvFeatInfo *feat,
                         const char *fn_template,
                         const char *str,
                         bool doSparse,
                         int digits,
                         const char *out_x_fn,
                         const char *out_n_fn,
                         int num,
                         const char *names[])
{
  const char *eyec = "AzSvDataS::mergeData";

  int data_num = m_x->colNum();
  int f_num = m_x->rowNum();
  if (feat->featNum() != f_num) {
    throw new AzException(eyec, "Conflict btw m_x and featInfo");
  }
  AzFile n_file(out_n_fn);
  n_file.open("wb");
  int fx;
  for (fx = 0; fx < feat->featNum(); ++fx) {
    AzBytArr s; feat->desc(fx, &s); s.nl();
    s.writeText(&n_file);
  }

  AzSmat m;
  m_x->transpose(&m);
  m.resize(data_num, f_num+num);
  AzStrPool sp_names;
  for (fx = 0; fx < num; ++fx) {
    AzBytArr s_fn(fn_template);
    s_fn.replace("*", names[fx]);

    AzDvect v;
    AzSvDataS::readVector(s_fn.c_str(), &v);
    if (v.rowNum() != m.rowNum()) {
      throw new AzException(AzInputError, eyec, "conflict in #data:", s_fn.c_str());
    }
    m.col_u(f_num+fx)->set(&v);

    AzBytArr s_nm;
    if (AzTools::isSpecified(str)) s_nm.c(str);
    s_nm.c(names[fx]); s_nm.nl();
    s_nm.writeText(&n_file);
  }
  n_file.close(true);

  AzSmat m1;
  m.transpose(&m1);
  m1.writeText(out_x_fn, digits, doSparse);
}
开发者ID:joshloyal,项目名称:RegularizedGreedyForest,代码行数:53,代码来源:AzSvDataS.cpp

示例4: AzException

 /*---  this never returns NULL ---*/
 inline const AzDvect *col(int col) const {
   if (col < 0 || col >= col_num) {
     throw new AzException("AzDmat::col", "col# is out of range"); 
   }
   if (column[col] == NULL) {
     if (dummy_zero.rowNum() != row_num) {
       throw new AzException("AzDmat::col", "wrong dummy_zero"); 
     }
     return &dummy_zero; 
   }
   return column[col]; 
 }
开发者ID:liangwuli1992,项目名称:svrg2.0,代码行数:13,代码来源:AzDmat.hpp

示例5: show_stat

 virtual void show_stat(AzBytArr &s) const {
   if (p.typ == AzpActivDflt_None) return;     
   if (!p.do_stat) return; 
   AzDvect my_v_pop(&v_pop_last); 
   my_v_pop.normalize1(); 
   s.nl(); 
   double accum = 0; 
   int ix; 
   for (ix = 0; ix < my_v_pop.rowNum(); ++ix) {
     accum += my_v_pop.get(ix); 
     s.c("b"); s.cn(v_border.get(ix)); s.c("="); s.cn(my_v_pop.get(ix),3); s.c("("); s.cn(accum,3); s.c("),"); 
   }
 }
开发者ID:DeercoderCourse,项目名称:NLP,代码行数:13,代码来源:AzpActivDflt.hpp

示例6: copyPred_to

 inline void copyPred_to(AzDvect *out_v_p) const {
   out_v_p->reform(v_p.rowNum()); 
   out_v_p->set(&v_p); 
 }
开发者ID:AlexInTown,项目名称:santander_2016,代码行数:4,代码来源:AzOptOnTree.hpp

示例7: resetTarDw_residual

 void resetTarDw_residual(const AzDvect *v_p) { /* only for LS */
   v_tar_dw.set(&v_y); 
   v_tar_dw.add(v_p, -1); 
 }
开发者ID:0x0all,项目名称:Kaggle_CrowdFlower,代码行数:4,代码来源:AzTrTtarget.hpp

示例8: resetTargetDw

 void resetTargetDw(const AzDvect *v_tar, const AzDvect *inp_v_dw) {
   v_tar_dw.set(v_tar); 
   v_dw.set(inp_v_dw); 
   v_tar_dw.scale(&v_dw); /* component-wise multiplication */
 }
开发者ID:0x0all,项目名称:Kaggle_CrowdFlower,代码行数:5,代码来源:AzTrTtarget.hpp

示例9: copy_from

 virtual void copy_from(const AzpActivDflt *i) {
   p = i->p; 
   m_drv.set(&i->m_drv); 
   v_border.set(&i->v_border); 
   v_pop.set(&i->v_pop); 
   v_pop_last.set(&i->v_pop_last); 
 }   
开发者ID:DeercoderCourse,项目名称:NLP,代码行数:7,代码来源:AzpActivDflt.hpp

示例10: _reset

 void _reset() {
   v_w.reset(); 
   v_p.reset(); 
   v_y.reset(); 
   v_fixed_dw.reset(); 
   var_const = fixed_const = 0; 
 }
开发者ID:AlexInTown,项目名称:santander_2016,代码行数:7,代码来源:AzOptOnTree.hpp

示例11: reset

 void reset(const AzTrTtarget *inp) {
   if (inp != NULL) {
     v_tar_dw.set(&inp->v_tar_dw); 
     v_dw.set(&inp->v_dw); 
     v_y.set(&inp->v_y); 
     v_fixed_dw.set(&inp->v_fixed_dw); 
     fixed_dw_sum = inp->fixed_dw_sum; 
   }
 }
开发者ID:0x0all,项目名称:Kaggle_CrowdFlower,代码行数:9,代码来源:AzTrTtarget.hpp

示例12: init_count

  /*---  to keep count  ---*/
  void init_count() {
//    const double border[] = {0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1, 2, 3, 9999999999, -1};  
    #define AzpActivDfltCountStop  7777
    const double border[] = {-1e+10, -10, -5, -1, -0.5, -0.2, -0.1, 0, 0.1, 0.2, 0.5, 1, 5, 10, 1e+10, AzpActivDfltCountStop}; 
    int num = 0; 
    int ix; 
    for (ix = 0; ; ++ix, ++num) if (border[ix] == AzpActivDfltCountStop) break;
    v_border.set(border, num); 
    v_pop.reform(num);   
  }
开发者ID:DeercoderCourse,项目名称:NLP,代码行数:11,代码来源:AzpActivDflt.hpp

示例13: count

 void count(const AzPmat *m) {
   if (v_border.rowNum() == 0) init_count(); 
   AzDmat md; m->get(&md); 
   const double *border = v_border.point(); 
   int row, col; 
   for (col = 0; col < md.colNum(); ++col) {
     for (row = 0; row < md.rowNum(); ++row) {
       double val = md.get(row, col); 
       int bx; 
       for (bx = 0; bx < v_border.rowNum(); ++bx) {
         if (val <= border[bx]) {
           v_pop.add(bx, 1); 
           break; 
         }
       }
     }
   }    
 }
开发者ID:DeercoderCourse,项目名称:NLP,代码行数:18,代码来源:AzpActivDflt.hpp

示例14:

 AzSortedFeat_Sparse & operator =(const AzSortedFeat_Sparse &inp) { /* never tested */
   if (this == &inp) return *this; 
   ia_zero.reset(&inp.ia_zero); 
   ia_index.reset(&inp.ia_index); 
   v_value.set(&inp.v_value); 
   _shouldDoBackward = inp._shouldDoBackward; 
   data_num = inp.data_num; 
   return *this; 
 }
开发者ID:AlexInTown,项目名称:santander_2016,代码行数:9,代码来源:AzSortedFeat.hpp

示例15: weight_tarDw

 inline void weight_tarDw() {
   v_tar_dw.scale(&v_fixed_dw); 
 }
开发者ID:0x0all,项目名称:Kaggle_CrowdFlower,代码行数:3,代码来源:AzTrTtarget.hpp


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