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


C++ VectorType::rows方法代码示例

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


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

示例1: verify_is_approx_upto_permutation

void verify_is_approx_upto_permutation(const VectorType& vec1, const VectorType& vec2)
{
  typedef typename NumTraits<typename VectorType::Scalar>::Real RealScalar;

  VERIFY(vec1.cols() == 1);
  VERIFY(vec2.cols() == 1);
  VERIFY(vec1.rows() == vec2.rows());
  for (int k = 1; k <= vec1.rows(); ++k)
  {
    VERIFY_IS_APPROX(vec1.array().pow(RealScalar(k)).sum(), vec2.array().pow(RealScalar(k)).sum());
  }
}
开发者ID:Aerobota,项目名称:eigen,代码行数:12,代码来源:eigensolver_complex.cpp

示例2: verify_is_approx_upto_permutation

void verify_is_approx_upto_permutation(const VectorType& vec1, const VectorType& vec2)
{
  typedef typename VectorType::Scalar Scalar;
  typedef typename NumTraits<Scalar>::Real RealScalar;

  VERIFY(vec1.cols() == 1);
  VERIFY(vec2.cols() == 1);
  VERIFY(vec1.rows() == vec2.rows());
  
  Index n = vec1.rows();
  RealScalar tol = test_precision<RealScalar>()*test_precision<RealScalar>()*numext::maxi(vec1.squaredNorm(),vec2.squaredNorm());
  Matrix<RealScalar,Dynamic,Dynamic> diffs = (vec1.rowwise().replicate(n) - vec2.rowwise().replicate(n).transpose()).cwiseAbs2();
  
  VERIFY( find_pivot(tol, diffs) );
}
开发者ID:13221325403,项目名称:openbr,代码行数:15,代码来源:eigensolver_complex.cpp

示例3: getIndecesSmallerGreater

void getIndecesSmallerGreater(const VectorType &gt_vector, float thresh, MatrixTypeUint &found_smaller_indeces,MatrixTypeUint & found_greater_indeces ){


    unsigned int n_samples = gt_vector.rows();
    MatrixTypeUint found_greater_indeces_temp = MatrixTypeUint::Zero(n_samples,1);
    MatrixTypeUint found_smaller_indeces_temp = MatrixTypeUint::Zero(n_samples,1);


    unsigned int i_found_great = 0;
    unsigned int i_found_small = 0;
    for(unsigned int i_sample = 0; i_sample<n_samples; i_sample++){
        if(gt_vector(i_sample)>=thresh){
            found_greater_indeces_temp(i_found_great) = i_sample;
            i_found_great++;
        }
        else{
            found_smaller_indeces_temp(i_found_small) = i_sample;
            i_found_small++;
        }
    }

    found_greater_indeces = found_greater_indeces_temp.head(i_found_great);
    found_smaller_indeces = found_smaller_indeces_temp.head(i_found_small);




}
开发者ID:Vaa3D,项目名称:vaa3d_tools,代码行数:28,代码来源:sampling.cpp

示例4: testTriangularProduct

void testTriangularProduct(const MatrixType& m, const VectorType& v, double tol)
{
  typedef typename MatrixType::RealScalar RealScalar;
  MatrixType m1;
  VectorType v1, v2, v3;
  RealScalar p;

  for (int i=0; i < g_repeat; ++i) {
    generateTriangularMatrix<MatrixType>::run(m1, m.rows());
    MatrixPowerTriangular<MatrixType> mpow(m1);

    v1 = VectorType::Random(v.rows(), v.cols());
    p = internal::random<RealScalar>();

    v2.noalias() = mpow(p) * v1;
    v3.noalias() = mpow(p).eval() * v1;
    std::cout << "testTriangularProduct: error powerm = " << relerr(v2, v3) << '\n';
    VERIFY(v2.isApprox(v3, static_cast<RealScalar>(tol)));
  }
}
开发者ID:caihuayu,项目名称:eigen,代码行数:20,代码来源:matrix_power.cpp


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