TRIQS/nda 2.0.0
Multi-dimensional array library for C++
Loading...
Searching...
No Matches
doc_arith_algebra.cpp
1#include <nda/nda.hpp>
2#include <iostream>
3
4int main() {
5 // multiply two arrays elementwise
6 auto A1 = nda::array<int, 2>({{1, 2}, {3, 4}});
7 auto A2 = nda::array<int, 2>({{5, 6}, {7, 8}});
8 nda::array<int, 2> A3 = A1 * A2;
9 std::cout << A3 << std::endl;
10
11 // multiply two matrices
12 auto M1 = nda::matrix<int>({{1, 2}, {3, 4}});
13 auto M2 = nda::matrix<int>({{5, 6}, {7, 8}});
14 nda::matrix<int> M3 = M1 * M2;
15 std::cout << M3 << std::endl;
16}
basic_array< ValueType, Rank, Layout, 'A', ContainerPolicy > array
Alias template of an nda::basic_array with an 'A' algebra.
basic_array< ValueType, 2, Layout, 'M', ContainerPolicy > matrix
Alias template of an nda::basic_array with rank 2 and an 'M' algebra.
Includes all relevant headers for the core nda library.