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


C++ const_Vector::size方法代码示例

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


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

示例1: pset

void
check_replicated_map(
  Replicated_map<Dim> const&          map,
  const_Vector<processor_type, Block> pset)
{
  typedef Replicated_map<Dim> map_type;
  typedef typename map_type::processor_iterator iterator;

  // Check num_processors()
  test_assert(map.num_processors() == pset.size());

  // Check processor_set()
  Vector<processor_type> map_pset = map.processor_set();

  test_assert(map_pset.size() == pset.size());
  for (index_type i=0; i<map_pset.size(); ++i)
    test_assert(map_pset(i) == pset(i));

  // Check processor_begin(), processor_end()
  iterator begin = map.processor_begin(0);
  iterator end   = map.processor_end(0);

  assert(static_cast<length_type>(end - begin) == pset.size());

  iterator cur = begin;
  while (cur != end)
  {
    index_type i = cur - begin;
    test_assert(*cur == pset(i));
    ++cur;
  }
}
开发者ID:BackupTheBerlios,项目名称:openvsipl,代码行数:32,代码来源:replicated_map.cpp

示例2:

typename Promotion<T1, T2>::type
dotp_ext(
  const_Vector<T1, Block1> op1,
  const_Vector<T2, Block2> op2)
{
  typedef typename Promotion<T1, T2>::type value_type;

  test_assert(op1.size() == op2.size());

  vsip::dda::Data<Block1, dda::in> raw1(op1.block());
  T1 const *p1   = raw1.ptr();
  stride_type str1 = raw1.stride(0);

  vsip::dda::Data<Block2, dda::in> raw2(op2.block());
  T2 const *p2   = raw2.ptr();
  stride_type str2 = raw2.stride(0);

  value_type sum = value_type();
  
  for (index_type i=0; i<op1.size(); ++i)
  {
    sum  += *p1 * *p2;
    p1 += str1;
    p2 += str2;
  }

  return sum;
}
开发者ID:bambang,项目名称:vsipl,代码行数:28,代码来源:extdata.cpp

示例3:

void
check_length(const_Vector<T, Block> vec, length_type len)
{
  test_assert(vec.length() == len);
  test_assert(vec.size() == len);
  test_assert(vec.size(0) == len);
}
开发者ID:BackupTheBerlios,项目名称:openvsipl,代码行数:7,代码来源:vector.cpp

示例4: equal

inline bool equal(const_Vector<T1, B1> v, const_Vector<T2, B2> w)
{
  if (v.size() != w.size()) return false;
  for (length_type i = 0; i != v.size(); ++i)
    if (!equal(v.get(i), w.get(i)))
      return false;
  return true;
}
开发者ID:fsheikh,项目名称:openvsip,代码行数:8,代码来源:equal.hpp

示例5: maxval

double
error_db(const_Vector<T1, Block1> v1,
	 const_Vector<T2, Block2> v2)
{
  double refmax = 0.0;
  double maxsum = -250;
  double sum;

  Index<1> idx;

  refmax = maxval(magsq(v1), idx);

  for (index_type i=0; i<v1.size(); ++i)
  {
    double val = magsq(v1.get(i) - v2.get(i));

    if (val < 1.e-20)
      sum = -201.;
    else
      sum = 10.0 * log10(val/(2.0*refmax));

    if (sum > maxsum)
      maxsum = sum;
  }

  return maxsum;
}
开发者ID:fsheikh,项目名称:openvsip,代码行数:27,代码来源:matvec.cpp

示例6: T

T
sum_view(const_Vector<T, Block> view)
{
  T sum = T();
  for (index_type i=0; i<view.size(); ++i)
    sum += view.get(i);
  return sum;
}
开发者ID:bambang,项目名称:vsipl,代码行数:8,代码来源:extdata.cpp

示例7: T

T
tc_sum_const(const_Vector<T, Block> vec)
{
  T sumval = T();
  for (index_type i=0; i<vec.size(0); ++i)
    sumval += vec.get(i);
  return sumval;
}
开发者ID:BackupTheBerlios,项目名称:openvsipl,代码行数:8,代码来源:vector.cpp

示例8: operator

  void 
  operator()(
    const_Vector<cscalar_f, Block1> in, 
    const_Vector<cscalar_f, Block2> coefficients,
    Vector<cscalar_f, Block3> out)
  {
    if((size() != in.size()) ||
       (size() != coefficients.size()) ||
       (size() != out.size()))
    {
      std::cout << "Error (class Filter): "
                << "all input and output views must be element-conformant" << std::endl;
      return;
    }

    out = i_fft_(coefficients * f_fft_(in));
  }
开发者ID:fsheikh,项目名称:openvsip,代码行数:17,代码来源:filter.cpp

示例9: operator

  void operator()(
    char const *            str,
    const_Vector<T, Block1> vin,
    Vector      <T, Block2> vout)
  {
    typedef vsip::impl::Layout<1, row1_type,
      vsip::impl::Stride_unit, vsip::impl::Cmplx_split_fmt>
		LP;
    typedef vsip::impl::Ext_data<Block1, LP> layout1;
    typedef vsip::impl::Ext_data<Block2, LP> layout2;

    // PROFILE: Check sizes, check layout costs.

    // Important to check size.  If vectors are too large, our
    // buffers will overflow.
    test_assert(vin.size()  == size_);
    test_assert(vout.size() == size_);

    if (verbose_)
    {
      cout << "Test_FFT_split: " << str << endl;
      cout << "Block_layout<Block1>:\n";
      print_layout<typename vsip::impl::Block_layout<Block1>::layout_type>(cout);
      cout << endl;
      
      cout << "LP:\n";
      print_layout<LP>(cout);
      cout << endl;
      
      cout << "  access_type<LP>(vin.block()) = "
	   <<    access_type<LP>(vin.block()) << endl;
      cout << "  access_type<LP>(vout.block()) = "
	   <<    access_type<LP>(vout.block()) << endl;
      
      cout << "  mem_required<LP>(vin.block()) = "
	   <<    vsip::impl::mem_required<LP>(vin.block()) << endl;
      cout << "  mem_required<LP>(vout.block()) = "
	   <<    vsip::impl::mem_required<LP>(vout.block()) << endl;
    }

    test_assert(vsip::impl::mem_required<LP>(vin.block())  <= sizeof(T)*size_);
    test_assert(vsip::impl::mem_required<LP>(vout.block()) <= sizeof(T)*size_);

    layout1 rin (vin.block(),  vsip::impl::SYNC_IN,  
		 make_pair(buffer_ + 0, buffer_ + size_));
    layout2 rout(vout.block(), vsip::impl::SYNC_OUT,
		 make_pair(buffer_ + 2*size_, buffer_ + 3*size_));

    test_assert(rin.stride(0) == 1);
    test_assert(rin.size(0) == size_);

    test_assert(rout.stride(0) == 1);
    test_assert(rout.size(0) == size_);

    fft_unit_stride_split(rin.data().first,  rin.data().second,
			  rout.data().first, rout.data().second,
			  size_);
  }
开发者ID:BackupTheBerlios,项目名称:openvsipl,代码行数:58,代码来源:extdata-fft.cpp

示例10: operator

  Vector<T>
  operator()(const_Vector<scalar_f> time, scalar_f start = 0.0)
  {
    length_type N = time.size();
    Vector<T> out(N, T());

    for (index_type i = 0; i < N; ++i)
      out(i) = (time(i) < (duration_ + start) && time(i) >= start) ? T(amplitude_) : T();

    return out;
  }
开发者ID:fsheikh,项目名称:openvsip,代码行数:11,代码来源:waveforms.cpp

示例11: if

 void 
 operator()(
   const_Vector<cscalar_f, Block1> in, 
   const_Vector<cscalar_f, Block2> coefficients,
   Vector<cscalar_f, Block3> out)
 {
   if (filter_.get() == 0)
   {
     std::cout << "Error (class Dynamic_filter): "
               << "reconfigure() not called prior to processing input data" << std::endl;
   }
   else if((filter_->size() != in.size()) ||
      (filter_->size() != coefficients.size()) ||
      (filter_->size() != out.size()))
   {
     std::cout << "Error (class Dynamic_filter): "
               << "all input and output views must be element-conformant" << std::endl;
   }
   else
     (*filter_)(in, coefficients, out);
 }
开发者ID:fsheikh,项目名称:openvsip,代码行数:21,代码来源:filter.cpp

示例12: T

void
test_view(const_Vector<complex<T>, Block> vec, int k)
{
  for (index_type i=0; i<vec.size(0); ++i)
  {
    if (!equal(vec.get(i), complex<T>(T(k*i+1), T(k*i+2))))
    {
      cout << "ERROR: i        = " << i << endl
	   << "       Got      = " << vec.get(i) << endl
	   << "       expected = " << vec.get(i) << endl;
    }
    test_assert(equal(vec.get(i), complex<T>(T(k*i+1), T(k*i+2))));
  }
}
开发者ID:BackupTheBerlios,项目名称:openvsipl,代码行数:14,代码来源:extdata-fft.cpp

示例13: in

void
test_conv(
  length_type              N,		// input size
  length_type              D,		// decimation
  const_Vector<T1, Block1> coeff,	// coefficients
  length_type const        n_loop = 2)
{
  length_type M = expected_kernel_size(symmetry, coeff.size());
  length_type P = expected_output_size(support, M, N, D);

  Vector<T> in(N);
  Vector<T> out(P, T(100));

  test_conv_base<symmetry, support>(in, out, coeff, D, n_loop);
}
开发者ID:BackupTheBerlios,项目名称:openvsipl,代码行数:15,代码来源:convolution.hpp

示例14: raw

T
sum_ext(const_Vector<T, Block> view)
{
  vsip::dda::Data<Block, dda::in> raw(view.block());
  float const *data   = raw.ptr();
  stride_type stride = raw.stride(0);

  T sum = T();
  
  for (index_type i=0; i<view.size(); ++i)
  {
    sum  += *data;
    data += stride;
  }

  return sum;
}
开发者ID:bambang,项目名称:vsipl,代码行数:17,代码来源:extdata.cpp

示例15:

void 
scaled_interpolate(Vector<T, ResultBlockType> result,
                   const_Vector<T, ArgumentBlockType> argument,
                   T scale, length_type new_size)
{
  length_type old_size = argument.size();
  float stretch = static_cast<float>(new_size)/old_size;
  for (index_type i = 0; i != new_size; ++i)
  {
    float pos = i / stretch;
    index_type j = static_cast<index_type>(pos);
    float alpha = pos - j;
    if (j + 1 == old_size)
      result.put(i, scale * (argument.get(j) * alpha));
    else
      result.put(i, scale * (argument.get(j) * alpha + argument.get(j + 1) * (1 - alpha)));
  }
}
开发者ID:BackupTheBerlios,项目名称:openvsipl,代码行数:18,代码来源:evaluation.cpp


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