It may surprise you (based on your apparently dim view of our decision making process), that the deprecation of A + 1
was not done just to annoy people and be pedantic, but with careful deliberation for mathematical reasons. Mathematicians tend to like +
to be associative, which was no longer the case when A + 1
with Matlab-like behavior was allowed in combination with uniform scaling objects (I
)—a uniquely Julian and very powerful feature. (It is left as an exercise for the reader to figure out how this causes associativity to fail or to find the issue where this decision was made.) In the showdown between A + 1
and A + I
the former loses out because broadcasting behavior for scalars is not really mathematically sound: in generic code A + 1
should really behave the same as A + I
instead of like A + ones(n,n)
because I
Is the multiplicative identity for arrays, not ones(n,n)
. The broadcasting behavior of +
really only makes sense in the old Matlab (et al.) mindset where vectorization is necessary for performance, a view point that is neither mandatory nor even beneficial in Julia.
14 Likes