I'm using ndarray and ndarray_einsum_beta to mimic numpy.einsum.
I seem to be getting a type error trying to implement the basic example given:
let m1 = arr1(&[1, 2]);
let m2 = arr2(&[[1, 2], [3, 4]]);
println!("{:?}", einsum("i,ij->j", &[&m1, &m2]));
For both m1 and m2 I get the error:
the trait bound
ndarray::ArrayBase<ndarray::OwnedRepr<{integer}>, ndarray::Dim<[usize; 1]>>: ndarray_einsum_beta::ArrayLike<_>is not satisfiedthe trait
ndarray_einsum_beta::ArrayLike<_>is not implemented forndarray::ArrayBase<ndarray::OwnedRepr<{integer}>, ndarray::Dim<[usize; 1]>>note: required for the cast to the object type
dyn ndarray_einsum_beta::ArrayLike<_>rustc(E0277)
As shown in the console on compilcation:
Whole main.rs:
use ndarray::prelude::*;
use ndarray_einsum_beta::*;
fn main() {
println!("Hello, world!");
let m1 = arr1(&[1, 2]);
let m2 = arr2(&[[1, 2], [3, 4]]);
println!("{:?}", einsum("i,ij->j", &[&m1, &m2]));
}
Whole Cargo.toml:
[package]
name = "clean_slate"
version = "0.1.0"
authors = ["Jonathan <[email protected]>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
ndarray = "0.13.0"
ndarray_einsum_beta = "0.4.4"
I really cannot figure what I have done wrong here, my best guess right now is perhaps a bad version combination of ndarray and ndarray_eisum_beta.
Any help would be greatly appreciated.