Allow ops on arrays with elems of different types#588
Conversation
The implementations of operations for `&'a ArrayBase<S, D>` are still unnecessarily restrictive in the `Output` element type, but the implementations are now more general than they were before this commit.
Yeah, that would be nice. It might be possible to do this using crates on crates.io that depend on the latest version of
I have a (non-public) project with ~1.3e4 lines of code that uses This is one (simplified) example: extern crate ndarray;
use ndarray::prelude::*;
fn main() {
let n = 5;
let a = Array2::<f64>::zeros((n, n));
let b = a + Array2::eye(n);
println!("{}", b);
}(The compiler can no longer infer the element type for Here's another similar example: extern crate ndarray;
use ndarray::prelude::*;
fn main() {
let n = 5;
let a = Array1::<f64>::zeros(n);
let b = Array2::zeros((n, n)) + a;
println!("{}", b);
}(The compiler can no longer infer the element type for I've added the "breaking-change" label. I don't see any way around this since Rust doesn't let us specify a default type for If everything looks good, let's go ahead and merge this. (We've already started merged some breaking changes for the 0.13 release.) |
eba4321 to
9b51170
Compare

This generalizes the right operand element type. The implementations of operations for
&'a ArrayBase<S, D>are still unnecessarily restrictive in theOutputelement type, but the implementations are now more general than they were before this commit.As far as I can tell, this change is backwards compatible except for possibly causing ambiguities in type inference that weren't present before.