|
TRIQS/nda 2.0.0
Multi-dimensional array library for C++
|
Multi-dimensional tensor operations on host (CPU) and device (CUDA).
nda ships a thin C++ layer in the nda::tensor namespace that exposes general tensor operations (contractions, reductions, element-wise operations, permutations, ...) on top of two external backends:
Most operations also provide a generic nda fallback that requires neither backend. nda::tensor::contract is the only operation without a fallback; it still requires TBLIS on the host. The fallback path is restricted to the simple same-rank, identical-index-string case — features like permutation, broadcasting and einsum-style reduction remain backend-specific. See the per-operation pages for the exact restrictions.
Einstein-notation index strings. Every operation is parameterised by std::string_view index labels (e.g. "ij", "ijk") that name each axis of the tensors involved. Repeated labels between two tensors are summed (contracted) over, in the spirit of standard Einstein summation. The exact rules — for example, whether repeated labels are allowed within a single tensor — depend on the backend that ends up being called: cuTENSOR rejects such patterns, while TBLIS accepts them. Refer to the per-operation pages for the precise constraints.
Dispatch. Selection of the backend is automatic and uses the address space of the input arrays:
Capability flags. The booleans nda::tensor::have_cutensor and nda::tensor::have_tblis (in tensor/tools.hpp) report at compile time whether nda was built with the corresponding backend, and can be used to gate user code.
Topics | |
| Tensor operations | |
| User-facing tensor operations dispatched to cuTENSOR, TBLIS, or the nda fallback. | |
| Tensor utilities | |
| Supporting types and helpers used by the tensor operations. | |