|
13 | 13 | #include "xtensor/xadapt.hpp" |
14 | 14 | #include "xtensor/xarray.hpp" |
15 | 15 | #include "xtensor/xassign.hpp" |
| 16 | +#include "xtensor/xlayout.hpp" |
16 | 17 | #include "xtensor/xnoalias.hpp" |
17 | 18 | #include "xtensor/xtensor.hpp" |
18 | 19 | #include "xtensor/xview.hpp" |
@@ -55,8 +56,11 @@ namespace xt |
55 | 56 | { |
56 | 57 | auto data = std::vector<double>{ |
57 | 58 | 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>{ |
60 | 64 | {1, 2, 3, 4}, |
61 | 65 | {5, 6, 7, 8}, |
62 | 66 | {9, 10, 11, 12}, |
@@ -111,8 +115,18 @@ namespace xt |
111 | 115 |
|
112 | 116 | { |
113 | 117 | 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 | + ); |
116 | 130 | EXPECT_TRUE(linear_adapter.is_contiguous()); |
117 | 131 | EXPECT_TRUE(adapter_cont2.is_contiguous()); |
118 | 132 | bool success_one = check_linear_assign(linear_adapter, xt::transpose(adapter_cont2)); |
@@ -154,7 +168,12 @@ namespace xt |
154 | 168 |
|
155 | 169 | { |
156 | 170 | 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 | + ); |
158 | 177 | auto strided_adapter = xt::adapt( |
159 | 178 | data.data(), |
160 | 179 | 6, |
|
0 commit comments