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


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

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例6:

bool
check_vector(const_Vector<T, Block> vec, int k)
{
  for (index_type i=0; i<vec.size(0); ++i)
    if (!equal(vec.get(i), T(k*i+1)))
      return false;
  return true;
}
开发者ID:BackupTheBerlios,项目名称:openvsipl,代码行数:8,代码来源:vector.cpp

示例7:

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

示例8:

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

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

  value_type sum = value_type();
  
  for (index_type i=0; i<op1.size(); ++i)
  {
    sum  += op1.get(i) * op2.get(i);
  }

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

示例9: T

T
sum(const_Vector<T, Block> v)
{
  // std::cout << "sum(" << Block_name<Block>::name() << ")\n";
  T total = T();
  for (index_type i=0; i<v.length(); ++i)
    total += v.get(i);
  return total;
}
开发者ID:BackupTheBerlios,项目名称:openvsipl,代码行数:9,代码来源:test.cpp


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