einsum-codegen

Crates.ioeinsum-codegen
lib.rseinsum-codegen
version0.1.0
sourcesrc
created_at2022-11-30 11:16:00.800256
updated_at2022-11-30 11:16:00.800256
descriptionHelper for generating einsum implementation using proc-macro
homepage
repositoryhttps://github.com/termoshtt/einsum-derive
max_upload_size
id726122
size43,228
Toshiki Teramura (termoshtt)

documentation

https://docs.rs/einsum-codegen/

README

einsum-derive

master bench

Proc-macro based einsum implementation for ndarray crate

use ndarray::array;
use einsum_derive::einsum;

let a = array![
  [1.0, 2.0],
  [3.0, 4.0]
];
let b = array![
  [1.0, 2.0],
  [3.0, 4.0]
];
let c = einsum!("ij,jk->ik", a, b);
assert_eq!(c, array![
  [6.0, 8.0],
  [12.0, 16.0]
]);

This proc-macro wil compile the input subscripts "ij,jk->ik" to generate Rust code executing corresponding operation.

Status / Roadmap

Architecture

  • einsum-derive crate is proc-macro crate to provide above einsum! macro.
  • einsum-codegen crate implements parser for the einsum subscripts like ij,jk->ik and generates Rust code.

Links

  • numpy.einsum is well-known einsum implementation in Python.
  • opt_einsum is an implementation for optimizing einsum computation for NumPy and other linear algebra packages.
  • oracleofnj/einsum is a runtime-based implementation of einsum for rust-ndarray

License

© 2022 Toshiki Teramura (@termoshtt)

This project is licensed under either of

at your option.

Commit count: 181

cargo fmt