mirror of
https://github.com/triqs/dft_tools
synced 2024-11-01 11:43:47 +01:00
47cb8a03f7
- 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.
34 lines
809 B
C++
34 lines
809 B
C++
#include <triqs/arrays.hpp>
|
|
using triqs::arrays::array;
|
|
using triqs::arrays::matrix;
|
|
using triqs::arrays::vector;
|
|
using triqs::arrays::permutation;
|
|
int main() {
|
|
|
|
// A 3d array of long, C ordering, no option
|
|
array<long, 3> A3(1, 2, 3);
|
|
|
|
// A 2d array of double, C ordering, with explicit Bound Checking
|
|
array<double, 2> B(1, 2);
|
|
|
|
// a matrix of long
|
|
matrix<long> M(2, 2);
|
|
|
|
// a vector of double
|
|
vector<double> V(10);
|
|
|
|
// arrays with custom memory layout
|
|
|
|
// C-style
|
|
array<long, 3> A0(2, 3, 4);
|
|
array<long, 3> A0b; // same type but empty
|
|
|
|
// Fortran-style
|
|
array<long, 3> A4(2, 3, 4, FORTRAN_LAYOUT);
|
|
array<long, 3> A1b(FORTRAN_LAYOUT); // same type but empty
|
|
|
|
// custom : (i,j,k) : index j is fastest, then k, then i
|
|
array<long, 3> A2(2, 3, 4, triqs::arrays::make_memory_layout(1, 0, 2));
|
|
}
|
|
|