void check(vsip::const_Vector<T, BlockT> vec, int k, int shift=0) { using vsip::no_subblock; using vsip::index_type; typedef T value_type; #if VERBOSE std::cout << "check(k=" << k << ", shift=" << shift << "):" << std::endl; #endif if (subblock(vec) != no_subblock) { for (index_type li=0; li<vec.local().size(); ++li) { index_type gi = global_from_local_index(vec, 0, li); #if VERBOSE std::cout << " - " << li << " gi:" << gi << " = " << vec.local().get(li) << " exp: " << value<T>(gi + shift, k) << std::endl; #endif #if DO_ASSERT test_assert(vec.local().get(li) == value<T>(gi + shift, k)); #endif } } }
void check_col_vector(vsip::const_Vector<T, BlockT> view, int col, int k=0) { using vsip::no_subblock; using vsip::index_type; typedef T value_type; if (subblock(view) != no_subblock) { for (index_type lr=0; lr<view.local().size(0); ++lr) { index_type gr = global_from_local_index(view, 0, lr); test_assert(view.local().get(lr) == value<T>(gr, col, k)); } } }
void check_row_vector(vsip::const_Vector<T, BlockT> view, int row, int k=1) { using vsip::no_subblock; using vsip::index_type; typedef T value_type; if (subblock(view) != no_subblock) { for (index_type lc=0; lc<view.local().size(0); ++lc) { index_type gc = global_from_local_index(view, 0, lc); test_assert(view.local().get(lc) == value<T>(row, gc, k)); } } }
void show(vsip::const_Vector<T, BlockT> vec) { using vsip::no_subblock; using vsip::index_type; typedef T value_type; std::cout << "[" << vsip::local_processor() << "] " << "show\n"; if (subblock(vec) != no_subblock) { for (index_type li=0; li<vec.local().size(); ++li) { index_type gi = global_from_local_index(vec, 0, li); std::cout << "[" << vsip::local_processor() << "] " << li << " gi:" << gi << " = " << vec.local().get(li) << std::endl; } } else std::cout << "[" << vsip::local_processor() << "] " << "show: no local subblock\n"; }