Hi there, I am trying to make a trait, TensorLike
where I have functions that will be generic over two types: one is some numeric type T
and the other is some type U: TensorLike<T>
such that I can have a function: fn dot(&self, other: &U) -> T;
to compute some kind of inner product on my two TensorLike
structs.
I was able to solve this by making the function signature use trait objects with: fn dot(&self, other: &dyn TensorLike<T>) -> T;
but this seems suboptimal.
Any ideas for how I can get this to work with monomorphisation and generic objects?