本文整理汇总了C++中Array2::size方法的典型用法代码示例。如果您正苦于以下问题:C++ Array2::size方法的具体用法?C++ Array2::size怎么用?C++ Array2::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Array2
的用法示例。
在下文中一共展示了Array2::size方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: compareFloatingArrays
bool Teuchos::compareFloatingArrays(
const Array1 &a1, const std::string &a1_name,
const Array2 &a2, const std::string &a2_name,
const ScalarMag &tol,
Teuchos::FancyOStream &out
)
{
using Teuchos::as;
bool success = true;
out << "Comparing " << a1_name << " == " << a2_name << " ... ";
const int n = a1.size();
// Compare sizes
if (as<int>(a2.size()) != n) {
out << "\nError, "<<a1_name<<".size() = "<<a1.size()<<" == "
<< a2_name<<".size() = "<<a2.size()<<" : failed!\n";
return false;
}
// Compare elements
for( int i = 0; i < n; ++i ) {
const ScalarMag err = relErr( a1[i], a2[i] );
if ( err > tol ) {
out
<<"\nError, relErr("<<a1_name<<"["<<i<<"],"
<<a2_name<<"["<<i<<"]) = relErr("<<a1[i]<<","<<a2[i]<<") = "
<<err<<" <= tol = "<<tol<<": failed!\n";
success = false;
}
}
if (success) {
out << "passed\n";
}
return success;
}