Skip to content

Commit f66ab3f

Browse files
committed
Add more elaborate view test
1 parent 4299283 commit f66ab3f

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

test/test_strided_assign.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,20 @@ namespace xt
3838
);
3939
return strided_assign_detail::get_loop_sizes(a, b).can_do_strided_assign;
4040
};
41+
{
42+
size_t size = 50;
43+
const std::array<size_t, 3> shape = {size, size, size};
44+
xt::xtensor<double, 3> a(shape), b(shape);
45+
auto core = xt::range(1, size - 1);
46+
auto lhs = xt::view(b, core, core, core);
47+
auto rhs = 1.0 / 7.0
48+
* (xt::view(a, core, core, core) + xt::view(a, core, xt::range(2, size), core)
49+
+ xt::view(a, core, xt::range(0, size - 2), core)
50+
+ xt::view(a, xt::range(2, size), core, core)
51+
+ xt::view(a, xt::range(0, size - 2), core, core));
52+
xt::noalias(lhs) = rhs;
53+
EXPECT_TRUE(check_strided_assign(lhs, rhs));
54+
}
4155
{
4256
auto data = std::vector<double>{
4357
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20};

0 commit comments

Comments
 (0)