I have the following Trait implementation and would like to make unit
generic over Array1<T>
, but fail to find the right Trait bounds (especially that this somehow seems trivial to me, all T needs to support is basically basic arithmetic that output T for the function to work).
trait Unit {
fn unit(&self) -> Array1<f32>;
}
impl Unit for Array1<f32>
{
fn unit(&self) -> Array1<f32> {
self / (self * self).sum().sqrt()
}
}
The compiler suggests adding std::ops::Mul<Output = &ArrayBase<OwnedRepr<T>, Dim<[usize; 1]>>>
, but doing so keeps giving the same error over and over.