TRIQS/nda
2.0.0
Multi-dimensional array library for C++
Toggle main menu visibility
Loading...
Searching...
No Matches
doc_basic_array.cpp
1
#include <
nda/nda.hpp
>
2
#include <iostream>
3
4
int
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
}
nda::ones
auto ones(std::array< Int, Rank > const &shape)
Make an array of the given shape and one-initialize it.
Definition
basic_functions.hpp:88
nda.hpp
Includes all relevant headers for the core nda library.
nda::ellipsis
Mimics Python's ... syntax.
Definition
range.hpp:36
doc
examples
doc_basic_array.cpp
Generated by
1.17.0