Einsums’s Documentation#
Version: main
Useful links: Source Repository | Issue Tracker | Discord | License
Einsums is a C++20 tensor algebra library for scientific computing. A few components use C++23 features through the CXX23 compatibility module, which supplies C++20 fallbacks. It provides:
A multidimensional
Tensortype with the usual algebraic operations, block-sparse and tiled variants, and a disk-backed tensor for out-of-core workloads.Contractions written as index specs. An
einsumsuch as"ij <- ik ; kj"is classified from its indices and routed to vendor BLAS, an in-tree BLIS-style packed contraction backend (PackedGemm), or a generic loop nest. The spec is data rather than types, so a graph can rewrite it and Python can pass it through unchanged.A deferred-execution ComputeGraph with multi-pass optimization for whole-algorithm rewrites.
Python bindings auto-generated from the C++ headers by Apiary, a standalone libclang tool, so the Python surface tracks the C++ surface without hand-written glue.
As a short example, the following einsum call routes to a single
dgemm because the contraction pattern matches a pure GEMM:
using namespace einsums; // Tensor, create_tensor, create_random_tensor
namespace cg = einsums::compute_graph; // einsum
auto A = create_random_tensor("A", 7, 7);
auto B = create_random_tensor("B", 7, 7);
auto C = create_tensor("C", 7, 7);
cg::einsum("ij <- ik ; kj", &C, A, B);
Getting Started
New to Einsums? Check out the Absolute Beginner’s Guide. It contains an introduction to Einsums’ main concepts and links to additional tutorials.
User’s Guide
The user guide provides in-depth information on the key concepts of Einsums with useful background information and explanation.
API Reference
The reference for the C++ and Python APIs. Start here when you need to know what a particular class does, what symbols a header exposes, or which functions the Python package binds.
Developer Guide
Want to add to the codebase? The developer guide covers the coding and documentation guidelines, the per-module internals, and the tooling for improving Einsums.