本文整理汇总了C++中vector_type::dimension_1方法的典型用法代码示例。如果您正苦于以下问题:C++ vector_type::dimension_1方法的具体用法?C++ vector_type::dimension_1怎么用?C++ vector_type::dimension_1使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vector_type
的用法示例。
在下文中一共展示了vector_type::dimension_1方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: compareRank2
bool compareRank2(const vector_type& y,
const vector_type& y_exp,
const scalar_type rel_tol,
const scalar_type abs_tol,
Teuchos::FancyOStream& out)
{
typedef typename vector_type::size_type size_type;
typename vector_type::HostMirror hy = Kokkos::create_mirror_view(y);
typename vector_type::HostMirror hy_exp = Kokkos::create_mirror_view(y_exp);
Kokkos::deep_copy(hy, y);
Kokkos::deep_copy(hy_exp, y_exp);
size_type num_rows = y.dimension_0();
size_type num_cols = y.dimension_1();
bool success = true;
for (size_type col = 0; col < num_cols; ++col){
for (size_type i=0; i<num_rows; ++i) {
for (size_type j=0; j<y.sacado_size(); ++j) {
scalar_type diff = std::abs( hy(i,col).fastAccessCoeff(j) - hy_exp(i,col).fastAccessCoeff(j) );
scalar_type tol = rel_tol*std::abs(hy_exp(i,col).fastAccessCoeff(j)) + abs_tol;
bool s = diff < tol;
out << "y_expected(" << i << ").coeff(" << j << ") - "
<< "y(" << i << ").coeff(" << j << ") = " << hy_exp(i,col).fastAccessCoeff(j)
<< " - " << hy(i,col).fastAccessCoeff(j) << " == "
<< diff << " < " << tol << " : ";
if (s)
out << "passed";
else
out << "failed";
out << std::endl;
success = success && s;
}
}
}
return success;
}