# Calc vector mapping: shape of result

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?

• Both cases return a vector of vectors. In the second case, as all vectors are length 1, it is equivalent to a matrix, thus `[3,1]`. Similarly, factoring a vector of 3 squares `[9,25,49]` yields a matrix of size `[3,2]` because all results are vectors of size 2. – Juancho Nov 19 '15 at 17:46
• Okay, that makes sense. I was thrown by the difference in how the result is displayed, plus the inability to do certain further mappings in the second case. – Sue D. Nymme Nov 19 '15 at 19:09