Skip to content

Commit 68a5a9e

Browse files
committed
Fix for column layout default
1 parent d84724e commit 68a5a9e

1 file changed

Lines changed: 24 additions & 5 deletions

File tree

test/test_strided_assign.cpp

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "xtensor/xadapt.hpp"
1414
#include "xtensor/xarray.hpp"
1515
#include "xtensor/xassign.hpp"
16+
#include "xtensor/xlayout.hpp"
1617
#include "xtensor/xnoalias.hpp"
1718
#include "xtensor/xtensor.hpp"
1819
#include "xtensor/xview.hpp"
@@ -55,8 +56,11 @@ namespace xt
5556
{
5657
auto data = std::vector<double>{
5758
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20};
58-
auto simple_xtensor_12 = xt::xtensor<double, 2>{{1, 2, 3, 4}, {5, 6, 7, 8}, {9, 10, 11, 12}};
59-
auto simple_xtensor_16 = xt::xtensor<double, 2>{
59+
auto simple_xtensor_12 = xt::xtensor<double, 2, layout_type::row_major>{
60+
{1, 2, 3, 4},
61+
{5, 6, 7, 8},
62+
{9, 10, 11, 12}};
63+
auto simple_xtensor_16 = xt::xtensor<double, 2, layout_type::row_major>{
6064
{1, 2, 3, 4},
6165
{5, 6, 7, 8},
6266
{9, 10, 11, 12},
@@ -111,8 +115,18 @@ namespace xt
111115

112116
{
113117
std::vector<double> data2{-1, -1, -1, -1};
114-
auto linear_adapter = xt::adapt(data2.data(), 4, xt::no_ownership(), std::vector<size_t>{4, 1});
115-
auto adapter_cont2 = xt::adapt(data.data(), 4, xt::no_ownership(), std::vector<size_t>{1, 4});
118+
auto linear_adapter = xt::adapt<layout_type::row_major>(
119+
data2.data(),
120+
4,
121+
xt::no_ownership(),
122+
std::vector<size_t>{4, 1}
123+
);
124+
auto adapter_cont2 = xt::adapt<layout_type::row_major>(
125+
data.data(),
126+
4,
127+
xt::no_ownership(),
128+
std::vector<size_t>{1, 4}
129+
);
116130
EXPECT_TRUE(linear_adapter.is_contiguous());
117131
EXPECT_TRUE(adapter_cont2.is_contiguous());
118132
bool success_one = check_linear_assign(linear_adapter, xt::transpose(adapter_cont2));
@@ -154,7 +168,12 @@ namespace xt
154168

155169
{
156170
std::vector<double> data2{-1, -1, -1, -1, -1, -1};
157-
auto linear_adapter2 = xt::adapt(data2.data(), 6, xt::no_ownership(), std::vector<size_t>{3, 2});
171+
auto linear_adapter2 = xt::adapt<layout_type::row_major>(
172+
data2.data(),
173+
6,
174+
xt::no_ownership(),
175+
std::vector<size_t>{3, 2}
176+
);
158177
auto strided_adapter = xt::adapt(
159178
data.data(),
160179
6,

0 commit comments

Comments
 (0)