本文整理汇总了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());
}
}
示例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) );
}
示例3: getIndecesSmallerGreater
void getIndecesSmallerGreater(const VectorType >_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);
}
示例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)));
}
}