• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ cvec类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: prePost

cvec prePost (cvec data_time, int pre, int post){

   data_time.ins(0, data_time.right(pre));
   data_time.ins(data_time.length(), data_time.mid(pre,post));
   return(data_time);

}
开发者ID:tony2909,项目名称:green,代码行数:7,代码来源:tx_funct.cpp


示例2: miso_out

ivec Ant1Relay::bpsk_nc_ml_demapping(Array<complex<double> > &miso_out, cvec symbols) {

	ivec res_label;
	res_label.set_size(miso_out.size());

	for(int i=0; i<miso_out.size(); i++) {

		complex<double> Y = miso_out(i);
		cvec X = zeros_c(2);

		double min_norm = numeric_limits<double>::max();
		int min_pt = -1;


		for(int q=0; q<symbols.size(); q++) {
			X(0) = symbols(q);
			for(int r=0; r<symbols.size(); r++) {
				X(1) = symbols(r);
				complex<double> hx = channel * X;
				double calc_norm = norm(Y-hx);
				if(calc_norm < min_norm) {
					min_norm = calc_norm;
					min_pt = (q^r) & 0x01; // xor
				}
			}
		}

		res_label(i) = min_pt;
	}

	return res_label;
}
开发者ID:jhnsnshen,项目名称:pnc,代码行数:32,代码来源:ant1relay.cpp


示例3: roots

void roots(const vec &p, cvec &r)
{
  int n = p.size(), m, l;
  ivec f = find(p != 0.0);
  m = f.size();
  vec v = p;
  mat A;

  if (m > 0 && n > 1) {
    v = v(f(0), f(m - 1));
    l = v.size();

    if (l > 1) {

      A = diag(ones(l - 2), -1);
      A.set_row(0, -v(1, l - 1) / v(0));
      r = eig(A);
      cvec d;
      cmat V;
      eig(A, d , V);

      if (f(m - 1) < n)
        r = concat(r, zeros_c(n - f(m - 1) - 1));
    }
    else {
      r.set_size(n - f(m - 1) - 1, false);
      r.zeros();
    }
  }
  else
    r.set_size(0, false);
}
开发者ID:c304728539,项目名称:itpp-fastica,代码行数:32,代码来源:poly.cpp


示例4: process

cvec fir_x::process(bvec ce, cvec x)
{
 cvec y;	
 int N;

	#if (DEBUG_LEVEL==3)
	cout << "***** fir_x::proc *****" << endl;	
	cout << "ce=" << ce << endl;
	cout << "x=" << x << endl;
	sleep(1000);
	#endif

	N=ce.length();
	if (x.length()!=N) { 
		throw sci_exception("fir_x::process - ce.size <> x.size", x.length() );
	}	
	y.set_size(N);
	for (int i=0; i<N; i++) {
		if (bool(ce[i])) y0=update(x[i]);				
		y[i]=y0;
	}
	

	#if (DEBUG_LEVEL==3)
	cout << "y=" << y << endl;
	cout << "+++++ fir_x::proc +++++" << endl;	
	sleep(1000);
	#endif

	return (y);
}
开发者ID:maki63,项目名称:c_sci,代码行数:31,代码来源:csim_fir_x.cpp


示例5: assert_cvec

static
void assert_cvec(const cvec &ref, const cvec &act)
{
  ASSERT_EQ(ref.length(), act.length());
  for (int n = 0; n < ref.length(); ++n) {
    ASSERT_NEAR(ref[n].real(), act[n].real(), tol);
    ASSERT_NEAR(ref[n].imag(), act[n].imag(), tol);
  }
}
开发者ID:snikulov,项目名称:mirror.itpp,代码行数:9,代码来源:ls_solve_test.cpp


示例6: assert_cvec_p

static
void assert_cvec_p(const cvec &ref, const cvec &act, int line)
{
  ASSERT_EQ(ref.length(), act.length()) << line;
  for (int n = 0; n < ref.length(); ++n) {
    ASSERT_NEAR(ref(n).real(), act(n).real(), tol) << line;
    ASSERT_NEAR(ref(n).imag(), act(n).imag(), tol) << line;
  }
}
开发者ID:snikulov,项目名称:mirror.itpp,代码行数:9,代码来源:poly_test.cpp


示例7: it_assert_debug

cvec operator/(const cvec &v, const double &s)
{
  it_assert_debug(v.size() > 0, "operator/(): Vector of zero length");

  cvec temp = v;
  for (int i = 0;i < v.size();i++) {
    temp(i) /= (double)s;
  }
  return temp;
}
开发者ID:c304728539,项目名称:itpp-fastica,代码行数:10,代码来源:operators.cpp


示例8: zero_pad_back

void zero_pad_back(cvec& vec_in, int m_in)
{
  int quotient = vec_in.length() / m_in;
  if (quotient*m_in == vec_in.length()) {
    return;
  }
  else {
    int n_remainder = (quotient + 1) * m_in - vec_in.length();
    vec_in = concat(vec_in, zeros_c(n_remainder));
  }
}
开发者ID:readytowork,项目名称:S29sPLMPWAtbN49RV,代码行数:11,代码来源:exp06.cpp


示例9: descrambling

	cvec descrambling(cvec data,cvec code)
	{
		cvec result;
		result.set_length(data.length());
		result.zeros();
		for(int i=0;i<data.length();i++)
		{
			result[i]=data(i)*code(i);
		}
		return result;
	}
开发者ID:haku90,项目名称:inzPraca,代码行数:11,代码来源:Haku.cpp


示例10: poly

void poly(const cvec &r, cvec &p)
{
  int n = r.size();

  p.set_size(n + 1, false);
  p.zeros();
  p(0) = 1.0;

  for (int i = 0; i < n; i++)
    p.set_subvector(1, p(1, i + 1) - r(i)*p(0, i));
}
开发者ID:c304728539,项目名称:itpp-fastica,代码行数:11,代码来源:poly.cpp


示例11: auto_correlation

void auto_correlation(const cvec &a, cvec &x)
{
    int k = a.size();
    x.set_size(k);
    for (int i = 0; i < k; ++i) {
        x[i] = 0;
        for (int j = 0; j < k - i; ++j)
            x[i] += a[j] * conj(a[j + i]);
        for (int j = k - i; j < k; ++j)
            x[i] += a[j] * conj(a[j - k + i]);
    }
}
开发者ID:setarcos,项目名称:itppexp,代码行数:12,代码来源:zadoff.cpp


示例12: it_assert_debug

cvec operator*(const cmat &m, const cvec &v)
{
  it_assert_debug(m.no_cols == v.size(), "cmat::operator*(): Wrong sizes");
  cvec r(m.no_rows);
  std::complex<double> alpha = std::complex<double>(1.0);
  std::complex<double> beta = std::complex<double>(0.0);
  char trans = 'n';
  int incr = 1;
  blas::zgemv_(&trans, &m.no_rows, &m.no_cols, &alpha, m.data, &m.no_rows,
               v._data(), &incr, &beta, r._data(), &incr);
  return r;
}
开发者ID:cristeab,项目名称:module_itfile,代码行数:12,代码来源:mat.cpp


示例13: set_state

void fir_x::set_state(cvec cv)
{
int k,N;

	N=get_size();
	if (cv.length()!=N ) {
		throw sci_exception("fir::set_state v.lenght <> fir_size", cv.length() );
	}	

	for (k=0; k < N; k++) {
		z[k]=cv[k];
	}
}
开发者ID:maki63,项目名称:c_sci,代码行数:13,代码来源:csim_fir_x.cpp


示例14: Plot_data

void Plot::Plot_data(cvec ydata, int plot_number){

    double x[ydata.length()];
    double y[ydata.length()];
    if(plot_number==2){
        curve2.setStyle(QwtPlotCurve::CurveStyle(4));
        for (int i=0;i<ydata.length();i++){
            x[i]=real(ydata.get(i));
            y[i]=imag(ydata.get(i));
        }
            curve2.setData(x,y,ydata.length());
            gui->qwtPlot_2->replot();
    }
}
开发者ID:Jalilpiran,项目名称:CogWave,代码行数:14,代码来源:plot.cpp


示例15: polyval

cvec polyval(const cvec &p, const vec &x)
{
  it_error_if(p.size() == 0, "polyval: size of polynomial is zero");
  it_error_if(x.size() == 0, "polyval: size of input value vector is zero");

  cvec out(x.size());

  out = p(0);

  for (int i = 1; i < p.size(); i++)
    out = std::complex<double>(p(i)) + elem_mult(to_cvec(x), out);

  return out;
}
开发者ID:c304728539,项目名称:itpp-fastica,代码行数:14,代码来源:poly.cpp


示例16: synchCatchChannel

/** Return the channel FIR estimation based on trainSeq and fill phiHat, Ahat, delay, sigmaSqrNoise
 *
 * @pre:
 *    - dataC: cvec of the received data
 *    - trainC: pointer to array of the training sequence
 *             !!!  length assume to be < than dataC.length()!!!
 *    - delay: pointer to a int with synchornization point
 *
 * @post:
 *    - Estimators are now filled!
 *    - returned the channel FIR estimation
 */
void synchCatchChannel(cvec dataC, cvec trainCUp , int *delay ){

  if(dataC.length()<trainCUp.length()){
    cerr << "The training sequence is too big compare to datas!\n";
    exit(1);
  }

  //std::cout<<"Data="<<dataC<<"\n";
  //std::cout<<"Train="<<trainCUp<<"\n";
  
  //Computes crosscorrelation:

  int timeLag=1000;

  cvec dataCSmall=dataC(1,timeLag);

  cvec crossCorr=itpp::xcorr(dataCSmall, trainCUp, timeLag);

  
    //std::cout<<"Cross="<<crossCorr<<"\n";

  //Search for the maximum
  double max=0.0;
  int index=0, count=0;
  double tmp[crossCorr.length()-timeLag+1];
  for(int i=timeLag-1;i<crossCorr.length();i++){
    tmp[count]=abs(crossCorr[i]);
   
    //DispVal(tmp[count]);
    //DispVal(count);
    if (tmp[count]> max ){
      max=tmp[count];
      index=i;
     
    }
     count++;
  }
  
  index=index-timeLag+1;
  *delay=index;


  // Save data to file
     std::ofstream ofs( "xcorr.dat" , std::ifstream::out );
     ofs.write((char * ) tmp, (crossCorr.length()-timeLag+1)*sizeof(double));
     ofs.close();

}
开发者ID:tony2909,项目名称:green,代码行数:60,代码来源:rx_funct.cpp


示例17: get

void Matlab_Engine::get(cvec &v, const char *name){
  mxArray *T;
  if((T = engGetArray(e, name)) == NULL)
    cout << "No variable with the given name exists in the Matlab workspace!\n";  
  else{
    const int *dims = mxGetDimensions(T);
    const int ndims = mxGetNumberOfDimensions(T);
    if((ndims>2) || !((dims[0]==1)||(dims[1]==1)))
      cout << "The requested variable is not a vector!\n";    
    if(!mxIsComplex(T))
      cout << "The requested variable is real-valued!\n";    
    double *pt_r = (double*) mxGetPr(T);
    double *pt_i = (double*) mxGetPi(T);
    const int N = mxGetNumberOfElements(T);
    v.set_size(N, false);
    if(mxIsComplex(T)) // Copy both real and imaginary part.
      for(int k=0; k<N; k++){
	complex<double> value(*pt_r++, *pt_i++);
	v(k) = value;
      }
    else // Copy only the real part.
      for(int k=0; k<N; k++){
	complex<double> value(*pt_r++, 0);
	v(k) = value;
      }         
  }
}
开发者ID:mbillingr,项目名称:tools4bci-unibuild,代码行数:27,代码来源:matlab_engine.cpp


示例18: dataAlloc

cvec dataAlloc (cvec data_qam, std::complex<double> data_pilot[], double pilot_pattern[], double data_pattern[], int N){

  int n=0;
  int m=0;
  int u=0;
  std::complex<double> zeroC(0,0);
  cvec data_alloc(N);

  for(int i=0;i<N;i++){;
   if (pilot_pattern[m]-1==i){
     data_alloc.set(i,data_pilot[m]);   
      m++;
     
   }
   else if (data_pattern[n]-1==i){
     data_alloc.set(i,data_qam.get(n));   
      n++;
   }
   else{
     data_alloc.set(i,zeroC);
     u++;
   }
  
 }

  return(data_alloc);

}
开发者ID:tony2909,项目名称:green,代码行数:28,代码来源:tx_funct.cpp


示例19: xcorr

cvec xcorr(const cvec &x, const cvec &y, const int max_lag, const std::string scaleopt)
{
  cvec out(2*x.length() - 1); //Initial size does ont matter, it will get adjusted
  xcorr(x, y, out, max_lag, scaleopt, false);

  return out;
}
开发者ID:c304728539,项目名称:itpp-fastica,代码行数:7,代码来源:sigfun.cpp


示例20:

std::complex<double> operator*(const ivec &a, const cvec &b)
{
  it_assert_debug(a.size() == b.size(), "operator*(): sizes does not match");
  std::complex<double> temp = 0;
  for (int i = 0;i < a.size();i++) {temp += (double)a(i) * b(i);}
  return temp;
}
开发者ID:c304728539,项目名称:itpp-fastica,代码行数:7,代码来源:operators.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ cxtype类代码示例发布时间:2022-05-31
下一篇:
C++ cv类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap