TRIQS/nda 2.0.0
Multi-dimensional array library for C++
Loading...
Searching...
No Matches
doc_basic_array.cpp
1#include <nda/nda.hpp>
2#include <iostream>
3
4int main() {
5 // create a regular 3x2 array of ones
6 auto arr = nda::ones<int>(3, 2);
7 std::cout << arr << std::endl;
8
9 // assign the value 42 to the first row
10 arr(0, nda::ellipsis{}) = 42;
11 std::cout << arr << std::endl;
12}
auto ones(std::array< Int, Rank > const &shape)
Make an array of the given shape and one-initialize it.
Includes all relevant headers for the core nda library.
Mimics Python's ... syntax.
Definition range.hpp:36