What determines the shape of the result of a vector mapping (
V M)? I had thought it was directly based on the shape of the input, but have a look at this.
k f factors an integer, returning a vector of its prime factors. Given a vector of n integers,
[27 31 33]
V M k f will factor all of them, yielding
[[3, 3, 3], , [3, 11]]
which is what I'd expect. But if all of them are primes, for example
[31, 37, 41]
then the output of
V M k f is
[ [ 31 ] [ 37 ] [ 41 ] ]
The shape (
H v l) of the first result is
; the shape of the second result is
[3, 1]. Why?