einsum

Crates.ioeinsum
lib.rseinsum
version0.1.0
sourcesrc
created_at2024-02-21 00:44:15.259629
updated_at2024-02-21 00:44:15.259629
descriptionA Rust implementation of `numpy`'s Einstein summation convention for the `ndarray` crate with compile-time path optimization.
homepage
repositoryhttps://github.com/Case-Rocket-Team/einsum
max_upload_size
id1147406
size10,190
Serena Lynas (SerenaLynas)

documentation

README

Macro Einsum for ndarray

Setup

Install python and the opt_einsum package.

Usage

The syntax is similar to numpy's. For each input argument, use (expr).(axes). Then use a fat arrow =>, and for the output axes use .(axes) and a semicolon ;. After the semicolon, you need to pass the dimensions of each of the axes in order for the macro to optimize the path at compiletime. See example below

Example

let y: Array<f64, _> = einsum!(a.mi, b.nj, c.ijpl, d.op, e.ql => .mnoq; i 2, j 2, l 10, m 40, n 40, o 8, p 7, q 6);

Commit count: 0

cargo fmt