TRIQS/nda 1.3.0
Multi-dimensional array library for C++
Loading...
Searching...
No Matches
Examples

Table of Contents

Example Description
Example 1: A quick overview A short introduction to nda
Example 2: Constructing arrays Different ways to construct and get started with arrays
Example 3: Initializing arrays Different ways to initialize already constructed arrays
Example 4: Views and slices How to take views and slices of arrays
Example 5: HDF5 support How to write/read arrays and views to/from HDF5 files
Example 6: MPI support How to broadcast, gather, scatter and reduce arrays and views
Example 7: Making use of symmetries How to use symmetries with nda arrays
Example 8: Linear algebra support Doing linear algebra with nda arrys

Compiling the examples

All examples have been compiled on a MacBook Pro with an Apple M2 Max chip with

installed via homebrew.

We further used clang 19.1.2 together with cmake 3.30.5.

Assuming that nda has been installed locally (see Installation) and that the actual example code is in a file main.cpp, the following generic CMakeLists.txt should work for all examples (see also Integration in C++ projects):

cmake_minimum_required(VERSION 3.20)
project(example CXX)
# set required standard
set(CMAKE_BUILD_TYPE Release)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# find nda
find_package(nda REQUIRED CONFIG)
# build the example
add_executable(ex main.cpp)
target_link_libraries(ex nda::nda_c)