3 ms·
This is a bit like other vector/array languages like Matlab or APL: 145 isn’t considered a ‘scalar’ but rather an array containing one element. Though it can ma
by dan-robertson 4y ago
This is a bit like other vector/array languages like Matlab or APL: 145 isn’t considered a ‘scalar’ but rather an array containing one element. Though it can make defining how to deal with different shapes for some operation like + tricky. One idea is cycling when one vector/axis is shorter. Another is to special case vectors with one element. Another is for these singletons to be, in some sense, zero dimensional arrays and then you can just have broadcasting with errors if one shape isn’t a prefix of the other.