本文整理汇总了C++中array_type::dimension_0方法的典型用法代码示例。如果您正苦于以下问题:C++ array_type::dimension_0方法的具体用法?C++ array_type::dimension_0怎么用?C++ array_type::dimension_0使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类array_type
的用法示例。
在下文中一共展示了array_type::dimension_0方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: operator
// Verify:
KOKKOS_INLINE_FUNCTION
void operator()( size_t iwork, value_type & errors ) const
{
const size_t tile_dim0 = ( m_array.dimension_0() + TileLayout::N0 - 1 ) / TileLayout::N0;
const size_t tile_dim1 = ( m_array.dimension_1() + TileLayout::N1 - 1 ) / TileLayout::N1;
const size_t itile = iwork % tile_dim0;
const size_t jtile = iwork / tile_dim0;
if ( jtile < tile_dim1 ) {
tile_type tile = Kokkos::tile_subview( m_array, itile, jtile );
if ( tile( 0, 0 ) != ptrdiff_t( ( itile + jtile * tile_dim0 ) * TileLayout::N0 * TileLayout::N1 ) ) {
++errors;
}
else {
for ( size_t j = 0; j < size_t( TileLayout::N1 ); ++j ) {
for ( size_t i = 0; i < size_t( TileLayout::N0 ); ++i ) {
const size_t iglobal = i + itile * TileLayout::N0;
const size_t jglobal = j + jtile * TileLayout::N1;
if ( iglobal < m_array.dimension_0() && jglobal < m_array.dimension_1() ) {
if ( tile( i, j ) != ptrdiff_t( tile( 0, 0 ) + i + j * TileLayout::N0 ) ) ++errors;
//printf( "tile(%d, %d)(%d, %d) = %d\n", int( itile ), int( jtile ), int( i ), int( j ), int( tile( i, j ) ) );
}
}
}
}
}
}
示例2: compare_rank_2_views
bool compare_rank_2_views(const array_type& y,
const array_type& y_exp,
const scalar_type rel_tol,
const scalar_type abs_tol,
Teuchos::FancyOStream& out)
{
typedef typename array_type::size_type size_type;
typename array_type::HostMirror hy = Kokkos::create_mirror_view(y);
typename array_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 i=0; i<num_rows; ++i) {
for (size_type j=0; j<num_cols; ++j) {
scalar_type diff = std::abs( hy(i,j) - hy_exp(i,j) );
scalar_type tol = rel_tol*std::abs(hy_exp(i,j)) + abs_tol;
bool s = diff < tol;
out << "y_expected(" << i << "," << j << ") - "
<< "y(" << i << "," << j << ") = " << hy_exp(i,j)
<< " - " << hy(i,j) << " == "
<< diff << " < " << tol << " : ";
if (s)
out << "passed";
else
out << "failed";
out << std::endl;
success = success && s;
}
}
return success;
}
示例3: operator
KOKKOS_INLINE_FUNCTION
void operator()( const unsigned i , long & fail_count ) const
{
if ( i % stride == 0 ) {
const unsigned claim = count()++ ;
if ( claim < array.dimension_0() ) {
array[claim] = i ;
}
else {
++fail_count ;
}
}
}