| Crates.io | einsum-codegen |
| lib.rs | einsum-codegen |
| version | 0.1.0 |
| created_at | 2022-11-30 11:16:00.800256+00 |
| updated_at | 2022-11-30 11:16:00.800256+00 |
| description | Helper for generating einsum implementation using proc-macro |
| homepage | |
| repository | https://github.com/termoshtt/einsum-derive |
| max_upload_size | |
| id | 726122 |
| size | 43,228 |
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.
ij,jk,kl->il is factorized into
two successive einsum ij,jk->ik and ik,kl->il.... supporteinsum! macro.ij,jk->ik and generates Rust code.© 2022 Toshiki Teramura (@termoshtt)
This project is licensed under either of
at your option.