3
0
mirror of https://github.com/triqs/dft_tools synced 2024-11-01 03:33:50 +01:00
dft_tools/test/triqs/arrays/c_ordered_transposed_view.cpp
Olivier Parcollet 47cb8a03f7 [arrays] Important changes in implementation.
- Simplify group_indices
  - Only for C ordered, remove complex compile time.
  - Could be generalized to non C ordered, but no need.
- Fix slice for custom orders.
- Generalize the group_indices for the custom order.
- Add c_ordered_transposed_view (useful ?)
- Improve slice, special for ellipsis (quicker).
- Simplify TraversalOrder
- Assignement. Specialize one case for speed.
- use FORCEINLINE in foreach, according to speed test for clang
- add one speed test
- Modify iterators for better speed.
- along the lines decided for the foreach
- update doc.
2014-10-18 21:20:17 +02:00

37 lines
717 B
C++

#include "./common.hpp"
using namespace triqs::arrays;
using namespace triqs::clef;
template <typename... T> void test(T... x) {
placeholder<0> i_;
placeholder<1> j_;
placeholder<2> k_;
placeholder<3> l_;
array<int, 4> a(1, 2, 3, 4, make_memory_layout(x...));
a(i_, j_, k_, l_) << i_ + 10 * j_ + 100 * k_ + 1000 * l_;
TEST_ERR(a);
auto v = c_ordered_transposed_view(a());
TEST(a.shape());
TEST(a.indexmap().get_memory_layout());
TEST(v.shape());
TEST(v.indexmap().get_memory_layout());
std::cerr << "----------------" << std::endl;
}
int main() {
try {
test(0, 1, 2, 3);
test(1, 0, 2, 3);
test(2, 0, 3, 1);
}
catch (std::exception const& e) {
std::cerr << e.what() << std::endl;
}
}